mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-17 07:17:12 +00:00
Improve parameter checking in psa_export_public_key_iop_setup()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
parent
b30233f6c3
commit
84cc90f63a
@ -1714,18 +1714,23 @@ psa_status_t psa_export_public_key_iop_setup(psa_export_public_key_iop_t *operat
|
|||||||
}
|
}
|
||||||
|
|
||||||
private_key_attributes = slot->attr;
|
private_key_attributes = slot->attr;
|
||||||
if (status != PSA_SUCCESS) {
|
|
||||||
|
private_key_type = psa_get_key_type(&private_key_attributes);
|
||||||
|
|
||||||
|
if (!PSA_KEY_TYPE_IS_KEY_PAIR(private_key_type)) {
|
||||||
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private_key_type = psa_get_key_type(&private_key_attributes);
|
|
||||||
if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(private_key_type)) {
|
if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(private_key_type)) {
|
||||||
|
status = PSA_ERROR_NOT_SUPPORTED;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
key_size = PSA_EXPORT_KEY_OUTPUT_SIZE(private_key_type,
|
key_size = PSA_EXPORT_KEY_OUTPUT_SIZE(private_key_type,
|
||||||
psa_get_key_bits(&private_key_attributes));
|
psa_get_key_bits(&private_key_attributes));
|
||||||
if (key_size == 0) {
|
if (key_size == 0) {
|
||||||
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user