Applied review comments to the code

This commit is contained in:
TakayukiMatsuo
2020-07-11 17:17:33 +09:00
parent 942226dc5a
commit af1b532758
4 changed files with 22 additions and 104 deletions

View File

@@ -275,65 +275,3 @@ 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

View File

@@ -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)

View File

@@ -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"

View File

@@ -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 *