From 45c4ff93c9674f59136b8999842322f7868d733d Mon Sep 17 00:00:00 2001 From: Raef Coles Date: Wed, 12 Oct 2022 15:22:48 +0100 Subject: [PATCH] Fix windows requiring explicit cast in LMS calloc Signed-off-by: Raef Coles --- library/lms.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/lms.c b/library/lms.c index 876deeb5c7..ccbcd8bffd 100644 --- a/library/lms.c +++ b/library/lms.c @@ -603,7 +603,9 @@ int mbedtls_lms_generate_private_key( mbedtls_lms_private_t *ctx, goto exit; } - ctx->ots_private_keys = mbedtls_calloc( MERKLE_TREE_LEAF_NODE_AM(ctx->params.type), + /* Requires a cast to size_t to avoid an implicit cast warning on certain + * platforms (particularly Windows) */ + ctx->ots_private_keys = mbedtls_calloc( ( size_t )MERKLE_TREE_LEAF_NODE_AM(ctx->params.type), sizeof( *ctx->ots_private_keys ) ); if( ctx->ots_private_keys == NULL ) { @@ -611,7 +613,9 @@ int mbedtls_lms_generate_private_key( mbedtls_lms_private_t *ctx, goto exit; } - ctx->ots_public_keys = mbedtls_calloc( MERKLE_TREE_LEAF_NODE_AM(ctx->params.type), + /* Requires a cast to size_t to avoid an implicit cast warning on certain + * platforms (particularly Windows) */ + ctx->ots_public_keys = mbedtls_calloc( ( size_t )MERKLE_TREE_LEAF_NODE_AM(ctx->params.type), sizeof( *ctx->ots_public_keys ) ); if( ctx->ots_public_keys == NULL ) {