]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
kdf: remove max argument to the param concatenation helper
authorPauli <ppzgs1@gmail.com>
Tue, 1 Jul 2025 00:49:50 +0000 (10:49 +1000)
committerTomas Mraz <tomas@openssl.org>
Thu, 31 Jul 2025 18:20:48 +0000 (20:20 +0200)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27923)

crypto/params.c
include/internal/params.h
providers/implementations/kdfs/hkdf.c.in
providers/implementations/kdfs/kbkdf.c.in
providers/implementations/kdfs/sskdf.c.in

index 127fae205aa27e60d53b74c7584216b4b08eef66..ae40488765fdffb623f5bcfc0df190a11d2ed22d 100644 (file)
@@ -1624,8 +1624,7 @@ err:
 }
 
 int ossl_param_get1_concat_octet_string(size_t n, OSSL_PARAM *params[],
-                                        unsigned char **out,
-                                        size_t *out_len, size_t maxsize)
+                                        unsigned char **out, size_t *out_len)
 {
     unsigned char *res;
     size_t sz = 0;
@@ -1637,10 +1636,6 @@ int ossl_param_get1_concat_octet_string(size_t n, OSSL_PARAM *params[],
     if (!setbuf_fromparams(n, params, NULL, &sz))
         return 0;
 
-    /* Check that it's not oversized */
-    if (maxsize > 0 && sz > maxsize)
-        return 0;
-
     /* Special case zero length */
     if (sz == 0) {
         if ((res = OPENSSL_zalloc(1)) == NULL)
index c2a272ee9e0db1d23eceba29f5a158ee6a64c0ad..7f98a096133367922bbd01fa878bd952b50728d4 100644 (file)
@@ -38,5 +38,4 @@ int ossl_param_get1_octet_string(const OSSL_PARAM *params, const char *name,
  * doesn't return success.
  */
 int ossl_param_get1_concat_octet_string(size_t n, OSSL_PARAM *params[],
-                                        unsigned char **out,
-                                        size_t *out_len, size_t maxsize);
+                                        unsigned char **out, size_t *out_len);
index 93b4344c804ce006bd3b00e0949e29d3c3b35a94..e392f3d5c2da4118adf1000019db8811dea7a2d0 100644 (file)
@@ -380,7 +380,7 @@ static int kdf_hkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
         return 0;
 
     if (ossl_param_get1_concat_octet_string(p.num_info, p.info,
-                                            &ctx->info, &ctx->info_len, 0) == 0)
+                                            &ctx->info, &ctx->info_len) == 0)
         return 0;
 
 #ifdef FIPS_MODULE
index d3580612715043cc1c001f0c41c43021cef46214..e3f08acbcfd4054d026e0c06b388d02421075917 100644 (file)
@@ -445,7 +445,7 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
         return 0;
 
     if (ossl_param_get1_concat_octet_string(p.num_info, p.info, &ctx->context,
-                                            &ctx->context_len, 0) == 0)
+                                            &ctx->context_len) == 0)
         return 0;
 
     if (ossl_param_get1_octet_string_from_param(p.seed, &ctx->iv,
index c968f9e06f0432797c6d696541e5742cc9d426ba..b9545e2837d2e7474bb71a31cf1450c6791e677b 100644 (file)
@@ -595,7 +595,7 @@ static int sskdf_common_set_ctx_params
         return 0;
 
     if (ossl_param_get1_concat_octet_string(p->num_info, p->info, &ctx->info,
-                                            &ctx->info_len, 0) == 0)
+                                            &ctx->info_len) == 0)
         return 0;
 
     if (ossl_param_get1_octet_string_from_param(p->salt, &ctx->salt,