Skip to content

Commit

Permalink
Testing the EVP_PKEY_CTX_new_from_name without preliminary init
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
(Merged from openssl#18175)
  • Loading branch information
beldmit authored and mattcaswell committed Apr 26, 2022
1 parent ac844f7 commit 1a68de8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion test/build.info
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ IF[{- !$disabled{tests} -}]
sanitytest rsa_complex exdatatest bntest \
ecstresstest gmdifftest pbelutest \
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_fetch_prov_test evp_libctx_test ossl_store_test \
v3nametest v3ext \
Expand Down Expand Up @@ -139,6 +139,10 @@ IF[{- !$disabled{tests} -}]
INCLUDE[localetest]=../include ../apps/include
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
INCLUDE[pbetest]=../include ../apps/include
DEPEND[pbetest]=../libcrypto libtestutil.a
Expand Down
14 changes: 14 additions & 0 deletions test/evp_pkey_ctx_new_from_name.c
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 3 additions & 1 deletion test/recipes/02-test_localetest.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ setup("locale tests");
plan skip_all => "Locale tests not available on Windows or VMS"
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";
ok(run(test(["localetest"])), "running localetest");
Expand Down

0 comments on commit 1a68de8

Please sign in to comment.