1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos BN_mod_inverse - compute inverse modulo n 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos #include <openssl/bn.h> 10 1.1 christos 11 1.1 christos BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, 12 1.1 christos BN_CTX *ctx); 13 1.1 christos 14 1.1 christos =head1 DESCRIPTION 15 1.1 christos 16 1.1 christos BN_mod_inverse() computes the inverse of B<a> modulo B<n> 17 1.1 christos places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, 18 1.1 christos a new B<BIGNUM> is created. 19 1.1 christos 20 1.1 christos B<ctx> is a previously allocated B<BN_CTX> used for temporary 21 1.1.1.3 christos variables. B<r> may be the same B<BIGNUM> as B<a>. 22 1.1.1.3 christos 23 1.1.1.3 christos =head1 NOTES 24 1.1.1.3 christos 25 1.1.1.3 christos It is an error to use the same B<BIGNUM> as B<n>. 26 1.1 christos 27 1.1 christos =head1 RETURN VALUES 28 1.1 christos 29 1.1 christos BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and 30 1.1 christos NULL on error. The error codes can be obtained by L<ERR_get_error(3)>. 31 1.1 christos 32 1.1 christos =head1 SEE ALSO 33 1.1 christos 34 1.1 christos L<ERR_get_error(3)>, L<BN_add(3)> 35 1.1 christos 36 1.1 christos =head1 COPYRIGHT 37 1.1 christos 38 1.1 christos Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. 39 1.1 christos 40 1.1.1.2 christos Licensed under the Apache License 2.0 (the "License"). You may not use 41 1.1 christos this file except in compliance with the License. You can obtain a copy 42 1.1 christos in the file LICENSE in the source distribution or at 43 1.1 christos L<https://www.openssl.org/source/license.html>. 44 1.1 christos 45 1.1 christos =cut 46