BN_MOD_INVERSE(3)
π NAME π
okay so BN_mod_inverse β compute inverse modulo m. This is the BN_MOD_INVERSE(3) page from the libcrypto manual, and it's lowkey iconic because modular inverses are literally everywhere, bestie.
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/bn.h>
BIGNUM *
BN_mod_inverse(BIGNUM *r, const BIGNUM *a, const BIGNUM *m,
BN_CTX *ctx);
You're pulling this from libcrypto and including <openssl/bn.h>, periodt. π
π¦ DESCRIPTION π¦
BN_mod_inverse() computes the inverse of a modulo m and places the result in r, so that r satisfies a * r == 1 (mod m). If r is NULL, a new BIGNUM is allocated. Slay.
If the flag BN_FLG_CONSTTIME is set on a or m, it operates in constant time. No cap, that's the whole vibe.
ctx is a previously allocated BN_CTX used for temporary variables. r may be the same BIGNUM as a or m. Bestie, you can alias them β it's fine.
π RETURN VALUES π
BN_mod_inverse() returns the BIGNUM containing the inverse, or NULL on error. The error codes can be obtained by ERR_get_error(3). So if it ghosts you, that's where the receipts live.
πΈ SEE ALSO πΈ
π HISTORY π
BN_mod_inverse() first appeared in SSLeay 0.5.1 and has been available since OpenBSD 2.4.
The r argument was added in SSLeay 0.9.1 and OpenBSD 2.6. β¨ character development β¨
mwah π this page is brought to you by Debian, dated June 8, 2025 β BN_MOD_INVERSE(3) out π
π«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms