1EVP_RAND-TEST-RAND(7ossl)           OpenSSL          EVP_RAND-TEST-RAND(7ossl)
2
3
4

NAME

6       EVP_RAND-TEST-RAND - The test EVP_RAND implementation
7

DESCRIPTION

9       Support for a test generator through the EVP_RAND API. This generator
10       is for test purposes only, it does not generate random numbers.
11
12   Identity
13       "TEST-RAND" is the name for this implementation; it can be used with
14       the EVP_RAND_fetch() function.
15
16   Supported parameters
17       The supported parameters are:
18
19       "state" (OSSL_RAND_PARAM_STATE) <integer>
20           These parameter works as described in "PARAMETERS" in EVP_RAND(3).
21
22       "strength" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
23       "reseed_requests" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
24       "reseed_time_interval" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
25       "max_request" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
26       "min_entropylen" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
27       "max_entropylen" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
28       "min_noncelen" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
29       "max_noncelen" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
30       "max_perslen" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
31       "max_adinlen" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
32       "reseed_counter" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
33           These parameters work as described in "PARAMETERS" in EVP_RAND(3),
34           except that they can all be set as well as read.
35
36       "test_entropy" (OSSL_RAND_PARAM_TEST_ENTROPY) <octet string>
37           Sets the bytes returned when the test generator is sent an entropy
38           request.  The current position is remembered across generate calls.
39           If there are insufficient data present to satisfy a call, an error
40           is returned.
41
42       "test_nonce" (OSSL_RAND_PARAM_TEST_NONCE) <octet string>
43           Sets the bytes returned when the test generator is sent a nonce
44           request.  Each nonce request will return all of the bytes.
45

NOTES

47       A context for a test generator can be obtained by calling:
48
49        EVP_RAND *rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL);
50        EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);
51

EXAMPLES

53        EVP_RAND *rand;
54        EVP_RAND_CTX *rctx;
55        unsigned char bytes[100];
56        OSSL_PARAM params[4], *p = params;
57        unsigned char entropy[1000] = { ... };
58        unsigned char nonce[20] = { ... };
59        unsigned int strength = 48;
60
61        rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL);
62        rctx = EVP_RAND_CTX_new(rand, NULL);
63        EVP_RAND_free(rand);
64
65        *p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);
66        *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,
67                                                 entropy, sizeof(entropy));
68        *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,
69                                                 nonce, sizeof(nonce));
70        *p = OSSL_PARAM_construct_end();
71        EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
72
73        EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);
74
75        EVP_RAND_CTX_free(rctx);
76

SEE ALSO

78       EVP_RAND(3), "PARAMETERS" in EVP_RAND(3)
79

HISTORY

81       This functionality was added in OpenSSL 3.0.
82
84       Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
85
86       Licensed under the Apache License 2.0 (the "License").  You may not use
87       this file except in compliance with the License.  You can obtain a copy
88       in the file LICENSE in the source distribution or at
89       <https://www.openssl.org/source/license.html>.
90
91
92
933.0.9                             2023-07-27         EVP_RAND-TEST-RAND(7ossl)
Impressum