Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ jobs:
- target: minimized
compiler: gcc
host_os: ubuntu-26.04
- target: no_dtls13
compiler: gcc
host_os: ubuntu-26.04
- target: no_tls12
compiler: gcc
host_os: ubuntu-26.04
Expand Down Expand Up @@ -356,7 +359,7 @@ jobs:
repository: ${{ env.BORINGSSL_REPO }}
ref: ${{ env.BORINGSSL_BRANCH }}
path: ./boringssl
if: matrix.target == 'no_tls12' || matrix.target == 'no_tls13'
if: matrix.target == 'no_dtls13' || matrix.target == 'no_tls12' || matrix.target == 'no_tls13'

- name: Setup Build Agent
uses: ./source/.github/actions/setup-build-agent
Expand Down
101 changes: 70 additions & 31 deletions doc/api_ref/tls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Transport Layer Security (TLS)
Botan has client and server implementations of TLS 1.2 and 1.3. Support for
older versions of the protocol was removed with Botan 3.0.

There is also support for DTLS (currently v1.2 only), a variant of TLS
There is also support for DTLS 1.2 and 1.3 (experimental), a variant of TLS
adapted for operation on datagram transports such as UDP and
SCTP. DTLS support should be considered as beta quality and further
testing is invited.
Expand Down Expand Up @@ -212,16 +212,18 @@ additional information about the connection.
std::function<void()> op)

..
TODO(Botan4): When timeout_check is removed, this becomes _required_ for DTLS.
TODO(Botan4): When timeout_check is removed, this becomes _required_
for DTLS 1.2 as well.

Optional, but recommended for DTLS. This callback is used to schedule a
deferred operation to be invoked after a specified number of milliseconds.
This is used by DTLS to schedule retransmissions of handshake messages that
are considered lost in transit.
Optional, but recommended for DTLS 1.2 and required for DTLS 1.3. This
callback is used to schedule a deferred operation to be invoked after a
specified number of milliseconds. This is used by DTLS to schedule
retransmissions of handshake messages that are considered lost in transit.

If this is not used, the application must call ``Channel::timeout_check()``
independently and regularly whenever a DTLS handshake is in progress. In
contrast, if it is implemented by the application, make sure to never call
independently and regularly whenever a DTLS 1.2 handshake is in progress.
DTLS 1.3 cannot work without this callback. In contrast, if it is
implemented by the application, make sure to never call
``Channel::timeout_check()`` directly.

The TLS implementation is not re-entrant. The ``op`` must be invoked in a
Expand All @@ -230,7 +232,9 @@ additional information about the connection.

Invoking ``op`` might throw an exception. Typically this indicates that the
maximum number of retransmission attempts has been reached (see also
``Policy::dtls_maximum_retransmissions()``) and the association is being
``Policy::dtls_maximum_retransmissions()``), or that the interaction did
not make progress within the flight timeout (see also
``Policy::dtls_flight_timeout()``), and the association is being
abandoned.

During an invocation of ``op`` the DTLS implementation might call
Expand Down Expand Up @@ -312,13 +316,15 @@ available:
Returns the remaining time until a call to ``timeout_check`` might
retransmit DTLS handshake data. A zero duration means that a
retransmission is due. If ``std::nullopt`` is returned, no timeout check
is currently needed.
is currently needed. For DTLS 1.3, this reports the deadlines of the
internal timers (retransmissions, ACK, flight timeout).

.. note::

This method is deprecated and will be removed in Botan 4.
For DTLS 1.3 this will always return std::nullopt because a call to
``timeout_check`` won't work for it anyway.
DTLS 1.3 handles its timers exclusively via
``Callbacks::tls_register_deferred_operation``; calling
``timeout_check`` on a DTLS 1.3 channel will throw.

.. cpp:function:: bool is_closed()

Expand All @@ -339,7 +345,7 @@ available:

.. cpp:function:: bool timeout_check()

This function does nothing unless the channel represents a DTLS
This function does nothing unless the channel represents a DTLS 1.2
connection with a handshake in progress. Returns true if a timeout
condition occurred and handshake packets were retransmitted.

Expand Down Expand Up @@ -384,6 +390,10 @@ available:
the same key. Applications only need to call this method to force a
key update at a specific point in time.

On a DTLS 1.3 channel, this method might throw ``Invalid_State`` when
there is a pending key update that was not acknowledged by the peer yet.
In that case, the application should retry the request after some time.

Note that this is a TLS 1.3 feature and invocations on a channel
using TLS 1.2 will throw.

Expand Down Expand Up @@ -522,21 +532,40 @@ TLS Servers
size_t reserved_io_buffer_size = 16*1024 \
)

The first 5 arguments as well as the final argument
*reserved_io_buffer_size*, are treated similarly to the :ref:`client
<tls_client>`.
The first 5 arguments as well as the final argument
*reserved_io_buffer_size*, are treated similarly to the :ref:`client
<tls_client>`.

If a client sends the ALPN extension, the ``callbacks`` function
``tls_server_choose_app_protocol`` will be called and the result
sent back to the client. If the empty string is returned, the server
will not send an ALPN response. The function can also throw an exception
to abort the handshake entirely, the ALPN specification says that if this
occurs the alert should be of type `NO_APPLICATION_PROTOCOL`.

The optional argument *is_datagram* specifies if this is a TLS or DTLS
server; unlike clients, which know what type of protocol (TLS vs DTLS)
they are negotiating from the start via the *offer_version*, servers
would not until they actually received a client hello.

.. cpp:function:: size_t send_new_session_tickets(size_t tickets)

Allows sending new session tickets to the client at any time after the
handshake has completed. The *tickets* parameter specifies how many
tickets to send. The return value is the number of tickets actually sent.

Note that this is supported on (D)TLS 1.3 channels only, other channels
will always return 0. See also ``new_session_ticket_supported()``

If a client sends the ALPN extension, the ``callbacks`` function
``tls_server_choose_app_protocol`` will be called and the result
sent back to the client. If the empty string is returned, the server
will not send an ALPN response. The function can also throw an exception
to abort the handshake entirely, the ALPN specification says that if this
occurs the alert should be of type `NO_APPLICATION_PROTOCOL`.
On a DTLS 1.3 channel, this method might throw ``Invalid_State`` when
there is a pending key update that was not acknowledged by the peer yet.
In that case, the application should retry the request after some time.

The optional argument *is_datagram* specifies if this is a TLS or DTLS
server; unlike clients, which know what type of protocol (TLS vs DTLS)
they are negotiating from the start via the *offer_version*, servers
would not until they actually received a client hello.
.. cpp:function:: bool new_session_ticket_supported() const

Returns true if the channel supports sending new session tickets to the
client. This is true for (D)TLS 1.3 servers whose client offered any
PSK-based key exchange methods.

.. _tls_server_example:

Expand Down Expand Up @@ -935,7 +964,8 @@ policy settings from a file.
Return true if this version of the protocol is one that we are
willing to negotiate.

Default: Accepts TLS v1.2 and DTLS v1.2, and rejects all older versions.
Default: Accepts TLS v1.2/v1.3 and DTLS v1.2/DTLS v1.3 (experimental), and
rejects all older versions.

.. cpp:function:: bool server_uses_own_ciphersuite_preferences() const

Expand Down Expand Up @@ -1026,6 +1056,14 @@ policy settings from a file.

Return true from here to allow TLS v1.3. Returns ``true`` by default.

.. cpp:function:: bool allow_dtls12() const

Return true from here to allow DTLS v1.2. Returns ``true`` by default.

.. cpp:function:: bool allow_dtls13() const

Return true from here to allow DTLS v1.3. Returns ``true`` by default.

.. cpp:function:: size_t minimum_rsa_bits() const

Minimum accepted RSA key size. Default 2048 bits.
Expand Down Expand Up @@ -1207,7 +1245,8 @@ The ``TLS::Protocol_Version`` class represents a specific version:

.. cpp:enum:: Version_Code

``TLS_V10``, ``TLS_V11``, ``TLS_V12``, ``DTLS_V10``, ``DTLS_V12``
``TLS_V10``, ``TLS_V11``, ``TLS_V12``, ``TLS_V13``, ``DTLS_V10``,
``DTLS_V12``, ``DTLS_V13``

.. cpp:function:: Protocol_Version(Version_Code named_version)

Expand All @@ -1224,17 +1263,17 @@ The ``TLS::Protocol_Version`` class represents a specific version:
.. cpp:function:: std::string to_string() const

Returns string description of the version, for instance "TLS
v1.1" or "DTLS v1.0".
v1.3" or "DTLS v1.2".

.. cpp:function:: static Protocol_Version latest_tls_version()

Returns the latest version of the TLS protocol known to the library
(currently TLS v1.2)
(currently TLS v1.3)

.. cpp:function:: static Protocol_Version latest_dtls_version()

Returns the latest version of the DTLS protocol known to the
library (currently DTLS v1.2)
library (currently DTLS v1.2, or experimental DTLS v1.3)


Post-quantum-secure key exchange
Expand Down
4 changes: 2 additions & 2 deletions doc/credits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ snail-mail address (S), and Bitcoin address (B).
N: Amos Treiber
E: amos.treiber@rohde-schwarz.com
W: https://www.rohde-schwarz.com/cybersecurity
D: SLH-DSA, TPM 2.0, FrodoKEM, Classic McEliece, ML-KEM, ML-DSA
D: SLH-DSA, TPM 2.0, FrodoKEM, Classic McEliece, ML-KEM, ML-DSA, DTLS 1.3
S: Cologne, Germany

N: Daniel Seither
Expand All @@ -179,7 +179,7 @@ snail-mail address (S), and Bitcoin address (B).
N: René Meusel
E: rene.meusel@rohde-schwarz.com
W: https://www.rohde-schwarz.com/cybersecurity
D: TLS 1.3, ML-KEM, ML-DSA, SLH-DSA, FrodoKEM, TPM 2.0, CI
D: (D)TLS 1.3, ML-KEM, ML-DSA, SLH-DSA, FrodoKEM, TPM 2.0, CI
S: Berlin, Germany

N: Daniel Neus
Expand Down
4 changes: 2 additions & 2 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ Find Enclosed
Transport Layer Security (TLS) Protocol
----------------------------------------

* TLS v1.2/v1.3, and DTLS v1.2
* TLS v1.2/v1.3, DTLS v1.2, and DTLS v1.3 (experimental)
* Supported extensions include session tickets, SNI, ALPN, OCSP stapling,
encrypt-then-mac CBC, and extended master secret.
* Supports authentication using certificates or preshared keys (PSK)
* Supports record encryption with modern AEAD modes as well as legacy CBC ciphersuites.
* TLS 1.3 supports hybrid post-quantum key exchange using ML-KEM or FrodoKEM
* (D)TLS 1.3 supports hybrid post-quantum key exchange using ML-KEM or FrodoKEM

Public Key Infrastructure
----------------------------------------
Expand Down
Loading
Loading