From f53c7af916877bfacf5fb9c27fbe0bfd21ff713d Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Tue, 11 May 2021 08:35:31 +0100 Subject: [PATCH] PSA PAKE: introduce psa_pake_family_t It is the size of something that has no a priori reason to consist of 8 bits. This should be psa_pake_family_t, both for documentation (and possibly static analysis) and in case 8 bits turn out not to be enough. Signed-off-by: Janos Follath --- include/psa/crypto.h | 4 ++-- include/psa/crypto_struct.h | 6 +++--- include/psa/crypto_types.h | 9 +++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/psa/crypto.h b/include/psa/crypto.h index df8d4d4e9..970aea324 100644 --- a/include/psa/crypto.h +++ b/include/psa/crypto.h @@ -4222,7 +4222,7 @@ static void psa_pake_cs_set_type( * * \return The primitive family stored in the cipher suite structure. */ -static uint8_t psa_pake_cs_get_family( +static psa_pake_family_t psa_pake_cs_get_family( const psa_pake_cipher_suite_t* cipher_suite ); @@ -4246,7 +4246,7 @@ static uint8_t psa_pake_cs_get_family( */ static void psa_pake_cs_set_family( psa_pake_cipher_suite_t* cipher_suite, - uint8_t family + psa_pake_family_t family ); /** Retrieve the size associated with the primitive from a PAKE cipher suite. diff --git a/include/psa/crypto_struct.h b/include/psa/crypto_struct.h index 881abcb2a..97d5d2b41 100644 --- a/include/psa/crypto_struct.h +++ b/include/psa/crypto_struct.h @@ -465,7 +465,7 @@ struct psa_pake_cipher_suite_s { psa_algorithm_t algorithm; psa_pake_primitive_type_t type; - uint8_t family; + psa_pake_family_t family; size_t bits; psa_algorithm_t hash; }; @@ -499,7 +499,7 @@ static inline void psa_pake_cs_set_type( cipher_suite->type = type; } -static inline uint8_t psa_pake_cs_get_family( +static inline psa_pake_family_t psa_pake_cs_get_family( const psa_pake_cipher_suite_t *cipher_suite) { return( cipher_suite->family ); @@ -507,7 +507,7 @@ static inline uint8_t psa_pake_cs_get_family( static inline void psa_pake_cs_set_family( psa_pake_cipher_suite_t *cipher_suite, - uint8_t family) + psa_pake_family_t family) { cipher_suite->family = family; } diff --git a/include/psa/crypto_types.h b/include/psa/crypto_types.h index 7c560b3a5..09ff1c5ed 100644 --- a/include/psa/crypto_types.h +++ b/include/psa/crypto_types.h @@ -403,8 +403,17 @@ typedef uint8_t psa_pake_data_t; * * Values defined by this standard will never be in the range 0x80-0xff. * Vendors who define additional types must use an encoding in this range. + * + * For more information see the documentation of individual + * PSA_PAKE_PRIMITIVE_TYPE_XXX constants. */ typedef uint8_t psa_pake_primitive_type_t; +/** \brief Encoding of the family of the primitive associated with the PAKE. + * + * For more information see the documentation of individual + * PSA_PAKE_PRIMITIVE_TYPE_XXX constants. + */ +typedef uint8_t psa_pake_family_t; /**@}*/ #endif /* PSA_CRYPTO_TYPES_H */