life_cycle-rand.pod 7.5 KB

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