From 23a3848bc1a71df07b287b04bc2f6ed7af1c1bbc Mon Sep 17 00:00:00 2001 From: tb <> Date: Fri, 23 Jun 2023 10:50:47 +0000 Subject: Codify BN_asc2bn(NULL, *) behavior in regress. --- src/regress/lib/libcrypto/bn/bn_convert.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/regress/lib/libcrypto/bn/bn_convert.c b/src/regress/lib/libcrypto/bn/bn_convert.c index 147bb6839a..69f7da43b1 100644 --- a/src/regress/lib/libcrypto/bn/bn_convert.c +++ b/src/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 * @@ -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: -- cgit v1.2.3-55-g6feb