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