---
name: "libressl-EVP_PKEY_CTX_new"
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-EVP_PKEY_CTX_new"
---

# libressl-EVP\_PKEY\_CTX\_new(3)

public key algorithm context functions

## NAME

**EVP\_PKEY\_CTX\_new**, **EVP\_PKEY\_CTX\_new\_id**, **EVP\_PKEY\_CTX\_dup**, **EVP\_PKEY\_CTX\_free** – public key algorithm context functions

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*EVP\_PKEY\_CTX* *\**\

**EVP\_PKEY\_CTX\_new**(*EVP\_PKEY \*pkey*, *ENGINE \*engine*);

*EVP\_PKEY\_CTX* *\**\

**EVP\_PKEY\_CTX\_new\_id**(*int id*, *ENGINE \*engine*);

*EVP\_PKEY\_CTX* *\**\

**EVP\_PKEY\_CTX\_dup**(*EVP\_PKEY\_CTX \*ctx*);

*void*\

**EVP\_PKEY\_CTX\_free**(*EVP\_PKEY\_CTX \*ctx*);

## DESCRIPTION

The **EVP\_PKEY\_CTX\_new**() function allocates a public key algorithm context using the algorithm specified in *pkey*. The *ENGINE*, *\*engine* argument is always ignored and passing NULL is recommended.

The **EVP\_PKEY\_CTX\_new\_id**() function allocates a public key algorithm context using the algorithm specified by *id*. The *ENGINE*, *\*engine* argument is always ignored and passing NULL is recommended. It is normally used when no *EVP\_PKEY* structure is associated with the operations, for example during parameter generation of key generation for some algorithms. The *id* argument can be any of the constants that EVP\_PKEY\_base\_id(3) and EVP\_PKEY\_id(3) may return.

**EVP\_PKEY\_CTX\_dup**() duplicates the context *ctx*.

**EVP\_PKEY\_CTX\_free**() frees up the context *ctx*. If *ctx* is a NULL pointer, no action occurs.

## RETURN VALUES

**EVP\_PKEY\_CTX\_new**(), **EVP\_PKEY\_CTX\_new\_id**(), and **EVP\_PKEY\_CTX\_dup**() return either the newly allocated *EVP\_PKEY\_CTX* structure or NULL if an error occurred.

## SEE ALSO

EVP\_DigestSignInit(3), EVP\_DigestVerifyInit(3), EVP\_PKEY\_base\_id(3), EVP\_PKEY\_CTX\_ctrl(3), EVP\_PKEY\_CTX\_get\_operation(3), EVP\_PKEY\_CTX\_hkdf\_mode(3), EVP\_PKEY\_decrypt(3), EVP\_PKEY\_derive(3), EVP\_PKEY\_encrypt(3), EVP\_PKEY\_keygen(3), EVP\_PKEY\_new(3), EVP\_PKEY\_sign(3), EVP\_PKEY\_verify(3), EVP\_PKEY\_verify\_recover(3), RSA\_pkey\_ctx\_ctrl(3), X25519(3)

## HISTORY

These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.

## CAVEATS

The *EVP\_PKEY\_CTX* structure is an opaque public key algorithm context used by the OpenSSL high level public key API. Contexts **MUST** **NOT** be shared between threads. It is not permissible to use the same context simultaneously in two threads.
