mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Fix issues when AES support was added for the STM32L1. From Juha Niskanen
This commit is contained in:
+17
-3
@@ -54,6 +54,14 @@
|
||||
|
||||
#include "testmngr.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CRYPTO_AES)
|
||||
|
||||
/****************************************************************************
|
||||
@@ -99,9 +107,15 @@ static int test_aes(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
AES_CYPHER_TEST(AES_MODE_ECB, "ECB", AES_ENC_TEST_VECTORS, AES_DEC_TEST_VECTORS, aes_enc_tv_template, aes_dec_tv_template)
|
||||
AES_CYPHER_TEST(AES_MODE_CBC, "CBC", AES_CBC_ENC_TEST_VECTORS, AES_CBC_DEC_TEST_VECTORS, aes_cbc_enc_tv_template, aes_cbc_dec_tv_template)
|
||||
AES_CYPHER_TEST(AES_MODE_CTR, "CTR", AES_CTR_ENC_TEST_VECTORS, AES_CTR_DEC_TEST_VECTORS, aes_ctr_enc_tv_template, aes_ctr_dec_tv_template)
|
||||
AES_CYPHER_TEST(AES_MODE_ECB, "ECB", ARRAY_SIZE(aes_enc_tv_template),
|
||||
ARRAY_SIZE(aes_dec_tv_template), aes_enc_tv_template,
|
||||
aes_dec_tv_template)
|
||||
AES_CYPHER_TEST(AES_MODE_CBC, "CBC", ARRAY_SIZE(aes_cbc_enc_tv_template),
|
||||
ARRAY_SIZE(aes_cbc_dec_tv_template),
|
||||
aes_cbc_enc_tv_template, aes_cbc_dec_tv_template)
|
||||
AES_CYPHER_TEST(AES_MODE_CTR, "CTR", ARRAY_SIZE(aes_ctr_enc_tv_template),
|
||||
ARRAY_SIZE(aes_ctr_dec_tv_template),
|
||||
aes_ctr_enc_tv_template, aes_ctr_dec_tv_template)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -64,13 +64,6 @@ struct cipher_testvec
|
||||
|
||||
/* AES test vectors */
|
||||
|
||||
#define AES_ENC_TEST_VECTORS 3
|
||||
#define AES_DEC_TEST_VECTORS 3
|
||||
#define AES_CBC_ENC_TEST_VECTORS 4
|
||||
#define AES_CBC_DEC_TEST_VECTORS 4
|
||||
#define AES_CTR_ENC_TEST_VECTORS 3
|
||||
#define AES_CTR_DEC_TEST_VECTORS 3
|
||||
|
||||
static struct cipher_testvec aes_enc_tv_template[] =
|
||||
{
|
||||
#ifndef CONFIG_CRYPTO_AES128_DISABLE
|
||||
|
||||
Reference in New Issue
Block a user