From 79ec07f5e12f9d458569d2298144ee28b8f1c7f5 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 22 Feb 2021 22:45:07 +0700 Subject: [PATCH] adjustment after rebase --- IDE/include.am | 1 + wolfcrypt/benchmark/benchmark.c | 1 + wolfcrypt/src/aes.c | 27 -------------------------- wolfcrypt/src/cmac.c | 3 +++ wolfcrypt/src/ecc.c | 3 +-- wolfcrypt/src/random.c | 3 ++- wolfcrypt/test/test.c | 3 --- wolfssl/wolfcrypt/port/caam/wolfcaam.h | 1 + 8 files changed, 9 insertions(+), 33 deletions(-) diff --git a/IDE/include.am b/IDE/include.am index 21932626b..e45a90820 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -35,6 +35,7 @@ include IDE/M68K/include.am include IDE/HEXAGON/include.am include IDE/RISCV/include.am include IDE/XilinxSDK/include.am +include IDE/VisualDSP/include.am include IDE/QNX/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif IDE/zephyr diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index ee80c9089..aea951100 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -753,6 +753,7 @@ static const char* bench_result_words2[][5] = { /* Asynchronous helper macros */ #ifdef WOLFSSL_QNX_CAAM +#include static THREAD_LS_T int devId = WOLFSSL_CAAM_DEVID; #else static THREAD_LS_T int devId = INVALID_DEVID; diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 413e1df66..e782070ef 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -3050,33 +3050,6 @@ int wc_AesSetIV(Aes* aes, const byte* iv) #if defined(HAVE_COLDFIRE_SEC) #error "Coldfire SEC doesn't yet support AES direct" - #elif defined(FREESCALE_LTC) - /* Allow direct access to one block encrypt */ - void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in) - { - byte *key; - uint32_t keySize; - - key = (byte*)aes->key; - wc_AesGetKeySize(aes, &keySize); - - LTC_AES_EncryptEcb(LTC_BASE, in, out, AES_BLOCK_SIZE, - key, keySize); - } - - /* Allow direct access to one block decrypt */ - void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in) - { - byte *key; - uint32_t keySize; - - key = (byte*)aes->key; - wc_AesGetKeySize(aes, &keySize); - - LTC_AES_DecryptEcb(LTC_BASE, in, out, AES_BLOCK_SIZE, - key, keySize, kLTC_EncryptKey); - } - #elif defined(WOLFSSL_IMX6_CAAM) && !defined(NO_IMX6_CAAM_AES) && \ !defined(WOLFSSL_QNX_CAAM) /* implemented in wolfcrypt/src/port/caam/caam_aes.c */ diff --git a/wolfcrypt/src/cmac.c b/wolfcrypt/src/cmac.c index 95a0ee152..88d7214ba 100644 --- a/wolfcrypt/src/cmac.c +++ b/wolfcrypt/src/cmac.c @@ -25,6 +25,9 @@ #endif #include +#ifdef WOLFSSL_QNX_CAAM +#include +#endif #if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 7106ca936..78b377ca8 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -8045,9 +8045,8 @@ int wc_ecc_export_ex(ecc_key* key, byte* qx, word32* qxLen, /* private key, d */ if (d != NULL) { if (dLen == NULL || - (key->type != ECC_PRIVATEKEY && key->type != ECC_PRIVATEKEY_ONLY)) { + (key->type != ECC_PRIVATEKEY && key->type != ECC_PRIVATEKEY_ONLY)) return BAD_FUNC_ARG; - } #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) /* Hardware cannot export private portion */ diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 74089b8c2..3170aeb22 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -2325,7 +2325,8 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) for (i = 0; i < times; i++) { buf[0].BufferType = DataBuffer | LastBuffer; buf[0].TheAddress = (CAAM_ADDRESS)(output + idx); - buf[0].Length = ((sz - idx) < 44)? sz-idx:44; + buf[0].Length = ((sz - idx) < WC_CAAM_MAX_ENTROPY)? + sz - idx : WC_CAAM_MAX_ENTROPY; args[0] = buf[0].Length; ret = wc_caamAddAndWait(buf, 1, args, CAAM_ENTROPY); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 8c202f425..176b79609 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -499,7 +499,6 @@ WOLFSSL_TEST_SUBROUTINE int mutex_test(void); #if defined(USE_WOLFSSL_MEMORY) && !defined(FREERTOS) WOLFSSL_TEST_SUBROUTINE int memcb_test(void); #endif - #ifdef WOLFSSL_IMX6_CAAM_BLOB WOLFSSL_TEST_SUBROUTINE int blob_test(void); #endif @@ -1430,7 +1429,6 @@ initDefaultName(); args.argc = argc; args.argv = argv; #endif - wolfSSL_Debugging_ON(); if ((ret = wolfCrypt_Init()) != 0) { printf("wolfCrypt_Init failed %d\n", ret); err_sys("Error with wolfCrypt_Init!\n", -1003); @@ -20185,7 +20183,6 @@ static int ecc_test_vector_item(const eccVector* vector) ret = wc_ecc_verify_hash(sig, sigSz, (byte*)vector->msg, vector->msgLen, &verify, userA); } while (ret == WC_PENDING_E); - if (ret != 0) goto done; TEST_SLEEP(); diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam.h b/wolfssl/wolfcrypt/port/caam/wolfcaam.h index f2dd88620..465fea5c4 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam.h @@ -74,6 +74,7 @@ WOLFSSL_API int wc_caamCoverKey(byte* in, word32 inSz, byte* out, word32* outSz, #define WC_CAAM_BLOB_BLACK 2 #define WC_CAAM_RED_KEYMOD_SZ 8 #define WC_CAAM_BLACK_KEYMOD_SZ 8 +#define WC_CAAM_MAX_ENTROPY 44 #ifndef WOLFSSL_QNX_CAAM WOLFSSL_API int wc_caamSetResource(IODevice ioDev);