From 831063b1ab5248d7dc30e8046279530d5a7a1495 Mon Sep 17 00:00:00 2001 From: ArtSin Date: Mon, 4 Nov 2024 12:56:52 +0400 Subject: [PATCH] Fix uses of `EVP_PKEY_Q_keygen` with `size_t` variadic argument Fix cases where `int` argument was passed instead of `size_t`. CLA: trivial Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25857) (cherry picked from commit ccaa754b5f66cc50d8ecbac48b38268e2acd715e) --- test/acvp_test.c | 2 +- test/evp_libctx_test.c | 2 +- test/threadstest.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/acvp_test.c b/test/acvp_test.c index fee880d441b..eccf9d90a02 100644 --- a/test/acvp_test.c +++ b/test/acvp_test.c @@ -1251,7 +1251,7 @@ static int rsa_decryption_primitive_test(int id) BN_CTX *bn_ctx = NULL; const struct rsa_decrypt_prim_st *tst = &rsa_decrypt_prim_data[id]; - if (!TEST_ptr(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", 2048)) + if (!TEST_ptr(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", (size_t)2048)) || !TEST_true(pkey_get_bn_bytes(pkey, OSSL_PKEY_PARAM_RSA_N, &n, &n_len)) || !TEST_true(pkey_get_bn_bytes(pkey, OSSL_PKEY_PARAM_RSA_E, &e, &e_len)) || !TEST_ptr(ctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, "")) diff --git a/test/evp_libctx_test.c b/test/evp_libctx_test.c index 9fe2606b8a0..fd114a118cb 100644 --- a/test/evp_libctx_test.c +++ b/test/evp_libctx_test.c @@ -501,7 +501,7 @@ static int rsa_keygen(int bits, EVP_PKEY **pub, EVP_PKEY **priv) size_t len = 0; OSSL_ENCODER_CTX *ectx = NULL; - if (!TEST_ptr(*priv = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", bits)) + if (!TEST_ptr(*priv = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", (size_t)bits)) || !TEST_ptr(ectx = OSSL_ENCODER_CTX_new_for_pkey(*priv, EVP_PKEY_PUBLIC_KEY, diff --git a/test/threadstest.c b/test/threadstest.c index 289565c14b5..046a9eb8023 100644 --- a/test/threadstest.c +++ b/test/threadstest.c @@ -358,7 +358,7 @@ static void thread_general_worker(void) * Therefore we use an insecure bit length where we can (512). * In the FIPS module though we must use a longer length. */ - pkey = EVP_PKEY_Q_keygen(multi_libctx, NULL, "RSA", isfips ? 2048 : 512); + pkey = EVP_PKEY_Q_keygen(multi_libctx, NULL, "RSA", (size_t)(isfips ? 2048 : 512)); if (!TEST_ptr(pkey)) goto err; -- 2.47.2