---
name: "libressl-SSL_read_early_data"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_read_early_data"
---

# libressl-SSL\_read\_early\_data(3)

transmit application data during the handshake

## NAME

**SSL\_CTX\_set\_max\_early\_data**, **SSL\_set\_max\_early\_data**, **SSL\_SESSION\_set\_max\_early\_data**, **SSL\_CTX\_get\_max\_early\_data**, **SSL\_get\_max\_early\_data**, **SSL\_SESSION\_get\_max\_early\_data**, **SSL\_write\_early\_data**, **SSL\_read\_early\_data**, **SSL\_get\_early\_data\_status** – transmit application data during the handshake

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#include \<openssl/ssl.h\>**

*int*\

**SSL\_CTX\_set\_max\_early\_data**(*SSL\_CTX \*ctx*, *uint32\_t max\_bytes*);

*int*\

**SSL\_set\_max\_early\_data**(*SSL \*ssl*, *uint32\_t max\_bytes*);

*int*\

**SSL\_SESSION\_set\_max\_early\_data**(*SSL\_SESSION \*session*, *uint32\_t max\_bytes*);

*uint32\_t*\

**SSL\_CTX\_get\_max\_early\_data**(*const SSL\_CTX \*ctx*);

*uint32\_t*\

**SSL\_get\_max\_early\_data**(*const SSL \*ssl*);

*uint32\_t*\

**SSL\_SESSION\_get\_max\_early\_data**(*const SSL\_SESSION \*session*);

*int*\

**SSL\_write\_early\_data**(*SSL \*ssl*, *const void \*buf*, *size\_t len*, *size\_t \*written*);

*int*\

**SSL\_read\_early\_data**(*SSL \*ssl*, *void \*buf*, *size\_t maxlen*, *size\_t \*readbytes*);

*int*\

**SSL\_get\_early\_data\_status**(*const SSL \*ssl*);

## DESCRIPTION

In LibreSSL, these functions have no effect. They are only provided because some application programs expect the API to be available when TLSv1.3 is supported. Using these functions is strongly discouraged because they provide marginal benefit in the first place even when implemented and used as designed, because they have absurdly complicated semantics, and because when they are used, inconspicuous oversights are likely to cause serious security vulnerabilities.

If these functions are used, other TLS implementations may allow the transfer of application data during the initial handshake. Even when used as designed, security of the connection is compromised; in particular, application data is exchanged with unauthenticated peers, and there is no forward secrecy. Other downsides include an increased risk of replay attacks.

**SSL\_CTX\_set\_max\_early\_data**(), **SSL\_set\_max\_early\_data**(), and **SSL\_SESSION\_set\_max\_early\_data**() are intended to configure the maximum number of bytes per session that can be transmitted during the handshake. With LibreSSL, all arguments are ignored.

An endpoint can attempt to send application data with **SSL\_write\_early\_data**() during the handshake. With LibreSSL, such attempts always fail and set \**written* to 0.

A server can attempt to read application data from the client using **SSL\_read\_early\_data**() during the handshake. With LibreSSL, no such data is ever accepted and \**readbytes* is always set to 0.

## RETURN VALUES

**SSL\_CTX\_set\_max\_early\_data**(), **SSL\_set\_max\_early\_data**(), and **SSL\_SESSION\_set\_max\_early\_data**() return 1 for success or 0 for failure. With LibreSSL, they always succeed.

**SSL\_CTX\_get\_max\_early\_data**(), **SSL\_get\_max\_early\_data**(), and **SSL\_SESSION\_get\_max\_early\_data**() return the maximum number of bytes of application data that will be accepted from the peer during the handshake. With LibreSSL, they always return 0.

**SSL\_write\_early\_data**() returns 1 for success or 0 for failure. With LibreSSL, it always fails.

With LibreSSL, **SSL\_read\_early\_data**() always returns SSL\_READ\_EARLY\_DATA\_FINISH on the server side and SSL\_READ\_EARLY\_DATA\_ERROR on the client side. SSL\_READ\_EARLY\_DATA\_SUCCESS can occur with other implementations, but not with LibreSSL.

With LibreSSL, **SSL\_get\_early\_data\_status**() always returns SSL\_EARLY\_DATA\_REJECTED. With other implementations, it might also return SSL\_EARLY\_DATA\_NOT\_SENT or SSL\_EARLY\_DATA\_ACCEPTED.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_read(3), SSL\_write(3)

## STANDARDS

RFC 9846: The Transport Layer Security (TLS) Protocol Version 1.3:

- Section 2.3

  0-RTT data

- Section 4.3.10

  Early Data Indication

- Section 8

  0-RTT and Anti-Replay

- Appendix F.5

  Replay Attacks on 0-RTT

## HISTORY

These functions first appeared in OpenSSL 1.1.1 and have been available since OpenBSD 7.0.
