1DSA_GENERATE_PARAMETERS(3)          OpenSSL         DSA_GENERATE_PARAMETERS(3)
2
3
4

NAME

6       DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA
7       parameters
8

SYNOPSIS

10        #include <openssl/dsa.h>
11
12        int DSA_generate_parameters_ex(DSA *dsa, int bits,
13                                       const unsigned char *seed, int seed_len,
14                                       int *counter_ret, unsigned long *h_ret,
15                                       BN_GENCB *cb);
16
17       Deprecated:
18
19        #if OPENSSL_API_COMPAT < 0x00908000L
20        DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len,
21                                     int *counter_ret, unsigned long *h_ret,
22                                     void (*callback)(int, int, void *), void *cb_arg);
23        #endif
24

DESCRIPTION

26       DSA_generate_parameters_ex() generates primes p and q and a generator g
27       for use in the DSA and stores the result in dsa.
28
29       bits is the length of the prime p to be generated.  For lengths under
30       2048 bits, the length of q is 160 bits; for lengths greater than or
31       equal to 2048 bits, the length of q is set to 256 bits.
32
33       If seed is NULL, or it does not generate primes, the primes will be
34       generated at random.  If seed_len is less than the length of q, an
35       error is returned if old DSA parameter generation method is used as a
36       backend.
37
38       DSA_generate_parameters_ex() places the iteration count in *counter_ret
39       and a counter used for finding a generator in *h_ret, unless these are
40       NULL.
41
42       A callback function may be used to provide feedback about the progress
43       of the key generation. If cb is not NULL, it will be called as shown
44       below. For information on the BN_GENCB structure and the BN_GENCB_call
45       function discussed below, refer to BN_generate_prime(3).
46
47       DSA_generate_prime() is similar to DSA_generate_prime_ex() but expects
48       an old-style callback function; see BN_generate_prime(3) for
49       information on the old-style callback.
50
51       · When a candidate for q is generated, BN_GENCB_call(cb, 0, m++) is
52         called (m is 0 for the first candidate).
53
54       · When a candidate for q has passed a test by trial division,
55         BN_GENCB_call(cb, 1, -1) is called.  While a candidate for q is
56         tested by Miller-Rabin primality tests, BN_GENCB_call(cb, 1, i) is
57         called in the outer loop (once for each witness that confirms that
58         the candidate may be prime); i is the loop counter (starting at 0).
59
60       · When a prime q has been found, BN_GENCB_call(cb, 2, 0) and
61         BN_GENCB_call(cb, 3, 0) are called.
62
63       · Before a candidate for p (other than the first) is generated and
64         tested, BN_GENCB_call(cb, 0, counter) is called.
65
66       · When a candidate for p has passed the test by trial division,
67         BN_GENCB_call(cb, 1, -1) is called.  While it is tested by the
68         Miller-Rabin primality test, BN_GENCB_call(cb, 1, i) is called in the
69         outer loop (once for each witness that confirms that the candidate
70         may be prime).  i is the loop counter (starting at 0).
71
72       · When p has been found, BN_GENCB_call(cb, 2, 1) is called.
73
74       · When the generator has been found, BN_GENCB_call(cb, 3, 1) is called.
75

RETURN VALUES

77       DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise.
78       The error codes can be obtained by ERR_get_error(3).
79
80       DSA_generate_parameters() returns a pointer to the DSA structure or
81       NULL if the parameter generation fails.
82

BUGS

84       Seed lengths greater than 20 are not supported.
85

SEE ALSO

87       DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_free(3),
88       BN_generate_prime(3)
89

HISTORY

91       DSA_generate_parameters() was deprecated in OpenSSL 0.9.8; use
92       DSA_generate_parameters_ex() instead.
93
95       Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
96
97       Licensed under the OpenSSL license (the "License").  You may not use
98       this file except in compliance with the License.  You can obtain a copy
99       in the file LICENSE in the source distribution or at
100       <https://www.openssl.org/source/license.html>.
101
102
103
1041.1.1g                            2020-04-23        DSA_GENERATE_PARAMETERS(3)
Impressum