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 21*e0c4386eSCy Schubertvariables. B<r> may be the same B<BIGNUM> as B<a>. 22*e0c4386eSCy Schubert 23*e0c4386eSCy Schubert=head1 NOTES 24*e0c4386eSCy Schubert 25*e0c4386eSCy SchubertIt is an error to use the same B<BIGNUM> as B<n>. 26e71b7053SJung-uk Kim 27e71b7053SJung-uk Kim=head1 RETURN VALUES 28e71b7053SJung-uk Kim 29e71b7053SJung-uk KimBN_mod_inverse() returns the B<BIGNUM> containing the inverse, and 30e71b7053SJung-uk KimNULL on error. The error codes can be obtained by L<ERR_get_error(3)>. 31e71b7053SJung-uk Kim 32e71b7053SJung-uk Kim=head1 SEE ALSO 33e71b7053SJung-uk Kim 34e71b7053SJung-uk KimL<ERR_get_error(3)>, L<BN_add(3)> 35e71b7053SJung-uk Kim 36e71b7053SJung-uk Kim=head1 COPYRIGHT 37e71b7053SJung-uk Kim 38e71b7053SJung-uk KimCopyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. 39e71b7053SJung-uk Kim 40b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 41e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 42e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 43e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 44e71b7053SJung-uk Kim 45e71b7053SJung-uk Kim=cut 46