]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
doc: Clarify that BN_CTX must not be NULL for BN arithmetic functions
authorkovan <xaum.io@gmail.com>
Tue, 27 Jan 2026 05:16:06 +0000 (06:16 +0100)
committerNorbert Pocs <norbertp@openssl.org>
Wed, 15 Apr 2026 11:47:58 +0000 (13:47 +0200)
The documentation for BN_add and related functions did not explicitly
state that the ctx parameter cannot be NULL. Users may assume NULL is
acceptable since some other OpenSSL functions allow it, but passing
NULL to functions like BN_mod_add() or BN_mod() causes a crash.

Update the documentation to explicitly state that ctx must not be NULL.

Fixes #12092

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Apr 15 11:47:59 2026
(Merged from https://github.com/openssl/openssl/pull/29773)

doc/man3/BN_add.pod

index 46966d99637925b5eebca7ae952e7cb676e32031..edbc48c50f92bbfca893cdfae5d4a873084b58f1 100644 (file)
@@ -108,8 +108,10 @@ BN_gcd() computes the greatest common divisor of I<a> and I<b> and
 places the result in I<r>. I<r> may be the same B<BIGNUM> as I<a> or
 I<b>.
 
-For all functions, I<ctx> is a previously allocated B<BN_CTX> used for
-temporary variables; see L<BN_CTX_new(3)>.
+For all functions that take a I<ctx> parameter, it must be a previously
+allocated B<BN_CTX> used for temporary variables; see L<BN_CTX_new(3)>.
+Unless stated otherwise in the documentation for a specific function,
+the I<ctx> parameter must not be NULL.
 
 Unless noted otherwise, the result B<BIGNUM> must be different from
 the arguments.