1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-12-24 17:41:01 +03:00

Change the bitwise encoding of key type categories

There were only 5 categories (now 4). Reduce the category mask from 7
bits to 3.

Combine unformatted, not-necessarily-uniform keys (HMAC, derivation)
with raw data.

Reintroduce a KEY_TYPE_IS_UNSTRUCTURED macro (which used to exist
under the name KEY_TYPE_IS_RAW_DATA macro) for key types that don't
have any structure, including both should-be-uniform keys (such as
block cipher and stream cipher keys) and not-necessarily-uniform
keys (such as HMAC keys and secrets for key derivation).
This commit is contained in:
Gilles Peskine
2018-08-10 16:03:41 +02:00
committed by Jaeden Amero
parent c32f0304db
commit 78b3bb670d
2 changed files with 56 additions and 30 deletions

View File

@@ -135,9 +135,7 @@ typedef struct
static int key_type_is_raw_bytes( psa_key_type_t type )
{
psa_key_type_t category = type & PSA_KEY_TYPE_CATEGORY_MASK;
return( category == PSA_KEY_TYPE_RAW_DATA ||
category == PSA_KEY_TYPE_CATEGORY_SYMMETRIC );
return( PSA_KEY_TYPE_IS_UNSTRUCTURED( type ) );
}
typedef struct