5 BN_mod_inverse - compute inverse modulo n
9 #include <openssl/bn.h>
11 BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n,
16 BN_mod_inverse() computes the inverse of B<a> modulo B<n>
17 places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL,
18 a new B<BIGNUM> is created.
20 B<ctx> is a previously allocated B<BN_CTX> used for temporary
21 variables. B<r> may be the same B<BIGNUM> as B<a>.
25 It is an error to use the same B<BIGNUM> as B<n>.
29 BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and
30 NULL on error. The error codes can be obtained by L<ERR_get_error(3)>.
34 L<ERR_get_error(3)>, L<BN_add(3)>
38 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
40 Licensed under the Apache License 2.0 (the "License"). You may not use
41 this file except in compliance with the License. You can obtain a copy
42 in the file LICENSE in the source distribution or at
43 L<https://www.openssl.org/source/license.html>.