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).
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 316acbe..dfbb680 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -135,9 +135,7 @@
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