libmbedtls: Fix cipher_wrap.c for nist_kw
The *_ctx_clone() function is missing and therefore
the wrong function pointers are assigned to
.ctx_free_func when MBEDTLS_NIST_KW_C is enabled.
lib/libmbedtls/mbedtls/library/cipher_wrap.c:2248:5: warning:
initialization of ‘void (*)(void *, const void *)’ from incompatible
pointer type ‘void (*)(void *)’ [-Wincompatible-pointer-types]
2248 | kw_ctx_free,
^~~~~~~~~~~
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Signed-off-by: Valerii Chubar <valerii_chubar@epam.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/lib/libmbedtls/mbedtls/library/cipher_wrap.c b/lib/libmbedtls/mbedtls/library/cipher_wrap.c
index 4b9d356..f05fa15 100644
--- a/lib/libmbedtls/mbedtls/library/cipher_wrap.c
+++ b/lib/libmbedtls/mbedtls/library/cipher_wrap.c
@@ -2201,6 +2201,11 @@
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 );
@@ -2245,6 +2250,7 @@
kw_aes_setkey_wrap,
kw_aes_setkey_unwrap,
kw_ctx_alloc,
+ kw_ctx_clone,
kw_ctx_free,
};