life_cycle-kdf.pod 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. =pod
  2. =head1 NAME
  3. life_cycle-kdf - The KDF algorithm life-cycle
  4. =head1 DESCRIPTION
  5. All key derivation functions (KDFs) and pseudo random functions (PRFs)
  6. go through a number of stages in their life-cycle:
  7. =over 4
  8. =item start
  9. This state represents the KDF/PRF before it has been allocated. It is the
  10. starting state for any life-cycle transitions.
  11. =item newed
  12. This state represents the KDF/PRF after it has been allocated.
  13. =item deriving
  14. This state represents the KDF/PRF when it is set up and capable of generating
  15. output.
  16. =item freed
  17. This state is entered when the KDF/PRF is freed. It is the terminal state
  18. for all life-cycle transitions.
  19. =back
  20. =head2 State Transition Diagram
  21. The usual life-cycle of a KDF/PRF is illustrated:
  22. =begin man
  23. +-------------------+
  24. | start |
  25. +-------------------+
  26. |
  27. | EVP_KDF_CTX_new
  28. v
  29. +-------------------+
  30. | newed | <+
  31. +-------------------+ |
  32. | |
  33. | EVP_KDF_derive |
  34. v | EVP_KDF_CTX_reset
  35. EVP_KDF_derive +-------------------+ |
  36. + - - - - - - - - | | |
  37. ' | deriving | |
  38. + - - - - - - - -> | | -+
  39. +-------------------+
  40. |
  41. | EVP_KDF_CTX_free
  42. v
  43. +-------------------+
  44. | freed |
  45. +-------------------+
  46. =end man
  47. =for html <img src="img/kdf.png">
  48. =head2 Formal State Transitions
  49. This section defines all of the legal state transitions.
  50. This is the canonical list.
  51. =begin man
  52. Function Call ------------- Current State -------------
  53. start newed deriving freed
  54. EVP_KDF_CTX_new newed
  55. EVP_KDF_derive deriving deriving
  56. EVP_KDF_CTX_free freed freed freed
  57. EVP_KDF_CTX_reset newed newed
  58. EVP_KDF_CTX_get_params newed deriving
  59. EVP_KDF_CTX_set_params newed deriving
  60. EVP_KDF_CTX_gettable_params newed deriving
  61. EVP_KDF_CTX_settable_params newed deriving
  62. =end man
  63. =begin html
  64. <table style="border:1px solid; border-collapse:collapse">
  65. <tr><th style="border:1px solid" align="left">Function Call</th>
  66. <th style="border:1px solid" colspan="4">Current State</th></tr>
  67. <tr><th style="border:1px solid"></th>
  68. <th style="border:1px solid" align="center">start</th>
  69. <th style="border:1px solid" align="center">newed</th>
  70. <th style="border:1px solid" align="center">deriving</th>
  71. <th style="border:1px solid" align="center">freed</th></tr>
  72. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_new</th>
  73. <td style="border:1px solid" align="center">newed</td>
  74. <td style="border:1px solid"></td>
  75. <td style="border:1px solid"></td>
  76. <td style="border:1px solid"></td></tr>
  77. <tr><th style="border:1px solid" align="left">EVP_KDF_derive</th>
  78. <td style="border:1px solid" align="center"></td>
  79. <td style="border:1px solid" align="center">newed</td>
  80. <td style="border:1px solid" align="center">deriving</td>
  81. <td style="border:1px solid"></td></tr>
  82. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_free</th>
  83. <td style="border:1px solid" align="center"></td>
  84. <td style="border:1px solid" align="center">newed</td>
  85. <td style="border:1px solid" align="center">deriving</td>
  86. <td style="border:1px solid"></td></tr>
  87. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_reset</th>
  88. <td style="border:1px solid" align="center">freed</td>
  89. <td style="border:1px solid" align="center">freed</td>
  90. <td style="border:1px solid" align="center">freed</td>
  91. <td style="border:1px solid"></td></tr>
  92. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_get_params</th>
  93. <td style="border:1px solid" align="center"></td>
  94. <td style="border:1px solid" align="center">newed</td>
  95. <td style="border:1px solid" align="center">deriving</td>
  96. <td style="border:1px solid"></td></tr>
  97. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_set_params</th>
  98. <td style="border:1px solid" align="center"></td>
  99. <td style="border:1px solid" align="center">newed</td>
  100. <td style="border:1px solid" align="center">deriving</td>
  101. <td style="border:1px solid"></td></tr>
  102. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_gettable_params</th>
  103. <td style="border:1px solid" align="center"></td>
  104. <td style="border:1px solid" align="center">newed</td>
  105. <td style="border:1px solid" align="center">deriving</td>
  106. <td style="border:1px solid"></td></tr>
  107. <tr><th style="border:1px solid" align="left">EVP_KDF_CTX_settable_params</th>
  108. <td style="border:1px solid" align="center"></td>
  109. <td style="border:1px solid" align="center">newed</td>
  110. <td style="border:1px solid" align="center">deriving</td>
  111. <td style="border:1px solid"></td></tr>
  112. </table>
  113. =end html
  114. =head1 NOTES
  115. At some point the EVP layer will begin enforcing the transitions described
  116. herein.
  117. =head1 SEE ALSO
  118. L<provider-kdf(7)>, L<EVP_KDF(3)>.
  119. =head1 HISTORY
  120. The provider KDF interface was introduced in OpenSSL 3.0.
  121. =head1 COPYRIGHT
  122. Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
  123. Licensed under the Apache License 2.0 (the "License"). You may not use
  124. this file except in compliance with the License. You can obtain a copy
  125. in the file LICENSE in the source distribution or at
  126. L<https://www.openssl.org/source/license.html>.
  127. =cut