forked from wolfSSL/wolfssl
Applied review comments to the code
This commit is contained in:
@@ -274,66 +274,4 @@ uint32_t s_inst2[R_TSIP_SINST2_WORD_SIZE]= { 0 };
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
#pragma section _FIRMWARE_UPDATE_CONTROL_BLOCK
|
||||
const st_key_index_block_data_t g_key_index_block_data =
|
||||
{
|
||||
/* struct firmware_update_control_data; */
|
||||
{
|
||||
/* uint32_t user_program_max_cnt; */
|
||||
0,
|
||||
/* uint32_t lifecycle_state; */
|
||||
LIFECYCLE_STATE_BLANK,
|
||||
/* uint32_t program_mac0[R_TSIP_AES_BLOCK_BYTE_SIZE / sizeof(uint32_t)]; */
|
||||
{
|
||||
0
|
||||
},
|
||||
/* uint32_t program_mac1[R_TSIP_AES_BLOCK_BYTE_SIZE / sizeof(uint32_t)]; */
|
||||
{
|
||||
0
|
||||
},
|
||||
},
|
||||
/* struct key_data; */
|
||||
{
|
||||
/* tsip_rsa2048_public_key_index_t user_rsa2048_ne_key_index; */
|
||||
{
|
||||
0
|
||||
},
|
||||
/* tsip_update_key_ring_t user_update_key_index; */
|
||||
{
|
||||
0
|
||||
},
|
||||
},
|
||||
/* uint8_t hash_sha1[R_TSIP_SHA1_HASH_LENGTH_BYTE_SIZE]; */
|
||||
{
|
||||
0xC6, 0x10, 0x5D, 0xF5, 0x16, 0x83, 0x7E, 0xCE, 0x50, 0x55, 0x87, 0x7F, 0x39, 0xBD, 0xA3, 0x0F,
|
||||
0xC4, 0xB4, 0x7B, 0x5F
|
||||
},
|
||||
};
|
||||
#pragma section
|
||||
|
||||
#pragma section _FIRMWARE_UPDATE_CONTROL_BLOCK_MIRROR
|
||||
const st_key_index_block_data_t g_key_index_block_data_mirror =
|
||||
{
|
||||
0
|
||||
};
|
||||
#pragma section
|
||||
|
||||
st_key_index_block_data_t g_key_index_block_image =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -35,9 +35,6 @@ typedef struct st_key_block_data
|
||||
uint8_t iv[R_TSIP_AES_CBC_IV_BYTE_SIZE];
|
||||
uint8_t encrypted_user_rsa2048_ne_key[R_TSIP_RSA2048_NE_KEY_BYTE_SIZE + 16];
|
||||
uint8_t encrypted_user_update_key[R_TSIP_AES256_KEY_BYTE_SIZE + 16];
|
||||
// #if (WOLFSSL_RENESAS_TSIP_VER >= 109)
|
||||
// uint32_t encrypted_user_key_type;
|
||||
// #endif
|
||||
} st_key_block_data_t;
|
||||
|
||||
#if (WOLFSSL_RENESAS_TSIP_VER >= 109)
|
||||
|
@@ -19,11 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
//#include "typedefine.h"
|
||||
#ifdef __cplusplus
|
||||
//#include <ios> // Remove the comment when you use ios
|
||||
//_SINT ios_base::Init::init_cnt; // Remove the comment when you use ios
|
||||
#endif
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
|
@@ -82,8 +82,8 @@ static uint32_t GetTsipCipherSuite(
|
||||
uint32_t tsipCipher;
|
||||
|
||||
if(cipherSuiteFirst == CIPHER_BYTE )
|
||||
{
|
||||
switch(cipherSuite){
|
||||
{
|
||||
switch(cipherSuite){
|
||||
|
||||
case TLS_RSA_WITH_AES_128_CBC_SHA: /*2F*/
|
||||
tsipCipher = R_TSIP_TLS_RSA_WITH_AES_128_CBC_SHA; /*0*/
|
||||
@@ -106,13 +106,13 @@ static uint32_t GetTsipCipherSuite(
|
||||
break;
|
||||
}
|
||||
WOLFSSL_MSG( "<< GetTsipCipherSuite");
|
||||
return tsipCipher;
|
||||
return tsipCipher;
|
||||
}
|
||||
else if( cipherSuiteFirst == ECC_BYTE )
|
||||
{
|
||||
else if( cipherSuiteFirst == ECC_BYTE )
|
||||
{
|
||||
tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
|
||||
/* comment out until implementation completes
|
||||
switch(cipherSuite){
|
||||
switch(cipherSuite){
|
||||
|
||||
case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
|
||||
tsipCipher = R_TSIP_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256;
|
||||
@@ -133,15 +133,15 @@ static uint32_t GetTsipCipherSuite(
|
||||
default:
|
||||
tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
|
||||
break;
|
||||
} */
|
||||
}
|
||||
} */
|
||||
}
|
||||
else{
|
||||
tsipCipher = (uint32_t)WOLFSSL_TSIP_ILLEGAL_CIPHERSUITE;
|
||||
}
|
||||
}
|
||||
|
||||
WOLFSSL_MSG( "<< GetTsipCipherSuite" );
|
||||
|
||||
return tsipCipher;
|
||||
return tsipCipher;
|
||||
}
|
||||
#elif defined(WOLFSSL_RENESAS_TSIP_TLS) && (WOLFSSL_RENESAS_TSIP_VER >=106)
|
||||
|
||||
@@ -174,8 +174,6 @@ int tsip_hw_lock()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
/*WOLFSSL_MSG("enter esp_sha_hw_lock");*/
|
||||
|
||||
if(tsip_CryptHwMutexInit_ == 0){
|
||||
|
||||
ret = tsip_CryptHwMutexInit(&tsip_mutex);
|
||||
@@ -191,7 +189,7 @@ int tsip_hw_lock()
|
||||
/* this should not happens */
|
||||
return -1;
|
||||
}
|
||||
/*WOLFSSL_MSG("leave tsip_sha_try_hw_lock");*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -200,9 +198,7 @@ int tsip_hw_lock()
|
||||
*/
|
||||
void tsip_hw_unlock( void )
|
||||
{
|
||||
/* WOLFSSL_MSG("enter tsip_hw_unlock"); */
|
||||
tsip_CryptHwMutexUnLock(&tsip_mutex);
|
||||
/* WOLFSSL_MSG("leave tsip_hw_unlock");*/
|
||||
}
|
||||
|
||||
/* check if tsip tls functions can be used for the cipher */
|
||||
@@ -217,41 +213,33 @@ int tsip_useable(const struct WOLFSSL *ssl)
|
||||
byte side;
|
||||
|
||||
/* sanity check */
|
||||
if (ssl == NULL){
|
||||
WOLFSSL_MSG("<< tsip_useable: No");
|
||||
if (ssl == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* when rsa key index == NULL, tsip isn't used for cert verification. */
|
||||
/* in the case, we cannot use TSIP. */
|
||||
if (!ssl->peerTsipEncRsaKeyIndex){
|
||||
WOLFSSL_MSG("<< tsip_useable: No");
|
||||
if (!ssl->peerTsipEncRsaKeyIndex)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* when enabled Extended Master Secret, we cannot use TSIP. */
|
||||
if (ssl->options.haveEMS){
|
||||
WOLFSSL_MSG("<< tsip_useable: No");
|
||||
if (ssl->options.haveEMS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cipher0 = ssl->options.cipherSuite0;
|
||||
cipher = ssl->options.cipherSuite;
|
||||
side = ssl->options.side;
|
||||
|
||||
if (cipher0 > 0x00){
|
||||
WOLFSSL_MSG("<< tsip_useable: No");
|
||||
if (cipher0 > 0x00)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cipher == l_TLS_RSA_WITH_AES_128_CBC_SHA ||
|
||||
cipher == l_TLS_RSA_WITH_AES_128_CBC_SHA256 ||
|
||||
cipher == l_TLS_RSA_WITH_AES_256_CBC_SHA ||
|
||||
cipher == l_TLS_RSA_WITH_AES_256_CBC_SHA256) &&
|
||||
side == WOLFSSL_CLIENT_END){
|
||||
WOLFSSL_MSG("<< tsip_useable: Yes");
|
||||
side == WOLFSSL_CLIENT_END)
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
WOLFSSL_MSG("<< tsip_useable: No");
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if the g_alreadyVerified CA's key can be used for *
|
||||
|
Reference in New Issue
Block a user