libressl-BN_mod_inverse - compute inverse modulo n


BN_MOD_INVERSE(3) Library Functions Manual BN_MOD_INVERSE(3)

NAME

BN_mod_inverse — compute inverse modulo n

SYNOPSIS

#include <openssl/bn.h>

BIGNUM *

BN_mod_inverse(BIGNUM *r, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);

DESCRIPTION

BN_mod_inverse() 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.

If the flag BN_FLG_CONSTTIME is set on a or n, it operates in constant time.

ctx is a previously allocated BN_CTX used for temporary variables. r may be the same BIGNUM as a or n.

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).

SEE ALSO

BN_add(3), BN_new(3), BN_set_flags(3)

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. GNU November 30, 2021 BN_MOD_INVERSE(3)


Updated 2024-01-29 - jenkler.se | uex.se