mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 05:55:46 +08:00
Fix issues when AES support was added for the STM32L1. From Juha Niskanen
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
#include <nuttx/fs/fs.h>
|
#include <nuttx/fs/fs.h>
|
||||||
#include <nuttx/syslog/ramlog.h>
|
#include <nuttx/syslog/ramlog.h>
|
||||||
#include <nuttx/syslog/syslog_console.h>
|
#include <nuttx/syslog/syslog_console.h>
|
||||||
|
#include <nuttx/crypto/crypto.h>
|
||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
@@ -196,14 +197,6 @@ void up_initialize(void)
|
|||||||
devnull_register(); /* Standard /dev/null */
|
devnull_register(); /* Standard /dev/null */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CRYPTO)
|
|
||||||
up_cryptoinitialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_CRYPTO_CRYPTODEV)
|
|
||||||
devcrypto_register(); /* /dev/crypto */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_DEV_ZERO)
|
#if defined(CONFIG_DEV_ZERO)
|
||||||
devzero_register(); /* Standard /dev/zero */
|
devzero_register(); /* Standard /dev/zero */
|
||||||
#endif
|
#endif
|
||||||
@@ -228,6 +221,18 @@ void up_initialize(void)
|
|||||||
ramlog_consoleinit();
|
ramlog_consoleinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize the HW crypto and /dev/crypto */
|
||||||
|
|
||||||
|
#if defined(CONFIG_CRYPTO)
|
||||||
|
up_cryptoinitialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
|
#if defined(CONFIG_CRYPTO_CRYPTODEV)
|
||||||
|
devcrypto_register();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the Random Number Generator (RNG) */
|
/* Initialize the Random Number Generator (RNG) */
|
||||||
|
|
||||||
#ifdef CONFIG_DEV_RANDOM
|
#ifdef CONFIG_DEV_RANDOM
|
||||||
|
|||||||
+17
-3
@@ -54,6 +54,14 @@
|
|||||||
|
|
||||||
#include "testmngr.h"
|
#include "testmngr.h"
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ARRAY_SIZE
|
||||||
|
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_CRYPTO_AES)
|
#if defined(CONFIG_CRYPTO_AES)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -99,9 +107,15 @@ static int test_aes(void)
|
|||||||
{
|
{
|
||||||
int i;
|
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_ECB, "ECB", ARRAY_SIZE(aes_enc_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)
|
ARRAY_SIZE(aes_dec_tv_template), aes_enc_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_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;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,13 +64,6 @@ struct cipher_testvec
|
|||||||
|
|
||||||
/* AES test vectors */
|
/* 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[] =
|
static struct cipher_testvec aes_enc_tv_template[] =
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_CRYPTO_AES128_DISABLE
|
#ifndef CONFIG_CRYPTO_AES128_DISABLE
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ extern "C"
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
|
int up_cryptoinitialize(void);
|
||||||
|
|
||||||
#if defined(CONFIG_CRYPTO_AES)
|
#if defined(CONFIG_CRYPTO_AES)
|
||||||
int up_aesinitialize(void);
|
int up_aesinitialize(void);
|
||||||
int aes_cypher(FAR void *out, FAR const void *in, uint32_t size, FAR const void *iv,
|
int aes_cypher(FAR void *out, FAR const void *in, uint32_t size, FAR const void *iv,
|
||||||
|
|||||||
Reference in New Issue
Block a user