EVP_KDF-TLS13_KDF(7SSL)
π EVP_KDF-TLS13_KDF π
okay bestie so this is EVP_KDF-TLS13_KDF(7SSL) β a page from the OpenSSL manual situation β and we're about to understand the TLS 1.3 version of HKDF. stay with me, it's actually so good π«Ά
β¨ NAME β¨
EVP_KDF-TLS13_KDF β the TLS 1.3 EVP_KDF implementation, periodt π
πΈ DESCRIPTION πΈ
So basically: this is how you compute the TLS 1.3 version of the HKDF KDF, but through the EVP_KDF API. That's the whole vibe. β¨
The EVP_KDF-TLS13_KDF algorithm implements the HKDF key derivation function as used by TLS 1.3.
The output is considered to be keying material. that's it, that's the tea π
π Identity π
"TLS13-KDF" is the name for this implementation, and it can be used with the EVP_KDF_fetch() function. iykyk π«
π§ Supported parameters π§
these are the parameters you get to play with:
"properties"(OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"digest"(OSSL_KDF_PARAM_DIGEST) <UTF8 string>"key"(OSSL_KDF_PARAM_KEY) <octet string>"salt"(OSSL_KDF_PARAM_SALT) <octet string>
All of these work exactly as described in "PARAMETERS" in EVP_KDF(3). no notes, no drama, they just do their thing π
"prefix"(OSSL_KDF_PARAM_PREFIX) <octet string>
This one sets the label prefix on the specified TLS 1.3 KDF context. For TLS 1.3 this should be set to the ASCII string "tls13 " β and please note, bestie, without a trailing zero byte. Refer to RFC 8446 section 7.1 "Key Schedule" for details. π
"label"(OSSL_KDF_PARAM_LABEL) <octet string>
Sets the label on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 "Key Schedule" for details. π·οΈ
"data"(OSSL_KDF_PARAM_DATA) <octet string>
Sets the context data on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 "Key Schedule" for details. π¦
"mode"(OSSL_KDF_PARAM_MODE) <UTF8 string> or <integer>
This sets the mode for the TLS 1.3 KDF operation. There are two modes that are currently defined:
"EXTRACT_ONLY"orEVP_KDF_HKDF_MODE_EXTRACT_ONLY
In this mode, calling EVP_KDF_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K. π
The keylen parameter must match the size of K β which you can look up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest. β¨
The digest, key and salt values must be set before a key is derived, otherwise an error will occur. no skipping steps!! π
"EXPAND_ONLY"orEVP_KDF_HKDF_MODE_EXPAND_ONLY
In this mode, calling EVP_KDF_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation. π¦
The digest, key and info values must be set before a key is derived, otherwise an error will occur. again: no skipping!! π
The OpenSSL FIPS provider also supports the following parameters, bestie, so listen up:
"fips-indicator"(OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>
A getter that returns 1 if the operation is FIPS approved, or 0 otherwise. You may use this after calling EVP_KDF_derive. It returns 0 if any "***-check" related parameter is set to 0 and the check fails. π΅οΈ
"digest-check"(OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <integer>
The default value of 1 causes an error during EVP_KDF_CTX_set_params() if the used digest is not approved. Setting this to zero will ignore the error and set the approved "fips-indicator" to 0. This option breaks FIPS compliance if it causes the approved "fips-indicator" to return 0. π
According to RFC 8446, the following are approved digest algorithms: SHA2-256, SHA2-384. β
"key-check"(OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer>
The default value of 1 causes an error during EVP_KDF_CTX_set_params() if the length of the used key-derivation key (OSSL_KDF_PARAM_KEY) is shorter than 112 bits. Setting this to zero will ignore the error and set the approved "fips-indicator" to 0. This option breaks FIPS compliance if it causes the approved "fips-indicator" to return 0. π
π NOTES π
This KDF is intended for use by the TLS 1.3 implementation in libssl. It does not support all the options and capabilities that HKDF does. π
The OSSL_PARAM array passed to EVP_KDF_derive(3) or EVP_KDF_CTX_set_params(3) must specify all of the parameters required. This KDF does not support a piecemeal approach to providing these. all or nothing, babe π
A context for a TLS 1.3 KDF can be obtained by calling:
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS13-KDF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
The output length of a TLS 1.3 KDF expand operation is specified via the keylen parameter to the EVP_KDF_derive(3) function. When using EVP_KDF_HKDF_MODE_EXTRACT_ONLY the keylen parameter must equal the size of the intermediate fixed-length pseudorandom key, otherwise an error will occur. For that mode, the fixed output size can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the EVP_KDF_CTX. π
π CONFORMING TO π
RFC 8446 β
π SEE ALSO π
EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), "PARAMETERS" in EVP_KDF(3), EVP_KDF-HKDF(7)
π°οΈ HISTORY π°οΈ
This functionality was added in OpenSSL 3.0. iconic behavior honestly π
Β©οΈ COPYRIGHT Β©οΈ
Copyright 2021-2024 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 in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
k that's the whole page bestie, you ate that fr fr π β¨ go derive some keys π«Ά
version 4.0.3, dated 2026-09-29 β mwah, catch you in EVP_KDF-TLS13_KDF(7SSL) again soon ππ
π¦ where this page comes from
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms