aes.h 928 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef _ROM_AES_H_
  7. #define _ROM_AES_H_
  8. #include <stdint.h>
  9. #include <stdbool.h>
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #define AES_BLOCK_SIZE 16
  14. enum AES_TYPE {
  15. AES_ENC,
  16. AES_DEC,
  17. };
  18. enum AES_BITS {
  19. AES128,
  20. AES192,
  21. AES256
  22. };
  23. void ets_aes_enable(void);
  24. void ets_aes_disable(void);
  25. void ets_aes_set_endian(bool key_word_swap, bool key_byte_swap,
  26. bool in_word_swap, bool in_byte_swap,
  27. bool out_word_swap, bool out_byte_swap);
  28. int ets_aes_setkey(enum AES_TYPE type, const void *key, enum AES_BITS bits);
  29. int ets_aes_setkey_enc(const void *key, enum AES_BITS bits);
  30. int ets_aes_setkey_dec(const void *key, enum AES_BITS bits);
  31. void ets_aes_block(const void *input, void *output);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* _ROM_AES_H_ */