1*729b1800Sjsg.\" $OpenBSD: SSL_read_early_data.3,v 1.4 2021/11/26 13:48:22 jsg Exp $ 295069a65Sschwarze.\" content checked up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200 395069a65Sschwarze.\" 495069a65Sschwarze.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 595069a65Sschwarze.\" 695069a65Sschwarze.\" Permission to use, copy, modify, and distribute this software for any 795069a65Sschwarze.\" purpose with or without fee is hereby granted, provided that the above 895069a65Sschwarze.\" copyright notice and this permission notice appear in all copies. 995069a65Sschwarze.\" 1095069a65Sschwarze.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1195069a65Sschwarze.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1295069a65Sschwarze.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1395069a65Sschwarze.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1495069a65Sschwarze.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1595069a65Sschwarze.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1695069a65Sschwarze.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1795069a65Sschwarze.\" 18*729b1800Sjsg.Dd $Mdocdate: November 26 2021 $ 1995069a65Sschwarze.Dt SSL_READ_EARLY_DATA 3 2095069a65Sschwarze.Os 2195069a65Sschwarze.Sh NAME 2295069a65Sschwarze.Nm SSL_CTX_set_max_early_data , 2395069a65Sschwarze.Nm SSL_set_max_early_data , 2495069a65Sschwarze.Nm SSL_SESSION_set_max_early_data , 2595069a65Sschwarze.Nm SSL_CTX_get_max_early_data , 2695069a65Sschwarze.Nm SSL_get_max_early_data , 2795069a65Sschwarze.Nm SSL_SESSION_get_max_early_data , 2895069a65Sschwarze.Nm SSL_write_early_data , 2995069a65Sschwarze.Nm SSL_read_early_data , 3095069a65Sschwarze.Nm SSL_get_early_data_status 31180a9edcSschwarze.Nd transmit application data during the handshake 3295069a65Sschwarze.Sh SYNOPSIS 3395069a65Sschwarze.In openssl/ssl.h 3495069a65Sschwarze.Ft int 3595069a65Sschwarze.Fo SSL_CTX_set_max_early_data 3695069a65Sschwarze.Fa "SSL_CTX *ctx" 3795069a65Sschwarze.Fa "uint32_t max_bytes" 3895069a65Sschwarze.Fc 3995069a65Sschwarze.Ft int 4095069a65Sschwarze.Fo SSL_set_max_early_data 4195069a65Sschwarze.Fa "SSL *ssl" 4295069a65Sschwarze.Fa "uint32_t max_bytes" 4395069a65Sschwarze.Fc 4495069a65Sschwarze.Ft int 4595069a65Sschwarze.Fo SSL_SESSION_set_max_early_data 4695069a65Sschwarze.Fa "SSL_SESSION *session" 4795069a65Sschwarze.Fa "uint32_t max_bytes" 4895069a65Sschwarze.Fc 4995069a65Sschwarze.Ft uint32_t 5095069a65Sschwarze.Fo SSL_CTX_get_max_early_data 5195069a65Sschwarze.Fa "const SSL_CTX *ctx" 5295069a65Sschwarze.Fc 5395069a65Sschwarze.Ft uint32_t 5495069a65Sschwarze.Fo SSL_get_max_early_data 5595069a65Sschwarze.Fa "const SSL *ssl" 5695069a65Sschwarze.Fc 5795069a65Sschwarze.Ft uint32_t 5895069a65Sschwarze.Fo SSL_SESSION_get_max_early_data 5995069a65Sschwarze.Fa "const SSL_SESSION *session" 6095069a65Sschwarze.Fc 6195069a65Sschwarze.Ft int 6295069a65Sschwarze.Fo SSL_write_early_data 6395069a65Sschwarze.Fa "SSL *ssl" 6495069a65Sschwarze.Fa "const void *buf" 6595069a65Sschwarze.Fa "size_t len" 6695069a65Sschwarze.Fa "size_t *written" 6795069a65Sschwarze.Fc 6895069a65Sschwarze.Ft int 6995069a65Sschwarze.Fo SSL_read_early_data 7095069a65Sschwarze.Fa "SSL *ssl" 7195069a65Sschwarze.Fa "void *buf" 7295069a65Sschwarze.Fa "size_t maxlen" 7395069a65Sschwarze.Fa "size_t *readbytes" 7495069a65Sschwarze.Fc 7595069a65Sschwarze.Ft int 7695069a65Sschwarze.Fo SSL_get_early_data_status 7795069a65Sschwarze.Fa "const SSL *ssl" 7895069a65Sschwarze.Fc 7995069a65Sschwarze.Sh DESCRIPTION 8095069a65SschwarzeIn LibreSSL, these functions have no effect. 8195069a65SschwarzeThey are only provided because some application programs 8295069a65Sschwarzeexpect the API to be available when TLSv1.3 is supported. 8395069a65SschwarzeUsing these functions is strongly discouraged because they provide 8495069a65Sschwarzemarginal benefit in the first place even when implemented and 8595069a65Sschwarzeused as designed, because they have absurdly complicated semantics, 8695069a65Sschwarzeand because when they are used, inconspicuous oversights are likely 8795069a65Sschwarzeto cause serious security vulnerabilities. 8895069a65Sschwarze.Pp 8995069a65SschwarzeIf these functions are used, other TLS implementations 90*729b1800Sjsgmay allow the transfer of application data during the initial handshake. 9195069a65SschwarzeEven when used as designed, security of the connection is compromised; 9295069a65Sschwarzein particular, application data is exchanged with unauthenticated peers, 9395069a65Sschwarzeand there is no forward secrecy. 9495069a65SschwarzeOther downsides include an increased risk of replay attacks. 9595069a65Sschwarze.Pp 9695069a65Sschwarze.Fn SSL_CTX_set_max_early_data , 9795069a65Sschwarze.Fn SSL_set_max_early_data , 9895069a65Sschwarzeand 9995069a65Sschwarze.Fn SSL_SESSION_set_max_early_data 10095069a65Sschwarzeare intended to configure the maximum number of bytes per session 101180a9edcSschwarzethat can be transmitted during the handshake. 10295069a65SschwarzeWith LibreSSL, all arguments are ignored. 10395069a65Sschwarze.Pp 10495069a65SschwarzeAn endpoint can attempt to send application data with 10595069a65Sschwarze.Fn SSL_write_early_data 106180a9edcSschwarzeduring the handshake. 10795069a65SschwarzeWith LibreSSL, such attempts always fail and set 10895069a65Sschwarze.Pf * Fa written 10995069a65Sschwarzeto 0. 11095069a65Sschwarze.Pp 11195069a65SschwarzeA server can attempt to read application data from the client using 11295069a65Sschwarze.Fn SSL_read_early_data 113180a9edcSschwarzeduring the handshake. 11495069a65SschwarzeWith LibreSSL, no such data is ever accepted and 11595069a65Sschwarze.Pf * Fa readbytes 11695069a65Sschwarzeis always set to 0. 11795069a65Sschwarze.Sh RETURN VALUES 11895069a65Sschwarze.Fn SSL_CTX_set_max_early_data , 11995069a65Sschwarze.Fn SSL_set_max_early_data , 12095069a65Sschwarzeand 12195069a65Sschwarze.Fn SSL_SESSION_set_max_early_data 12295069a65Sschwarzereturn 1 for success or 0 for failure. 12395069a65SschwarzeWith LibreSSL, they always succeed. 12495069a65Sschwarze.Pp 12595069a65Sschwarze.Fn SSL_CTX_get_max_early_data , 12695069a65Sschwarze.Fn SSL_get_max_early_data , 12795069a65Sschwarzeand 12895069a65Sschwarze.Fn SSL_SESSION_get_max_early_data 12995069a65Sschwarzereturn the maximum number of bytes of application data 130180a9edcSschwarzethat will be accepted from the peer during the handshake. 13195069a65SschwarzeWith LibreSSL, they always return 0. 13295069a65Sschwarze.Pp 13395069a65Sschwarze.Fn SSL_write_early_data 13495069a65Sschwarzereturns 1 for success or 0 for failure. 13595069a65SschwarzeWith LibreSSL, it always fails. 13695069a65Sschwarze.Pp 13795069a65SschwarzeWith LibreSSL, 13895069a65Sschwarze.Fn SSL_read_early_data 13995069a65Sschwarzealways returns 14095069a65Sschwarze.Dv SSL_READ_EARLY_DATA_FINISH 14195069a65Sschwarzeon the server side and 14295069a65Sschwarze.Dv SSL_READ_EARLY_DATA_ERROR 14395069a65Sschwarzeon the client side. 14495069a65Sschwarze.Dv SSL_READ_EARLY_DATA_SUCCESS 14595069a65Sschwarzecan occur with other implementations, but not with LibreSSL. 14695069a65Sschwarze.Pp 14795069a65SschwarzeWith LibreSSL, 14895069a65Sschwarze.Fn SSL_get_early_data_status 14995069a65Sschwarzealways returns 15095069a65Sschwarze.Dv SSL_EARLY_DATA_REJECTED . 15195069a65SschwarzeWith other implementations, it might also return 15295069a65Sschwarze.Dv SSL_EARLY_DATA_NOT_SENT 15395069a65Sschwarzeor 15495069a65Sschwarze.Dv SSL_EARLY_DATA_ACCEPTED . 15595069a65Sschwarze.Sh SEE ALSO 15695069a65Sschwarze.Xr ssl 3 , 15795069a65Sschwarze.Xr SSL_read 3 , 15895069a65Sschwarze.Xr SSL_write 3 15995069a65Sschwarze.Sh STANDARDS 16095069a65SschwarzeRFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3: 16195069a65Sschwarze.Bl -tag -width "section 4.2.10" -compact 16295069a65Sschwarze.It Section 2.3 16395069a65Sschwarze0-RTT data 16495069a65Sschwarze.It Section 4.2.10 16595069a65SschwarzeEarly Data Indication 16695069a65Sschwarze.It Section 8 16795069a65Sschwarze0-RTT and Anti-Replay 16895069a65Sschwarze.It Appendix E.5 16995069a65SschwarzeReplay Attacks on 0-RTT 17095069a65Sschwarze.El 17195069a65Sschwarze.Sh HISTORY 17295069a65SschwarzeThese functions first appeared in OpenSSL 1.1.1 17395069a65Sschwarzeand have been available since 174c560a301Stb.Ox 7.0 . 175