1DH_GENERATE_PARAMETERS(3)           OpenSSL          DH_GENERATE_PARAMETERS(3)
2
3
4

NAME

6       DH_generate_parameters_ex, DH_generate_parameters, DH_check,
7       DH_check_params, DH_check_ex, DH_check_params_ex, DH_check_pub_key_ex -
8       generate and check Diffie-Hellman parameters
9

SYNOPSIS

11        #include <openssl/dh.h>
12
13        int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb);
14
15        int DH_check(DH *dh, int *codes);
16        int DH_check_params(DH *dh, int *codes);
17
18        int DH_check_ex(const DH *dh);
19        int DH_check_params_ex(const DH *dh);
20        int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);
21
22       Deprecated:
23
24        #if OPENSSL_API_COMPAT < 0x00908000L
25        DH *DH_generate_parameters(int prime_len, int generator,
26                                   void (*callback)(int, int, void *), void *cb_arg);
27        #endif
28

DESCRIPTION

30       DH_generate_parameters_ex() generates Diffie-Hellman parameters that
31       can be shared among a group of users, and stores them in the provided
32       DH structure. The pseudo-random number generator must be seeded before
33       calling it.  The parameters generated by DH_generate_parameters_ex()
34       should not be used in signature schemes.
35
36       prime_len is the length in bits of the safe prime to be generated.
37       generator is a small number > 1, typically 2 or 5.
38
39       A callback function may be used to provide feedback about the progress
40       of the key generation. If cb is not NULL, it will be called as
41       described in BN_generate_prime(3) while a random prime number is
42       generated, and when a prime has been found, BN_GENCB_call(cb, 3, 0) is
43       called. See BN_generate_prime_ex(3) for information on the
44       BN_GENCB_call() function.
45
46       DH_generate_parameters() is similar to DH_generate_prime_ex() but
47       expects an old-style callback function; see BN_generate_prime(3) for
48       information on the old-style callback.
49
50       DH_check_params() confirms that the p and g are likely enough to be
51       valid.  This is a lightweight check, if a more thorough check is
52       needed, use DH_check().  The value of *codes is updated with any
53       problems found.  If *codes is zero then no problems were found,
54       otherwise the following bits may be set:
55
56       DH_CHECK_P_NOT_PRIME
57           The parameter p has been determined to not being an odd prime.
58           Note that the lack of this bit doesn't guarantee that p is a prime.
59
60       DH_NOT_SUITABLE_GENERATOR
61           The generator g is not suitable.  Note that the lack of this bit
62           doesn't guarantee that g is suitable, unless p is known to be a
63           strong prime.
64
65       DH_check() confirms that the Diffie-Hellman parameters dh are valid.
66       The value of *codes is updated with any problems found. If *codes is
67       zero then no problems were found, otherwise the following bits may be
68       set:
69
70       DH_CHECK_P_NOT_PRIME
71           The parameter p is not prime.
72
73       DH_CHECK_P_NOT_SAFE_PRIME
74           The parameter p is not a safe prime and no q value is present.
75
76       DH_UNABLE_TO_CHECK_GENERATOR
77           The generator g cannot be checked for suitability.
78
79       DH_NOT_SUITABLE_GENERATOR
80           The generator g is not suitable.
81
82       DH_CHECK_Q_NOT_PRIME
83           The parameter q is not prime.
84
85       DH_CHECK_INVALID_Q_VALUE
86           The parameter q is invalid.
87
88       DH_CHECK_INVALID_J_VALUE
89           The parameter j is invalid.
90
91       DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() are similar
92       to DH_check() and DH_check_params() respectively, but the error reasons
93       are added to the thread's error queue instead of provided as return
94       values from the function.
95

RETURN VALUES

97       DH_generate_parameters_ex(), DH_check() and DH_check_params() return 1
98       if the check could be performed, 0 otherwise.
99
100       DH_generate_parameters() returns a pointer to the DH structure or NULL
101       if the parameter generation fails.
102
103       DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() return 1 if
104       the check is successful, 0 for failed.
105
106       The error codes can be obtained by ERR_get_error(3).
107

SEE ALSO

109       DH_new(3), ERR_get_error(3), RAND_bytes(3), DH_free(3)
110

HISTORY

112       DH_generate_parameters() was deprecated in OpenSSL 0.9.8; use
113       DH_generate_parameters_ex() instead.
114
116       Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
117
118       Licensed under the OpenSSL license (the "License").  You may not use
119       this file except in compliance with the License.  You can obtain a copy
120       in the file LICENSE in the source distribution or at
121       <https://www.openssl.org/source/license.html>.
122
123
124
1251.1.1l                            2021-09-15         DH_GENERATE_PARAMETERS(3)
Impressum