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