Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / include / u-boot / aes.h
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);
16 int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
17                               void *fit, int node_noffset);
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
26 int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
27                               void *fit, int node_noffset)
28 {
29         return -ENXIO;
30 }
31 #endif /* IMAGE_ENABLE_ENCRYPT */
32
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
46 #endif