BN_mod_inverse(3) — Subroutines
NAME
BN_mod_inverse − Compute inverse modulo n
SYNOPSIS
#include <openssl/bn.h>
BIGNUM ∗BN_mod_inverse(
BIGNUM ∗r, BIGNUM ∗a, const BIGNUM ∗n, BN_CTX ∗ctx );
DESCRIPTION
The BN_mod_inverse() function computes the inverse of a modulo n and places the result in r ((a∗r)%n==1). If r is NULL, a new BIGNUM is created.
The ctx is a previously allocated BN_CTX used for temporary variables. The r value may be the same BIGNUM as a or n.
RETURN VALUES
The BN_mod_inverse() function returns the BIGNUM containing the inverse, and NULL on error. The error codes can be obtained by using ERR_get_error().
HISTORY
The BN_mod_inverse() function is available in all versions of SSLeay and OpenSSL.