=head1 NAME
-SSL_set_session_secret_cb, tls_session_secret_cb_fn
-- set the session secret callback
+SSL_set_session_secret_cb, tls_session_secret_cb_fn,
+SSL_set_session_ticket_ext, SSL_set_session_ticket_ext_cb,
+tls_session_ticket_ext_cb_fn
+- set the session secret and EAP-FAST session ticket extension callbacks
=head1 SYNOPSIS
tls_session_secret_cb_fn session_secret_cb,
void *arg);
+ typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data,
+ int len, void *arg);
+
+ int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
+
+ int SSL_set_session_ticket_ext_cb(SSL *s,
+ tls_session_ticket_ext_cb_fn cb,
+ void *arg);
+
=head1 DESCRIPTION
SSL_set_session_secret_cb() sets the session secret callback to be used
The callback is also supplied with an additional argument in I<arg> which is the
argument that was provided to the original SSL_set_session_secret_cb() call.
+SSL_set_session_ticket_ext() is used on the client-side to set the session ticket
+extension data for EAP-FAST (RFC4851). The I<ext_data> argument is a pointer to
+the extension data, and I<ext_len> is the length of that data. I<ext_len> must
+be between 0 and 65535. If I<ext_data> is NULL, then the session ticket
+extension will not be sent.
+
+SSL_set_session_ticket_ext_cb() is used on the server-side to set a callback
+(I<cb>) that will be called when a session ticket extension is received. The
+callback is supplied with the extension data in I<data> and its length in
+I<len>, as well as the additional argument I<arg> that was provided when the
+callback was set.
+
=head1 RETURN VALUES
-SSL_set_session_secret_cb() returns 1 on success and 0 on failure.
+SSL_set_session_secret_cb(), SSL_set_session_ticket_ext(), and
+SSL_set_session_ticket_ext_cb() return 1 on success and 0 on failure.
+
+If the session secret callback returns 1 then this indicates it has successfully
+set the secret. A return value of 0 indicates that the secret has not been set.
+On the client this will cause an immediate abort of the handshake.
-If the callback returns 1 then this indicates it has successfully set the
-secret. A return value of 0 indicates that the secret has not been set. On the
-client this will cause an immediate abort of the handshake.
+The session ticket extension callback should return 1 for success. A return value
+of 0 indicates failure and will cause the handshake to abort immediately.
=head1 SEE ALSO
=head1 COPYRIGHT
-Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2024-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len)
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
-
- if (sc == NULL)
+ if (sc == NULL || ext_len < 0 || ext_len > 0xffff)
return 0;
-
- if (sc->version >= TLS1_VERSION) {
- OPENSSL_free(sc->ext.session_ticket);
- sc->ext.session_ticket = NULL;
+ OPENSSL_free(sc->ext.session_ticket);
+ if (ext_data != NULL) {
sc->ext.session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
if (sc->ext.session_ticket == NULL)
return 0;
-
- if (ext_data != NULL) {
- sc->ext.session_ticket->length = ext_len;
- sc->ext.session_ticket->data = sc->ext.session_ticket + 1;
- memcpy(sc->ext.session_ticket->data, ext_data, ext_len);
- } else {
- sc->ext.session_ticket->length = 0;
- sc->ext.session_ticket->data = NULL;
- }
-
- return 1;
+ sc->ext.session_ticket->length = ext_len;
+ sc->ext.session_ticket->data = sc->ext.session_ticket + 1;
+ memcpy(sc->ext.session_ticket->data, ext_data, ext_len);
+ } else {
+ sc->ext.session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT));
+ if (sc->ext.session_ticket == NULL)
+ return 0;
+ sc->ext.session_ticket->data = NULL;
+ sc->ext.session_ticket->length = 0;
}
-
- return 0;
+ return 1;
}
#ifndef OPENSSL_NO_DEPRECATED_3_4