SSL_SESSION_NEW(3) | Library Functions Manual | SSL_SESSION_NEW(3)

# NAME

`SSL_SESSION_new` — construct a new SSL_SESSION object

# SYNOPSIS

library “libssl” libcrypto
`#include <openssl/ssl.h>`

SSL_SESSION *
`SSL_SESSION_new`(void);

# 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).

# RETURN VALUES

`SSL_SESSION_new`() returns 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_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.

June 8, 2025 | Debian