aes.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2019, Softathome
  4. */
  5. #ifndef _AES_H
  6. #define _AES_H
  7. #include <errno.h>
  8. #include <image.h>
  9. #if IMAGE_ENABLE_ENCRYPT
  10. int image_aes_encrypt(struct image_cipher_info *info,
  11. const unsigned char *data, int size,
  12. unsigned char **cipher, int *cipher_len);
  13. int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
  14. void *fit, int node_noffset);
  15. #else
  16. int image_aes_encrypt(struct image_cipher_info *info,
  17. const unsigned char *data, int size,
  18. unsigned char **cipher, int *cipher_len)
  19. {
  20. return -ENXIO;
  21. }
  22. int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
  23. void *fit, int node_noffset)
  24. {
  25. return -ENXIO;
  26. }
  27. #endif /* IMAGE_ENABLE_ENCRYPT */
  28. #if IMAGE_ENABLE_DECRYPT
  29. int image_aes_decrypt(struct image_cipher_info *info,
  30. const void *cipher, size_t cipher_len,
  31. void **data, size_t *size);
  32. #else
  33. int image_aes_decrypt(struct image_cipher_info *info,
  34. const void *cipher, size_t cipher_len,
  35. void **data, size_t *size)
  36. {
  37. return -ENXIO;
  38. }
  39. #endif /* IMAGE_ENABLE_DECRYPT */
  40. #endif