summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto/bn
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-06-23 10:50:48 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-06-23 10:50:48 +0000
commit34d62a5261e51bd907abadf12d2b190e9a4aa668 (patch)
tree195b12e6148c0ecce9282f8cf6b7643ba62a0c51 /regress/lib/libcrypto/bn
parent82de47819c500693deedd64795781f7437361b2d (diff)
Codify BN_asc2bn(NULL, *) behavior in regress.
Diffstat (limited to 'regress/lib/libcrypto/bn')
-rw-r--r--regress/lib/libcrypto/bn/bn_convert.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/bn/bn_convert.c b/regress/lib/libcrypto/bn/bn_convert.c
index 147bb6839a5..69f7da43b1c 100644
--- a/regress/lib/libcrypto/bn/bn_convert.c
+++ b/regress/lib/libcrypto/bn/bn_convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_convert.c,v 1.2 2023/05/27 15:50:56 jsing Exp $ */
+/* $OpenBSD: bn_convert.c,v 1.3 2023/06/23 10:50:47 tb Exp $ */
/*
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
*
@@ -214,6 +214,16 @@ test_bn_asc2bn(void)
}
}
+ /*
+ * While it makes little sense to call BN_asc2bn() with a NULL bn,
+ * check for consistent behavior.
+ */
+ if (!BN_asc2bn(NULL, "1") || !BN_asc2bn(NULL, "-1") ||
+ !BN_asc2bn(NULL, "0x1") || !BN_asc2bn(NULL, "-0x1")) {
+ fprintf(stderr, "FAIL: BN_asc2bn() with NULL BIGNUM failed\n");
+ goto failure;
+ }
+
failed = 0;
failure: