diff options
Diffstat (limited to 'src/lib/libcrypto/man/DH_generate_parameters.3')
-rw-r--r-- | src/lib/libcrypto/man/DH_generate_parameters.3 | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DH_generate_parameters.3 b/src/lib/libcrypto/man/DH_generate_parameters.3 new file mode 100644 index 0000000000..431ffd634c --- /dev/null +++ b/src/lib/libcrypto/man/DH_generate_parameters.3 | |||
@@ -0,0 +1,125 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DH_GENERATE_PARAMETERS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DH_generate_parameters_ex , | ||
6 | .Nm DH_generate_parameters , | ||
7 | .Nm DH_check | ||
8 | .Nd generate and check Diffie-Hellman parameters | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/dh.h | ||
11 | .Ft int | ||
12 | .Fo DH_generate_parameters_ex | ||
13 | .Fa "DH *dh" | ||
14 | .Fa "int prime_len" | ||
15 | .Fa "int generator" | ||
16 | .Fa "BN_GENCB *cb" | ||
17 | .Fc | ||
18 | .Ft int | ||
19 | .Fo DH_check | ||
20 | .Fa "DH *dh" | ||
21 | .Fa "int *codes" | ||
22 | .Fc | ||
23 | .Pp | ||
24 | Deprecated: | ||
25 | .Pp | ||
26 | .Ft DH * | ||
27 | .Fo DH_generate_parameters | ||
28 | .Fa "int prime_len" | ||
29 | .Fa "int generator" | ||
30 | .Fa "void (*callback)(int" | ||
31 | .Fa int | ||
32 | .Fa "void *)" | ||
33 | .Fa "void *cb_arg" | ||
34 | .Fc | ||
35 | .Sh DESCRIPTION | ||
36 | .Fn DH_generate_parameters_ex | ||
37 | generates Diffie-Hellman parameters that can be shared among a group of | ||
38 | users, and stores them in the provided | ||
39 | .Vt DH | ||
40 | structure. | ||
41 | .Pp | ||
42 | .Fa prime_len | ||
43 | is the length in bits of the safe prime to be generated. | ||
44 | .Fa generator | ||
45 | is a small number > 1, typically 2 or 5. | ||
46 | .Pp | ||
47 | A callback function may be used to provide feedback about the progress | ||
48 | of the key generation. | ||
49 | If | ||
50 | .Fa cb | ||
51 | is not | ||
52 | .Dv NULL , | ||
53 | it will be called as described in | ||
54 | .Xr BN_generate_prime 3 | ||
55 | while a random prime number is generated, and when a prime has been | ||
56 | found, | ||
57 | .Fn BN_GENCB_call cb 3 0 | ||
58 | is called; see | ||
59 | .Xr BN_GENCB_call 3 . | ||
60 | .Pp | ||
61 | .Fn DH_check | ||
62 | validates Diffie-Hellman parameters. | ||
63 | It checks that | ||
64 | .Fa dh->p | ||
65 | is a safe prime, and that | ||
66 | .Fa dh->g | ||
67 | is a suitable generator. | ||
68 | In the case of an error, the bit flags | ||
69 | .Dv DH_CHECK_P_NOT_SAFE_PRIME | ||
70 | or | ||
71 | .Dv DH_NOT_SUITABLE_GENERATOR | ||
72 | are set in | ||
73 | .Pf * Fa codes . | ||
74 | .Dv DH_UNABLE_TO_CHECK_GENERATOR | ||
75 | is set if the generator cannot be checked, i.e. if it does not equal 2 or 5. | ||
76 | .Sh RETURN VALUES | ||
77 | .Fn DH_generate_parameters_ex | ||
78 | and | ||
79 | .Fn DH_check | ||
80 | return 1 if the check could be performed, 0 otherwise. | ||
81 | .Pp | ||
82 | .Fn DH_generate_parameters | ||
83 | (deprecated) returns a pointer to the | ||
84 | .Vt DH | ||
85 | structure, or | ||
86 | .Dv NULL | ||
87 | if the parameter generation fails. | ||
88 | .Pp | ||
89 | The error codes can be obtained by | ||
90 | .Xr ERR_get_error 3 . | ||
91 | .Sh SEE ALSO | ||
92 | .Xr dh 3 , | ||
93 | .Xr DH_free 3 , | ||
94 | .Xr ERR_get_error 3 , | ||
95 | .Xr rand 3 | ||
96 | .Sh HISTORY | ||
97 | .Fn DH_check | ||
98 | is available in all versions of SSLeay and OpenSSL. | ||
99 | The | ||
100 | .Fa cb_arg | ||
101 | argument to | ||
102 | .Fn DH_generate_parameters | ||
103 | was added in SSLeay 0.9.0. | ||
104 | .Pp | ||
105 | In versions before OpenSSL 0.9.5, | ||
106 | .Dv DH_CHECK_P_NOT_STRONG_PRIME | ||
107 | is used instead of | ||
108 | .Dv DH_CHECK_P_NOT_SAFE_PRIME . | ||
109 | .Sh CAVEATS | ||
110 | .Fn DH_generate_parameters_ex | ||
111 | and | ||
112 | .Fn DH_generate_parameters | ||
113 | may run for several hours before finding a suitable prime. | ||
114 | .Pp | ||
115 | The parameters generated by | ||
116 | .Fn DH_generate_parameters_ex | ||
117 | and | ||
118 | .Fn DH_generate_parameters | ||
119 | are not to be used in signature schemes. | ||
120 | .Sh BUGS | ||
121 | If | ||
122 | .Fa generator | ||
123 | is not 2 or 5, | ||
124 | .Fa dh->g Ns = Ns Fa generator | ||
125 | is not a usable generator. | ||