]> git.ipfire.org Git - thirdparty/openssl.git/commit
Refactor BN_mod() and BN_nnmod() arguments to match documentation
authorRichard Levitte <levitte@openssl.foundation>
Wed, 27 May 2026 07:45:17 +0000 (09:45 +0200)
committerNorbert Pocs <norbertp@openssl.org>
Fri, 29 May 2026 07:25:27 +0000 (09:25 +0200)
commitd3b4e88f2de4ea9cc101bef9a835fe1e9f01c494
treecb3127b68c94d67c0b10b09dc9bc59f9ceaf603e
parent50fa6d38b32880d16a5679cfb186a6a118401963
Refactor BN_mod() and BN_nnmod() arguments to match documentation

The documentation has this signature for that function:

    int BN_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
    int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);

The implementation, however, had this signature:

    #define BN_mod(rem, m, d, ctx) BN_div(NULL, (rem), (m), (d), (ctx))
    int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);

That pattern alone trips up anyone who associates 'm' with modulus, and
and finds themselves using BN_nnmod() incorrectly.

This change modifies the argument names to match documentation.

Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Igor Ustinov <igus@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri May 29 07:25:31 2026
(Merged from https://github.com/openssl/openssl/pull/31304)
crypto/bn/bn_mod.c
include/openssl/bn.h