VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.7/doc/man7/EVP_RAND-TEST-RAND.pod@ 107278

最後變更 在這個檔案從107278是 104078,由 vboxsync 提交於 11 月 前

openssl-3.1.5: Applied and adjusted our OpenSSL changes to 3.1.4. bugref:10638

檔案大小: 3.7 KB
 
1=pod
2
3=head1 NAME
4
5EVP_RAND-TEST-RAND - The test EVP_RAND implementation
6
7=head1 DESCRIPTION
8
9Support for a test generator through the B<EVP_RAND> API. This generator is
10for test purposes only, it does not generate random numbers.
11
12=head2 Identity
13
14"TEST-RAND" is the name for this implementation; it can be used with the
15EVP_RAND_fetch() function.
16
17=head2 Supported parameters
18
19The supported parameters are:
20
21=over 4
22
23=item "state" (B<OSSL_RAND_PARAM_STATE>) <integer>
24
25These parameter works as described in L<EVP_RAND(3)/PARAMETERS>.
26
27=item "strength" (B<OSSL_RAND_PARAM_STRENGTH>) <unsigned integer>
28
29=item "reseed_requests" (B<OSSL_DRBG_PARAM_RESEED_REQUESTS>) <unsigned integer>
30
31=item "reseed_time_interval" (B<OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL>) <integer>
32
33=item "max_request" (B<OSSL_DRBG_PARAM_RESEED_REQUESTS>) <unsigned integer>
34
35=item "min_entropylen" (B<OSSL_DRBG_PARAM_MIN_ENTROPYLEN>) <unsigned integer>
36
37=item "max_entropylen" (B<OSSL_DRBG_PARAM_MAX_ENTROPYLEN>) <unsigned integer>
38
39=item "min_noncelen" (B<OSSL_DRBG_PARAM_MIN_NONCELEN>) <unsigned integer>
40
41=item "max_noncelen" (B<OSSL_DRBG_PARAM_MAX_NONCELEN>) <unsigned integer>
42
43=item "max_perslen" (B<OSSL_DRBG_PARAM_MAX_PERSLEN>) <unsigned integer>
44
45=item "max_adinlen" (B<OSSL_DRBG_PARAM_MAX_ADINLEN>) <unsigned integer>
46
47=item "reseed_counter" (B<OSSL_DRBG_PARAM_RESEED_COUNTER>) <unsigned integer>
48
49These parameters work as described in L<EVP_RAND(3)/PARAMETERS>, except that
50they can all be set as well as read.
51
52=item "test_entropy" (B<OSSL_RAND_PARAM_TEST_ENTROPY>) <octet string>
53
54Sets the bytes returned when the test generator is sent an entropy request.
55The current position is remembered across generate calls.
56If there are insufficient data present to satisfy a call, an error is returned.
57
58=item "test_nonce" (B<OSSL_RAND_PARAM_TEST_NONCE>) <octet string>
59
60Sets the bytes returned when the test generator is sent a nonce request.
61Each nonce request will return all of the bytes.
62
63=item "generate" (B<OSSL_RAND_PARAM_GENERATE>) <integer>
64
65If this parameter is zero, it will only emit the nonce and entropy data
66supplied via the aforementioned parameters. Otherwise, low quality
67non-cryptographic pseudorandom output is produced. This parameter defaults
68to zero.
69
70=back
71
72=head1 NOTES
73
74A context for a test generator can be obtained by calling:
75
76 EVP_RAND *rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL);
77 EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);
78
79=head1 EXAMPLES
80
81 EVP_RAND *rand;
82 EVP_RAND_CTX *rctx;
83 unsigned char bytes[100];
84 OSSL_PARAM params[4], *p = params;
85 unsigned char entropy[1000] = { ... };
86 unsigned char nonce[20] = { ... };
87 unsigned int strength = 48;
88
89 rand = EVP_RAND_fetch(NULL, "TEST-RAND", NULL);
90 rctx = EVP_RAND_CTX_new(rand, NULL);
91 EVP_RAND_free(rand);
92
93 *p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);
94 *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,
95 entropy, sizeof(entropy));
96 *p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,
97 nonce, sizeof(nonce));
98 *p = OSSL_PARAM_construct_end();
99 EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
100
101 EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);
102
103 EVP_RAND_CTX_free(rctx);
104
105=head1 SEE ALSO
106
107L<EVP_RAND(3)>,
108L<EVP_RAND(3)/PARAMETERS>
109
110=head1 HISTORY
111
112This functionality was added in OpenSSL 3.0.
113
114=head1 COPYRIGHT
115
116Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
117
118Licensed under the Apache License 2.0 (the "License"). You may not use
119this file except in compliance with the License. You can obtain a copy
120in the file LICENSE in the source distribution or at
121L<https://www.openssl.org/source/license.html>.
122
123=cut
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette