=pod =head1 NAME EVP_RAND-TEST-RAND - The test EVP_RAND implementation =head1 DESCRIPTION Support for a test generator through the B API. This generator is for test purposes only, it does not generate random numbers. =head2 Identity "TEST-RAND" is the name for this implementation; it can be used with the EVP_RAND_fetch() function. =head2 Supported parameters The supported parameters are: =over 4 =item "state" (B) These parameter works as described in L. =item "strength" (B) =item "reseed_requests" (B) =item "reseed_time_interval" (B) =item "max_request" (B) =item "min_entropylen" (B) =item "max_entropylen" (B) =item "min_noncelen" (B) =item "max_noncelen" (B) =item "max_perslen" (B) =item "max_adinlen" (B) =item "reseed_counter" (B) These parameters work as described in L, except that they can all be set as well as read. =item "test_entropy" (B) Sets the bytes returned when the test generator is sent an entropy request. The current position is remembered across generate calls. If there are insufficient data present to satisfy a call, an error is returned. =item "test_nonce" (B) Sets the bytes returned when the test generator is sent a nonce request. Each nonce request will return all of the bytes. =back =head1 NOTES A context for a test generator can be obtained by calling: EVP_RAND *rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL); EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand); =head1 EXAMPLES EVP_RAND *rand; EVP_RAND_CTX *rctx; unsigned char bytes[100]; OSSL_PARAM params[4], *p = params; unsigned char entropy[1000] = { ... }; unsigned char nonce[20] = { ... }; unsigned int strength = 48; rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL); rctx = EVP_RAND_CTX_new(rand, NULL); EVP_RAND_free(rand); *p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength); *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY, entropy, sizeof(entropy)); *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE, nonce, sizeof(nonce)); *p = OSSL_PARAM_construct_end(); EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params); EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0); EVP_RAND_CTX_free(rctx); =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L. =cut