]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix uses of `EVP_PKEY_Q_keygen` with `size_t` variadic argument
authorArtSin <artsin666@gmail.com>
Mon, 4 Nov 2024 08:56:52 +0000 (12:56 +0400)
committerTomas Mraz <tomas@openssl.org>
Tue, 5 Nov 2024 12:49:08 +0000 (13:49 +0100)
Fix cases where `int` argument was passed instead of `size_t`.

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25857)

test/acvp_test.c
test/evp_libctx_test.c
test/pairwise_fail_test.c
test/threadstest.c

index 944c8c0e485cbbf82aef5aedae3b2f0eeac7f067..2bcc886fd29044b2d5f6922db9773aeceb7b4ec4 100644 (file)
@@ -1504,7 +1504,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, ""))
index 7e246efd800a845b07efcdfd3f64a0de861c68d2..9940599b50d5ab5f15d3f96092a5eef123b3fdec 100644 (file)
@@ -549,7 +549,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,
index 128ee92d5402be9b280ca67b9836d3e5ef137ae8..0e46aba2ad79dc31d6714c54ea69022f27e33b30 100644 (file)
@@ -96,7 +96,7 @@ static int test_keygen_pairwise_failure(void)
     if (strcmp(pairwise_name, "rsa") == 0) {
         if (!TEST_true(setup_selftest_pairwise_failure(type)))
             goto err;
-        if (!TEST_ptr_null(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", 2048)))
+        if (!TEST_ptr_null(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", (size_t)2048)))
             goto err;
     } else if (strncmp(pairwise_name, "ec", 2) == 0) {
         if (strcmp(pairwise_name, "eckat") == 0)
index 85d5e1149506ee5cb33bb003f8c0fda09c96c494..faa9e2728c5176633be9df00912f943b48e17fe2 100644 (file)
@@ -863,7 +863,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;