EVP_KDF-TLS1_PRF(7SSL)
β¨ NAME β¨
EVP_KDF-TLS1_PRF β the TLS1 PRF EVP_KDF implementation, bestie π (this is the 7SSL manual page, btw, so you know exactly where you are)
π¦ DESCRIPTION π¦
So basically: this is support for computing the TLS1 PRF through the EVP_KDF API. π
The EVP_KDF-TLS1_PRF algorithm implements the PRF used by TLS versions up to and including TLS 1.2. That's right, we're doing the classics. πΈ
And the output? It's considered to be keying material. Periodt. π
π Identity
"TLS1-PRF" is the name for this implementation β like, that's the whole government name, okay? You can use it with the EVP_KDF_fetch() function. π«Ά
π Supported parameters
Here's the menu of supported parameters, and yes we're listing every single one, no skipping, that's the rules π€:
"properties"(OSSL_KDF_PARAM_PROPERTIES)<UTF8 string>β and also"digest"(OSSL_KDF_PARAM_DIGEST)<UTF8 string>β these two work exactly as described in"PARAMETERS"inEVP_KDF(3), no cap.
The OSSL_KDF_PARAM_DIGEST parameter is the one that sets the message digest associated with the TLS PRF. Lowkey special case alert π¨: EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1 as used in TLS 1.0 and 1.1. Iconic behavior, honestly.
"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. Not merged, not combined β replaced. Bye to the old one π"seed"(OSSL_KDF_PARAM_SEED)<octet string>β this sets the context seed. The length of the context seed cannot exceed 1024 bytes. And fr fr, that should be more than enough for any normal use of the TLS PRF. Don't be extra. π
The OpenSSL FIPS provider also supports the following parameters, and these are giving very serious compliance energy:
"fips-indicator"(OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR)<integer>β a getter that returns1if the operation is FIPS approved, or0otherwise. You can use this after callingEVP_KDF_derive. It returns0if any"***-check"related parameter is set to0and the check fails. π"ems_check"(OSSL_KDF_PARAM_FIPS_EMS_CHECK)<integer>β the default value of1causes an error duringEVP_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"to0. And listen β this option breaks FIPS compliance if it causes the approved"fips-indicator"to return0. So like, choose wisely bestie π"digest-check"(OSSL_KDF_PARAM_FIPS_DIGEST_CHECK)<integer>β the default value of1causes an error duringEVP_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"to0. Again: this option breaks FIPS compliance if it causes the approved"fips-indicator"to return0. π
According to SP 800-135r1, the following are approved digest algorithms: SHA2-256, SHA2-384, SHA2-512. Those three. That's the whole approved squad. β
"key-check"(OSSL_KDF_PARAM_FIPS_KEY_CHECK)<integer>β the default value of1causes an error duringEVP_KDF_CTX_set_params()if the length of used key-derivation key (OSSL_KDF_PARAM_SECRET) is shorter than112bits. Setting this to zero will ignore the error and set the approved"fips-indicator"to0. And yep, you guessed it: this option breaks FIPS compliance if it causes the approved"fips-indicator"to return0. π
πΈ NOTES πΈ
You can get yourself a context for the TLS PRF by calling this, okay? Copy it down:
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
The digest, the secret value and the seed must be set before a key is derived β otherwise an error will occur. No exceptions, no vibes-based shortcuts. π«
Also the output length of the PRF is specified by the keylen parameter to the EVP_KDF_derive() function. That's where you tell it how much you want. π
π₯ EXAMPLES π₯
Okay so this example derives 10 bytes using SHA-256 with the secret key "secret" and seed value "seed". Look at her go π
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's certified, she's spec-compliant, she read the docs. πβ¨
π SEE ALSO π
Go read these too, they're all part of the squad:
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)
β HISTORY β
This functionality was added in OpenSSL 3.0. So it's not ancient history, it's just iconic history. π«
π COPYRIGHT π
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, bestie β this was EVP_KDF-TLS1_PRF(7SSL) from OpenSSL 4.0.3, dated 2026-09-29. Slay, go derive some keying material responsibly ππβ¨
π¦ 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