Testing the EVP_PKEY_CTX_new_from_name without preliminary init

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18199)
This commit is contained in:
Dmitry Belyavskiy 2022-04-22 19:26:08 +02:00
parent e560655f72
commit 2d96bfd957
3 changed files with 22 additions and 2 deletions

View File

@ -37,7 +37,7 @@ IF[{- !$disabled{tests} -}]
sanitytest rsa_complex exdatatest bntest \ sanitytest rsa_complex exdatatest bntest \
ecstresstest gmdifftest pbelutest \ ecstresstest gmdifftest pbelutest \
destest mdc2test sha_test \ destest mdc2test sha_test \
exptest pbetest localetest \ exptest pbetest localetest evp_pkey_ctx_new_from_name\
evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \ evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
evp_fetch_prov_test evp_libctx_test ossl_store_test \ evp_fetch_prov_test evp_libctx_test ossl_store_test \
v3nametest v3ext \ v3nametest v3ext \
@ -140,6 +140,10 @@ IF[{- !$disabled{tests} -}]
INCLUDE[localetest]=../include ../apps/include INCLUDE[localetest]=../include ../apps/include
DEPEND[localetest]=../libcrypto libtestutil.a DEPEND[localetest]=../libcrypto libtestutil.a
SOURCE[evp_pkey_ctx_new_from_name]=evp_pkey_ctx_new_from_name.c
INCLUDE[evp_pkey_ctx_new_from_name]=../include ../apps/include
DEPEND[evp_pkey_ctx_new_from_name]=../libcrypto
SOURCE[pbetest]=pbetest.c SOURCE[pbetest]=pbetest.c
INCLUDE[pbetest]=../include ../apps/include INCLUDE[pbetest]=../include ../apps/include
DEPEND[pbetest]=../libcrypto libtestutil.a DEPEND[pbetest]=../libcrypto libtestutil.a

View File

@ -0,0 +1,14 @@
#include <stdio.h>
#include <openssl/ec.h>
#include <openssl/evp.h>
#include <openssl/err.h>
int main(int argc, char *argv[])
{
EVP_PKEY_CTX *pctx = NULL;
pctx = EVP_PKEY_CTX_new_from_name(NULL, "NO_SUCH_ALGORITHM", NULL);
EVP_PKEY_CTX_free(pctx);
return 0;
}

View File

@ -15,7 +15,9 @@ setup("locale tests");
plan skip_all => "Locale tests not available on Windows or VMS" plan skip_all => "Locale tests not available on Windows or VMS"
if $^O =~ /^(VMS|MSWin32)$/; if $^O =~ /^(VMS|MSWin32)$/;
plan tests => 2; plan tests => 3;
ok(run(test(["evp_pkey_ctx_new_from_name"])), "running evp_pkey_ctx_new_from_name without explicit context init");
$ENV{LANG} = "C"; $ENV{LANG} = "C";
ok(run(test(["localetest"])), "running localetest"); ok(run(test(["localetest"])), "running localetest");