1*2175Sjp161948=pod 2*2175Sjp161948 3*2175Sjp161948=head1 NAME 4*2175Sjp161948 5*2175Sjp161948BN_mod_inverse - compute inverse modulo n 6*2175Sjp161948 7*2175Sjp161948=head1 SYNOPSIS 8*2175Sjp161948 9*2175Sjp161948 #include <openssl/bn.h> 10*2175Sjp161948 11*2175Sjp161948 BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, 12*2175Sjp161948 BN_CTX *ctx); 13*2175Sjp161948 14*2175Sjp161948=head1 DESCRIPTION 15*2175Sjp161948 16*2175Sjp161948BN_mod_inverse() computes the inverse of B<a> modulo B<n> 17*2175Sjp161948places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, 18*2175Sjp161948a new B<BIGNUM> is created. 19*2175Sjp161948 20*2175Sjp161948B<ctx> is a previously allocated B<BN_CTX> used for temporary 21*2175Sjp161948variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>. 22*2175Sjp161948 23*2175Sjp161948=head1 RETURN VALUES 24*2175Sjp161948 25*2175Sjp161948BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and 26*2175Sjp161948NULL on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. 27*2175Sjp161948 28*2175Sjp161948=head1 SEE ALSO 29*2175Sjp161948 30*2175Sjp161948L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)> 31*2175Sjp161948 32*2175Sjp161948=head1 HISTORY 33*2175Sjp161948 34*2175Sjp161948BN_mod_inverse() is available in all versions of SSLeay and OpenSSL. 35*2175Sjp161948 36*2175Sjp161948=cut 37