Skip to content

Commit 6cf1d1c

Browse files
author
Andrzej Kurek
committed
Remove redundant slot range checks
Cryptoauthlib will perform the checks instead and return ATCA_BAD_PARAM
1 parent 5b500ae commit 6cf1d1c

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

atecc608a_se.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ static psa_status_t atecc608a_generate_key(
246246
size_t bits = psa_get_key_bits(attributes);
247247

248248
(void) drv_context;
249-
/* The hardware has slots 0-15 */
250-
if (key_slot > 15) {
251-
return PSA_ERROR_INVALID_ARGUMENT;
252-
}
253249

254250
if (type != PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP256R1)) {
255251
return PSA_ERROR_NOT_SUPPORTED;
@@ -369,11 +365,6 @@ psa_status_t atecc608a_write(uint16_t slot, size_t offset, const uint8_t *data,
369365
{
370366
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
371367

372-
/* The hardware has slots 0-15 */
373-
if (slot > 15) {
374-
return PSA_ERROR_INVALID_ARGUMENT;
375-
}
376-
377368
ASSERT_SUCCESS_PSA(atecc608a_init());
378369
ASSERT_SUCCESS(atcab_write_bytes_zone(ATCA_ZONE_DATA, slot, offset, data, length));
379370

@@ -386,11 +377,6 @@ psa_status_t atecc608a_read(uint16_t slot, size_t offset, uint8_t *data, size_t
386377
{
387378
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
388379

389-
/* The hardware has slots 0-15 */
390-
if (slot > 15) {
391-
return PSA_ERROR_INVALID_ARGUMENT;
392-
}
393-
394380
ASSERT_SUCCESS_PSA(atecc608a_init());
395381
ASSERT_SUCCESS(atcab_read_bytes_zone(ATCA_ZONE_DATA, slot, offset, data, length));
396382

0 commit comments

Comments
 (0)