Add public API functions for setting TLSv1.3 PSK callbacks
authorMatt Caswell <matt@openssl.org>
Mon, 12 Jun 2017 14:59:00 +0000 (15:59 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 21 Jun 2017 13:45:35 +0000 (14:45 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3670)

include/openssl/ssl.h
ssl/ssl_lib.c
util/libssl.num

index 41edb38..9928781 100644 (file)
@@ -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,
index 4bcbfa8..bcb012f 100644 (file)
@@ -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,
index 4cf8227..e1c28d0 100644 (file)
@@ -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: