EVP_KDF-TLS13_KDF.pod 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. =pod
  2. =head1 NAME
  3. EVP_KDF-TLS13_KDF - The TLS 1.3 EVP_KDF implementation
  4. =head1 DESCRIPTION
  5. Support for computing the TLS 1.3 version of the B<HKDF> KDF through
  6. the B<EVP_KDF> API.
  7. The EVP_KDF-TLS13_KDF algorithm implements the HKDF key derivation function
  8. as used by TLS 1.3.
  9. =head2 Identity
  10. "TLS13-KDF" is the name for this implementation; it
  11. can be used with the EVP_KDF_fetch() function.
  12. =head2 Supported parameters
  13. The supported parameters are:
  14. =over 4
  15. =item "properties" (B<OSSL_KDF_PARAM_PROPERTIES>) <UTF8 string>
  16. =item "digest" (B<OSSL_KDF_PARAM_DIGEST>) <UTF8 string>
  17. =item "key" (B<OSSL_KDF_PARAM_KEY>) <octet string>
  18. =item "salt" (B<OSSL_KDF_PARAM_SALT>) <octet string>
  19. These parameters work as described in L<EVP_KDF(3)/PARAMETERS>.
  20. =item "prefix" (B<OSSL_KDF_PARAM_PREFIX>) <octet string>
  21. This parameter sets the label prefix on the specified TLS 1.3 KDF context.
  22. For TLS 1.3 this should be set to the ASCII string "tls13 " without a
  23. trailing zero byte. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  24. =item "label" (B<OSSL_KDF_PARAM_LABEL>) <octet string>
  25. This parameter sets the label on the specified TLS 1.3 KDF context.
  26. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  27. =item "data" (B<OSSL_KDF_PARAM_DATA>) <octet string>
  28. This parameter sets the context data on the specified TLS 1.3 KDF context.
  29. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  30. =item "mode" (B<OSSL_KDF_PARAM_MODE>) <UTF8 string> or <integer>
  31. This parameter sets the mode for the TLS 1.3 KDF operation.
  32. There are two modes that are currently defined:
  33. =over 4
  34. =item "EXTRACT_ONLY" or B<EVP_KDF_HKDF_MODE_EXTRACT_ONLY>
  35. In this mode calling L<EVP_KDF_derive(3)> will just perform the extract
  36. operation. The value returned will be the intermediate fixed-length pseudorandom
  37. key K. The I<keylen> parameter must match the size of K, which can be looked
  38. up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest.
  39. The digest, key and salt values must be set before a key is derived otherwise
  40. an error will occur.
  41. =item "EXPAND_ONLY" or B<EVP_KDF_HKDF_MODE_EXPAND_ONLY>
  42. In this mode calling L<EVP_KDF_derive(3)> will just perform the expand
  43. operation. The input key should be set to the intermediate fixed-length
  44. pseudorandom key K returned from a previous extract operation.
  45. The digest, key and info values must be set before a key is derived otherwise
  46. an error will occur.
  47. =back
  48. =back
  49. =head1 NOTES
  50. This KDF is intended for use by the TLS 1.3 implementation in libssl.
  51. It does not support all the options and capabilities that HKDF does.
  52. The I<OSSL_PARAM> array passed to L<EVP_KDF_derive(3)> or
  53. L<EVP_KDF_CTX_set_params(3)> must specify all of the parameters required.
  54. This KDF does not support a piecemeal approach to providing these.
  55. A context for a TLS 1.3 KDF can be obtained by calling:
  56. EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS13-KDF", NULL);
  57. EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
  58. The output length of a TLS 1.3 KDF expand operation is specified via the
  59. I<keylen> parameter to the L<EVP_KDF_derive(3)> function. When using
  60. EVP_KDF_HKDF_MODE_EXTRACT_ONLY the I<keylen> parameter must equal the size of
  61. the intermediate fixed-length pseudorandom key otherwise an error will occur.
  62. For that mode, the fixed output size can be looked up by calling
  63. EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the
  64. B<EVP_KDF_CTX>.
  65. =head1 CONFORMING TO
  66. RFC 8446
  67. =head1 SEE ALSO
  68. L<EVP_KDF(3)>,
  69. L<EVP_KDF_CTX_new(3)>,
  70. L<EVP_KDF_CTX_free(3)>,
  71. L<EVP_KDF_CTX_get_kdf_size(3)>,
  72. L<EVP_KDF_CTX_set_params(3)>,
  73. L<EVP_KDF_derive(3)>,
  74. L<EVP_KDF(3)/PARAMETERS>,
  75. L<EVP_KDF-HKDF(7)>
  76. =head1 COPYRIGHT
  77. Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
  78. Licensed under the Apache License 2.0 (the "License"). You may not use
  79. this file except in compliance with the License. You can obtain a copy
  80. in the file LICENSE in the source distribution or at
  81. L<https://www.openssl.org/source/license.html>.
  82. =cut