Debian Codegraph @

upstream/debian-unstable/man3/EVP_RAND.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "EVP_RAND 3SSL"
58 .TH EVP_RAND 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 EVP_RAND, EVP_RAND_fetch, EVP_RAND_free, EVP_RAND_up_ref, EVP_RAND_CTX,
65 EVP_RAND_CTX_new, EVP_RAND_CTX_free, EVP_RAND_CTX_up_ref, EVP_RAND_instantiate,
66 EVP_RAND_uninstantiate, EVP_RAND_generate, EVP_RAND_reseed, EVP_RAND_nonce,
67 EVP_RAND_enable_locking, EVP_RAND_verify_zeroization, EVP_RAND_get_strength,
68 EVP_RAND_get_state,
69 EVP_RAND_get0_provider, EVP_RAND_CTX_get0_rand, EVP_RAND_is_a,
70 EVP_RAND_get0_name, EVP_RAND_names_do_all,
71 EVP_RAND_get0_description,
72 EVP_RAND_CTX_get_params,
73 EVP_RAND_CTX_set_params, EVP_RAND_do_all_provided, EVP_RAND_get_params,
74 EVP_RAND_gettable_ctx_params, EVP_RAND_settable_ctx_params,
75 EVP_RAND_CTX_gettable_params, EVP_RAND_CTX_settable_params,
76 EVP_RAND_gettable_params, EVP_RAND_STATE_UNINITIALISED, EVP_RAND_STATE_READY,
77 EVP_RAND_STATE_ERROR \- EVP RAND routines
78 .SH SYNOPSIS
79 .IX Header "SYNOPSIS"
80 .Vb 1
81 \& #include <openssl/evp.h>
82 \&
83 \& typedef struct evp_rand_st EVP_RAND;
84 \& typedef struct evp_rand_ctx_st EVP_RAND_CTX;
85 \&
86 \& EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
87 \& const char *properties);
88 \& int EVP_RAND_up_ref(EVP_RAND *rand);
89 \& void EVP_RAND_free(EVP_RAND *rand);
90 \& EVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent);
91 \& void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);
92 \& int EVP_RAND_CTX_up_ref(EVP_RAND_CTX *ctx);
93 \& EVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx);
94 \& int EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);
95 \& int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
96 \& int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
97 \& const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);
98 \& const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);
99 \& const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);
100 \& const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx);
101 \& const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx);
102 \& const char *EVP_RAND_get0_name(const EVP_RAND *rand);
103 \& const char *EVP_RAND_get0_description(const EVP_RAND *rand);
104 \& int EVP_RAND_is_a(const EVP_RAND *rand, const char *name);
105 \& const OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand);
106 \& void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,
107 \& void (*fn)(EVP_RAND *rand, void *arg),
108 \& void *arg);
109 \& int EVP_RAND_names_do_all(const EVP_RAND *rand,
110 \& void (*fn)(const char *name, void *data),
111 \& void *data);
112 \&
113 \& int EVP_RAND_instantiate(EVP_RAND_CTX *ctx, unsigned int strength,
114 \& int prediction_resistance,
115 \& const unsigned char *pstr, size_t pstr_len,
116 \& const OSSL_PARAM params[]);
117 \& int EVP_RAND_uninstantiate(EVP_RAND_CTX *ctx);
118 \& int EVP_RAND_generate(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen,
119 \& unsigned int strength, int prediction_resistance,
120 \& const unsigned char *addin, size_t addin_len);
121 \& int EVP_RAND_reseed(EVP_RAND_CTX *ctx, int prediction_resistance,
122 \& const unsigned char *ent, size_t ent_len,
123 \& const unsigned char *addin, size_t addin_len);
124 \& int EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen);
125 \& int EVP_RAND_enable_locking(EVP_RAND_CTX *ctx);
126 \& int EVP_RAND_verify_zeroization(EVP_RAND_CTX *ctx);
127 \& unsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx);
128 \& int EVP_RAND_get_state(EVP_RAND_CTX *ctx);
129 \&
130 \& #define EVP_RAND_STATE_UNINITIALISED 0
131 \& #define EVP_RAND_STATE_READY 1
132 \& #define EVP_RAND_STATE_ERROR 2
133 .Ve
134 .SH DESCRIPTION
135 .IX Header "DESCRIPTION"
136 The EVP RAND routines are a high-level interface to random number generators
137 both deterministic and not.
138 If you just want to generate random bytes then you don't need to use
139 these functions: just call \fBRAND_bytes()\fR or \fBRAND_priv_bytes()\fR.
140 If you want to do more, these calls should be used instead of the older
141 RAND and RAND_DRBG functions.
142 .PP
143 After creating a \fBEVP_RAND_CTX\fR for the required algorithm using
144 \&\fBEVP_RAND_CTX_new()\fR, inputs to the algorithm are supplied either by
145 passing them as part of the \fBEVP_RAND_instantiate()\fR call or using calls to
146 \&\fBEVP_RAND_CTX_set_params()\fR before calling \fBEVP_RAND_instantiate()\fR. Finally,
147 call \fBEVP_RAND_generate()\fR to produce cryptographically secure random bytes.
148 .SS Types
149 .IX Subsection "Types"
150 \&\fBEVP_RAND\fR is a type that holds the implementation of a RAND.
151 .PP
152 \&\fBEVP_RAND_CTX\fR is a context type that holds the algorithm inputs.
153 \&\fBEVP_RAND_CTX\fR structures are reference counted.
154 .SS "Algorithm implementation fetching"
155 .IX Subsection "Algorithm implementation fetching"
156 \&\fBEVP_RAND_fetch()\fR fetches an implementation of a RAND \fIalgorithm\fR, given
157 a library context \fIlibctx\fR and a set of \fIproperties\fR.
158 See "ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for further information.
159 .PP
160 The returned value must eventually be freed with
161 \&\fBEVP_RAND_free\fR\|(3).
162 .PP
163 \&\fBEVP_RAND_up_ref()\fR increments the reference count of an already fetched
164 RAND.
165 .PP
166 \&\fBEVP_RAND_free()\fR frees a fetched algorithm.
167 NULL is a valid parameter, for which this function is a no-op.
168 .SS "Context manipulation functions"
169 .IX Subsection "Context manipulation functions"
170 \&\fBEVP_RAND_CTX_new()\fR creates a new context for the RAND implementation \fIrand\fR.
171 If not NULL, \fIparent\fR specifies the seed source for this implementation.
172 Not all random number generators need to have a seed source specified.
173 If a parent is required, a NULL \fIparent\fR will utilise the operating
174 system entropy sources.
175 It is recommended to minimise the number of random number generators that
176 rely on the operating system for their randomness because this is often scarce.
177 .PP
178 \&\fBEVP_RAND_CTX_free()\fR frees up the context \fIctx\fR. If \fIctx\fR is NULL, nothing
179 is done.
180 .PP
181 \&\fBEVP_RAND_CTX_get0_rand()\fR returns the \fBEVP_RAND\fR associated with the context
182 \&\fIctx\fR.
183 .SS "Random Number Generator Functions"
184 .IX Subsection "Random Number Generator Functions"
185 \&\fBEVP_RAND_instantiate()\fR processes any parameters in \fIparams\fR and
186 then instantiates the RAND \fIctx\fR with a minimum security strength
187 of <strength> and personalisation string \fIpstr\fR of length <pstr_len>.
188 If \fIprediction_resistance\fR is specified, fresh entropy from a live source
189 will be sought. This call operates as per NIST SP 800\-90A and SP 800\-90C.
190 .PP
191 \&\fBEVP_RAND_uninstantiate()\fR uninstantiates the RAND \fIctx\fR as per
192 NIST SP 800\-90A and SP 800\-90C. Subsequent to this call, the RAND cannot
193 be used to generate bytes. It can only be freed or instantiated again.
194 .PP
195 \&\fBEVP_RAND_generate()\fR produces random bytes from the RAND \fIctx\fR with the
196 additional input \fIaddin\fR of length \fIaddin_len\fR. The bytes
197 produced will meet the security \fIstrength\fR.
198 If \fIprediction_resistance\fR is specified, fresh entropy from a live source
199 will be sought. This call operates as per NIST SP 800\-90A and SP 800\-90C.
200 .PP
201 \&\fBEVP_RAND_reseed()\fR reseeds the RAND with new entropy.
202 Entropy \fIent\fR of length \fIent_len\fR bytes can be supplied as can additional
203 input \fIaddin\fR of length \fIaddin_len\fR bytes. In the FIPS provider, both are
204 treated as additional input as per NIST SP\-800\-90Ar1, Sections 9.1 and 9.2.
205 Additional seed material is also drawn from the RAND's parent or the
206 operating system. If \fIprediction_resistance\fR is specified, fresh entropy
207 from a live source will be sought. This call operates as per NIST SP 800\-90A
208 and SP 800\-90C.
209 .PP
210 \&\fBEVP_RAND_nonce()\fR creates a nonce in \fIout\fR of length \fIoutlen\fR
211 bytes from the RAND \fIctx\fR.
212 .PP
213 \&\fBEVP_RAND_enable_locking()\fR enables locking for the RAND \fIctx\fR and all of
214 its parents. After this \fIctx\fR will operate in a thread safe manner, albeit
215 more slowly. This function is not itself thread safe if called with the same
216 \&\fIctx\fR from multiple threads. Typically locking should be enabled before a
217 \&\fIctx\fR is shared across multiple threads.
218 .PP
219 \&\fBEVP_RAND_get_params()\fR retrieves details about the implementation
220 \&\fIrand\fR.
221 The set of parameters given with \fIparams\fR determine exactly what
222 parameters should be retrieved.
223 Note that a parameter that is unknown in the underlying context is
224 simply ignored.
225 .PP
226 \&\fBEVP_RAND_CTX_get_params()\fR retrieves chosen parameters, given the
227 context \fIctx\fR and its underlying context.
228 The set of parameters given with \fIparams\fR determine exactly what
229 parameters should be retrieved.
230 Note that a parameter that is unknown in the underlying context is
231 simply ignored.
232 .PP
233 \&\fBEVP_RAND_CTX_set_params()\fR passes chosen parameters to the underlying
234 context, given a context \fIctx\fR.
235 The set of parameters given with \fIparams\fR determine exactly what
236 parameters are passed down.
237 Note that a parameter that is unknown in the underlying context is
238 simply ignored.
239 Also, what happens when a needed parameter isn't passed down is
240 defined by the implementation.
241 .PP
242 \&\fBEVP_RAND_gettable_params()\fR returns an \fBOSSL_PARAM\fR\|(3) array that describes
243 the retrievable and settable parameters. \fBEVP_RAND_gettable_params()\fR returns
244 parameters that can be used with \fBEVP_RAND_get_params()\fR.
245 .PP
246 \&\fBEVP_RAND_gettable_ctx_params()\fR and \fBEVP_RAND_CTX_gettable_params()\fR return
247 constant \fBOSSL_PARAM\fR\|(3) arrays that describe the retrievable parameters that
248 can be used with \fBEVP_RAND_CTX_get_params()\fR. \fBEVP_RAND_gettable_ctx_params()\fR
249 returns the parameters that can be retrieved from the algorithm, whereas
250 \&\fBEVP_RAND_CTX_gettable_params()\fR returns the parameters that can be retrieved
251 in the context's current state.
252 .PP
253 \&\fBEVP_RAND_settable_ctx_params()\fR and \fBEVP_RAND_CTX_settable_params()\fR return
254 constant \fBOSSL_PARAM\fR\|(3) arrays that describe the settable parameters that
255 can be used with \fBEVP_RAND_CTX_set_params()\fR. \fBEVP_RAND_settable_ctx_params()\fR
256 returns the parameters that can be retrieved from the algorithm, whereas
257 \&\fBEVP_RAND_CTX_settable_params()\fR returns the parameters that can be retrieved
258 in the context's current state.
259 .SS "Information functions"
260 .IX Subsection "Information functions"
261 \&\fBEVP_RAND_get_strength()\fR returns the security strength of the RAND \fIctx\fR.
262 .PP
263 \&\fBEVP_RAND_get_state()\fR returns the current state of the RAND \fIctx\fR.
264 States defined by the OpenSSL RNGs are:
265 .IP \(bu 4
266 EVP_RAND_STATE_UNINITIALISED: this RNG is currently uninitialised.
267 The instantiate call will change this to the ready state.
268 .IP \(bu 4
269 EVP_RAND_STATE_READY: this RNG is currently ready to generate output.
270 .IP \(bu 4
271 EVP_RAND_STATE_ERROR: this RNG is in an error state.
272 .PP
273 \&\fBEVP_RAND_is_a()\fR returns 1 if \fIrand\fR is an implementation of an
274 algorithm that's identifiable with \fIname\fR, otherwise 0.
275 .PP
276 \&\fBEVP_RAND_get0_provider()\fR returns the provider that holds the implementation
277 of the given \fIrand\fR.
278 .PP
279 \&\fBEVP_RAND_do_all_provided()\fR traverses all RAND implemented by all activated
280 providers in the given library context \fIlibctx\fR, and for each of the
281 implementations, calls the given function \fIfn\fR with the implementation method
282 and the given \fIarg\fR as argument.
283 .PP
284 \&\fBEVP_RAND_get0_name()\fR returns the canonical name of \fIrand\fR.
285 .PP
286 \&\fBEVP_RAND_names_do_all()\fR traverses all names for \fIrand\fR, and calls
287 \&\fIfn\fR with each name and \fIdata\fR.
288 .PP
289 \&\fBEVP_RAND_get0_description()\fR returns a description of the rand, meant for
290 display and human consumption. The description is at the discretion of
291 the rand implementation.
292 .PP
293 \&\fBEVP_RAND_verify_zeroization()\fR confirms if the internal DRBG state is
294 currently zeroed. This is used by the FIPS provider to support the mandatory
295 self tests.
296 .SH PARAMETERS
297 .IX Header "PARAMETERS"
298 The standard parameter names are:
299 .IP """state"" (\fBOSSL_RAND_PARAM_STATE\fR) <integer>" 4
300 .IX Item """state"" (OSSL_RAND_PARAM_STATE) <integer>"
301 Returns the state of the random number generator.
302 .IP """strength"" (\fBOSSL_RAND_PARAM_STRENGTH\fR) <unsigned integer>" 4
303 .IX Item """strength"" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>"
304 Returns the bit strength of the random number generator.
305 .IP """fips-indicator"" (\fBOSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
306 .IX Item """fips-indicator"" (OSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
307 A getter that returns 1 if the operation is FIPS approved, or 0 otherwise.
308 This option is used by the OpenSSL FIPS provider and is not supported
309 by all EVP_RAND sources.
310 .PP
311 For rands that are also deterministic random bit generators (DRBGs), these
312 additional parameters are recognised. Not all
313 parameters are relevant to, or are understood by all DRBG rands:
314 .IP """reseed_requests"" (\fBOSSL_DRBG_PARAM_RESEED_REQUESTS\fR) <unsigned integer>" 4
315 .IX Item """reseed_requests"" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>"
316 Reads or set the number of generate requests before reseeding the
317 associated RAND ctx.
318 .IP """reseed_time_interval"" (\fBOSSL_DRBG_PARAM_RESEED_TIME_INTERVAL\fR) <integer>" 4
319 .IX Item """reseed_time_interval"" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>"
320 Reads or set the number of elapsed seconds before reseeding the
321 associated RAND ctx.
322 .IP """max_request"" (\fBOSSL_RAND_PARAM_MAX_REQUEST\fR) <unsigned integer>" 4
323 .IX Item """max_request"" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>"
324 Specifies the maximum number of bytes that can be generated in a single
325 call to OSSL_FUNC_rand_generate.
326 .IP """min_entropylen"" (\fBOSSL_DRBG_PARAM_MIN_ENTROPYLEN\fR) <unsigned integer>" 4
327 .IX Item """min_entropylen"" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>"
328 .PD 0
329 .IP """max_entropylen"" (\fBOSSL_DRBG_PARAM_MAX_ENTROPYLEN\fR) <unsigned integer>" 4
330 .IX Item """max_entropylen"" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>"
331 .PD
332 Specify the minimum and maximum number of bytes of random material that
333 can be used to seed the DRBG.
334 .IP """min_noncelen"" (\fBOSSL_DRBG_PARAM_MIN_NONCELEN\fR) <unsigned integer>" 4
335 .IX Item """min_noncelen"" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>"
336 .PD 0
337 .IP """max_noncelen"" (\fBOSSL_DRBG_PARAM_MAX_NONCELEN\fR) <unsigned integer>" 4
338 .IX Item """max_noncelen"" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>"
339 .PD
340 Specify the minimum and maximum number of bytes of nonce that can be used to
341 seed the DRBG.
342 .IP """max_perslen"" (\fBOSSL_DRBG_PARAM_MAX_PERSLEN\fR) <unsigned integer>" 4
343 .IX Item """max_perslen"" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>"
344 .PD 0
345 .IP """max_adinlen"" (\fBOSSL_DRBG_PARAM_MAX_ADINLEN\fR) <unsigned integer>" 4
346 .IX Item """max_adinlen"" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>"
347 .PD
348 Specify the minimum and maximum number of bytes of personalisation string
349 that can be used with the DRBG.
350 .IP """reseed_counter"" (\fBOSSL_DRBG_PARAM_RESEED_COUNTER\fR) <unsigned integer>" 4
351 .IX Item """reseed_counter"" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>"
352 Specifies the number of times the DRBG has been seeded or reseeded.
353 .IP """properties"" (\fBOSSL_RAND_PARAM_PROPERTIES\fR) <UTF8 string>" 4
354 .IX Item """properties"" (OSSL_RAND_PARAM_PROPERTIES) <UTF8 string>"
355 .PD 0
356 .IP """mac"" (\fBOSSL_RAND_PARAM_MAC\fR) <UTF8 string>" 4
357 .IX Item """mac"" (OSSL_RAND_PARAM_MAC) <UTF8 string>"
358 .IP """digest"" (\fBOSSL_RAND_PARAM_DIGEST\fR) <UTF8 string>" 4
359 .IX Item """digest"" (OSSL_RAND_PARAM_DIGEST) <UTF8 string>"
360 .IP """cipher"" (\fBOSSL_RAND_PARAM_CIPHER\fR) <UTF8 string>" 4
361 .IX Item """cipher"" (OSSL_RAND_PARAM_CIPHER) <UTF8 string>"
362 .PD
363 For RAND implementations that use an underlying computation MAC, digest or
364 cipher, these parameters set what the algorithm should be.
365 .Sp
366 The value is always the name of the intended algorithm,
367 or the properties in the case of \fBOSSL_RAND_PARAM_PROPERTIES\fR.
368 .SH NOTES
369 .IX Header "NOTES"
370 The use of a nonzero value for the \fIprediction_resistance\fR argument to
371 \&\fBEVP_RAND_instantiate()\fR, \fBEVP_RAND_generate()\fR or \fBEVP_RAND_reseed()\fR should
372 be used sparingly. In the default setup, this will cause all public and
373 private DRBGs to be reseeded on next use. Since, by default, public and
374 private DRBGs are allocated on a per thread basis, this can result in
375 significant overhead for highly multi-threaded applications. For normal
376 use-cases, the default "reseed_requests" and "reseed_time_interval"
377 thresholds ensure sufficient prediction resistance over time and you
378 can reduce those values if you think they are too high. Explicitly
379 requesting prediction resistance is intended for more special use-cases
380 like generating long-term secrets.
381 .PP
382 An \fBEVP_RAND_CTX\fR needs to have locking enabled if it acts as the parent of
383 more than one child and the children can be accessed concurrently. This must
384 be done by explicitly calling \fBEVP_RAND_enable_locking()\fR.
385 .PP
386 The RAND life-cycle is described in \fBlife_cycle\-rand\fR\|(7). In the future,
387 the transitions described there will be enforced. When this is done, it will
388 not be considered a breaking change to the API.
389 .SH "RETURN VALUES"
390 .IX Header "RETURN VALUES"
391 \&\fBEVP_RAND_fetch()\fR returns a pointer to a newly fetched \fBEVP_RAND\fR, or
392 NULL if allocation failed.
393 .PP
394 \&\fBEVP_RAND_get0_provider()\fR returns a pointer to the provider for the RAND, or
395 NULL on error.
396 .PP
397 \&\fBEVP_RAND_CTX_get0_rand()\fR returns a pointer to the \fBEVP_RAND\fR associated
398 with the context.
399 .PP
400 \&\fBEVP_RAND_get0_name()\fR returns the name of the random number generation
401 algorithm.
402 .PP
403 \&\fBEVP_RAND_up_ref()\fR returns 1 on success, 0 on error.
404 .PP
405 \&\fBEVP_RAND_names_do_all()\fR returns 1 if the callback was called for all names. A
406 return value of 0 means that the callback was not called for any names.
407 .PP
408 \&\fBEVP_RAND_CTX_new()\fR returns either the newly allocated
409 \&\fBEVP_RAND_CTX\fR structure or NULL if an error occurred.
410 .PP
411 \&\fBEVP_RAND_CTX_free()\fR does not return a value.
412 .PP
413 \&\fBEVP_RAND_CTX_up_ref()\fR returns 1 on success, 0 on error.
414 .PP
415 \&\fBEVP_RAND_nonce()\fR returns 1 on success, 0 on error.
416 .PP
417 \&\fBEVP_RAND_get_strength()\fR returns the strength of the random number generator
418 in bits.
419 .PP
420 \&\fBEVP_RAND_gettable_params()\fR, \fBEVP_RAND_gettable_ctx_params()\fR and
421 \&\fBEVP_RAND_settable_ctx_params()\fR return an array of OSSL_PARAMs.
422 .PP
423 \&\fBEVP_RAND_verify_zeroization()\fR returns 1 if the internal DRBG state is
424 currently zeroed, and 0 if not.
425 .PP
426 The remaining functions return 1 for success and 0 or a negative value for
427 failure.
428 .SH "SEE ALSO"
429 .IX Header "SEE ALSO"
430 \&\fBRAND_bytes\fR\|(3),
431 \&\fBEVP_RAND\-CTR\-DRBG\fR\|(7),
432 \&\fBEVP_RAND\-HASH\-DRBG\fR\|(7),
433 \&\fBEVP_RAND\-HMAC\-DRBG\fR\|(7),
434 \&\fBEVP_RAND\-TEST\-RAND\fR\|(7),
435 \&\fBprovider\-rand\fR\|(7),
436 \&\fBlife_cycle\-rand\fR\|(7)
437 .SH HISTORY
438 .IX Header "HISTORY"
439 \&\fBEVP_RAND_CTX_up_ref()\fR was added in OpenSSL 3.1.
440 .PP
441 The remaining functions were added in OpenSSL 3.0.
442 .SH COPYRIGHT
443 .IX Header "COPYRIGHT"
444 Copyright 2020\-2025 The OpenSSL Project Authors. All Rights Reserved.
445 .PP
446 Licensed under the Apache License 2.0 (the "License"). You may not use
447 this file except in compliance with the License. You can obtain a copy
448 in the file LICENSE in the source distribution or at
449 <https://www.openssl.org/source/license.html>.