From: Tomas Mraz Date: Tue, 28 Jul 2026 14:23:01 +0000 (+0200) Subject: Document the behavior of BN_generate_prime() on failure X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fopenssl.git Document the behavior of BN_generate_prime() on failure The ret argument is freed on failure which might be surprising to callers. Reported by: Minkyung Park (UNIST) Reviewed-by: Eugene Syromiatnikov Reviewed-by: Paul Yang MergeDate: Mon Aug 10 15:09:34 2026 (Merged from https://github.com/openssl/openssl/pull/32099) --- diff --git a/doc/man3/BN_generate_prime.pod b/doc/man3/BN_generate_prime.pod index 005c25fd7cc..1a2bb5d7fe5 100644 --- a/doc/man3/BN_generate_prime.pod +++ b/doc/man3/BN_generate_prime.pod @@ -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 otherwise. +Please note that the B 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 otherwise.