Add PSA key in mbedtls_ssl_cookie_ctx
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
parent
052deb941f
commit
bca99ee0ac
2 changed files with 10 additions and 0 deletions
|
@ -53,6 +53,10 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
typedef struct mbedtls_ssl_cookie_ctx
|
typedef struct mbedtls_ssl_cookie_ctx
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
mbedtls_svc_key_id_t MBEDTLS_PRIVATE(psa_hmac); /*!< key id for the HMAC portion */
|
||||||
|
psa_algorithm_t MBEDTLS_PRIVATE(psa_hmac_alg); /*!< key algorithm for the HMAC portion */
|
||||||
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
mbedtls_md_context_t MBEDTLS_PRIVATE(hmac_ctx); /*!< context for the HMAC portion */
|
mbedtls_md_context_t MBEDTLS_PRIVATE(hmac_ctx); /*!< context for the HMAC portion */
|
||||||
#if !defined(MBEDTLS_HAVE_TIME)
|
#if !defined(MBEDTLS_HAVE_TIME)
|
||||||
unsigned long MBEDTLS_PRIVATE(serial); /*!< serial number for expiration */
|
unsigned long MBEDTLS_PRIVATE(serial); /*!< serial number for expiration */
|
||||||
|
|
|
@ -68,6 +68,9 @@
|
||||||
|
|
||||||
void mbedtls_ssl_cookie_init( mbedtls_ssl_cookie_ctx *ctx )
|
void mbedtls_ssl_cookie_init( mbedtls_ssl_cookie_ctx *ctx )
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
ctx->psa_hmac = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
mbedtls_md_init( &ctx->hmac_ctx );
|
mbedtls_md_init( &ctx->hmac_ctx );
|
||||||
#if !defined(MBEDTLS_HAVE_TIME)
|
#if !defined(MBEDTLS_HAVE_TIME)
|
||||||
ctx->serial = 0;
|
ctx->serial = 0;
|
||||||
|
@ -86,6 +89,9 @@ void mbedtls_ssl_cookie_set_timeout( mbedtls_ssl_cookie_ctx *ctx, unsigned long
|
||||||
|
|
||||||
void mbedtls_ssl_cookie_free( mbedtls_ssl_cookie_ctx *ctx )
|
void mbedtls_ssl_cookie_free( mbedtls_ssl_cookie_ctx *ctx )
|
||||||
{
|
{
|
||||||
|
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||||
|
psa_destroy_key( ctx->psa_hmac );
|
||||||
|
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
mbedtls_md_free( &ctx->hmac_ctx );
|
mbedtls_md_free( &ctx->hmac_ctx );
|
||||||
|
|
||||||
#if defined(MBEDTLS_THREADING_C)
|
#if defined(MBEDTLS_THREADING_C)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue