provider-rand.7ossl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "PROVIDER-RAND 7ossl"
  136. .TH PROVIDER-RAND 7ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. provider\-rand \- The random number generation library <\-> provider
  143. functions
  144. .SH "SYNOPSIS"
  145. .IX Header "SYNOPSIS"
  146. .Vb 2
  147. \& #include <openssl/core_dispatch.h>
  148. \& #include <openssl/core_names.h>
  149. \&
  150. \& /*
  151. \& * None of these are actual functions, but are displayed like this for
  152. \& * the function signatures for functions that are offered as function
  153. \& * pointers in OSSL_DISPATCH arrays.
  154. \& */
  155. \&
  156. \& /* Context management */
  157. \& void *OSSL_FUNC_rand_newctx(void *provctx, void *parent,
  158. \& const OSSL_DISPATCH *parent_calls);
  159. \& void OSSL_FUNC_rand_freectx(void *ctx);
  160. \&
  161. \& /* Random number generator functions: NIST */
  162. \& int OSSL_FUNC_rand_instantiate(void *ctx, unsigned int strength,
  163. \& int prediction_resistance,
  164. \& const unsigned char *pstr, size_t pstr_len,
  165. \& const OSSL_PARAM params[]);
  166. \& int OSSL_FUNC_rand_uninstantiate(void *ctx);
  167. \& int OSSL_FUNC_rand_generate(void *ctx, unsigned char *out, size_t outlen,
  168. \& unsigned int strength, int prediction_resistance,
  169. \& const unsigned char *addin, size_t addin_len);
  170. \& int OSSL_FUNC_rand_reseed(void *ctx, int prediction_resistance,
  171. \& const unsigned char *ent, size_t ent_len,
  172. \& const unsigned char *addin, size_t addin_len);
  173. \&
  174. \& /* Random number generator functions: additional */
  175. \& size_t OSSL_FUNC_rand_nonce(void *ctx, unsigned char *out, size_t outlen,
  176. \& int strength, size_t min_noncelen,
  177. \& size_t max_noncelen);
  178. \& size_t OSSL_FUNC_rand_get_seed(void *ctx, unsigned char **buffer,
  179. \& int entropy, size_t min_len, size_t max_len,
  180. \& int prediction_resistance,
  181. \& const unsigned char *adin, size_t adin_len);
  182. \& void OSSL_FUNC_rand_clear_seed(void *ctx, unsigned char *buffer, size_t b_len);
  183. \& int OSSL_FUNC_rand_verify_zeroization(void *ctx);
  184. \&
  185. \& /* Context Locking */
  186. \& int OSSL_FUNC_rand_enable_locking(void *ctx);
  187. \& int OSSL_FUNC_rand_lock(void *ctx);
  188. \& void OSSL_FUNC_rand_unlock(void *ctx);
  189. \&
  190. \& /* RAND parameter descriptors */
  191. \& const OSSL_PARAM *OSSL_FUNC_rand_gettable_params(void *provctx);
  192. \& const OSSL_PARAM *OSSL_FUNC_rand_gettable_ctx_params(void *ctx, void *provctx);
  193. \& const OSSL_PARAM *OSSL_FUNC_rand_settable_ctx_params(void *ctx, void *provctx);
  194. \&
  195. \& /* RAND parameters */
  196. \& int OSSL_FUNC_rand_get_params(OSSL_PARAM params[]);
  197. \& int OSSL_FUNC_rand_get_ctx_params(void *ctx, OSSL_PARAM params[]);
  198. \& int OSSL_FUNC_rand_set_ctx_params(void *ctx, const OSSL_PARAM params[]);
  199. .Ve
  200. .SH "DESCRIPTION"
  201. .IX Header "DESCRIPTION"
  202. This documentation is primarily aimed at provider authors. See \fBprovider\fR\|(7)
  203. for further information.
  204. .PP
  205. The \s-1RAND\s0 operation enables providers to implement random number generation
  206. algorithms and random number sources and make
  207. them available to applications via the \s-1API\s0 function \s-1\fBEVP_RAND\s0\fR\|(3).
  208. .SS "Context Management Functions"
  209. .IX Subsection "Context Management Functions"
  210. \&\fBOSSL_FUNC_rand_newctx()\fR should create and return a pointer to a provider side
  211. structure for holding context information during a rand operation.
  212. A pointer to this context will be passed back in a number of the other rand
  213. operation function calls.
  214. The parameter \fIprovctx\fR is the provider context generated during provider
  215. initialisation (see \fBprovider\fR\|(7)).
  216. The parameter \fIparent\fR specifies another rand instance to be used for
  217. seeding purposes. If \s-1NULL\s0 and the specific instance supports it, the
  218. operating system will be used for seeding.
  219. The parameter \fIparent_calls\fR points to the dispatch table for \fIparent\fR.
  220. Thus, the parent need not be from the same provider as the new instance.
  221. .PP
  222. \&\fBOSSL_FUNC_rand_freectx()\fR is passed a pointer to the provider side rand context in
  223. the \fImctx\fR parameter.
  224. If it receives \s-1NULL\s0 as \fIctx\fR value, it should not do anything other than
  225. return.
  226. This function should free any resources associated with that context.
  227. .SS "Random Number Generator Functions: \s-1NIST\s0"
  228. .IX Subsection "Random Number Generator Functions: NIST"
  229. These functions correspond to those defined in \s-1NIST SP 800\-90A\s0 and \s-1SP 800\-90C.\s0
  230. .PP
  231. \&\fBOSSL_FUNC_rand_instantiate()\fR is used to instantiate the \s-1DRBG\s0 \fIctx\fR at a requested
  232. security \fIstrength\fR. In addition, \fIprediction_resistance\fR can be requested.
  233. Additional input \fIaddin\fR of length \fIaddin_len\fR bytes can optionally
  234. be provided. The parameters specified in \fIparams\fR configure the \s-1DRBG\s0 and these
  235. should be processed before instantiation.
  236. .PP
  237. \&\fBOSSL_FUNC_rand_uninstantiate()\fR is used to uninstantiate the \s-1DRBG\s0 \fIctx\fR. After being
  238. uninstantiated, a \s-1DRBG\s0 is unable to produce output until it is instantiated
  239. anew.
  240. .PP
  241. \&\fBOSSL_FUNC_rand_generate()\fR is used to generate random bytes from the \s-1DRBG\s0 \fIctx\fR.
  242. It will generate \fIoutlen\fR bytes placing them into the buffer pointed to by
  243. \&\fIout\fR. The generated bytes will meet the specified security \fIstrength\fR and,
  244. if \fIprediction_resistance\fR is true, the bytes will be produced after reseeding
  245. from a live entropy source. Additional input \fIaddin\fR of length \fIaddin_len\fR
  246. bytes can optionally be provided.
  247. .SS "Random Number Generator Functions: Additional"
  248. .IX Subsection "Random Number Generator Functions: Additional"
  249. \&\fBOSSL_FUNC_rand_nonce()\fR is used to generate a nonce of the given \fIstrength\fR with a
  250. length from \fImin_noncelen\fR to \fImax_noncelen\fR. If the output buffer \fIout\fR is
  251. \&\s-1NULL,\s0 the length of the nonce should be returned.
  252. .PP
  253. \&\fBOSSL_FUNC_rand_get_seed()\fR is used by deterministic generators to obtain their
  254. seeding material from their parent. The seed bytes will meet the specified
  255. security level of \fIentropy\fR bits and there will be between \fImin_len\fR
  256. and \fImax_len\fR inclusive bytes in total. If \fIprediction_resistance\fR is
  257. true, the bytes will be produced from a live entropy source. Additional
  258. input \fIaddin\fR of length \fIaddin_len\fR bytes can optionally be provided.
  259. A pointer to the seed material is returned in \fI*buffer\fR and this must be
  260. freed by a later call to \fBOSSL_FUNC_rand_clear_seed()\fR.
  261. .PP
  262. \&\fBOSSL_FUNC_rand_clear_seed()\fR frees a seed \fIbuffer\fR of length \fIb_len\fR bytes
  263. which was previously allocated by \fBOSSL_FUNC_rand_get_seed()\fR.
  264. .PP
  265. \&\fBOSSL_FUNC_rand_verify_zeroization()\fR is used to determine if the internal state of the
  266. \&\s-1DRBG\s0 is zero. This capability is mandated by \s-1NIST\s0 as part of the self
  267. tests, it is unlikely to be useful in other circumstances.
  268. .SS "Context Locking"
  269. .IX Subsection "Context Locking"
  270. When DRBGs are used by multiple threads, there must be locking employed to
  271. ensure their proper operation. Because locking introduces an overhead, it
  272. is disabled by default.
  273. .PP
  274. \&\fBOSSL_FUNC_rand_enable_locking()\fR allows locking to be turned on for a \s-1DRBG\s0 and all of
  275. its parent DRBGs. From this call onwards, the \s-1DRBG\s0 can be used in a thread
  276. safe manner.
  277. .PP
  278. \&\fBOSSL_FUNC_rand_lock()\fR is used to lock a \s-1DRBG.\s0 Once locked, exclusive access
  279. is guaranteed.
  280. .PP
  281. \&\fBOSSL_FUNC_rand_unlock()\fR is used to unlock a \s-1DRBG.\s0
  282. .SS "Rand Parameters"
  283. .IX Subsection "Rand Parameters"
  284. See \s-1\fBOSSL_PARAM\s0\fR\|(3) for further details on the parameters structure used by
  285. these functions.
  286. .PP
  287. \&\fBOSSL_FUNC_rand_get_params()\fR gets details of parameter values associated with the
  288. provider algorithm and stores them in \fIparams\fR.
  289. .PP
  290. \&\fBOSSL_FUNC_rand_set_ctx_params()\fR sets rand parameters associated with the given
  291. provider side rand context \fIctx\fR to \fIparams\fR.
  292. Any parameter settings are additional to any that were previously set.
  293. Passing \s-1NULL\s0 for \fIparams\fR should return true.
  294. .PP
  295. \&\fBOSSL_FUNC_rand_get_ctx_params()\fR gets details of currently set parameter values
  296. associated with the given provider side rand context \fIctx\fR and stores them
  297. in \fIparams\fR.
  298. Passing \s-1NULL\s0 for \fIparams\fR should return true.
  299. .PP
  300. \&\fBOSSL_FUNC_rand_gettable_params()\fR, \fBOSSL_FUNC_rand_gettable_ctx_params()\fR,
  301. and \fBOSSL_FUNC_rand_settable_ctx_params()\fR all return constant \s-1\fBOSSL_PARAM\s0\fR\|(3)
  302. arrays as descriptors of the parameters that \fBOSSL_FUNC_rand_get_params()\fR,
  303. \&\fBOSSL_FUNC_rand_get_ctx_params()\fR, and \fBOSSL_FUNC_rand_set_ctx_params()\fR
  304. can handle, respectively. \fBOSSL_FUNC_rand_gettable_ctx_params()\fR
  305. and \fBOSSL_FUNC_rand_settable_ctx_params()\fR will return the parameters
  306. associated with the provider side context \fIctx\fR in its current state
  307. if it is not \s-1NULL.\s0 Otherwise, they return the parameters associated
  308. with the provider side algorithm \fIprovctx\fR.
  309. .PP
  310. Parameters currently recognised by built-in rands are as follows. Not all
  311. parameters are relevant to, or are understood by all rands:
  312. .ie n .IP """state"" (\fB\s-1OSSL_RAND_PARAM_STATE\s0\fR) <integer>" 4
  313. .el .IP "``state'' (\fB\s-1OSSL_RAND_PARAM_STATE\s0\fR) <integer>" 4
  314. .IX Item "state (OSSL_RAND_PARAM_STATE) <integer>"
  315. Returns the state of the random number generator.
  316. .ie n .IP """strength"" (\fB\s-1OSSL_RAND_PARAM_STRENGTH\s0\fR) <unsigned integer>" 4
  317. .el .IP "``strength'' (\fB\s-1OSSL_RAND_PARAM_STRENGTH\s0\fR) <unsigned integer>" 4
  318. .IX Item "strength (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>"
  319. Returns the bit strength of the random number generator.
  320. .PP
  321. For rands that are also deterministic random bit generators (DRBGs), these
  322. additional parameters are recognised. Not all
  323. parameters are relevant to, or are understood by all \s-1DRBG\s0 rands:
  324. .ie n .IP """reseed_requests"" (\fB\s-1OSSL_DRBG_PARAM_RESEED_REQUESTS\s0\fR) <unsigned integer>" 4
  325. .el .IP "``reseed_requests'' (\fB\s-1OSSL_DRBG_PARAM_RESEED_REQUESTS\s0\fR) <unsigned integer>" 4
  326. .IX Item "reseed_requests (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>"
  327. Reads or set the number of generate requests before reseeding the
  328. associated \s-1RAND\s0 ctx.
  329. .ie n .IP """reseed_time_interval"" (\fB\s-1OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL\s0\fR) <integer>" 4
  330. .el .IP "``reseed_time_interval'' (\fB\s-1OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL\s0\fR) <integer>" 4
  331. .IX Item "reseed_time_interval (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>"
  332. Reads or set the number of elapsed seconds before reseeding the
  333. associated \s-1RAND\s0 ctx.
  334. .ie n .IP """max_request"" (\fB\s-1OSSL_DRBG_PARAM_RESEED_REQUESTS\s0\fR) <unsigned integer>" 4
  335. .el .IP "``max_request'' (\fB\s-1OSSL_DRBG_PARAM_RESEED_REQUESTS\s0\fR) <unsigned integer>" 4
  336. .IX Item "max_request (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>"
  337. Specifies the maximum number of bytes that can be generated in a single
  338. call to OSSL_FUNC_rand_generate.
  339. .ie n .IP """min_entropylen"" (\fB\s-1OSSL_DRBG_PARAM_MIN_ENTROPYLEN\s0\fR) <unsigned integer>" 4
  340. .el .IP "``min_entropylen'' (\fB\s-1OSSL_DRBG_PARAM_MIN_ENTROPYLEN\s0\fR) <unsigned integer>" 4
  341. .IX Item "min_entropylen (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>"
  342. .PD 0
  343. .ie n .IP """max_entropylen"" (\fB\s-1OSSL_DRBG_PARAM_MAX_ENTROPYLEN\s0\fR) <unsigned integer>" 4
  344. .el .IP "``max_entropylen'' (\fB\s-1OSSL_DRBG_PARAM_MAX_ENTROPYLEN\s0\fR) <unsigned integer>" 4
  345. .IX Item "max_entropylen (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>"
  346. .PD
  347. Specify the minimum and maximum number of bytes of random material that
  348. can be used to seed the \s-1DRBG.\s0
  349. .ie n .IP """min_noncelen"" (\fB\s-1OSSL_DRBG_PARAM_MIN_NONCELEN\s0\fR) <unsigned integer>" 4
  350. .el .IP "``min_noncelen'' (\fB\s-1OSSL_DRBG_PARAM_MIN_NONCELEN\s0\fR) <unsigned integer>" 4
  351. .IX Item "min_noncelen (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>"
  352. .PD 0
  353. .ie n .IP """max_noncelen"" (\fB\s-1OSSL_DRBG_PARAM_MAX_NONCELEN\s0\fR) <unsigned integer>" 4
  354. .el .IP "``max_noncelen'' (\fB\s-1OSSL_DRBG_PARAM_MAX_NONCELEN\s0\fR) <unsigned integer>" 4
  355. .IX Item "max_noncelen (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>"
  356. .PD
  357. Specify the minimum and maximum number of bytes of nonce that can be used to
  358. instantiate the \s-1DRBG.\s0
  359. .ie n .IP """max_perslen"" (\fB\s-1OSSL_DRBG_PARAM_MAX_PERSLEN\s0\fR) <unsigned integer>" 4
  360. .el .IP "``max_perslen'' (\fB\s-1OSSL_DRBG_PARAM_MAX_PERSLEN\s0\fR) <unsigned integer>" 4
  361. .IX Item "max_perslen (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>"
  362. .PD 0
  363. .ie n .IP """max_adinlen"" (\fB\s-1OSSL_DRBG_PARAM_MAX_ADINLEN\s0\fR) <unsigned integer>" 4
  364. .el .IP "``max_adinlen'' (\fB\s-1OSSL_DRBG_PARAM_MAX_ADINLEN\s0\fR) <unsigned integer>" 4
  365. .IX Item "max_adinlen (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>"
  366. .PD
  367. Specify the minimum and maximum number of bytes of personalisation string
  368. that can be used with the \s-1DRBG.\s0
  369. .ie n .IP """reseed_counter"" (\fB\s-1OSSL_DRBG_PARAM_RESEED_COUNTER\s0\fR) <unsigned integer>" 4
  370. .el .IP "``reseed_counter'' (\fB\s-1OSSL_DRBG_PARAM_RESEED_COUNTER\s0\fR) <unsigned integer>" 4
  371. .IX Item "reseed_counter (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>"
  372. Specifies the number of times the \s-1DRBG\s0 has been seeded or reseeded.
  373. .ie n .IP """digest"" (\fB\s-1OSSL_DRBG_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  374. .el .IP "``digest'' (\fB\s-1OSSL_DRBG_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  375. .IX Item "digest (OSSL_DRBG_PARAM_DIGEST) <UTF8 string>"
  376. .PD 0
  377. .ie n .IP """cipher"" (\fB\s-1OSSL_DRBG_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  378. .el .IP "``cipher'' (\fB\s-1OSSL_DRBG_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  379. .IX Item "cipher (OSSL_DRBG_PARAM_CIPHER) <UTF8 string>"
  380. .ie n .IP """mac"" (\fB\s-1OSSL_DRBG_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  381. .el .IP "``mac'' (\fB\s-1OSSL_DRBG_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  382. .IX Item "mac (OSSL_DRBG_PARAM_MAC) <UTF8 string>"
  383. .PD
  384. Sets the name of the underlying cipher, digest or \s-1MAC\s0 to be used.
  385. It must name a suitable algorithm for the \s-1DRBG\s0 that's being used.
  386. .ie n .IP """properties"" (\fB\s-1OSSL_DRBG_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  387. .el .IP "``properties'' (\fB\s-1OSSL_DRBG_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  388. .IX Item "properties (OSSL_DRBG_PARAM_PROPERTIES) <UTF8 string>"
  389. Sets the properties to be queried when trying to fetch an underlying algorithm.
  390. This must be given together with the algorithm naming parameter to be
  391. considered valid.
  392. .SH "RETURN VALUES"
  393. .IX Header "RETURN VALUES"
  394. \&\fBOSSL_FUNC_rand_newctx()\fR should return the newly created
  395. provider side rand context, or \s-1NULL\s0 on failure.
  396. .PP
  397. \&\fBOSSL_FUNC_rand_gettable_params()\fR, \fBOSSL_FUNC_rand_gettable_ctx_params()\fR and
  398. \&\fBOSSL_FUNC_rand_settable_ctx_params()\fR should return a constant \s-1\fBOSSL_PARAM\s0\fR\|(3)
  399. array, or \s-1NULL\s0 if none is offered.
  400. .PP
  401. \&\fBOSSL_FUNC_rand_nonce()\fR returns the size of the generated nonce, or 0 on error.
  402. .PP
  403. \&\fBOSSL_FUNC_rand_get_seed()\fR returns the size of the generated seed, or 0 on
  404. error.
  405. .PP
  406. All of the remaining functions should return 1 for success or 0 on error.
  407. .SH "NOTES"
  408. .IX Header "NOTES"
  409. The \s-1RAND\s0 life-cycle is described in \fBlife_cycle\-rand\fR\|(7). Providers should
  410. ensure that the various transitions listed there are supported. At some point
  411. the \s-1EVP\s0 layer will begin enforcing the listed transitions.
  412. .SH "SEE ALSO"
  413. .IX Header "SEE ALSO"
  414. \&\fBprovider\fR\|(7),
  415. \&\s-1\fBRAND\s0\fR\|(7),
  416. \&\s-1\fBEVP_RAND\s0\fR\|(7),
  417. \&\fBlife_cycle\-rand\fR\|(7),
  418. \&\s-1\fBEVP_RAND\s0\fR\|(3)
  419. .SH "HISTORY"
  420. .IX Header "HISTORY"
  421. The provider \s-1RAND\s0 interface was introduced in OpenSSL 3.0.
  422. .SH "COPYRIGHT"
  423. .IX Header "COPYRIGHT"
  424. Copyright 2020\-2021 The OpenSSL Project Authors. All Rights Reserved.
  425. .PP
  426. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  427. this file except in compliance with the License. You can obtain a copy
  428. in the file \s-1LICENSE\s0 in the source distribution or at
  429. <https://www.openssl.org/source/license.html>.