mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-05 13:44:41 +02:00
addressed review comments
This commit is contained in:
@@ -71,11 +71,12 @@
|
|||||||
/* TSIP TLS specific definitions */
|
/* TSIP TLS specific definitions */
|
||||||
#if !defined(WOLFSSL_RENESAS_TSIP)
|
#if !defined(WOLFSSL_RENESAS_TSIP)
|
||||||
#define OPENSSL_EXTRA
|
#define OPENSSL_EXTRA
|
||||||
#define WOLFSSL_GENSEED_FORTEST /* Wardning: define your own seed gen */
|
#define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */
|
||||||
#else
|
#else
|
||||||
#if defined(WOLFSSL_RENESAS_RX65N)
|
#if defined(WOLFSSL_RENESAS_RX65N)
|
||||||
/* In the case of Static RSA and AES-CBC use */
|
/* In the case of Static RSA and AES-CBC use */
|
||||||
#define HAVE_AES_CBC
|
#define HAVE_AES_CBC
|
||||||
|
/* TSIP ver 1.0.6 or lower supports only static RSA as Public-key cryptography. */
|
||||||
#define WOLFSSL_STATIC_RSA
|
#define WOLFSSL_STATIC_RSA
|
||||||
/* for disabling TSIP CRYPT and TSIP TLS */
|
/* for disabling TSIP CRYPT and TSIP TLS */
|
||||||
/* #define NO_RENESAS_TSIP_CRYPT */
|
/* #define NO_RENESAS_TSIP_CRYPT */
|
||||||
|
@@ -28,8 +28,8 @@
|
|||||||
#include "wolfssl/certs_test.h"
|
#include "wolfssl/certs_test.h"
|
||||||
#include "key_data.h"
|
#include "key_data.h"
|
||||||
|
|
||||||
#define SIMPLE_TLSSEVER_IP "192.168.1.45"
|
#define SIMPLE_TLSSEVER_IP "192.168.1.45"
|
||||||
#define SIMPLE_TLSSERVER_PORT "11111"
|
#define SIMPLE_TLSSERVER_PORT "11111"
|
||||||
|
|
||||||
ER t4_tcp_callback(ID cepid, FN fncd , VP p_parblk);
|
ER t4_tcp_callback(ID cepid, FN fncd , VP p_parblk);
|
||||||
uint32_t g_encrypted_root_public_key[140];
|
uint32_t g_encrypted_root_public_key[140];
|
||||||
@@ -41,8 +41,10 @@ static int my_IORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||||||
int ret;
|
int ret;
|
||||||
ID cepid;
|
ID cepid;
|
||||||
|
|
||||||
if(ctx != NULL)cepid = *(ID *)ctx;
|
if(ctx != NULL)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
cepid = *(ID *)ctx;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
|
|
||||||
ret = tcp_rcv_dat(cepid, buff, sz, TMO_FEVR);
|
ret = tcp_rcv_dat(cepid, buff, sz, TMO_FEVR);
|
||||||
if(ret > 0)return ret;
|
if(ret > 0)return ret;
|
||||||
@@ -54,8 +56,10 @@ static int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||||||
int ret;
|
int ret;
|
||||||
ID cepid;
|
ID cepid;
|
||||||
|
|
||||||
if(ctx != NULL)cepid = *(ID *)ctx;
|
if(ctx != NULL)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
cepid = *(ID *)ctx;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
|
|
||||||
ret = tcp_snd_dat(cepid, buff, sz, TMO_FEVR);
|
ret = tcp_snd_dat(cepid, buff, sz, TMO_FEVR);
|
||||||
if(ret == sz)return ret;
|
if(ret == sz)return ret;
|
||||||
|
@@ -35,12 +35,16 @@ static int my_IORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||||||
int ret;
|
int ret;
|
||||||
ID cepid;
|
ID cepid;
|
||||||
|
|
||||||
if(ctx != NULL)cepid = *(ID *)ctx;
|
if(ctx != NULL)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
cepid = *(ID *)ctx;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
|
|
||||||
ret = tcp_rcv_dat(cepid, buff, sz, TMO_FEVR);
|
ret = tcp_rcv_dat(cepid, buff, sz, TMO_FEVR);
|
||||||
if(ret == sz)return ret;
|
if(ret == sz)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
return ret;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
static int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
||||||
@@ -48,12 +52,16 @@ static int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||||||
int ret;
|
int ret;
|
||||||
ID cepid;
|
ID cepid;
|
||||||
|
|
||||||
if(ctx != NULL)cepid = *(ID *)ctx;
|
if(ctx != NULL)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
cepid = *(ID *)ctx;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
|
|
||||||
ret = tcp_snd_dat(cepid, buff, sz, TMO_FEVR);
|
ret = tcp_snd_dat(cepid, buff, sz, TMO_FEVR);
|
||||||
if(ret == sz)return ret;
|
if(ret == sz)
|
||||||
else return WOLFSSL_CBIO_ERR_GENERAL;
|
return ret;
|
||||||
|
else
|
||||||
|
return WOLFSSL_CBIO_ERR_GENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -391,16 +391,22 @@ int tsip_generateSeesionKey(struct WOLFSSL *ssl)
|
|||||||
if (enc->aes == NULL)
|
if (enc->aes == NULL)
|
||||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), ssl->heap,
|
enc->aes = (Aes*)XMALLOC(sizeof(Aes), ssl->heap,
|
||||||
DYNAMIC_TYPE_CIPHER);
|
DYNAMIC_TYPE_CIPHER);
|
||||||
if (enc->aes == NULL)
|
if (enc->aes == NULL)
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
|
|
||||||
XMEMSET(enc->aes, 0, sizeof(Aes));
|
XMEMSET(enc->aes, 0, sizeof(Aes));
|
||||||
}
|
}
|
||||||
if (dec) {
|
if (dec) {
|
||||||
if (dec->aes == NULL)
|
if (dec->aes == NULL)
|
||||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), ssl->heap,
|
dec->aes = (Aes*)XMALLOC(sizeof(Aes), ssl->heap,
|
||||||
DYNAMIC_TYPE_CIPHER);
|
DYNAMIC_TYPE_CIPHER);
|
||||||
if (dec->aes == NULL)
|
if (dec->aes == NULL) {
|
||||||
|
if (enc) {
|
||||||
|
XFREE(enc->aes, NULL, DYNAMIC_TYPE_CIPHER);
|
||||||
|
}
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
|
}
|
||||||
|
|
||||||
XMEMSET(dec->aes, 0, sizeof(Aes));
|
XMEMSET(dec->aes, 0, sizeof(Aes));
|
||||||
}
|
}
|
||||||
/* copy key index into aes */
|
/* copy key index into aes */
|
||||||
|
@@ -2209,7 +2209,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
if (sz < len) {
|
if (sz < len) {
|
||||||
len = sz;
|
len = sz;
|
||||||
}
|
}
|
||||||
/* retun 4 words randum number*/
|
/* retun 4 words random number*/
|
||||||
ret = R_TSIP_GenerateRandomNumber(buffer);
|
ret = R_TSIP_GenerateRandomNumber(buffer);
|
||||||
if(ret == TSIP_SUCCESS) {
|
if(ret == TSIP_SUCCESS) {
|
||||||
XMEMCPY(output, &buffer, len);
|
XMEMCPY(output, &buffer, len);
|
||||||
|
@@ -119,6 +119,9 @@ int wolfCrypt_Init(void)
|
|||||||
ret = tsip_Open( );
|
ret = tsip_Open( );
|
||||||
if( ret != TSIP_SUCCESS ) {
|
if( ret != TSIP_SUCCESS ) {
|
||||||
WOLFSSL_MSG("RENESAS TSIP Open failed");
|
WOLFSSL_MSG("RENESAS TSIP Open failed");
|
||||||
|
/* not return 1 since WOLFSSL_SUCCESS=1*/
|
||||||
|
ret = -1;/* FATAL ERROR */
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2087,8 +2087,8 @@ typedef struct Keys {
|
|||||||
byte keyUpdateRespond:1; /* KeyUpdate is to be responded to. */
|
byte keyUpdateRespond:1; /* KeyUpdate is to be responded to. */
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
||||||
byte tsip_client_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
|
byte tsip_client_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
|
||||||
byte tsip_server_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
|
byte tsip_server_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
|
||||||
#endif
|
#endif
|
||||||
} Keys;
|
} Keys;
|
||||||
|
|
||||||
@@ -3441,7 +3441,7 @@ typedef struct Arrays {
|
|||||||
byte masterSecret[SECRET_LEN];
|
byte masterSecret[SECRET_LEN];
|
||||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && \
|
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && \
|
||||||
!defined(NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION)
|
!defined(NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION)
|
||||||
byte tsip_masterSecret[80];
|
byte tsip_masterSecret[TSIP_TLS_MASTERSECRET_SIZE];
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_DTLS
|
#ifdef WOLFSSL_DTLS
|
||||||
byte cookie[MAX_COOKIE_LEN];
|
byte cookie[MAX_COOKIE_LEN];
|
||||||
|
@@ -273,6 +273,7 @@
|
|||||||
|
|
||||||
#if defined(WOLFSSL_RENESAS_TSIP)
|
#if defined(WOLFSSL_RENESAS_TSIP)
|
||||||
#define TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE 64
|
#define TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE 64
|
||||||
|
#define TSIP_TLS_MASTERSECRET_SIZE 80 /* 20 words */
|
||||||
#if !defined(NO_RENESAS_TSIP_CRYPT) && defined(WOLFSSL_RENESAS_RX65N)
|
#if !defined(NO_RENESAS_TSIP_CRYPT) && defined(WOLFSSL_RENESAS_RX65N)
|
||||||
#define WOLFSSL_RENESAS_TSIP_CRYPT
|
#define WOLFSSL_RENESAS_TSIP_CRYPT
|
||||||
#define WOLFSSL_RENESAS_TSIP_TLS
|
#define WOLFSSL_RENESAS_TSIP_TLS
|
||||||
|
Reference in New Issue
Block a user