aes.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #else
  15. int image_aes_encrypt(struct image_cipher_info *info,
  16. const unsigned char *data, int size,
  17. unsigned char **cipher, int *cipher_len)
  18. {
  19. return -ENXIO;
  20. }
  21. int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest)
  22. {
  23. return -ENXIO;
  24. }
  25. #endif /* IMAGE_ENABLE_ENCRYPT */
  26. #if IMAGE_ENABLE_DECRYPT
  27. int image_aes_decrypt(struct image_cipher_info *info,
  28. const void *cipher, size_t cipher_len,
  29. void **data, size_t *size);
  30. #else
  31. int image_aes_decrypt(struct image_cipher_info *info,
  32. const void *cipher, size_t cipher_len,
  33. void **data, size_t *size)
  34. {
  35. return -ENXIO;
  36. }
  37. #endif /* IMAGE_ENABLE_DECRYPT */
  38. #endif