]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
hkdf: allow salt to be set to null
authorPauli <ppzgs1@gmail.com>
Wed, 9 Apr 2025 02:42:10 +0000 (12:42 +1000)
committerMatt Caswell <matt@openssl.org>
Fri, 18 Apr 2025 14:30:19 +0000 (15:30 +0100)
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27305)

(cherry picked from commit 12eb6c58ff2a8d857924b3020d30c8d485ace0a7)

providers/implementations/kdfs/hkdf.c

index c7454b00cffccb35c56e5c7481bb900f3bceb3e0..62e919c270c3c833242775f45a00d4514b075c32 100644 (file)
@@ -307,13 +307,11 @@ static int hkdf_common_set_ctx_params(KDF_HKDF *ctx, const OSSL_PARAM params[])
     }
 
     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL) {
-        if (p->data_size != 0 && p->data != NULL) {
-            OPENSSL_free(ctx->salt);
-            ctx->salt = NULL;
-            if (!OSSL_PARAM_get_octet_string(p, (void **)&ctx->salt, 0,
-                                             &ctx->salt_len))
-                return 0;
-        }
+        OPENSSL_free(ctx->salt);
+        ctx->salt = NULL;
+        if (!OSSL_PARAM_get_octet_string(p, (void **)&ctx->salt, 0,
+                                         &ctx->salt_len))
+            return 0;
     }
 
     return 1;