{"id":3932,"date":"2022-12-20T17:28:26","date_gmt":"2022-12-20T20:28:26","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/evp_kdf_tls1_prf-man7\/"},"modified":"2022-12-20T17:28:26","modified_gmt":"2022-12-20T20:28:26","slug":"evp_kdf_tls1_prf-man7","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/evp_kdf_tls1_prf-man7\/","title":{"rendered":"EVP_KDF_TLS1_PRF (man7)"},"content":{"rendered":"<h1 align=\"center\">EVP_KDF_TLS1_PRF<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#EXAMPLE\">EXAMPLE<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">EVP_KDF_TLS1_PRF \u2212 The TLS1 PRF EVP_KDF implementation<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Support for computing the <b><small>TLS1<\/small><\/b> <small>PRF<\/small> through the <b><small>EVP_KDF<\/small><\/b> <small>API.<\/small><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <small>EVP_KDF_TLS1_PRF<\/small> algorithm implements the <small>PRF<\/small> used by <small>TLS<\/small> versions up to and including <small>TLS 1.2.<\/small><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Numeric identity <small><br \/> EVP_KDF_TLS1_PRF<\/small><\/b> is the numeric identity for this implementation; it can be used with the <b>EVP_KDF_CTX_new_id()<\/b> function.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Supported controls<\/b> <br \/> The supported controls are: <b><small><br \/> EVP_KDF_CTRL_SET_MD<\/small><\/b><\/p>\n<p style=\"margin-left:17%;\">This control works as described in &#8221; <small>CONTROLS&#8221;<\/small> in <b><small>EVP_KDF_CTX<\/small><\/b> (3).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The &#8220;EVP_KDF_CTRL_SET_MD&#8221; control is used to set the message digest associated with the <small>TLS PRF.<\/small> <b>EVP_md5_sha1()<\/b> is treated as a special case which uses the <small>PRF<\/small> algorithm using both <b><small>MD5<\/small><\/b> and <b><small>SHA1<\/small><\/b> as used in <small>TLS 1.0<\/small> and 1.1.<\/p>\n<p style=\"margin-left:11%;\"><b><small>EVP_KDF_CTRL_SET_TLS_SECRET<\/small><\/b><\/p>\n<p style=\"margin-left:17%;\">This control expects two arguments: &#8220;unsigned char *sec&#8221;, &#8220;size_t seclen&#8221;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Sets the secret value of the <small>TLS PRF<\/small> to <b>seclen<\/b> bytes of the buffer <b>sec<\/b>. Any existing secret value is replaced.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b>EVP_KDF_ctrl_str()<\/b> takes two type strings for this control: <br \/> &#8220;secret&#8221;<\/p>\n<p style=\"margin-left:23%;\">The value string is used as is.<\/p>\n<p style=\"margin-left:17%;\">&#8220;hexsecret&#8221;<\/p>\n<p style=\"margin-left:23%;\">The value string is expected to be a hexadecimal number, which will be decoded before being passed on as the control value.<\/p>\n<p style=\"margin-left:11%;\"><b><small>EVP_KDF_CTRL_RESET_TLS_SEED<\/small><\/b><\/p>\n<p style=\"margin-left:17%;\">This control does not expect any arguments.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Resets the context seed buffer to zero length.<\/p>\n<p style=\"margin-left:11%;\"><b><small>EVP_KDF_CTRL_ADD_TLS_SEED<\/small><\/b><\/p>\n<p style=\"margin-left:17%;\">This control expects two arguments: &#8220;unsigned char *seed&#8221;, &#8220;size_t seedlen&#8221;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Sets the seed to <b>seedlen<\/b> bytes of <b>seed<\/b>. If a seed is already set it is appended to the existing value.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The total length of the context seed buffer cannot exceed 1024 bytes; this should be more than enough for any normal use of the <small>TLS PRF.<\/small><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b>EVP_KDF_ctrl_str()<\/b> takes two type strings for this control: <br \/> &#8220;seed&#8221;<\/p>\n<p style=\"margin-left:23%;\">The value string is used as is.<\/p>\n<p style=\"margin-left:17%;\">&#8220;hexseed&#8221;<\/p>\n<p style=\"margin-left:23%;\">The value string is expected to be a hexadecimal number, which will be decoded before being passed on as the control value.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">A context for the <small>TLS PRF<\/small> can be obtained by calling:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">EVP_KDF_CTX *kctx = EVP_KDF_CTX_new_id(EVP_KDF_TLS1_PRF, NULL);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The digest, secret value and seed must be set before a key is derived otherwise an error will occur.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The output length of the <small>PRF<\/small> is specified by the &#8220;keylen&#8221; parameter to the <b>EVP_KDF_derive()<\/b> function.<\/p>\n<h2>EXAMPLE <a name=\"EXAMPLE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This example derives 10 bytes using <small>SHA\u2212256<\/small> with the secret key &#8220;secret&#8221; and seed value &#8220;seed&#8221;:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">EVP_KDF_CTX *kctx; <br \/> unsigned char out[10]; <br \/> kctx = EVP_KDF_CTX_new_id(EVP_KDF_TLS1_PRF); <br \/> if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_MD, EVP_sha256()) <= 0) { <br \/> error(&#8220;EVP_KDF_CTRL_SET_MD&#8221;); <br \/> } <br \/> if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_TLS_SECRET, <br \/> &#8220;secret&#8221;, (size_t)6) <= 0) { <br \/> error(&#8220;EVP_KDF_CTRL_SET_TLS_SECRET&#8221;); <br \/> } <br \/> if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_ADD_TLS_SEED, &#8220;seed&#8221;, (size_t)4) <= 0) { <br \/> error(&#8220;EVP_KDF_CTRL_ADD_TLS_SEED&#8221;); <br \/> } <br \/> if (EVP_KDF_derive(kctx, out, sizeof(out)) <= 0) { <br \/> error(&#8220;EVP_KDF_derive&#8221;); <br \/> } <br \/> EVP_KDF_CTX_free(kctx);<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><small>EVP_KDF_CTX<\/small> , <b>EVP_KDF_CTX_new_id<\/b>(3), <b>EVP_KDF_CTX_free<\/b>(3), <b>EVP_KDF_ctrl<\/b>(3), <b>EVP_KDF_derive<\/b>(3), &#8221; <small>CONTROLS&#8221;<\/small> in <b><small>EVP_KDF_CTX<\/small><\/b> (3)<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Licensed under the Apache License 2.0 (the &#8220;License&#8221;). You may not use this file except in compliance with the License. You can obtain a copy in the file <small>LICENSE<\/small> in the source distribution or at <https:\/\/www.openssl.org\/source\/license.html>.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  EVP_KDF_TLS1_PRF \u2212 The TLS1 PRF EVP_KDF implementation <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[971],"tags":[973,1025,972],"class_list":["post-3932","post","type-post","status-publish","format-standard","hentry","category-7-miscelanea","tag-973","tag-evp_kdf_tls1_prf","tag-man7"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3932"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3932\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}