PSA PAKE: move the API to crypto_extra.h
At this point this is a proposed PAKE interface for the PSA Crypto API and not part of the official standard. Place the interface in crypto_extra.h to make this clear. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
304766e11e
commit
702cf09ae9
6 changed files with 1041 additions and 1043 deletions
|
@ -461,81 +461,6 @@ static inline size_t psa_get_key_bits(
|
|||
return( attributes->core.bits );
|
||||
}
|
||||
|
||||
struct psa_pake_cipher_suite_s
|
||||
{
|
||||
psa_algorithm_t algorithm;
|
||||
psa_pake_primitive_type_t type;
|
||||
psa_pake_family_t family;
|
||||
uint16_t bits;
|
||||
psa_algorithm_t hash;
|
||||
};
|
||||
|
||||
static inline psa_algorithm_t psa_pake_cs_get_algorithm(
|
||||
const psa_pake_cipher_suite_t *cipher_suite)
|
||||
{
|
||||
return( cipher_suite->algorithm );
|
||||
}
|
||||
|
||||
static inline void psa_pake_cs_set_algorithm(
|
||||
psa_pake_cipher_suite_t *cipher_suite,
|
||||
psa_algorithm_t algorithm)
|
||||
{
|
||||
if( !PSA_ALG_IS_PAKE(algorithm) )
|
||||
cipher_suite->algorithm = 0;
|
||||
else
|
||||
cipher_suite->algorithm = algorithm;
|
||||
}
|
||||
|
||||
static inline psa_pake_primitive_t psa_pake_cs_get_primitive(
|
||||
const psa_pake_cipher_suite_t *cipher_suite)
|
||||
{
|
||||
return( PSA_PAKE_PRIMITIVE( cipher_suite->type, cipher_suite->family,
|
||||
cipher_suite->bits) );
|
||||
}
|
||||
|
||||
static inline void psa_pake_cs_set_primitive(
|
||||
psa_pake_cipher_suite_t *cipher_suite,
|
||||
psa_pake_primitive_t primitive)
|
||||
{
|
||||
cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24);
|
||||
cipher_suite->family = (psa_pake_family_t) ( 0xFF & (primitive >> 16) );
|
||||
cipher_suite->bits = (uint16_t) ( 0xFFFF & primitive );
|
||||
}
|
||||
|
||||
static inline psa_algorithm_t psa_pake_cs_get_hash(
|
||||
const psa_pake_cipher_suite_t *cipher_suite)
|
||||
{
|
||||
return( cipher_suite->hash );
|
||||
}
|
||||
|
||||
static inline void psa_pake_cs_set_hash(
|
||||
psa_pake_cipher_suite_t *cipher_suite,
|
||||
psa_algorithm_t hash)
|
||||
{
|
||||
if( !PSA_ALG_IS_HASH(hash) )
|
||||
cipher_suite->hash = 0;
|
||||
else
|
||||
cipher_suite->hash = hash;
|
||||
}
|
||||
|
||||
struct psa_pake_operation_s
|
||||
{
|
||||
psa_algorithm_t alg;
|
||||
union
|
||||
{
|
||||
/* Make the union non-empty even with no supported algorithms. */
|
||||
uint8_t dummy;
|
||||
} ctx;
|
||||
};
|
||||
|
||||
/* This only zeroes out the first byte in the union, the rest is unspecified. */
|
||||
#define PSA_PAKE_OPERATION_INIT {0, {0}}
|
||||
static inline struct psa_pake_operation_s psa_pake_operation_init( void )
|
||||
{
|
||||
const struct psa_pake_operation_s v = PSA_PAKE_OPERATION_INIT;
|
||||
return( v );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue