Adding documentation to that fact as well.
Fixes #17070
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17074)
OSSL_PARAM_BLD_DEF *pd;
if (bn != NULL) {
+ if (BN_is_negative(bn)) {
+ ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_UNSUPPORTED,
+ "Negative big numbers are unsupported for OSSL_PARAM");
+ return 0;
+ }
+
n = BN_num_bytes(bn);
if (n < 0) {
ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_ZERO_LENGTH_NUMBER);
All of the OSSL_PARAM_BLD_push_TYPE functions return 1 on success and 0
on error.
+=head1 NOTES
+
+OSSL_PARAM_BLD_push_BN() and OSSL_PARAM_BLD_push_BN_pad() currently only
+support nonnegative B<BIGNUM>s. They return an error on negative B<BIGNUM>s.
+
=head1 EXAMPLES
Both examples creating an OSSL_PARAM array that contains an RSA key.