]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Document the behavior of BN_generate_prime() on failure master
authorTomas Mraz <tomas@openssl.foundation>
Tue, 28 Jul 2026 14:23:01 +0000 (16:23 +0200)
committerTomas Mraz <tomas@openssl.foundation>
Mon, 10 Aug 2026 15:09:29 +0000 (17:09 +0200)
The ret argument is freed on failure which might be
surprising to callers.

Reported by: Minkyung Park (UNIST)

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
MergeDate: Mon Aug 10 15:09:34 2026
(Merged from https://github.com/openssl/openssl/pull/32099)

doc/man3/BN_generate_prime.pod

index 005c25fd7cc0a57e7d66970f0ab7449f8499a881..1a2bb5d7fe519c56d3bd702d250158acbadc907e 100644 (file)
@@ -201,6 +201,8 @@ BN_is_prime_fasttest() and BN_check_prime return 0 if the number is composite,
 -1 on error.
 
 BN_generate_prime() returns the prime number on success, B<NULL> otherwise.
+Please note that the B<ret> BIGNUM is freed on failure and must not be
+used or freed by the caller in such case.
 
 BN_GENCB_new returns a pointer to a BN_GENCB structure on success, or B<NULL>
 otherwise.