Blame doc/man3/SSL_export_keying_material.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_export_keying_material,
Packit c4476c
SSL_export_keying_material_early
Packit c4476c
- obtain keying material for application use
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
Packit c4476c
                                const char *label, size_t llen,
Packit c4476c
                                const unsigned char *context,
Packit c4476c
                                size_t contextlen, int use_context);
Packit c4476c
Packit c4476c
 int SSL_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,
Packit c4476c
                                      const char *label, size_t llen,
Packit c4476c
                                      const unsigned char *context,
Packit c4476c
                                      size_t contextlen);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
During the creation of a TLS or DTLS connection shared keying material is
Packit c4476c
established between the two endpoints. The functions
Packit c4476c
SSL_export_keying_material() and SSL_export_keying_material_early() enable an
Packit c4476c
application to use some of this keying material for its own purposes in
Packit c4476c
accordance with RFC5705 (for TLSv1.2 and below) or RFC8446 (for TLSv1.3).
Packit c4476c
Packit c4476c
SSL_export_keying_material() derives keying material using
Packit c4476c
the F<exporter_master_secret> established in the handshake.
Packit c4476c
Packit c4476c
SSL_export_keying_material_early() is only usable with TLSv1.3, and derives
Packit c4476c
keying material using the F<early_exporter_master_secret> (as defined in the
Packit c4476c
TLS 1.3 RFC). For the client, the F<early_exporter_master_secret> is only
Packit c4476c
available when the client attempts to send 0-RTT data. For the server, it is
Packit c4476c
only available when the server accepts 0-RTT data.
Packit c4476c
Packit c4476c
An application may need to securely establish the context within which this
Packit c4476c
keying material will be used. For example this may include identifiers for the
Packit c4476c
application session, application algorithms or parameters, or the lifetime of
Packit c4476c
the context. The context value is left to the application but must be the same
Packit c4476c
on both sides of the communication.
Packit c4476c
Packit c4476c
For a given SSL connection B<s>, B<olen> bytes of data will be written to
Packit c4476c
B<out>. The application specific context should be supplied in the location
Packit c4476c
pointed to by B<context> and should be B<contextlen> bytes long. Provision of
Packit c4476c
a context is optional. If the context should be omitted entirely then
Packit c4476c
B<use_context> should be set to 0. Otherwise it should be any other value. If
Packit c4476c
B<use_context> is 0 then the values of B<context> and B<contextlen> are ignored.
Packit c4476c
Note that in TLSv1.2 and below a zero length context is treated differently from
Packit c4476c
no context at all, and will result in different keying material being returned.
Packit c4476c
In TLSv1.3 a zero length context is that same as no context at all and will
Packit c4476c
result in the same keying material being returned.
Packit c4476c
Packit c4476c
An application specific label should be provided in the location pointed to by
Packit c4476c
B<label> and should be B<llen> bytes long. Typically this will be a value from
Packit c4476c
the IANA Exporter Label Registry
Packit c4476c
(L<https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels>).
Packit c4476c
Alternatively labels beginning with "EXPERIMENTAL" are permitted by the standard
Packit c4476c
to be used without registration. TLSv1.3 imposes a maximum label length of
Packit c4476c
249 bytes.
Packit c4476c
Packit c4476c
Note that this function is only defined for TLSv1.0 and above, and DTLSv1.0 and
Packit c4476c
above. Attempting to use it in SSLv3 will result in an error.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SSL_export_keying_material() returns 0 or -1 on failure or 1 on success.
Packit c4476c
Packit c4476c
SSL_export_keying_material_early() returns 0 on failure or 1 on success.
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The SSL_export_keying_material_early() function was added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut