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

# libressl-SSL\_SESSION\_new(3)

construct a new SSL\_SESSION object

## NAME

**SSL\_SESSION\_new**, **SSL\_SESSION\_dup** – construct a new SSL\_SESSION object

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

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

*SSL\_SESSION* *\**\

**SSL\_SESSION\_new**(*void*);

*SSL\_SESSION* *\**\

**SSL\_SESSION\_dup**(*const SSL\_SESSION \*src*);

## DESCRIPTION

**SSL\_SESSION\_new**() allocates and initializes a new *SSL\_SESSION* object. The reference count is set to 1, the time to the current time, and the timeout to five minutes.

When the object is no longer needed, it can be destructed with SSL\_SESSION\_free(3).

**SSL\_SESSION\_new**() is used internally, for example by SSL\_connect(3).

**SSL\_SESSION\_dup**() creates a deep copy of *src* with the exception that the reference count is set to 1, that the peer certificate is shared with *src*, and that the new session is not part of any session cache.

## RETURN VALUES

**SSL\_SESSION\_new**() and **SSL\_SESSION\_dup**() return the new *SSL\_SESSION* object or NULL if insufficient memory is available.

After failure, ERR\_get\_error(3) returns ERR\_R\_MALLOC\_FAILURE.

## SEE ALSO

d2i\_SSL\_SESSION(3), PEM\_read\_SSL\_SESSION(3), [ssl(3)](/ssl/3.md), SSL\_connect(3), SSL\_copy\_session\_id(3), SSL\_CTX\_add\_session(3), SSL\_CTX\_sess\_set\_get\_cb(3), SSL\_get\_session(3), SSL\_SESSION\_free(3), SSL\_SESSION\_get0\_peer(3), SSL\_SESSION\_get\_compress\_id(3), SSL\_SESSION\_get\_ex\_new\_index(3), SSL\_SESSION\_get\_id(3), SSL\_SESSION\_get\_master\_key(3), SSL\_SESSION\_get\_protocol\_version(3), SSL\_SESSION\_get\_time(3), SSL\_SESSION\_has\_ticket(3), SSL\_SESSION\_is\_resumable(3), SSL\_SESSION\_print(3), SSL\_SESSION\_set1\_id\_context(3), SSL\_set\_session(3)

## HISTORY

**SSL\_SESSION\_new**() first appeared in SSLeay 0.5.2 and has been available since OpenBSD 2.4.

**SSL\_SESSION\_dup**() first appeared in OpenSSL 1.1.1 and has been available since OpenBSD 7.9.
