Skip to content

Commit d099394

Browse files
author
Andrzej Kurek
committed
Use the driver version of private key generation
1 parent 3a7353e commit d099394

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

atecc608a_utils.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,3 @@ psa_status_t atecc608a_check_config_locked()
6161
}
6262
return status;
6363
}
64-
65-
psa_status_t atecc608a_generate_key(uint16_t slot, uint8_t *pubkey, size_t pubkey_size)
66-
{
67-
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
68-
if (pubkey != NULL && pubkey_size < ATCA_PUB_KEY_SIZE)
69-
{
70-
return PSA_ERROR_BUFFER_TOO_SMALL;
71-
}
72-
73-
ASSERT_SUCCESS_PSA(atecc608a_init());
74-
ASSERT_SUCCESS(atcab_genkey(slot, pubkey));
75-
76-
exit:
77-
atecc608a_deinit();
78-
return status;
79-
}

atecc608a_utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,4 @@ psa_status_t atecc608a_get_serial_number(uint8_t *buffer, size_t buffer_size,
6161

6262
psa_status_t atecc608a_check_config_locked();
6363

64-
psa_status_t atecc608a_generate_key(uint16_t slot, uint8_t *pubkey, size_t pubkey_size);
65-
6664
#endif /* ATECC608A_SE_H */

main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ int main(void)
147147

148148
atecc608a_print_serial_number();
149149
atecc608a_print_config_zone();
150-
ASSERT_SUCCESS_PSA(atecc608a_generate_key(atecc608a_key_slot_device, pubkey, pubkey_size));
150+
151+
ASSERT_SUCCESS_PSA(atecc608a_drv_info.p_key_management->p_generate(
152+
atecc608a_key_slot_device, keypair_type,
153+
PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY,
154+
key_bits, NULL, 0, pubkey, pubkey_size, &pubkey_len));
155+
151156
atcab_printbin_label("pubKey generated: ", pubkey, ATCA_PUB_KEY_SIZE);
152157

153158
ASSERT_SUCCESS_PSA(atecc608a_hash_sha256(hash_input1,

0 commit comments

Comments
 (0)