]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
make generate_pkcs11_ec_key consistent with others
authorAydın Mercan <aydin@isc.org>
Tue, 13 Jan 2026 10:40:03 +0000 (13:40 +0300)
committerAydın Mercan <aydin@isc.org>
Mon, 2 Feb 2026 08:50:14 +0000 (11:50 +0300)
lib/isc/ossl_wrap/ossl3.c

index 1478e58683e023706f4748f334d687d4c3b912bf..b8da16e8e03086b7bd6c73bd7bea870b32f29ff9 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <stdbool.h>
+#include <string.h>
 
 #include <openssl/bn.h>
 #include <openssl/core_names.h>
@@ -183,13 +184,17 @@ static isc_result_t
 generate_pkcs11_ec_key(char *uri, EVP_PKEY **pkeyp, int nid) {
        isc_result_t result;
        EVP_PKEY_CTX *pctx;
-       OSSL_PARAM params[3];
+       size_t len;
+
+       INSIST(uri != NULL);
+       len = strlen(uri);
 
-       params[0] = OSSL_PARAM_construct_utf8_string("pkcs11_uri", uri, 0);
-       params[1] = OSSL_PARAM_construct_utf8_string(
-               "pkcs11_key_usage", pkcs11_key_usage,
-               sizeof(pkcs11_key_usage) - 1);
-       params[2] = OSSL_PARAM_construct_end();
+       const OSSL_PARAM params[] = {
+               OSSL_PARAM_utf8_string("pkcs11_uri", uri, len),
+               OSSL_PARAM_utf8_string("pkcs11_key_usage", pkcs11_key_usage,
+                                      sizeof(pkcs11_key_usage) - 1),
+               OSSL_PARAM_END,
+       };
 
        pctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", "provider=pkcs11");
        if (pctx == NULL) {