=pod =head1 NAME EVP_KDF_TLS1_PRF - The TLS1 PRF EVP_KDF implementation =head1 DESCRIPTION Support for computing the B PRF through the B API. The EVP_KDF_TLS1_PRF algorithm implements the PRF used by TLS versions up to and including TLS 1.2. =head2 Numeric identity B is the numeric identity for this implementation; it can be used with the EVP_KDF_CTX_new_id() function. =head2 Supported controls The supported controls are: =over 4 =item B This control works as described in L. The C control is used to set the message digest associated with the TLS PRF. EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both B and B as used in TLS 1.0 and 1.1. =item B This control expects two arguments: C, C Sets the secret value of the TLS PRF to B bytes of the buffer B. Any existing secret value is replaced. EVP_KDF_ctrl_str() takes two type strings for this control: =over 4 =item "secret" The value string is used as is. =item "hexsecret" The value string is expected to be a hexadecimal number, which will be decoded before being passed on as the control value. =back =item B This control does not expect any arguments. Resets the context seed buffer to zero length. =item B This control expects two arguments: C, C Sets the seed to B bytes of B. If a seed is already set it is appended to the existing value. The total length of the context seed buffer cannot exceed 1024 bytes; this should be more than enough for any normal use of the TLS PRF. EVP_KDF_ctrl_str() takes two type strings for this control: =over 4 =item "seed" The value string is used as is. =item "hexseed" The value string is expected to be a hexadecimal number, which will be decoded before being passed on as the control value. =back =back =head1 NOTES A context for the TLS PRF can be obtained by calling: EVP_KDF_CTX *kctx = EVP_KDF_CTX_new_id(EVP_KDF_TLS1_PRF, NULL); The digest, secret value and seed must be set before a key is derived otherwise an error will occur. The output length of the PRF is specified by the C parameter to the EVP_KDF_derive() function. =head1 EXAMPLE This example derives 10 bytes using SHA-256 with the secret key "secret" and seed value "seed": EVP_KDF_CTX *kctx; unsigned char out[10]; kctx = EVP_KDF_CTX_new_id(EVP_KDF_TLS1_PRF); if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_MD, EVP_sha256()) <= 0) { error("EVP_KDF_CTRL_SET_MD"); } if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_TLS_SECRET, "secret", (size_t)6) <= 0) { error("EVP_KDF_CTRL_SET_TLS_SECRET"); } if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_ADD_TLS_SEED, "seed", (size_t)4) <= 0) { error("EVP_KDF_CTRL_ADD_TLS_SEED"); } if (EVP_KDF_derive(kctx, out, sizeof(out)) <= 0) { error("EVP_KDF_derive"); } EVP_KDF_CTX_free(kctx); =head1 SEE ALSO L, L, L, L, L, L =head1 COPYRIGHT Copyright 2018 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 L. =cut