Skip to content

Commit

Permalink
libmbedtls: fix cipher_wrap.c for NIST AES Key Wrap mode
Browse files Browse the repository at this point in the history
For AES Key Wrap mode, the *_ctx_clone() function is missing and
therefore the wrong function pointers are assigned to .ctx_clone_func
and .ctx_free_func when MBEDTLS_NIST_KW_C is enabled.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-By: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jenswi-linaro committed Oct 6, 2023
1 parent ad67ef0 commit 6956420
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/libmbedtls/mbedtls/library/cipher_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,11 @@ static void *kw_ctx_alloc(void)
return ctx;
}

static void kw_ctx_clone(void *dst, const void *src)
{
memcpy(dst, src, sizeof(mbedtls_nist_kw_context));
}

static void kw_ctx_free(void *ctx)
{
mbedtls_nist_kw_free(ctx);
Expand Down Expand Up @@ -2115,6 +2120,7 @@ static const mbedtls_cipher_base_t kw_aes_info = {
kw_aes_setkey_wrap,
kw_aes_setkey_unwrap,
kw_ctx_alloc,
kw_ctx_clone,
kw_ctx_free,
};

Expand Down

0 comments on commit 6956420

Please sign in to comment.