summaryrefslogtreecommitdiff
path: root/include/u-boot/aes.h
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2019-12-18 18:25:41 +0100
committerTom Rini <trini@konsulko.com>2020-01-17 10:15:49 -0500
commit7298e422504ef4455160216b9b7a1baa1169283f (patch)
tree35e93c2a2a6c11b683523b657593bd93ef5fd978 /include/u-boot/aes.h
parent1c6cd16de810f88c27c5c945a30e0e9f3842df68 (diff)
mkimage: fit: add support to encrypt image with aes
This commit add the support of encrypting image with aes in mkimage. To enable the ciphering, a node cipher with a reference to a key and IV (Initialization Vector) must be added to the its file. Then mkimage add the encrypted image to the FIT and add the key and IV to the u-boot device tree. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Diffstat (limited to 'include/u-boot/aes.h')
-rw-r--r--include/u-boot/aes.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/u-boot/aes.h b/include/u-boot/aes.h
new file mode 100644
index 0000000000..4fb2cb7502
--- /dev/null
+++ b/include/u-boot/aes.h
@@ -0,0 +1,31 @@
+/* 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 */
+
+#endif