mirror of
https://github.com/espressif/mbedtls.git
synced 2026-10-23 09:18:11 +00:00
FFDH: improve sanity checks
- avoid grouping checks, for a better debugging experience (breakpoints) - use a more logical order, checking the key type first Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
This commit is contained in:
@@ -269,8 +269,11 @@ psa_status_t mbedtls_psa_ffdh_key_agreement(
|
||||
mbedtls_mpi P, X, GY, K;
|
||||
const size_t calculated_shared_secret_size = key_buffer_size;
|
||||
|
||||
if (peer_key_length != key_buffer_size ||
|
||||
!PSA_KEY_TYPE_IS_DH_KEY_PAIR(psa_get_key_type(attributes))) {
|
||||
if (!PSA_KEY_TYPE_IS_DH_KEY_PAIR(psa_get_key_type(attributes))) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (peer_key_length != key_buffer_size) {
|
||||
return PSA_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user