EVP_KDF-TLS1_PRF(7ossl)

πŸ’… EVP_KDF-TLS1_PRF πŸ’…

okay so this is the 7ossl page for EVP_KDF-TLS1_PRF, straight out of the OpenSSL docs β€” and bestie, it's literally the TLS1 PRF implementation, so let's get into it ✨


🌸 NAME 🌸

EVP_KDF-TLS1_PRF β€” the TLS1 PRF EVP_KDF implementation, no cap 🫢


✨ DESCRIPTION ✨

So the whole point: this gives you support for computing the TLS1 PRF through the EVP_KDF API. That's it, that's the vibe. πŸ’–

The EVP_KDF-TLS1_PRF algorithm implements the PRF used by TLS versions up to and including TLS 1.2 β€” so like, TLS 1.0, 1.1, 1.2, all of them, she's been around πŸ‘‘

And the output? Consider it keying material. That's what it is, periodt.

πŸŽ€ Identity πŸŽ€

"TLS1-PRF" is the name for this implementation, and you use it with the EVP_KDF_fetch() function. That's the string you pass, don't get it twisted πŸ’…

πŸ¦‹ Supported parameters πŸ¦‹

Here's the list of supported parameters, and yes we're doing all of them:

  • "properties" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>
  • "digest" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>

These two work exactly as described in "PARAMETERS" in EVP_KDF(3). 🫢

The OSSL_KDF_PARAM_DIGEST parameter is the one you use to set the message digest that's associated with the TLS PRF. And here's the little special case you gotta know: EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1, exactly like TLS 1.0 and 1.1 did. so iconic of her to keep that around 😭

  • "secret" (OSSL_KDF_PARAM_SECRET) <octet string>

This one sets the secret value of the TLS PRF. Heads up: any existing secret value gets replaced. πŸ”₯

  • "seed" (OSSL_KDF_PARAM_SEED) <octet string>

This sets the context seed. But listen β€” the length of the context seed cannot exceed 1024 bytes. And honestly? That should be more than enough for any normal use of the TLS PRF. like, if you're hitting 1024 bytes of seed, what are you doing πŸ’€

The OpenSSL FIPS provider also supports the following parameters:

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

This is a getter that returns 1 if the operation is FIPS approved, or 0 otherwise. You can use it after calling EVP_KDF_derive. It returns 0 if any "***-check" related parameter is set to 0 and the check fails. 🧚

  • "ems_check" (OSSL_KDF_PARAM_FIPS_EMS_CHECK) <integer>

The default value of 1 causes an error during EVP_KDF_derive() if "master secret" is used instead of "extended master secret". Setting this to zero will ignore the error and set the approved "fips-indicator" to 0. ⚠️ And this option breaks FIPS compliance if it causes the approved "fips-indicator" to return 0.

  • "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 SP 800-135r1, these are the approved digest algorithms: SHA2-256, SHA2-384, SHA2-512. Those three, that's the list πŸ’…

  • "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_SECRET) 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 🌈

You get a context for the TLS PRF by calling this, bestie:

EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);

Now the important part β€” the digest, the secret value and the seed must all be set before a key is derived, otherwise an error will occur. Like, no skipping steps, that's the rule 😀

And the output length of the PRF is specified by the keylen parameter to the EVP_KDF_derive() function. πŸŽ€


πŸ”₯ EXAMPLES πŸ”₯

This example derives 10 bytes using SHA-256 with the secret key "secret" and seed value "seed" β€” look how cute and tidy she is:

EVP_KDF *kdf;
EVP_KDF_CTX *kctx;
unsigned char out[10];
OSSL_PARAM params[4], *p = params;

kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);

*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
                                        SN_sha256, strlen(SN_sha256));
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
                                         "secret", (size_t)6);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,
                                         "seed", (size_t)4);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
    error("EVP_KDF_derive");
}
EVP_KDF_CTX_free(kctx);

πŸ‘‘ CONFORMING TO πŸ‘‘

RFC 2246, RFC 5246 and NIST SP 800-135 r1 β€” she conforms, she's certified, she did her homework 🌸


πŸ’œ SEE ALSO πŸ’œ

EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), "PARAMETERS" in EVP_KDF(3) β€” go read these too, iykyk πŸ¦‹


⭐ HISTORY ⭐

This functionality was added in OpenSSL 3.0 β€” so if you're on something older, sorry bestie, she's not there πŸ™ˆ


Copyright 2018-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, no crumbs left πŸ“

okay bye bestie, mwah πŸ’‹ β€” this was version 3.5.9, dated 2026-09-29, and it's the EVP_KDF-TLS1_PRF(7ossl) page from OpenSSL, signing off πŸ’…βœ¨

πŸ“¦ where this page comes from