Fixes for ATECC with PMS outlen and ATECC_MAX_SLOT.

This commit is contained in:
David Garske
2019-01-21 08:25:59 -08:00
parent 952d0b3b6b
commit 7ce255aa4d
4 changed files with 17 additions and 17 deletions

View File

@ -102,7 +102,7 @@ void my_atmel_free(int slotId)
{
ESP_LOGI(TAG, "Enter my_atmel_alloc");
if(slotId >= 0 && slotId <= ATECC_MAX_SLOT){
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
mSlotList[slotId] = ATECC_INVALID_SLOT;
}

View File

@ -111,7 +111,7 @@ int my_atmel_alloc(int slotType)
/* free slot array */
void my_atmel_free(int slotId)
{
if(slotId >= 0 && slotId <= ATECC_MAX_SLOT){
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
mSlotList[slotId] = ATECC_INVALID_SLOT;
}
}

View File

@ -115,7 +115,7 @@ int my_atmel_alloc(int slotType)
/* free slot array */
void my_atmel_free(int slotId)
{
if(slotId >= 0 && slotId <= ATECC_MAX_SLOT){
if(slotId >= 0 && slotId < ATECC_MAX_SLOT){
mSlotList[slotId] = ATECC_INVALID_SLOT;
}
}

View File

@ -402,7 +402,7 @@ int atmel_init(void)
#endif
/* Init the free slotId list */
for (i=0; i<=ATECC_MAX_SLOT; i++) {
for (i=0; i<ATECC_MAX_SLOT; i++) {
if (i == ATECC_SLOT_AUTH_PRIV || i == ATECC_SLOT_I2C_ENC) {
mSlotList[i] = i;
}
@ -603,7 +603,7 @@ int atcatls_create_pms_cb(WOLFSSL* ssl, ecc_key* otherKey,
}
ret = atmel_ecc_create_pms(tmpKey.slot, peerKey, out);
*outlen = ATECC_SIG_SIZE;
*outlen = ATECC_KEY_SIZE;
#ifndef WOLFSSL_ATECC508A_NOIDLE
/* put chip into idle to prevent watchdog situation on chip */