aes.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * AES functions
  3. * Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef AES_H
  9. #define AES_H
  10. #include <stdint.h>
  11. #include <stdlib.h>
  12. typedef uint8_t u8;
  13. typedef uint16_t u16;
  14. typedef uint32_t u32;
  15. #define AES_BLOCK_SIZE 16
  16. void * aes_encrypt_init(const u8 *key, size_t len);
  17. void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
  18. void aes_encrypt_deinit(void *ctx);
  19. void * aes_decrypt_init(const u8 *key, size_t len);
  20. void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
  21. void aes_decrypt_deinit(void *ctx);
  22. int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce,
  23. size_t M, const u8 *plain, size_t plain_len,
  24. const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth);
  25. int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
  26. size_t M, const u8 *crypt, size_t crypt_len,
  27. const u8 *aad, size_t aad_len, const u8 *auth, u8 *plain);
  28. #endif /* AES_H */