Scroll to navigation

SSL_SESSION_NEW(3) Library Functions Manual SSL_SESSION_NEW(3)

NAME

SSL_SESSION_new, SSL_SESSION_dupconstruct a new SSL_SESSION object

SYNOPSIS

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

SSL_SESSION *
SSL_SESSION_new(void);

SSL_SESSION *
SSL_SESSION_dup(const SSL_SESSION *src);

DESCRIPTION

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

() is used internally, for example by SSL_connect(3).

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

October 24, 2025 Linux 6.4.0-150700.53.55-default