Add support for get_(bit)len on opaque keys

This commit is contained in:
Manuel Pégourié-Gonnard 2018-10-31 10:36:51 +01:00
parent 01a12c49aa
commit 0184b3c69b
2 changed files with 18 additions and 2 deletions

View file

@ -733,10 +733,21 @@ static void pk_psa_free_wrap( void *ctx )
mbedtls_free( ctx );
}
static size_t pk_psa_get_bitlen( const void *ctx )
{
const psa_key_slot_t *key = (const psa_key_slot_t *) ctx;
size_t bits;
if( PSA_SUCCESS != psa_get_key_information( *key, NULL, &bits ) )
return( 0 );
return( bits );
}
const mbedtls_pk_info_t mbedtls_pk_opaque_psa_info = {
MBEDTLS_PK_OPAQUE_PSA,
"Opaque (PSA)",
NULL, /* coming soon: bitlen */
pk_psa_get_bitlen,
NULL, /* coming soon: can_do */
NULL, /* verify - will be done later */
NULL, /* coming soon: sign */