diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 41edb380b8b9923531ef7e23f97e7253ae08ca4a..9928781f2f285f81848c684071633d1cda34cfe2 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -780,6 +780,13 @@ const char *SSL_get_psk_identity_hint(const SSL *s); const char *SSL_get_psk_identity(const SSL *s); # endif +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb); +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb); + /* Register callbacks to handle custom TLS Extensions for client or server. */ __owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 4bcbfa837714a4fe10cd7dcfcf65d70619d79738..bcb012f1072e54dc0d6fed78aa5b0720c6a3ff5a 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -636,6 +636,8 @@ SSL *SSL_new(SSL_CTX *ctx) s->psk_client_callback = ctx->psk_client_callback; s->psk_server_callback = ctx->psk_server_callback; #endif + s->psk_find_session_cb = ctx->psk_find_session_cb; + s->psk_use_session_cb = ctx->psk_use_session_cb; s->job = NULL; @@ -3858,6 +3860,28 @@ void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb) } #endif +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb) +{ + s->psk_find_session_cb = cb; +} + +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb) +{ + ctx->psk_find_session_cb = cb; +} + +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb) +{ + s->psk_use_session_cb = cb; +} + +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb) +{ + ctx->psk_use_session_cb = cb; +} + void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb) (int write_p, int version, int content_type, const void *buf, diff --git a/util/libssl.num b/util/libssl.num index 4cf8227b73e9cd7b52a99b5ccdeffda949d7d8e1..e1c28d00a9652f4fa364c164eb2f6d71e3962e84 100644 --- a/util/libssl.num +++ b/util/libssl.num @@ -451,3 +451,7 @@ SSL_set_record_padding_callback_arg 451 1_1_1 EXIST::FUNCTION: SSL_CTX_set_record_padding_callback_arg 452 1_1_1 EXIST::FUNCTION: SSL_CTX_use_serverinfo_ex 453 1_1_1 EXIST::FUNCTION: SSL_early_get1_extensions_present 454 1_1_1 EXIST::FUNCTION: +SSL_set_psk_find_session_callback 455 1_1_1 EXIST::FUNCTION: +SSL_set_psk_use_session_callback 456 1_1_1 EXIST::FUNCTION: +SSL_CTX_set_psk_use_session_callback 457 1_1_1 EXIST::FUNCTION: +SSL_CTX_set_psk_find_session_callback 458 1_1_1 EXIST::FUNCTION: