summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/DSA_generate_parameters.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-02 11:57:56 +0000
committerschwarze <>2016-11-02 11:57:56 +0000
commit90c573eba184fe31184d14ce10367f810fa1d417 (patch)
tree62d26e7f75bb451eba292aad57737306b2f28280 /src/lib/libcrypto/man/DSA_generate_parameters.3
parentdb06cab2812484b360f2873ade2dd8277ad08a42 (diff)
downloadopenbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.gz
openbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.bz2
openbsd-90c573eba184fe31184d14ce10367f810fa1d417.zip
convert DSA and EC manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/DSA_generate_parameters.3')
-rw-r--r--src/lib/libcrypto/man/DSA_generate_parameters.3171
1 files changed, 171 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DSA_generate_parameters.3 b/src/lib/libcrypto/man/DSA_generate_parameters.3
new file mode 100644
index 0000000000..1acb85e77a
--- /dev/null
+++ b/src/lib/libcrypto/man/DSA_generate_parameters.3
@@ -0,0 +1,171 @@
1.Dd $Mdocdate: November 2 2016 $
2.Dt DSA_GENERATE_PARAMETERS 3
3.Os
4.Sh NAME
5.Nm DSA_generate_parameters_ex ,
6.Nm DSA_generate_parameters
7.Nd generate DSA parameters
8.Sh SYNOPSIS
9.In openssl/dsa.h
10.Ft int
11.Fo DSA_generate_parameters_ex
12.Fa "DSA *dsa"
13.Fa "int bits"
14.Fa "const unsigned char *seed"
15.Fa "int seed_len"
16.Fa "int *counter_ret"
17.Fa "unsigned long *h_ret"
18.Fa "BN_GENCB *cb"
19.Fc
20.Pp
21Deprecated:
22.Pp
23.Ft DSA *
24.Fo DSA_generate_parameters
25.Fa "int bits"
26.Fa "unsigned char *seed"
27.Fa "int seed_len"
28.Fa "int *counter_ret"
29.Fa "unsigned long *h_ret"
30.Fa "void (*callback)(int, int, void *)"
31.Fa "void *cb_arg"
32.Fc
33.Sh DESCRIPTION
34.Fn DSA_generate_parameters_ex
35generates primes p and q and a generator g for use in the DSA and stores
36the result in
37.Fa dsa .
38.Pp
39.Fa bits
40is the length of the prime to be generated; the DSS allows a maximum of
411024 bits.
42.Pp
43If
44.Fa seed
45is
46.Dv NULL
47or
48.Fa seed_len
49< 20, the primes will be generated at random.
50Otherwise, the seed is used to generate them.
51If the given seed does not yield a prime q, a new random seed is chosen
52and placed at
53.Fa seed .
54.Pp
55.Fn DSA_generate_parameters_ex
56places the iteration count in
57.Pf * Fa counter_ret
58and a counter used for finding a generator in
59.Pf * Fa h_ret ,
60unless these are
61.Dv NULL .
62.Pp
63A callback function may be used to provide feedback about the progress
64of the key generation.
65If
66.Fa cb
67is not
68.Dv NULL ,
69it will be called as shown below.
70For information on the
71.Vt BN_GENCB
72structure, refer to
73.Xr BN_GENCB_call 3 .
74.Bl -bullet
75.It
76When a candidate for q is generated,
77.Fn BN_GENCB_call cb 0 m++
78is called
79.Pf ( Fa m
80is 0 for the first candidate).
81.It
82When a candidate for q has passed a test by trial division,
83.Fn BN_GENCB_call cb 1 -1
84is called.
85While a candidate for q is tested by Miller-Rabin primality tests,
86.Fn BN_GENCB_call cb 1 i
87is called in the outer loop (once for each witness that confirms that
88the candidate may be prime);
89.Fa i
90is the loop counter (starting at 0).
91.It
92When a prime q has been found,
93.Fn BN_GENCB_call cb 2 0
94and
95.Fn BN_GENCB_call cb 3 0
96are called.
97.It
98Before a candidate for p (other than the first) is generated and tested,
99.Fn BN_GENCB_call cb 0 counter
100is called.
101.It
102When a candidate for p has passed the test by trial division,
103.Fn BN_GENCB_call cb 1 -1
104is called.
105While it is tested by the Miller-Rabin primality test,
106.Fn BN_GENCB_call cb 1 i
107is called in the outer loop (once for each witness that confirms that
108the candidate may be prime).
109.Fa i
110is the loop counter (starting at 0).
111.It
112When p has been found,
113.Fn BN_GENCB_call cb 2 1
114is called.
115.It
116When the generator has been found,
117.Fn BN_GENCB_call cb 3 1
118is called.
119.El
120.Pp
121.Fn DSA_generate_parameters
122(deprecated) works in much the same way as for
123.Fn DSA_generate_parameters_ex ,
124except that no
125.Fa dsa
126parameter is passed and instead a newly allocated
127.Vt DSA
128structure is returned.
129Additionally "old style" callbacks are used instead of the newer
130.Vt BN_GENCB
131based approach.
132Refer to
133.Xr BN_generate_prime 3
134for further information.
135.Sh RETURN VALUE
136.Fn DSA_generate_parameters_ex
137returns a 1 on success, or 0 otherwise.
138.Pp
139.Fn DSA_generate_parameters
140returns a pointer to the
141.Vt DSA
142structure, or
143.Dv NULL
144if the parameter generation fails.
145.Pp
146The error codes can be obtained by
147.Xr ERR_get_error 3 .
148.Sh SEE ALSO
149.Xr BN_generate_prime 3 ,
150.Xr dsa 3 ,
151.Xr DSA_free 3 ,
152.Xr ERR_get_error 3 ,
153.Xr rand 3
154.Sh HISTORY
155.Fn DSA_generate_parameters
156appeared in SSLeay 0.8.
157The
158.Fa cb_arg
159argument was added in SSLeay 0.9.0.
160In versions up to OpenSSL 0.9.4,
161.Fn callback 1 ...\&
162was called in the inner loop of the Miller-Rabin test whenever it
163reached the squaring step (the parameters to
164.Fn callback
165did not reveal how many witnesses had been tested); since OpenSSL 0.9.5,
166.Fn callback 1 ...\&
167is called as in
168.Xr BN_is_prime 3 ,
169i.e. once for each witness.
170.Sh BUGS
171Seed lengths > 20 are not supported.