aes: add support for aes192 and aes256
v3 cover aes: add support for aes192 and aes256
This serie add the support of aes192 and aes256. This first commit clean a bit the code, and introduce a constant for the block (instead of using the key size). The second commit add the support of aes192 and aes256 to the lib and the cmd. The third update the code of crypto for tegra20. The forth add a test unit for aes128, and the sixth add a test unit for aes 196 and aes256.
Philippe Reynes (5):
aes: add a define for the size of a block
aes: add support of aes192 and aes256
tegra20: crypto: update code to use new aes api
aes: add test unit for aes128
aes: add test unit for aes196 and aes256
arch/arm/mach-tegra/tegra20/crypto.c | 41 +++++---- cmd/aes.c | 40 ++++++--- include/uboot_aes.h | 39 +++++--- lib/aes.c | 111 ++++++++++++++--------- test/lib/Makefile | 1 + test/lib/test_aes.c | 166 +++++++++++++++++++++++++++++++++++ 6 files changed, 313 insertions(+), 85 deletions(-) create mode 100644 test/lib/test_aes.c
Signature · 1 line
2.7.4
PATCH v3 1/5 aes: add a define for the size of a block
In the code, we use the size of the key for the size of the block. It's true when the key is 128 bits, but it become false for key of 192 bits and 256 bits. So to prepare the support of aes192 and 256, we introduce a constant for the iaes block size.
--- cmd/aes.c | 2 +- include/uboot_aes.h | 5 +++-- lib/aes.c | 34 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 20 deletions(-)
Changelog:
v3:
- no change
v2:
- no change
cmd/aes.c +1 -1
@@ -56,7 +56,7 @@ static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])aes_expand_key (key_ptr, key_exp);/* Calculate the number of AES blocks to encrypt. */ - aes_blocks =DIV_ROUND_UP (len,AES_KEY_LENGTH ); + aes_blocks =DIV_ROUND_UP (len,AES_BLOCK_LENGTH );if (enc) aes_cbc_encrypt_blocks(key_exp, iv_ptr, src_ptr, dst_ptr,
include/uboot_aes.h +3 -2
@@ -18,7 +18,7 @@ typedef unsigned int u32;* AES encryption library, with small code size, supporting only 128-bit AES * * AES is a stream cipher which works a block at a time, with each block -* in this case being AES_KEY_LENGTH bytes. +* in this case being AES_BLOCK_LENGTH bytes. */ enum {
@@ -28,6 +28,7 @@ enum {AES_KEY_LENGTH =128 /8 ,AES_EXPAND_KEY_LENGTH =4 *AES_STATECOLS * (AES_ROUNDS +1 ), + AES_BLOCK_LENGTH = 128 / 8, };/**
@@ -62,7 +63,7 @@ void aes_decrypt(u8 *in, u8 *expkey, u8 *out);/** * Apply chain data to the destination using EOR * -* Each array is of length AES_KEY_LENGTH. +* Each array is of length AES_BLOCK_LENGTH. * * @cbc_chain_data Chain data * @src Source data
lib/aes.c +17 -17
@@ -596,62 +596,62 @@ void aes_apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst) {int i; -for (i =0 ; i <AES_KEY_LENGTH ; i++) +for (i =0 ; i <AES_BLOCK_LENGTH ; i++) *dst++ = *src++ ^ *cbc_chain_data++; }void aes_cbc_encrypt_blocks (u8 *key_exp,u8 *iv,u8 *src,u8 *dst,u32 num_aes_blocks) { -u8 tmp_data[AES_KEY_LENGTH ]; +u8 tmp_data[AES_BLOCK_LENGTH ];u8 *cbc_chain_data = iv;u32 i;for (i =0 ; i < num_aes_blocks; i++) {debug ("encrypt_object: block %d of %d\n" , i, num_aes_blocks); -debug_print_vector ("AES Src" ,AES_KEY_LENGTH , src); +debug_print_vector ("AES Src" ,AES_BLOCK_LENGTH , src);/* Apply the chain data */ aes_apply_cbc_chain_data (cbc_chain_data, src, tmp_data); -debug_print_vector ("AES Xor" ,AES_KEY_LENGTH , tmp_data); +debug_print_vector ("AES Xor" ,AES_BLOCK_LENGTH , tmp_data);/* Encrypt the AES block */ aes_encrypt (tmp_data, key_exp, dst); -debug_print_vector ("AES Dst" ,AES_KEY_LENGTH , dst); +debug_print_vector ("AES Dst" ,AES_BLOCK_LENGTH , dst);/* Update pointers for next loop. */ cbc_chain_data = dst; - src +=AES_KEY_LENGTH ; - dst +=AES_KEY_LENGTH ; + src +=AES_BLOCK_LENGTH ; + dst +=AES_BLOCK_LENGTH ; } }void aes_cbc_decrypt_blocks (u8 *key_exp,u8 *iv,u8 *src,u8 *dst,u32 num_aes_blocks) { -u8 tmp_data[AES_KEY_LENGTH ], tmp_block[AES_KEY_LENGTH ]; +u8 tmp_data[AES_BLOCK_LENGTH ], tmp_block[AES_BLOCK_LENGTH ];/* Convenient array of 0's for IV */ -u8 cbc_chain_data[AES_KEY_LENGTH ]; +u8 cbc_chain_data[AES_BLOCK_LENGTH ];u32 i; -memcpy (cbc_chain_data, iv,AES_KEY_LENGTH ); +memcpy (cbc_chain_data, iv,AES_BLOCK_LENGTH );for (i =0 ; i < num_aes_blocks; i++) {debug ("encrypt_object: block %d of %d\n" , i, num_aes_blocks); -debug_print_vector ("AES Src" ,AES_KEY_LENGTH , src); +debug_print_vector ("AES Src" ,AES_BLOCK_LENGTH , src); -memcpy (tmp_block, src,AES_KEY_LENGTH ); +memcpy (tmp_block, src,AES_BLOCK_LENGTH );/* Decrypt the AES block */ aes_decrypt (src, key_exp, tmp_data); -debug_print_vector ("AES Xor" ,AES_KEY_LENGTH , tmp_data); +debug_print_vector ("AES Xor" ,AES_BLOCK_LENGTH , tmp_data);/* Apply the chain data */ aes_apply_cbc_chain_data (cbc_chain_data, tmp_data, dst); -debug_print_vector ("AES Dst" ,AES_KEY_LENGTH , dst); +debug_print_vector ("AES Dst" ,AES_BLOCK_LENGTH , dst);/* Update pointers for next loop. */ -memcpy (cbc_chain_data, tmp_block,AES_KEY_LENGTH ); - src +=AES_KEY_LENGTH ; - dst +=AES_KEY_LENGTH ; +memcpy (cbc_chain_data, tmp_block,AES_BLOCK_LENGTH ); + src +=AES_BLOCK_LENGTH ; + dst +=AES_BLOCK_LENGTH ; } }
Signature · 1 line
2.7.4
PATCH v3 1/5 aes: add a define for the size of a block
Quoted 14 lines · Philippe Reynes
In the code, we use the size of the key for the size of the block. It's true when the key is 128 bits, but it become false for key of 192 bits and 256 bits. So to prepare the support of aes192 and 256, we introduce a constant for the iaes block size.
Signed-off-by Philippe Reynes <[email protected]>--- cmd/aes.c | 2 +- include/uboot_aes.h | 5 +++-- lib/aes.c | 34 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 20 deletions(-)
Quoted 6 lines
Changelog:
v3:
- no change
v2:
- no change
PATCH v3 2/5 aes: add support of aes192 and aes256
In reply to Philippe ReynesUntil now, we only support aes128. This commit add the support of aes192 and aes256.
--- cmd/aes.c | 38 +++++++++++++++++--------- include/uboot_aes.h | 34 +++++++++++++++-------- lib/aes.c | 77 +++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 103 insertions(+), 46 deletions(-)
Changelog:
v3:
- no change
v2:
- fix the help for the aes command
cmd/aes.c +26 -12
@@ -2,7 +2,7 @@/* * Copyright (C) 2014 Marek Vasut <[email protected]> * -* Command for en/de-crypting block of memory with AES-128-CBC cipher. +* Command for en/de-crypting block of memory with AES-[128/192/256]-CBC cipher. */ #include <common.h>
@@ -13,6 +13,18 @@#include <linux/compiler.h> #include <mapmem.h> +u32 aes_get_key_len (char *command) +{ +u32 key_len =AES128_KEY_LENGTH ; + +if (!strcmp (command,"aes.192" )) + key_len =AES192_KEY_LENGTH ; +else if (!strcmp (command,"aes.256" )) + key_len =AES256_KEY_LENGTH ; + +return key_len; +} +/** * do_aes() - Handle the "aes" command-line command * @cmdtp: Command data struct pointer
@@ -27,13 +39,15 @@ static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) {uint32_t key_addr, iv_addr, src_addr, dst_addr, len;uint8_t *key_ptr, *iv_ptr, *src_ptr, *dst_ptr; -uint8_t key_exp[AES_EXPAND_KEY_LENGTH ]; -uint32_t aes_blocks; +u8 key_exp[AES256_EXPAND_KEY_LENGTH ]; +u32 aes_blocks, key_len;int enc;if (argc !=7 )return CMD_RET_USAGE ; + key_len =aes_get_key_len (argv[0 ]); +if (!strncmp (argv[1 ],"enc" ,3 )) enc =1 ;else if (!strncmp (argv[1 ],"dec" ,3 ))
@@ -47,23 +61,23 @@ static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) dst_addr =simple_strtoul (argv[5 ],NULL ,16 ); len =simple_strtoul (argv[6 ],NULL ,16 ); - key_ptr = (uint8_t *)map_sysmem (key_addr,128 /8 ); + key_ptr = (uint8_t *)map_sysmem (key_addr, key_len); iv_ptr = (uint8_t *)map_sysmem (iv_addr,128 /8 ); src_ptr = (uint8_t *)map_sysmem (src_addr, len); dst_ptr = (uint8_t *)map_sysmem (dst_addr, len);/* First we expand the key. */ -aes_expand_key (key_ptr, key_exp); +aes_expand_key (key_ptr, key_len, key_exp);/* Calculate the number of AES blocks to encrypt. */ aes_blocks =DIV_ROUND_UP (len,AES_BLOCK_LENGTH );if (enc) -aes_cbc_encrypt_blocks (key_exp, iv_ptr, src_ptr, dst_ptr, - aes_blocks); +aes_cbc_encrypt_blocks (key_len, key_exp, iv_ptr, src_ptr, + dst_ptr, aes_blocks);else -aes_cbc_decrypt_blocks (key_exp, iv_ptr, src_ptr, dst_ptr, - aes_blocks); +aes_cbc_decrypt_blocks (key_len, key_exp, iv_ptr, src_ptr, + dst_ptr, aes_blocks);unmap_sysmem (key_ptr);unmap_sysmem (iv_ptr);
@@ -76,13 +90,13 @@ static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])/***************************************************/ #ifdef CONFIG_SYS_LONGHELP static char aes_help_text[] = -"enc key iv src dst len - Encrypt block of data $len bytes long\n" +"[.128,.192,.256] enc key iv src dst len - Encrypt block of data $len bytes long\n" " at address $src using a key at address\n" " $key with initialization vector at address\n" " $iv. Store the result at address $dst.\n" " The $len size must be multiple of 16 bytes.\n" " The $key and $iv must be 16 bytes long.\n" -"aes dec key iv src dst len - Decrypt block of data $len bytes long\n" +"aes [.128,.192,.256] dec key iv src dst len - Decrypt block of data $len bytes long\n" " at address $src using a key at address\n" " $key with initialization vector at address\n" " $iv. Store the result at address $dst.\n"
@@ -92,6 +106,6 @@ static char aes_help_text[] =U_BOOT_CMD ( aes,7 ,1 , do_aes, -"AES 128 CBC encryption" , +"AES 128/192/256 CBC encryption" , aes_help_text );
include/uboot_aes.h +23 -11
@@ -23,11 +23,18 @@ typedef unsigned int u32;enum {AES_STATECOLS =4 ,/* columns in the state & expanded key */ -AES_KEYCOLS =4 ,/* columns in a key */ -AES_ROUNDS =10 ,/* rounds in encryption */ - -AES_KEY_LENGTH =128 /8 , -AES_EXPAND_KEY_LENGTH =4 *AES_STATECOLS * (AES_ROUNDS +1 ), +AES128_KEYCOLS =4 ,/* columns in a key for aes128 */ +AES192_KEYCOLS =6 ,/* columns in a key for aes128 */ +AES256_KEYCOLS =8 ,/* columns in a key for aes128 */ +AES128_ROUNDS =10 ,/* rounds in encryption for aes128 */ +AES192_ROUNDS =12 ,/* rounds in encryption for aes192 */ +AES256_ROUNDS =14 ,/* rounds in encryption for aes256 */ +AES128_KEY_LENGTH =128 /8 , +AES192_KEY_LENGTH =192 /8 , +AES256_KEY_LENGTH =256 /8 , +AES128_EXPAND_KEY_LENGTH =4 *AES_STATECOLS * (AES128_ROUNDS +1 ), +AES192_EXPAND_KEY_LENGTH =4 *AES_STATECOLS * (AES192_ROUNDS +1 ), +AES256_EXPAND_KEY_LENGTH =4 *AES_STATECOLS * (AES256_ROUNDS +1 ),AES_BLOCK_LENGTH =128 /8 , };
@@ -37,28 +44,31 @@ enum {* Expand a key into a key schedule, which is then used for the other * operations. * -* @key Key, of length AES_KEY_LENGTH bytes +* @key Key +* @key_size Size of the key (in bits) * @expkey Buffer to place expanded key, AES_EXPAND_KEY_LENGTH */ -void aes_expand_key (u8 *key,u8 *expkey); +void aes_expand_key (u8 *key,u32 key_size,u8 *expkey);/** * aes_encrypt() - Encrypt single block of data with AES 128 * +* @key_size Size of the aes key (in bits) * @in Input data * @expkey Expanded key to use for encryption (from aes_expand_key()) * @out Output data */ -void aes_encrypt (u8 *in,u8 *expkey,u8 *out); +void aes_encrypt (u32 key_size,u8 *in,u8 *expkey,u8 *out);/** * aes_decrypt() - Decrypt single block of data with AES 128 * +* @key_size Size of the aes key (in bits) * @in Input data * @expkey Expanded key to use for decryption (from aes_expand_key()) * @out Output data */ -void aes_decrypt (u8 *in,u8 *expkey,u8 *out); +void aes_decrypt (u32 key_size,u8 *in,u8 *expkey,u8 *out);/** * Apply chain data to the destination using EOR
@@ -74,25 +84,27 @@ void aes_apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst);/** * aes_cbc_encrypt_blocks() - Encrypt multiple blocks of data with AES CBC. * +* @key_size Size of the aes key (in bits) * @key_exp Expanded key to use * @iv Initialization vector * @src Source data to encrypt * @dst Destination buffer * @num_aes_blocks Number of AES blocks to encrypt */ -void aes_cbc_encrypt_blocks (u8 *key_exp,u8 *iv,u8 *src,u8 *dst, +void aes_cbc_encrypt_blocks (u32 key_size,u8 *key_exp,u8 *iv,u8 *src,u8 *dst,u32 num_aes_blocks);/** * Decrypt multiple blocks of data with AES CBC. * +* @key_size Size of the aes key (in bits) * @key_exp Expanded key to use * @iv Initialization vector * @src Source data to decrypt * @dst Destination buffer * @num_aes_blocks Number of AES blocks to decrypt */ -void aes_cbc_decrypt_blocks (u8 *key_exp,u8 *iv,u8 *src,u8 *dst, +void aes_cbc_decrypt_blocks (u32 key_size,u8 *key_exp,u8 *iv,u8 *src,u8 *dst,u32 num_aes_blocks);#endif /* _AES_REF_H_ */
lib/aes.c +54 -23
150 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 2/5 aes: add support of aes192 and aes256
Quoted 11 lines · Philippe Reynes
Until now, we only support aes128. This commit add the support of aes192 and aes256.
Signed-off-by Philippe Reynes <[email protected]>--- cmd/aes.c | 38 +++++++++++++++++--------- include/uboot_aes.h | 34 +++++++++++++++-------- lib/aes.c | 77 +++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 103 insertions(+), 46 deletions(-)
Quoted 6 lines
Changelog:
v3:
- no change
v2:
- fix the help for the aes command
PATCH v3 3/5 tegra20: crypto: update code to use new aes api
In reply to Philippe ReynesThis commit update tge driver crypto for tegra20
to use the new aes api.
--- arch/arm/mach-tegra/tegra20/crypto.c | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-)
Changelog:
v3:
- no change
v2:
- add a really simple commit text
arch/arm/mach-tegra/tegra20/crypto.c +22 -19
@@ -39,34 +39,35 @@ static void left_shift_vector(u8 *in, u8 *out, int size)/** * Sign a block of data, putting the result into dst. * -* \param key Input AES key, length AES_KEY_LENGTH +* \param key Input AES key, length AES128_KEY_LENGTH * \param key_schedule Expanded key to use * \param src Source data of length 'num_aes_blocks' blocks -* \param dst Destination buffer, length AES_KEY_LENGTH +* \param dst Destination buffer, length AES128_KEY_LENGTH * \param num_aes_blocks Number of AES blocks to encrypt */ static void sign_object (u8 *key,u8 *key_schedule,u8 *src,u8 *dst,u32 num_aes_blocks) { -u8 tmp_data[AES_KEY_LENGTH ]; -u8 iv[AES_KEY_LENGTH ] = {0 }; -u8 left[AES_KEY_LENGTH ]; -u8 k1[AES_KEY_LENGTH ]; +u8 tmp_data[AES128_KEY_LENGTH ]; +u8 iv[AES128_KEY_LENGTH ] = {0 }; +u8 left[AES128_KEY_LENGTH ]; +u8 k1[AES128_KEY_LENGTH ];u8 *cbc_chain_data;unsigned i; cbc_chain_data = zero_key;/* Convenient array of 0's for IV */ /* compute K1 constant needed by AES-CMAC calculation */ -for (i =0 ; i <AES_KEY_LENGTH ; i++) +for (i =0 ; i <AES128_KEY_LENGTH ; i++) tmp_data[i] =0 ; -aes_cbc_encrypt_blocks (key_schedule, iv, tmp_data, left,1 ); +aes_cbc_encrypt_blocks (AES128_KEY_LENGTH , key_schedule, iv, + tmp_data, left,1 );left_shift_vector (left, k1,sizeof (left));if ((left[0 ] >>7 ) !=0 )/* get MSB of L */ - k1[AES_KEY_LENGTH -1 ] ^=AES_CMAC_CONST_RB ; + k1[AES128_KEY_LENGTH -1 ] ^=AES_CMAC_CONST_RB ;/* compute the AES-CMAC value */ for (i =0 ; i < num_aes_blocks; i++) {
@@ -78,31 +79,32 @@ static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst,aes_apply_cbc_chain_data (tmp_data, k1, tmp_data);/* encrypt the AES block */ -aes_encrypt (tmp_data, key_schedule, dst); +aes_encrypt (AES128_KEY_LENGTH , tmp_data, + key_schedule, dst);debug ("sign_obj: block %d of %d\n" , i, num_aes_blocks);/* Update pointers for next loop. */ cbc_chain_data = dst; - src +=AES_KEY_LENGTH ; + src +=AES128_KEY_LENGTH ; } }/** * Encrypt and sign a block of data (depending on security mode). * -* \param key Input AES key, length AES_KEY_LENGTH +* \param key Input AES key, length AES128_KEY_LENGTH * \param oper Security operations mask to perform (enum security_op) * \param src Source data * \param length Size of source data -* \param sig_dst Destination address for signature, AES_KEY_LENGTH bytes +* \param sig_dst Destination address for signature, AES128_KEY_LENGTH bytes */ static int encrypt_and_sign (u8 *key,enum security_op oper,u8 *src,u32 length,u8 *sig_dst) {u32 num_aes_blocks; -u8 key_schedule[AES_EXPAND_KEY_LENGTH ]; -u8 iv[AES_KEY_LENGTH ] = {0 }; +u8 key_schedule[AES128_EXPAND_KEY_LENGTH ]; +u8 iv[AES128_KEY_LENGTH ] = {0 };debug ("encrypt_and_sign: length = %d\n" , length);
@@ -110,15 +112,16 @@ static int encrypt_and_sign(u8 *key, enum security_op oper, u8 *src,* The only need for a key is for signing/checksum purposes, so * if not encrypting, expand a key of 0s. */ -aes_expand_key (oper &SECURITY_ENCRYPT ? key : zero_key, key_schedule); +aes_expand_key (oper &SECURITY_ENCRYPT ? key : zero_key, +AES128_KEY_LENGTH , key_schedule); - num_aes_blocks = (length +AES_KEY_LENGTH -1 ) /AES_KEY_LENGTH ; + num_aes_blocks = (length +AES128_KEY_LENGTH -1 ) /AES128_KEY_LENGTH ;if (oper &SECURITY_ENCRYPT ) {/* Perform this in place, resulting in src being encrypted. */ debug ("encrypt_and_sign: begin encryption\n" ); -aes_cbc_encrypt_blocks (key_schedule, iv, src, src, - num_aes_blocks); +aes_cbc_encrypt_blocks (AES128_KEY_LENGTH , key_schedule, iv, src, + src, num_aes_blocks);debug ("encrypt_and_sign: end encryption\n" ); }
Signature · 1 line
2.7.4
PATCH v3 3/5 tegra20: crypto: update code to use new aes api
Quoted 9 lines · Philippe Reynes
This commit update tge driver crypto for tegra20
to use the new aes api.Signed-off-by Philippe Reynes <[email protected]>--- arch/arm/mach-tegra/tegra20/crypto.c | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-)
Quoted 6 lines
Changelog:
v3:
- no change
v2:
- add a really simple commit text
But it looks like you need to squash this with the previous commit to avoid a build error on this one.
PATCH v3 4/5 aes: add test unit for aes128
In reply to Philippe ReynesThis commit add test unit for aes128.
--- test/lib/Makefile | 1 + test/lib/test_aes.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 test/lib/test_aes.c
Changelog:
v3:
- new patch in this serie (in the previous version, the test to aes was added to pytest, now, we add test unit for aes as proposed by Simon)
test/lib/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-y += hexdump.o obj-y += lmb.o obj-y += string.o obj-$(CONFIG_ERRNO_STR) += test_errno_str.o +obj-$(CONFIG_AES) += test_aes.o
test/lib/test_aes.c new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 4/5 aes: add test unit for aes128
Hi Philippe,
Quoted 10 lines · Philippe Reynes
This commit add test unit for aes128.
Signed-off-by Philippe Reynes <[email protected]>--- test/lib/Makefile | 1 + test/lib/test_aes.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 test/lib/test_aes.c
Quoted 5 lines
Changelog:
v3:
- new patch in this serie (in the previous version, the test to aes was added to pytest, now, we add test unit for aes as proposed by Simon)
nit below
[..]
Quoted 10 lines
test/lib/test_aes.c new file +4
-0@@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2019 Philippe Reynes <[email protected]> +*
test/lib/test_aes.c line 14
Quoted 10 lines
test/lib/test_aes.c new file +10
-0+* Unit tests for aes functions +*/ + +#include <common.h> +#include <command.h> +#include <hexdump.h> +#include <test/lib.h> +#include <test/test.h> +#include <test/ut.h> +#include <uboot_aes.h>
Put test/ headers at the end.
Regards,
Simon
PATCH v3 5/5 aes: add test unit for aes196 and aes256
In reply to Philippe ReynesThis commit add test unit for aes196 and aes256.
--- test/lib/test_aes.c | 4 ++++ 1 file changed, 4 insertions(+)
Changelog:
v3:
- new patch in this serie (in the previous version, the test to aes was added to pytest, now, we add test unit for aes as proposed by Simon)
test/lib/test_aes.c +4 -0
@@ -26,6 +26,10 @@ struct test_aes_s {static struct test_aes_s test_aes[] = { {AES128_KEY_LENGTH ,AES128_EXPAND_KEY_LENGTH ,TEST_AES_ONE_BLOCK ,1 }, {AES128_KEY_LENGTH ,AES128_EXPAND_KEY_LENGTH ,TEST_AES_CBC_CHAIN ,16 }, + {AES192_KEY_LENGTH ,AES192_EXPAND_KEY_LENGTH ,TEST_AES_ONE_BLOCK ,1 }, + {AES192_KEY_LENGTH ,AES192_EXPAND_KEY_LENGTH ,TEST_AES_CBC_CHAIN ,16 }, + {AES256_KEY_LENGTH ,AES256_EXPAND_KEY_LENGTH ,TEST_AES_ONE_BLOCK ,1 }, + {AES256_KEY_LENGTH ,AES256_EXPAND_KEY_LENGTH ,TEST_AES_CBC_CHAIN ,16 }, };static void rand_buf (u8 *buf,int size)
Signature · 1 line
2.7.4
PATCH v3 5/5 aes: add test unit for aes196 and aes256
Quoted 4 lines · Philippe Reynes
This commit add test unit for aes196 and aes256.
Signed-off-by Philippe Reynes <[email protected]>
Quoted 9 lines
--- test/lib/test_aes.c | 4 ++++ 1 file changed, 4 insertions(+)Changelog:
v3:
- new patch in this serie (in the previous version, the test to aes was added to pytest, now, we add test unit for aes as proposed by Simon)