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