code cleanup based on PR review comments

This commit is contained in:
Vysakh P Pillai
2021-04-27 12:17:23 +05:30
committed by GitHub
parent 4911977946
commit c34fcf908c

View File

@@ -190,7 +190,11 @@ int wolfCrypt_ATECC_SetConfig(ATCAIfaceCfg* cfg)
XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi)); XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi));
cfg_ateccx08a_i2c_pi.iface_type = cfg->iface_type; cfg_ateccx08a_i2c_pi.iface_type = cfg->iface_type;
cfg_ateccx08a_i2c_pi.devtype = cfg->devtype; cfg_ateccx08a_i2c_pi.devtype = cfg->devtype;
#ifdef ATCA_ENABLE_DEPRECATED
cfg_ateccx08a_i2c_pi.atcai2c.slave_address = cfg->atcai2c.slave_address;
#else
cfg_ateccx08a_i2c_pi.atcai2c.address = cfg->atcai2c.address; cfg_ateccx08a_i2c_pi.atcai2c.address = cfg->atcai2c.address;
#endif
cfg_ateccx08a_i2c_pi.atcai2c.bus = cfg->atcai2c.bus; cfg_ateccx08a_i2c_pi.atcai2c.bus = cfg->atcai2c.bus;
cfg_ateccx08a_i2c_pi.atcai2c.baud = cfg->atcai2c.baud; cfg_ateccx08a_i2c_pi.atcai2c.baud = cfg->atcai2c.baud;
cfg_ateccx08a_i2c_pi.wake_delay = cfg->wake_delay; cfg_ateccx08a_i2c_pi.wake_delay = cfg->wake_delay;
@@ -389,7 +393,7 @@ void atmel_show_rev_info(void)
#ifdef WOLFSSL_ATECC_DEBUG #ifdef WOLFSSL_ATECC_DEBUG
word32 revision = 0; word32 revision = 0;
atmel_get_rev_info(&revision); atmel_get_rev_info(&revision);
printf("ATECC508A Revision: %x\r\n", (word32)revision); printf("ATECC608 Revision: %x\n", (word32)revision);
#endif #endif
} }
@@ -513,6 +517,11 @@ int atmel_init(void)
XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi)); XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi));
cfg_ateccx08a_i2c_pi.iface_type = ATCA_I2C_IFACE; cfg_ateccx08a_i2c_pi.iface_type = ATCA_I2C_IFACE;
cfg_ateccx08a_i2c_pi.devtype = ATECC_DEV_TYPE; cfg_ateccx08a_i2c_pi.devtype = ATECC_DEV_TYPE;
#ifdef ATCA_ENABLE_DEPRECATED
cfg_ateccx08a_i2c_pi.atcai2c.slave_address = ATECC_I2C_ADDR;
#else
cfg_ateccx08a_i2c_pi.atcai2c.address = ATECC_I2C_ADDR;
#endif
cfg_ateccx08a_i2c_pi.atcai2c.address = ATECC_I2C_ADDR; cfg_ateccx08a_i2c_pi.atcai2c.address = ATECC_I2C_ADDR;
cfg_ateccx08a_i2c_pi.atcai2c.bus = ATECC_I2C_BUS; cfg_ateccx08a_i2c_pi.atcai2c.bus = ATECC_I2C_BUS;
cfg_ateccx08a_i2c_pi.atcai2c.baud = 400000; cfg_ateccx08a_i2c_pi.atcai2c.baud = 400000;
@@ -938,7 +947,7 @@ static int atcatls_set_certificates(WOLFSSL_CTX *ctx)
#endif #endif
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
} }
certBuffer=XMALLOC(signerCertSize+deviceCertSize, NULL, DYNAMIC_TYPE_TMP_BUFFER); certBuffer=(uint8_t*)XMALLOC(signerCertSize+deviceCertSize, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if(NULL == certBuffer){ if(NULL == certBuffer){
#ifdef WOLFSSL_ATECC_DEBUG #ifdef WOLFSSL_ATECC_DEBUG
printf("Failed allocating space for certBuffer\r\n"); printf("Failed allocating space for certBuffer\r\n");
@@ -947,7 +956,7 @@ static int atcatls_set_certificates(WOLFSSL_CTX *ctx)
} }
/* Read signer cert */ /* Read signer cert */
status = tng_atcacert_read_signer_cert(&certBuffer[deviceCertSize],\ status = tng_atcacert_read_signer_cert(&certBuffer[deviceCertSize],
&signerCertSize); &signerCertSize);
if (ATCA_SUCCESS != status) { if (ATCA_SUCCESS != status) {
#ifdef WOLFSSL_ATECC_DEBUG #ifdef WOLFSSL_ATECC_DEBUG