summaryrefslogtreecommitdiff
path: root/include/u-boot/aes.h
blob: 32281041de245278a41ed7c94894405efc5d2da5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (c) 2019, Softathome
 */

#ifndef _AES_H
#define _AES_H

#include <errno.h>
#include <image.h>

#if IMAGE_ENABLE_ENCRYPT
int image_aes_encrypt(struct image_cipher_info *info,
		      const unsigned char *data, int size,
		      unsigned char **cipher, int *cipher_len);
int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest);
#else
int image_aes_encrypt(struct image_cipher_info *info,
		      const unsigned char *data, int size,
		      unsigned char **cipher, int *cipher_len)
{
	return -ENXIO;
}

int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest)
{
	return -ENXIO;
}
#endif /* IMAGE_ENABLE_ENCRYPT */

#if IMAGE_ENABLE_DECRYPT
int image_aes_decrypt(struct image_cipher_info *info,
		      const void *cipher, size_t cipher_len,
		      void **data, size_t *size);
#else
int image_aes_decrypt(struct image_cipher_info *info,
		      const void *cipher, size_t cipher_len,
		      void **data, size_t *size)
{
	return -ENXIO;
}
#endif /* IMAGE_ENABLE_DECRYPT */

#endif