EVP_KDF-TLS13_KDF(7ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

✨ EVP_KDF-TLS13_KDF ✨

okay bestie, gather round πŸ’– this is the EVP_KDF-TLS13_KDF page from the OpenSSL 7ossl manual β€” the whole thing, none of the boring bits skipped, promise. 🫢


🌸 NAME 🌸

EVP_KDF-TLS13_KDF β€” the TLS 1.3 flavour of the EVP_KDF implementation. literally the whole vibe in one line πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

So. This is the support for computing the TLS 1.3 version of the HKDF KDF, and you get to it through the EVP_KDF API. slay. ✨

The EVP_KDF-TLS13_KDF algorithm implements the HKDF key derivation function exactly as used by TLS 1.3.

The output is considered to be keying material. that's the whole point, no cap. πŸ”₯

πŸ¦‹ Identity πŸ¦‹

"TLS13-KDF" is the name for this implementation β€” that's the string you feed to the EVP_KDF_fetch() function. iykyk πŸ’«

πŸŽ€ Supported parameters πŸŽ€

Here's the lineup, bestie β€” the supported parameters are:

  • "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>

These parameters work exactly as described in "PARAMETERS" in EVP_KDF(3). classic. πŸ‘‘

  • "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 note there's no trailing zero byte, okay? that detail matters, don't come for me πŸ™ˆ Refer to RFC 8446 section 7.1 "Key Schedule" for the deets.

  • "label" (OSSL_KDF_PARAM_LABEL) <octet string>

Sets the label on the specified TLS 1.3 KDF context. RFC 8446 section 7.1 "Key Schedule", as always. πŸ“–

  • "data" (OSSL_KDF_PARAM_DATA) <octet string>

Sets the context data on the specified TLS 1.3 KDF context. again: RFC 8446 section 7.1 "Key Schedule". bestie the RFC just keeps showing up 🧚

  • "mode" (OSSL_KDF_PARAM_MODE) <UTF8 string> or <integer>

This sets the mode for the TLS 1.3 KDF operation. There are two modes currently defined:

  • "EXTRACT_ONLY" or EVP_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 exceptions fr fr πŸ’€

  • "EXPAND_ONLY" or EVP_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. same energy, same warning ⭐

The OpenSSL FIPS provider also supports the following parameters:

  • "fips-indicator" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>

A getter that returns 1 if the operation is FIPS approved, or 0 otherwise. You can 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. (that's the whole approved list, don't add to it πŸ’…)

  • "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. That's its moment, its main character energy πŸ‘‘ It does not support all the options and capabilities that HKDF does. so don't expect HKDF-level flexibility, bestie 😭

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 β€” it's all or nothing, periodt. πŸ’€

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. easy. πŸ“


πŸ’œ 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)

go read those too, they're iconic, i don't make the rules πŸ“šβœ¨


πŸŽ€ HISTORY πŸŽ€

This functionality was added in OpenSSL 3.0. a classic, an original, we love to see it 🌸


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>.


and that's the whole page, bestie, every single detail intact, nothing dropped πŸ’–

okay bye, this was 3.5.0, dated 2026-09-25, and it's the EVP_KDF-TLS13_KDF(7ossl) page β€” drink water, set your digest, and slay πŸ’…πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from