1.Dd $Mdocdate: February 23 2015 $ 2.Dt BN_CTX_START 3 3.Os 4.Sh NAME 5.Nm BN_CTX_start , 6.Nm BN_CTX_get , 7.Nm BN_CTX_end 8.Nd use temporary BIGNUM variables 9.Sh SYNOPSIS 10.In openssl/bn.h 11.Ft void 12.Fo BN_CTX_start 13.Fa "BN_CTX *ctx" 14.Fc 15.Ft BIGNUM * 16.Fo BN_CTX_get 17.Fa "BN_CTX *ctx" 18.Fc 19.Ft void 20.Fo BN_CTX_end 21.Fa "BN_CTX *ctx" 22.Fc 23.Sh DESCRIPTION 24These functions are used to obtain temporary 25.Vt BIGNUM 26variables from a 27.Vt BN_CTX 28(which can been created by using 29.Xr BN_CTX_new 3 ) 30in order to save the overhead of repeatedly creating and freeing 31.Vt BIGNUM Ns s 32in functions that are called from inside a loop. 33.Pp 34A function must call 35.Fn BN_CTX_start 36first. 37Then, 38.Fn BN_CTX_get 39may be called repeatedly to obtain temporary 40.Vt BIGNUM Ns s. 41All 42.Fn BN_CTX_get 43calls must be made before calling any other functions that use the 44.Fa ctx 45as an argument. 46.Pp 47Finally, 48.Fn BN_CTX_end 49must be called before returning from the function. 50When 51.Fn BN_CTX_end 52is called, the 53.Vt BIGNUM 54pointers obtained from 55.Fn BN_CTX_get 56become invalid. 57.Sh RETURN VALUES 58.Fn BN_CTX_start 59and 60.Fn BN_CTX_end 61return no values. 62.Pp 63.Fn BN_CTX_get 64returns a pointer to the 65.Vt BIGNUM , 66or 67.Dv NULL 68on error. 69Once 70.Fn BN_CTX_get 71has failed, the subsequent calls will return 72.Dv NULL 73as well, so it is sufficient to check the return value of the last 74.Fn BN_CTX_get 75call. 76In case of an error, an error code is set, which can be obtained by 77.Xr ERR_get_error 3 . 78.Sh SEE ALSO 79.Xr BN_CTX_new 3 80.Sh HISTORY 81.Fn BN_CTX_start , 82.Fn BN_CTX_get , 83and 84.Fn BN_CTX_end 85were added in OpenSSL 0.9.5. 86