|
|
021e03 |
From 68f23e3725d9639f5b27d868fee291cabb516677 Mon Sep 17 00:00:00 2001
|
|
|
021e03 |
From: Dmitry Belyavskiy <beldmit@gmail.com>
|
|
|
021e03 |
Date: Fri, 22 Apr 2022 18:16:56 +0200
|
|
|
021e03 |
Subject: [PATCH 1/2] Ensure we initialized the locale before
|
|
|
021e03 |
evp_pkey_name2type
|
|
|
021e03 |
|
|
|
021e03 |
Fixes #18158
|
|
|
021e03 |
---
|
|
|
021e03 |
crypto/evp/pmeth_lib.c | 2 ++
|
|
|
021e03 |
1 file changed, 2 insertions(+)
|
|
|
021e03 |
|
|
|
021e03 |
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
|
|
|
021e03 |
index 2b9c6c2351da..92d25de44532 100644
|
|
|
021e03 |
--- a/crypto/evp/pmeth_lib.c
|
|
|
021e03 |
+++ b/crypto/evp/pmeth_lib.c
|
|
|
021e03 |
@@ -27,6 +27,7 @@
|
|
|
021e03 |
#ifndef FIPS_MODULE
|
|
|
021e03 |
# include "crypto/asn1.h"
|
|
|
021e03 |
#endif
|
|
|
021e03 |
+#include "crypto/ctype.h"
|
|
|
021e03 |
#include "crypto/evp.h"
|
|
|
021e03 |
#include "crypto/dh.h"
|
|
|
021e03 |
#include "crypto/ec.h"
|
|
|
021e03 |
@@ -199,6 +200,7 @@ static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx,
|
|
|
021e03 |
}
|
|
|
021e03 |
#ifndef FIPS_MODULE
|
|
|
021e03 |
if (keytype != NULL) {
|
|
|
021e03 |
+ ossl_init_casecmp();
|
|
|
021e03 |
id = evp_pkey_name2type(keytype);
|
|
|
021e03 |
if (id == NID_undef)
|
|
|
021e03 |
id = -1;
|
|
|
021e03 |
|
|
|
021e03 |
From 51c7b2d9c30b72aeb7e8eb69799dc039d5b23e58 Mon Sep 17 00:00:00 2001
|
|
|
021e03 |
From: Dmitry Belyavskiy <beldmit@gmail.com>
|
|
|
021e03 |
Date: Fri, 22 Apr 2022 19:26:08 +0200
|
|
|
021e03 |
Subject: [PATCH 2/2] Testing the EVP_PKEY_CTX_new_from_name without
|
|
|
021e03 |
preliminary init
|
|
|
021e03 |
|
|
|
021e03 |
---
|
|
|
021e03 |
test/build.info | 6 +++++-
|
|
|
021e03 |
test/evp_pkey_ctx_new_from_name.c | 14 ++++++++++++++
|
|
|
021e03 |
test/recipes/02-test_localetest.t | 4 +++-
|
|
|
021e03 |
3 files changed, 22 insertions(+), 2 deletions(-)
|
|
|
021e03 |
create mode 100644 test/evp_pkey_ctx_new_from_name.c
|
|
|
021e03 |
|
|
|
021e03 |
diff --git a/test/build.info b/test/build.info
|
|
|
021e03 |
index 14a84f00a258..ee059973d31a 100644
|
|
|
021e03 |
--- a/test/build.info
|
|
|
021e03 |
+++ b/test/build.info
|
|
|
021e03 |
@@ -37,7 +37,7 @@ IF[{- !$disabled{tests} -}]
|
|
|
021e03 |
sanitytest rsa_complex exdatatest bntest \
|
|
|
021e03 |
ecstresstest gmdifftest pbelutest \
|
|
|
021e03 |
destest mdc2test sha_test \
|
|
|
021e03 |
- exptest pbetest localetest \
|
|
|
021e03 |
+ exptest pbetest localetest evp_pkey_ctx_new_from_name\
|
|
|
021e03 |
evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
|
|
|
021e03 |
evp_fetch_prov_test evp_libctx_test ossl_store_test \
|
|
|
021e03 |
v3nametest v3ext \
|
|
|
021e03 |
@@ -139,6 +139,10 @@ IF[{- !$disabled{tests} -}]
|
|
|
021e03 |
INCLUDE[localetest]=../include ../apps/include
|
|
|
021e03 |
DEPEND[localetest]=../libcrypto libtestutil.a
|
|
|
021e03 |
|
|
|
021e03 |
+ SOURCE[evp_pkey_ctx_new_from_name]=evp_pkey_ctx_new_from_name.c
|
|
|
021e03 |
+ INCLUDE[evp_pkey_ctx_new_from_name]=../include ../apps/include
|
|
|
021e03 |
+ DEPEND[evp_pkey_ctx_new_from_name]=../libcrypto
|
|
|
021e03 |
+
|
|
|
021e03 |
SOURCE[pbetest]=pbetest.c
|
|
|
021e03 |
INCLUDE[pbetest]=../include ../apps/include
|
|
|
021e03 |
DEPEND[pbetest]=../libcrypto libtestutil.a
|
|
|
021e03 |
diff --git a/test/evp_pkey_ctx_new_from_name.c b/test/evp_pkey_ctx_new_from_name.c
|
|
|
021e03 |
new file mode 100644
|
|
|
021e03 |
index 000000000000..24063ea05ea5
|
|
|
021e03 |
--- /dev/null
|
|
|
021e03 |
+++ b/test/evp_pkey_ctx_new_from_name.c
|
|
|
021e03 |
@@ -0,0 +1,14 @@
|
|
|
021e03 |
+#include <stdio.h>
|
|
|
021e03 |
+#include <openssl/ec.h>
|
|
|
021e03 |
+#include <openssl/evp.h>
|
|
|
021e03 |
+#include <openssl/err.h>
|
|
|
021e03 |
+
|
|
|
021e03 |
+int main(int argc, char *argv[])
|
|
|
021e03 |
+{
|
|
|
021e03 |
+ EVP_PKEY_CTX *pctx = NULL;
|
|
|
021e03 |
+
|
|
|
021e03 |
+ pctx = EVP_PKEY_CTX_new_from_name(NULL, "NO_SUCH_ALGORITHM", NULL);
|
|
|
021e03 |
+ EVP_PKEY_CTX_free(pctx);
|
|
|
021e03 |
+
|
|
|
021e03 |
+ return 0;
|
|
|
021e03 |
+}
|
|
|
021e03 |
diff --git a/test/recipes/02-test_localetest.t b/test/recipes/02-test_localetest.t
|
|
|
021e03 |
index 1bccd57d4c63..77fba7d819ab 100644
|
|
|
021e03 |
--- a/test/recipes/02-test_localetest.t
|
|
|
021e03 |
+++ b/test/recipes/02-test_localetest.t
|
|
|
021e03 |
@@ -15,7 +15,9 @@ setup("locale tests");
|
|
|
021e03 |
plan skip_all => "Locale tests not available on Windows or VMS"
|
|
|
021e03 |
if $^O =~ /^(VMS|MSWin32)$/;
|
|
|
021e03 |
|
|
|
021e03 |
-plan tests => 2;
|
|
|
021e03 |
+plan tests => 3;
|
|
|
021e03 |
+
|
|
|
021e03 |
+ok(run(test(["evp_pkey_ctx_new_from_name"])), "running evp_pkey_ctx_new_from_name without explicit context init");
|
|
|
021e03 |
|
|
|
021e03 |
$ENV{LANG} = "C";
|
|
|
021e03 |
ok(run(test(["localetest"])), "running localetest");
|