xref: /freebsd-src/crypto/openssl/doc/man3/BN_mod_inverse.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimBN_mod_inverse - compute inverse modulo n
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/bn.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n,
12*e71b7053SJung-uk Kim                        BN_CTX *ctx);
13*e71b7053SJung-uk Kim
14*e71b7053SJung-uk Kim=head1 DESCRIPTION
15*e71b7053SJung-uk Kim
16*e71b7053SJung-uk KimBN_mod_inverse() computes the inverse of B<a> modulo B<n>
17*e71b7053SJung-uk Kimplaces the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL,
18*e71b7053SJung-uk Kima new B<BIGNUM> is created.
19*e71b7053SJung-uk Kim
20*e71b7053SJung-uk KimB<ctx> is a previously allocated B<BN_CTX> used for temporary
21*e71b7053SJung-uk Kimvariables. B<r> may be the same B<BIGNUM> as B<a> or B<n>.
22*e71b7053SJung-uk Kim
23*e71b7053SJung-uk Kim=head1 RETURN VALUES
24*e71b7053SJung-uk Kim
25*e71b7053SJung-uk KimBN_mod_inverse() returns the B<BIGNUM> containing the inverse, and
26*e71b7053SJung-uk KimNULL on error. The error codes can be obtained by L<ERR_get_error(3)>.
27*e71b7053SJung-uk Kim
28*e71b7053SJung-uk Kim=head1 SEE ALSO
29*e71b7053SJung-uk Kim
30*e71b7053SJung-uk KimL<ERR_get_error(3)>, L<BN_add(3)>
31*e71b7053SJung-uk Kim
32*e71b7053SJung-uk Kim=head1 COPYRIGHT
33*e71b7053SJung-uk Kim
34*e71b7053SJung-uk KimCopyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
35*e71b7053SJung-uk Kim
36*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
37*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
38*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
39*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
40*e71b7053SJung-uk Kim
41*e71b7053SJung-uk Kim=cut
42