aes_wrap.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * AES-based functions
  3. *
  4. * - AES Key Wrap Algorithm (128-bit KEK) (RFC3394)
  5. * - One-Key CBC MAC (OMAC1) hash with AES-128
  6. * - AES-128 CTR mode encryption
  7. * - AES-128 EAX mode encryption/decryption
  8. * - AES-128 CBC
  9. * - AES-GCM
  10. * - AES-CCM
  11. *
  12. * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
  13. *
  14. * This software may be distributed under the terms of the BSD license.
  15. * See README for more details.
  16. */
  17. #ifndef AES_WRAP_H
  18. #define AES_WRAP_H
  19. int __must_check aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher);
  20. int __must_check aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain);
  21. int __must_check omac1_aes_128_vector(const u8 *key, size_t num_elem,
  22. const u8 *addr[], const size_t *len,
  23. u8 *mac);
  24. int __must_check omac1_aes_128(const u8 *key, const u8 *data, size_t data_len,
  25. u8 *mac);
  26. int __must_check aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out);
  27. int __must_check aes_128_ctr_encrypt(const u8 *key, const u8 *nonce,
  28. u8 *data, size_t data_len);
  29. int __must_check aes_128_eax_encrypt(const u8 *key,
  30. const u8 *nonce, size_t nonce_len,
  31. const u8 *hdr, size_t hdr_len,
  32. u8 *data, size_t data_len, u8 *tag);
  33. int __must_check aes_128_eax_decrypt(const u8 *key,
  34. const u8 *nonce, size_t nonce_len,
  35. const u8 *hdr, size_t hdr_len,
  36. u8 *data, size_t data_len, const u8 *tag);
  37. int __must_check aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data,
  38. size_t data_len);
  39. int __must_check aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data,
  40. size_t data_len);
  41. int __must_check aes_gcm_ae(const u8 *key, size_t key_len,
  42. const u8 *iv, size_t iv_len,
  43. const u8 *plain, size_t plain_len,
  44. const u8 *aad, size_t aad_len,
  45. u8 *crypt, u8 *tag);
  46. int __must_check aes_gcm_ad(const u8 *key, size_t key_len,
  47. const u8 *iv, size_t iv_len,
  48. const u8 *crypt, size_t crypt_len,
  49. const u8 *aad, size_t aad_len, const u8 *tag,
  50. u8 *plain);
  51. int __must_check aes_gmac(const u8 *key, size_t key_len,
  52. const u8 *iv, size_t iv_len,
  53. const u8 *aad, size_t aad_len, u8 *tag);
  54. int __must_check aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce,
  55. size_t M, const u8 *plain, size_t plain_len,
  56. const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth);
  57. int __must_check aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
  58. size_t M, const u8 *crypt, size_t crypt_len,
  59. const u8 *aad, size_t aad_len, const u8 *auth,
  60. u8 *plain);
  61. #endif /* AES_WRAP_H */