[openssl/openssl] d3b4e8: Refactor BN_mod() and BN_nnmod() arguments to matc...

0 views
Skip to first unread message

Richard Levitte

unread,
May 29, 2026, 3:26:45 AM (yesterday) May 29
to openssl...@openssl.org
Branch: refs/heads/master
Home: https://github.com/openssl/openssl
Commit: d3b4e88f2de4ea9cc101bef9a835fe1e9f01c494
https://github.com/openssl/openssl/commit/d3b4e88f2de4ea9cc101bef9a835fe1e9f01c494
Author: Richard Levitte <lev...@openssl.foundation>
Date: 2026-05-29 (Fri, 29 May 2026)

Changed paths:
M crypto/bn/bn_mod.c
M include/openssl/bn.h

Log Message:
-----------
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 <ma...@openssl.foundation>
Reviewed-by: Tomas Mraz <to...@openssl.foundation>
Reviewed-by: Igor Ustinov <ig...@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
MergeDate: Fri May 29 07:25:31 2026
(Merged from https://github.com/openssl/openssl/pull/31304)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
Reply all
Reply to author
Forward
0 new messages