aes.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. ROM functions for hardware AES support.
  3. It is not recommended to use these functions directly,
  4. use the wrapper functions in esp32/aes.h instead.
  5. */
  6. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License");
  9. // you may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software
  14. // distributed under the License is distributed on an "AS IS" BASIS,
  15. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. // See the License for the specific language governing permissions and
  17. // limitations under the License.
  18. #ifndef _ROM_AES_H_
  19. #define _ROM_AES_H_
  20. #include <stdint.h>
  21. #include <stdbool.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //TODO, add comment for aes apis
  26. enum AES_BITS {
  27. AES128,
  28. AES192,
  29. AES256
  30. };
  31. void ets_aes_enable(void);
  32. void ets_aes_disable(void);
  33. void ets_aes_set_endian(bool key_word_swap, bool key_byte_swap,
  34. bool in_word_swap, bool in_byte_swap,
  35. bool out_word_swap, bool out_byte_swap);
  36. bool ets_aes_setkey_enc(const uint8_t *key, enum AES_BITS bits);
  37. bool ets_aes_setkey_dec(const uint8_t *key, enum AES_BITS bits);
  38. void ets_aes_crypt(const uint8_t input[16], uint8_t output[16]);
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif /* _ROM_AES_H_ */