ccmp.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /* Software CCMP (AES-CCM): see ccmp.c.
  2. *
  3. * The 7265D firmware's RX crypto path can fail to use keys that are correctly
  4. * installed with ADD_STA_KEY (SEC_ENC_ERR with the matching key ID), while TX
  5. * works. The RX path therefore decrypts the frame in software using the
  6. * same TK/GTK. */
  7. #ifndef CCMP_H
  8. #define CCMP_H
  9. /* Decrypt one FromDS CCMP-protected MPDU in place.
  10. *
  11. * frame the 802.11 MPDU (header, CCMP header, ciphertext, 8-byte MIC)
  12. * len full MPDU length
  13. * hdr 802.11 header length (24, or 26 with a QoS control field)
  14. * key 16-byte CCMP key (TK for key ID 0, GTK for the group key ID)
  15. *
  16. * Returns 0 and leaves the plaintext at frame + hdr + 8, or -1 on a MIC
  17. * failure or malformed frame. */
  18. int ccmp_rx_decrypt(unsigned char *frame, unsigned int len, unsigned int hdr,
  19. const unsigned char key[16]);
  20. /* Encrypt one ToDS CCMP MPDU in place (the RTL8821AU runs with its crypto
  21. * engine off).
  22. *
  23. * frame header, the filled-in 8-byte CCMP header (PN, ExtIV, key ID) and
  24. * the plaintext; the buffer must have 8 more bytes for the MIC
  25. * len header + CCMP header + plaintext length (without the MIC)
  26. * hdr 802.11 header length (24 or 26)
  27. *
  28. * Returns 0 (the MPDU is then len + 8 bytes long) or -1. */
  29. int ccmp_tx_encrypt(unsigned char *frame, unsigned int len, unsigned int hdr,
  30. const unsigned char key[16]);
  31. #endif