pkwrite: fix internal buffer size in pk_write_ec_pubkey()

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-08-10 07:40:18 +02:00
parent 0f6d565d26
commit e1d7c9dabd

View File

@ -165,7 +165,7 @@ static int pk_write_ec_pubkey(unsigned char **p, unsigned char *start,
const mbedtls_pk_context *pk) const mbedtls_pk_context *pk)
{ {
size_t len = 0; size_t len = 0;
uint8_t buf[PSA_EXPORT_KEY_PAIR_MAX_SIZE]; uint8_t buf[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE];
if (mbedtls_pk_get_type(pk) == MBEDTLS_PK_OPAQUE) { if (mbedtls_pk_get_type(pk) == MBEDTLS_PK_OPAQUE) {
if (psa_export_public_key(pk->priv_id, buf, sizeof(buf), &len) != PSA_SUCCESS) { if (psa_export_public_key(pk->priv_id, buf, sizeof(buf), &len) != PSA_SUCCESS) {