From c6e25917112b97c13bdd2bceac41ce313090a17b Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Tue, 23 Jun 2015 17:39:15 +0900 Subject: [PATCH 1/4] Remove wornings --- wolfcrypt/src/port/ti/ti-aes.c | 1 + wolfcrypt/src/port/ti/ti-ccm.c | 8 ++++---- wolfcrypt/src/port/ti/ti-des3.c | 10 ++++++++-- wolfcrypt/src/port/ti/ti-hash.c | 3 ++- wolfssl/wolfcrypt/port/ti/ti-ccm.h | 12 +++++++++--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/wolfcrypt/src/port/ti/ti-aes.c b/wolfcrypt/src/port/ti/ti-aes.c index d38e7a3cb..fdf3c689b 100644 --- a/wolfcrypt/src/port/ti/ti-aes.c +++ b/wolfcrypt/src/port/ti/ti-aes.c @@ -250,6 +250,7 @@ static int AesAuthArgCheck(Aes* aes, byte* out, const byte* in, word32 inSz, const byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz, word32 *M, word32 *L) { + (void) authInSz ; if((aes == NULL)||(nonce == NULL)||(authTag== NULL)||(authIn == NULL)) return BAD_FUNC_ARG; if((inSz != 0) && ((out == NULL)||(in == NULL))) diff --git a/wolfcrypt/src/port/ti/ti-ccm.c b/wolfcrypt/src/port/ti/ti-ccm.c index 09705cfb8..2b25820c4 100644 --- a/wolfcrypt/src/port/ti/ti-ccm.c +++ b/wolfcrypt/src/port/ti/ti-ccm.c @@ -27,7 +27,7 @@ #if defined(WOLFSSL_TI_CRYPT) || defined(WOLFSSL_TI_HASH) - +#include "wolfssl/wolfcrypt/port/ti/ti-ccm.h" #include #include @@ -44,7 +44,7 @@ #define WAIT(stat) { volatile int i ; for(i=0; i #include #include +#include #ifndef TI_DUMMY_BUILD #include "inc/hw_memmap.h" @@ -61,7 +62,7 @@ bool wolfSSL_TI_CCMInit(void) { return true ; } #endif static int hashInit(wolfssl_TI_Hash *hash) { - if(!wolfSSL_TI_CCMInit())return ; + if(!wolfSSL_TI_CCMInit())return 1 ; hash->used = 0 ; hash->msg = 0 ; hash->len = 0 ; diff --git a/wolfssl/wolfcrypt/port/ti/ti-ccm.h b/wolfssl/wolfcrypt/port/ti/ti-ccm.h index f0fb24799..8e75e0d3e 100644 --- a/wolfssl/wolfcrypt/port/ti/ti-ccm.h +++ b/wolfssl/wolfcrypt/port/ti/ti-ccm.h @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef WOLF_CRYPT_TI_CCM_H +#define WOLF_CRYPT_TI_CCM_H + #ifdef HAVE_CONFIG_H #include #endif @@ -27,14 +30,17 @@ #if defined(WOLFSSL_TI_CRYPT) || defined(WOLFSSL_TI_HASH) -bool wolfSSL_TI_CCMInit(void) ; +int wolfSSL_TI_CCMInit(void) ; #ifndef SINGLE_THREADED -void wolfSSL_TI_lockCCM() ; -void wolfSSL_TI_unlockCCM() ; +void wolfSSL_TI_lockCCM(void) ; +void wolfSSL_TI_unlockCCM(void) ; #else #define wolfSSL_TI_lockCCM() #define wolfSSL_TI_unlockCCM() #endif #endif + +#endif + From a910daa8862beafb051d2af35ea27651b2e96816 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 24 Jun 2015 11:06:38 +0900 Subject: [PATCH 2/4] fixed arm-none-eabi-gcc type check on AESIVSet, AESKey1Set --- wolfcrypt/src/port/ti/ti-aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/port/ti/ti-aes.c b/wolfcrypt/src/port/ti/ti-aes.c index fdf3c689b..91d11a590 100644 --- a/wolfcrypt/src/port/ti/ti-aes.c +++ b/wolfcrypt/src/port/ti/ti-aes.c @@ -89,8 +89,8 @@ static int AesAlign16(Aes* aes, byte* out, const byte* in, word32 sz, word32 di ROM_AESReset(AES_BASE); ROM_AESConfigSet(AES_BASE, (aes->keylen | dir | (mode==AES_CFG_MODE_CTR_NOCTR ? AES_CFG_MODE_CTR : mode))); - ROM_AESIVSet(AES_BASE, aes->reg); - ROM_AESKey1Set(AES_BASE, aes->key, aes->keylen); + ROM_AESIVSet(AES_BASE, (uint32_t *)aes->reg); + ROM_AESKey1Set(AES_BASE, (uint32_t *)aes->key, aes->keylen); if((dir == AES_CFG_DIR_DECRYPT)&& (mode == AES_CFG_MODE_CBC)) /* if input and output same will overwrite input iv */ XMEMCPY(aes->tmp, in + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE); From 1feac72b62d5b81a9c2d38464d89fcd03ddea54a Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 24 Jun 2015 11:47:58 +0900 Subject: [PATCH 3/4] check InitMutex --- wolfcrypt/src/port/ti/ti-ccm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/port/ti/ti-ccm.c b/wolfcrypt/src/port/ti/ti-ccm.c index 2b25820c4..65a51350e 100644 --- a/wolfcrypt/src/port/ti/ti-ccm.c +++ b/wolfcrypt/src/port/ti/ti-ccm.c @@ -63,7 +63,7 @@ int wolfSSL_TI_CCMInit(void) WAIT(ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0)) ; #ifndef SINGLE_THREADED - InitMutex(&TI_CCM_Mutex) ; + if(InitMutex(&TI_CCM_Mutex))return false ; #endif return true ; From 309aadd3f30a2eb0b10e38846476afcd04b3f489 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 24 Jun 2015 14:12:40 +0900 Subject: [PATCH 4/4] TI-des3.c, type mismatch --- wolfcrypt/src/port/ti/ti-des3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/port/ti/ti-des3.c b/wolfcrypt/src/port/ti/ti-des3.c index 04203e241..2927a1b89 100644 --- a/wolfcrypt/src/port/ti/ti-des3.c +++ b/wolfcrypt/src/port/ti/ti-des3.c @@ -74,8 +74,8 @@ static int DesCbcAlign16(Des* des, byte* out, const byte* in, word32 sz, word32 wolfSSL_TI_lockCCM() ; ROM_DESReset(DES_BASE); ROM_DESConfigSet(DES_BASE, (dir | DES_CFG_MODE_CBC | tri)); - ROM_DESIVSet(DES_BASE, des->reg); - ROM_DESKeySet(DES_BASE, des->key); + ROM_DESIVSet(DES_BASE, (uint32_t*)des->reg); + ROM_DESKeySet(DES_BASE,(uint32_t*)des->key); if(dir == DES_CFG_DIR_DECRYPT) /* if input and output same will overwrite input iv */ XMEMCPY(des->tmp, in + sz - DES_BLOCK_SIZE, DES_BLOCK_SIZE); @@ -161,7 +161,7 @@ WOLFSSL_API int wc_Des_CbcDecryptWithKey(byte* out, const byte* in, word32 sz, const byte* key, const byte* iv) { (void)out; (void)in; (void)sz; (void)key; (void)iv ; - return 0 ; + return -1 ; } WOLFSSL_API int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz) @@ -178,7 +178,7 @@ WOLFSSL_API int wc_Des3_CbcDecryptWithKey(byte* out, const byte* in, word32 sz, const byte* key, const byte* iv) { (void)out; (void)in; (void)sz; (void)key; (void)iv ; - return 0 ; + return -1 ; }