mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-16 04:20:49 +00:00
Add overflow check for maximum key slot length
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
68a4b7453f
commit
0b2bd071f8
@ -111,6 +111,11 @@ MBEDTLS_STATIC_ASSERT(PSA_KEY_ID_VOLATILE_MAX < MBEDTLS_PSA_KEY_ID_BUILTIN_MIN |
|
||||
#error "Slice index does not fit in uint8_t for psa_key_slot_t::slice_index"
|
||||
#endif
|
||||
|
||||
MBEDTLS_STATIC_ASSERT((KEY_SLOT_VOLATILE_SLICE_BASE_LENGTH
|
||||
& (SIZE_MAX >> (KEY_SLOT_VOLATILE_SLICE_COUNT - 1)))
|
||||
== KEY_SLOT_VOLATILE_SLICE_BASE_LENGTH,
|
||||
"Maximum slice length overflows size_t");
|
||||
|
||||
|
||||
/* Calculate the volatile key id to use for a given slot.
|
||||
* This function assumes valid parameter values. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user