]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove unnecessary caps in key/iv initialization loops
authorOwenSanzas <zesheng@tamu.edu>
Tue, 10 Mar 2026 09:31:54 +0000 (09:31 +0000)
committerNeil Horman <nhorman@openssl.org>
Wed, 11 Mar 2026 20:58:36 +0000 (16:58 -0400)
Drop the `&& i < 16` and `&& i < 8` guards that were carried over from
the original fixed-size arrays. The loops now fill the entire
heap-allocated buffer, with values wrapping naturally via unsigned char.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
MergeDate: Wed Mar 11 20:58:49 2026
(Merged from https://github.com/openssl/openssl/pull/30331)

fuzz/provider.c

index 623c54b2b7ad0c49268ec4b47f5c4de3871cda8f..1b67cfd77481c9cd5adfa8bd9b4cf6f4bf3deec0 100644 (file)
@@ -479,9 +479,9 @@ static int do_evp_cipher(const EVP_CIPHER *evp_cipher, const OSSL_PARAM param[])
     iv = OPENSSL_zalloc(iv_len);
     if (key == NULL || iv == NULL)
         goto err;
-    for (i = 0; i < key_len && i < 16; i++)
+    for (i = 0; i < key_len; i++)
         key[i] = (unsigned char)i;
-    for (i = 0; i < iv_len && i < 8; i++)
+    for (i = 0; i < iv_len; i++)
         iv[i] = (unsigned char)(i + 1);
 
     ctx = EVP_CIPHER_CTX_new();