DH_generate_parameters.3 revision 296465
Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "DH_generate_parameters 3"
DH_generate_parameters 3 "2015-12-03" "0.9.8zh" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
DH_generate_parameters, DH_check - generate and check Diffie-Hellman parameters
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/dh.h> \& DH *DH_generate_parameters(int prime_len, int generator, void (*callback)(int, int, void *), void *cb_arg); \& int DH_check(DH *dh, int *codes); .Ve
"DESCRIPTION"
Header "DESCRIPTION" \fIDH_generate_parameters() generates Diffie-Hellman parameters that can be shared among a group of users, and returns them in a newly allocated \s-1DH\s0 structure. The pseudo-random number generator must be seeded prior to calling DH_generate_parameters().

\fBprime_len is the length in bits of the safe prime to be generated. \fBgenerator is a small number > 1, typically 2 or 5.

A callback function may be used to provide feedback about the progress of the key generation. If callback is not \s-1NULL\s0, it will be called as described in BN_generate_prime\|(3) while a random prime number is generated, and when a prime has been found, callback(3, 0, cb_arg) is called.

\fIDH_check() validates Diffie-Hellman parameters. It checks that p is a safe prime, and that g is a suitable generator. In the case of an error, the bit flags \s-1DH_CHECK_P_NOT_SAFE_PRIME\s0 or \s-1DH_NOT_SUITABLE_GENERATOR\s0 are set in *codes. \s-1DH_UNABLE_TO_CHECK_GENERATOR\s0 is set if the generator cannot be checked, i.e. it does not equal 2 or 5.

"RETURN VALUES"
Header "RETURN VALUES" \fIDH_generate_parameters() returns a pointer to the \s-1DH\s0 structure, or \s-1NULL\s0 if the parameter generation fails. The error codes can be obtained by ERR_get_error\|(3).

\fIDH_check() returns 1 if the check could be performed, 0 otherwise.

"NOTES"
Header "NOTES" \fIDH_generate_parameters() may run for several hours before finding a suitable prime.

The parameters generated by DH_generate_parameters() are not to be used in signature schemes.

"BUGS"
Header "BUGS" If generator is not 2 or 5, dh->g=generator is not a usable generator.
"SEE ALSO"
Header "SEE ALSO" \fIdh\|(3), ERR_get_error\|(3), rand\|(3), \fIDH_free\|(3)
"HISTORY"
Header "HISTORY" \fIDH_check() is available in all versions of SSLeay and OpenSSL. The cb_arg argument to DH_generate_parameters() was added in SSLeay 0.9.0.

In versions before OpenSSL 0.9.5, \s-1DH_CHECK_P_NOT_STRONG_PRIME\s0 is used instead of \s-1DH_CHECK_P_NOT_SAFE_PRIME.\s0