mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-10 06:44:28 +00:00
test_suite_pk: properly size buffers for public keys in pk_psa_sign()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
aa9cc49879
commit
f71c060cb2
@ -1822,8 +1822,13 @@ void pk_psa_sign(int psa_type, int bits, int rsa_padding)
|
||||
mbedtls_pk_context pk;
|
||||
unsigned char hash[32];
|
||||
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
|
||||
unsigned char legacy_pub_key[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE];
|
||||
unsigned char opaque_pub_key[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE];
|
||||
/* These buffers will be used to contain the key in DER format. Unfortunately
|
||||
* when only EC is supported on the PSA side (i.e. no RSA or DH)
|
||||
* PSA_EXPORT_PUBLIC_KEY_MAX_SIZE falls to PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(),
|
||||
* but this is not enough to contain the DER representation of the public key.
|
||||
* Therefore we pick the RSA size to be safe. */
|
||||
unsigned char legacy_pub_key[RSA_WRITE_PUBKEY_MAX_SIZE];
|
||||
unsigned char opaque_pub_key[RSA_WRITE_PUBKEY_MAX_SIZE];
|
||||
size_t sig_len, legacy_pub_key_len, opaque_pub_key_len;
|
||||
int ret;
|
||||
mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user