---
name: "libressl-BN_CTX_start"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-BN_CTX_start"
---

# libressl-BN\_CTX\_start(3)

use temporary BIGNUM variables

## NAME

**BN\_CTX\_start**, **BN\_CTX\_get**, **BN\_CTX\_end** – use temporary BIGNUM variables

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/bn.h\>**

*void*\

**BN\_CTX\_start**(*BN\_CTX \*ctx*);

*BIGNUM* *\**\

**BN\_CTX\_get**(*BN\_CTX \*ctx*);

*void*\

**BN\_CTX\_end**(*BN\_CTX \*ctx*);

## DESCRIPTION

These functions are used to obtain temporary *BIGNUM* variables from a *BN\_CTX* (which can be created using BN\_CTX\_new(3)) in order to save the overhead of repeatedly creating and freeing *BIGNUM*s in functions that are called from inside a loop.

A function must call **BN\_CTX\_start**() first. Then, **BN\_CTX\_get**() may be called repeatedly to obtain temporary *BIGNUM*s. All **BN\_CTX\_get**() calls must be made before calling any other functions that use the *ctx* as an argument.

Finally, **BN\_CTX\_end**() must be called before returning from the function. When **BN\_CTX\_end**() is called, the *BIGNUM* pointers obtained from **BN\_CTX\_get**() become invalid. If *ctx* is NULL, no action occurs.

## RETURN VALUES

**BN\_CTX\_get**() returns a pointer to the *BIGNUM*, or NULL on error. Once **BN\_CTX\_get**() has failed, the subsequent calls will return NULL as well, so it is sufficient to check the return value of the last **BN\_CTX\_get**() call. In case of an error, an error code is set which can be obtained by ERR\_get\_error(3).

## SEE ALSO

BN\_CTX\_new(3), BN\_new(3)

## HISTORY

**BN\_CTX\_start**(), **BN\_CTX\_get**(), and **BN\_CTX\_end**() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
