1EVP_RAND-SEED-SRC(7ossl)            OpenSSL           EVP_RAND-SEED-SRC(7ossl)
2
3
4

NAME

6       EVP_RAND-SEED-SRC - The randomness seed source EVP_RAND implementation
7

DESCRIPTION

9       Support for deterministic random number generator seeding through the
10       EVP_RAND API.
11
12       The seed sources used are specified at the time OpenSSL is configured
13       for building using the --with-rand-seed= option.  By default, operating
14       system randomness sources are used.
15
16   Identity
17       "SEED-SRC" is the name for this implementation; it can be used with the
18       EVP_RAND_fetch() function.
19
20   Supported parameters
21       The supported parameters are:
22
23       "state" (OSSL_RAND_PARAM_STATE) <integer>
24       "strength" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
25       "max_request" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
26           These parameters work as described in "PARAMETERS" in EVP_RAND(3).
27

NOTES

29       A context for the seed source can be obtained by calling:
30
31        EVP_RAND *rand = EVP_RAND_fetch(NULL, "SEED-SRC", NULL);
32        EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);
33

EXAMPLES

35        EVP_RAND *rand;
36        EVP_RAND_CTX *seed, *rctx;
37        unsigned char bytes[100];
38        OSSL_PARAM params[2], *p = params;
39        unsigned int strength = 128;
40
41        /* Create a seed source */
42        rand = EVP_RAND_fetch(NULL, "SEED-SRC", NULL);
43        seed = EVP_RAND_CTX_new(rand, NULL);
44        EVP_RAND_free(rand);
45
46        /* Feed this into a DRBG */
47        rand = EVP_RAND_fetch(NULL, "CTR-DRBG", NULL);
48        rctx = EVP_RAND_CTX_new(rand, seed);
49        EVP_RAND_free(rand);
50
51        /* Configure the DRBG */
52        *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
53                                                SN_aes_256_ctr, 0);
54        *p = OSSL_PARAM_construct_end();
55        EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
56
57        EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);
58
59        EVP_RAND_CTX_free(rctx);
60        EVP_RAND_CTX_free(seed);
61

SEE ALSO

63       EVP_RAND(3), "PARAMETERS" in EVP_RAND(3)
64
66       Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
67
68       Licensed under the Apache License 2.0 (the "License").  You may not use
69       this file except in compliance with the License.  You can obtain a copy
70       in the file LICENSE in the source distribution or at
71       <https://www.openssl.org/source/license.html>.
72
73
74
753.0.5                             2022-11-01          EVP_RAND-SEED-SRC(7ossl)
Impressum