summaryrefslogtreecommitdiffstats
path: root/test/asn1_internal_test.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-03-21 11:36:56 +0100
committerTomas Mraz <tomas@openssl.org>2023-03-23 15:33:47 +0100
commit908ba3ed9adbb3df90f7684a3111ca916a45202d (patch)
treed1776af33ea8dcccfd5ab0d87f5ac08c6f029820 /test/asn1_internal_test.c
parentf5935fcf8e4bc2191ac4a32e5b7ec32817642f1e (diff)
OBJ_nid2obj(): Return UNDEF object instead of NULL for NID_undef
Fixes a regression from 3.0 from the obj creation refactoring. Fixes #20555 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20556)
Diffstat (limited to 'test/asn1_internal_test.c')
-rw-r--r--test/asn1_internal_test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/asn1_internal_test.c b/test/asn1_internal_test.c
index d97ca92129..f91e21cb54 100644
--- a/test/asn1_internal_test.c
+++ b/test/asn1_internal_test.c
@@ -254,6 +254,16 @@ static int test_obj_create(void)
return 1;
}
+static int test_obj_nid_undef(void)
+{
+ if (!TEST_ptr(OBJ_nid2obj(NID_undef))
+ || !TEST_ptr(OBJ_nid2sn(NID_undef))
+ || !TEST_ptr(OBJ_nid2ln(NID_undef)))
+ return 0;
+
+ return 1;
+}
+
int setup_tests(void)
{
ADD_TEST(test_tbl_standard);
@@ -261,5 +271,6 @@ int setup_tests(void)
ADD_TEST(test_empty_nonoptional_content);
ADD_TEST(test_unicode_range);
ADD_TEST(test_obj_create);
+ ADD_TEST(test_obj_nid_undef);
return 1;
}