summaryrefslogtreecommitdiff
path: root/lib/libcrypto/man/BN_mod_inverse.3
blob: db63269fb855c9104b9ea944902b619ffd68c1ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.Dd $Mdocdate: February 23 2015 $
.Dt BN_MOD_INVERSE 3
.Os
.Sh NAME
.Nm BN_mod_inverse
.Nd compute inverse modulo n
.Sh SYNOPSIS
.In openssl/bn.h
.Ft BIGNUM *
.Fo BN_mod_inverse
.Fa "BIGNUM *r"
.Fa "BIGNUM *a"
.Fa "const BIGNUM *n"
.Fa "BN_CTX *ctx"
.Fc
.Sh DESCRIPTION
.Fn BN_mod_inverse
computes the inverse of
.Fa a
modulo
.Fa n
add places the result in
.Fa r
.Pq Li (a*r)%n==1 .
If
.Fa r
is
.Dv NULL ,
a new
.Vt BIGNUM
is created.
.Pp
.Fa ctx
is a previously allocated
.Vt BN_CTX
used for temporary variables.
.Fa r
may be the same
.Vt BIGNUM
as
.Fa a
or
.Fa n .
.Sh RETURN VALUES
.Fn BN_mod_inverse
returns the
.Vt BIGNUM
containing the inverse, or
.Dv NULL
on error.
The error codes can be obtained by
.Xr ERR_get_error 3 .
.Sh SEE ALSO
.Xr bn 3 ,
.Xr BN_add 3 ,
.Xr ERR_get_error 3
.Sh HISTORY
.Fn BN_mod_inverse
is available in all versions of SSLeay and OpenSSL.