1EVP_KDF-TLS1_PRF(7ossl) OpenSSL EVP_KDF-TLS1_PRF(7ossl)
2
3
4
6 EVP_KDF-TLS1_PRF - The TLS1 PRF EVP_KDF implementation
7
9 Support for computing the TLS1 PRF through the EVP_KDF API.
10
11 The EVP_KDF-TLS1_PRF algorithm implements the PRF used by TLS versions
12 up to and including TLS 1.2.
13
14 Identity
15 "TLS1-PRF" is the name for this implementation; it can be used with the
16 EVP_KDF_fetch() function.
17
18 Supported parameters
19 The supported parameters are:
20
21 "properties" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>
22 "digest" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>
23 These parameters work as described in "PARAMETERS" in EVP_KDF(3).
24
25 The OSSL_KDF_PARAM_DIGEST parameter is used to set the message
26 digest associated with the TLS PRF. EVP_md5_sha1() is treated as a
27 special case which uses the PRF algorithm using both MD5 and SHA1
28 as used in TLS 1.0 and 1.1.
29
30 "secret" (OSSL_KDF_PARAM_SECRET) <octet string>
31 This parameter sets the secret value of the TLS PRF. Any existing
32 secret value is replaced.
33
34 "seed" (OSSL_KDF_PARAM_SEED) <octet string>
35 This parameter sets the context seed. The length of the context
36 seed cannot exceed 1024 bytes; this should be more than enough for
37 any normal use of the TLS PRF.
38
40 A context for the TLS PRF can be obtained by calling:
41
42 EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
43 EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
44
45 The digest, secret value and seed must be set before a key is derived
46 otherwise an error will occur.
47
48 The output length of the PRF is specified by the keylen parameter to
49 the EVP_KDF_derive() function.
50
52 This example derives 10 bytes using SHA-256 with the secret key
53 "secret" and seed value "seed":
54
55 EVP_KDF *kdf;
56 EVP_KDF_CTX *kctx;
57 unsigned char out[10];
58 OSSL_PARAM params[4], *p = params;
59
60 kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
61 kctx = EVP_KDF_CTX_new(kdf);
62 EVP_KDF_free(kdf);
63
64 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
65 SN_sha256, strlen(SN_sha256));
66 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
67 "secret", (size_t)6);
68 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,
69 "seed", (size_t)4);
70 *p = OSSL_PARAM_construct_end();
71 if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
72 error("EVP_KDF_derive");
73 }
74 EVP_KDF_CTX_free(kctx);
75
77 RFC 2246, RFC 5246 and NIST SP 800-135 r1
78
80 EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3),
81 EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), "PARAMETERS" in
82 EVP_KDF(3)
83
85 This functionality was added in OpenSSL 3.0.
86
88 Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
89
90 Licensed under the Apache License 2.0 (the "License"). You may not use
91 this file except in compliance with the License. You can obtain a copy
92 in the file LICENSE in the source distribution or at
93 <https://www.openssl.org/source/license.html>.
94
95
96
973.1.1 2023-08-31 EVP_KDF-TLS1_PRF(7ossl)