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