blob: acbc50b9e6f3f2261a3f1a1a85928ef3105d5f1c [file] [log] [blame]
Philippe Reynes3148e422019-12-18 18:25:41 +01001/* 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
13int image_aes_encrypt(struct image_cipher_info *info,
14 const unsigned char *data, int size,
15 unsigned char **cipher, int *cipher_len);
Philippe Reynes64d67c42020-09-17 15:01:46 +020016int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
17 void *fit, int node_noffset);
Philippe Reynes3148e422019-12-18 18:25:41 +010018#else
19int 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 Reynes64d67c42020-09-17 15:01:46 +020026int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest,
27 void *fit, int node_noffset)
Philippe Reynes3148e422019-12-18 18:25:41 +010028{
29 return -ENXIO;
30}
31#endif /* IMAGE_ENABLE_ENCRYPT */
32
Philippe Reynes3d964702019-12-18 18:25:42 +010033#if IMAGE_ENABLE_DECRYPT
34int image_aes_decrypt(struct image_cipher_info *info,
35 const void *cipher, size_t cipher_len,
36 void **data, size_t *size);
37#else
38int 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 Reynes3148e422019-12-18 18:25:41 +010046#endif