forked from wolfSSL/wolfssl
Addressed review comments
This commit is contained in:
@@ -4050,13 +4050,17 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
|
|||||||
if (err == SA_SILIB_RET_OK && key->pubkey.x && key->pubkey.y) {
|
if (err == SA_SILIB_RET_OK && key->pubkey.x && key->pubkey.y) {
|
||||||
err = mp_read_unsigned_bin(key->pubkey.x,
|
err = mp_read_unsigned_bin(key->pubkey.x,
|
||||||
&ucompressed_key[1], key->dp->size);
|
&ucompressed_key[1], key->dp->size);
|
||||||
err = mp_read_unsigned_bin(key->pubkey.y,
|
if (err == MP_OKAY) {
|
||||||
|
err = mp_read_unsigned_bin(key->pubkey.y,
|
||||||
&ucompressed_key[1+key->dp->size],key->dp->size);
|
&ucompressed_key[1+key->dp->size],key->dp->size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
raw_size = key->dp->size;
|
raw_size = key->dp->size;
|
||||||
err = CRYS_ECPKI_ExportPrivKey(&key->ctx.privKey,
|
if (err == MP_OKAY) {
|
||||||
ucompressed_key,
|
err = CRYS_ECPKI_ExportPrivKey(&key->ctx.privKey,
|
||||||
&raw_size);
|
ucompressed_key,
|
||||||
|
&raw_size);
|
||||||
|
}
|
||||||
|
|
||||||
if (err == SA_SILIB_RET_OK) {
|
if (err == SA_SILIB_RET_OK) {
|
||||||
err = mp_read_unsigned_bin(&key->k, ucompressed_key, raw_size);
|
err = mp_read_unsigned_bin(&key->k, ucompressed_key, raw_size);
|
||||||
|
@@ -56,10 +56,9 @@ static void cc310_enable(void)
|
|||||||
cc310_enableCount++;
|
cc310_enableCount++;
|
||||||
|
|
||||||
/* Enable the CC310 HW/IQ once*/
|
/* Enable the CC310 HW/IQ once*/
|
||||||
if (cc310_enableCount == 1) {
|
|
||||||
NRF_CRYPTOCELL->ENABLE = 1;
|
NRF_CRYPTOCELL->ENABLE = 1;
|
||||||
NVIC_EnableIRQ(CRYPTOCELL_IRQn);
|
NVIC_EnableIRQ(CRYPTOCELL_IRQn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cc310_disable(void)
|
static void cc310_disable(void)
|
||||||
@@ -76,7 +75,7 @@ static void cc310_disable(void)
|
|||||||
int cc310_Init(void)
|
int cc310_Init(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
static bool initialized = false;
|
static int initialized = 0;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
/* Enable the CC310 HW. */
|
/* Enable the CC310 HW. */
|
||||||
@@ -96,7 +95,7 @@ int cc310_Init(void)
|
|||||||
WOLFSSL_MSG("Error CRYS_RndInit");
|
WOLFSSL_MSG("Error CRYS_RndInit");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
initialized = true;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -274,11 +273,11 @@ static int rtc_get_ms(void)
|
|||||||
double current_time(int reset)
|
double current_time(int reset)
|
||||||
{
|
{
|
||||||
double time;
|
double time;
|
||||||
static bool initialized = false;
|
static int initialized = 0;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
rtc_config();
|
rtc_config();
|
||||||
initialized = true;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
time = mRtcSec;
|
time = mRtcSec;
|
||||||
time += (double)rtc_get_ms() / 1000;
|
time += (double)rtc_get_ms() / 1000;
|
||||||
@@ -289,7 +288,7 @@ double current_time(int reset)
|
|||||||
int nrf_random_generate(byte* output, word32 size)
|
int nrf_random_generate(byte* output, word32 size)
|
||||||
{
|
{
|
||||||
uint32_t err_code;
|
uint32_t err_code;
|
||||||
static bool initialized = false;
|
static int initialized = 0;
|
||||||
|
|
||||||
/* RNG must be initialized once */
|
/* RNG must be initialized once */
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -297,7 +296,7 @@ int nrf_random_generate(byte* output, word32 size)
|
|||||||
if (err_code != NRF_SUCCESS) {
|
if (err_code != NRF_SUCCESS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
initialized = true;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
nrf_drv_rng_block_rand(output, size);
|
nrf_drv_rng_block_rand(output, size);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user