xref: /freebsd/share/man/man5/moduli.5 (revision 37e28b851653ac098179f3a56956e5f27f5acba7)
1*37e28b85SXin LI.\"	$OpenBSD: moduli.5,v 1.16 2011/11/28 08:46:27 eric Exp $
2323b03c5SDag-Erling Smørgrav.\"
3*37e28b85SXin LI.\" Copyright (c) 2008 Damien Miller <djm@mindrot.org>
4323b03c5SDag-Erling Smørgrav.\"
5*37e28b85SXin LI.\" Permission to use, copy, modify, and distribute this software for any
6*37e28b85SXin LI.\" purpose with or without fee is hereby granted, provided that the above
7*37e28b85SXin LI.\" copyright notice and this permission notice appear in all copies.
8323b03c5SDag-Erling Smørgrav.\"
9*37e28b85SXin LI.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*37e28b85SXin LI.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*37e28b85SXin LI.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*37e28b85SXin LI.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*37e28b85SXin LI.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*37e28b85SXin LI.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*37e28b85SXin LI.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16323b03c5SDag-Erling Smørgrav.\"
17e4731543SRuslan Ermilov.\" $FreeBSD$
18323b03c5SDag-Erling Smørgrav.\"
19*37e28b85SXin LI.Dd July 19, 2012
20323b03c5SDag-Erling Smørgrav.Dt MODULI 5
21323b03c5SDag-Erling Smørgrav.Os
22323b03c5SDag-Erling Smørgrav.Sh NAME
23323b03c5SDag-Erling Smørgrav.Nm moduli
24*37e28b85SXin LI.Nd Diffie-Hellman moduli
25323b03c5SDag-Erling Smørgrav.Sh DESCRIPTION
26323b03c5SDag-Erling SmørgravThe
27*37e28b85SXin LI.Pa /etc/ssh/moduli
28*37e28b85SXin LIfile contains prime numbers and generators for use by
29*37e28b85SXin LI.Xr sshd 8
30*37e28b85SXin LIin the Diffie-Hellman Group Exchange key exchange method.
31*37e28b85SXin LI.Pp
32*37e28b85SXin LINew moduli may be generated with
33*37e28b85SXin LI.Xr ssh-keygen 1
34*37e28b85SXin LIusing a two-step process.
35*37e28b85SXin LIAn initial
36*37e28b85SXin LI.Em candidate generation
37*37e28b85SXin LIpass, using
38*37e28b85SXin LI.Ic ssh-keygen -G ,
39*37e28b85SXin LIcalculates numbers that are likely to be useful.
40*37e28b85SXin LIA second
41*37e28b85SXin LI.Em primality testing
42*37e28b85SXin LIpass, using
43*37e28b85SXin LI.Ic ssh-keygen -T ,
44*37e28b85SXin LIprovides a high degree of assurance that the numbers are prime and are
45*37e28b85SXin LIsafe for use in Diffie-Hellman operations by
46*37e28b85SXin LI.Xr sshd 8 .
47*37e28b85SXin LIThis
48e4731543SRuslan Ermilov.Nm
49*37e28b85SXin LIformat is used as the output from each pass.
50*37e28b85SXin LI.Pp
51*37e28b85SXin LIThe file consists of newline-separated records, one per modulus,
52*37e28b85SXin LIcontaining seven space-separated fields.
53*37e28b85SXin LIThese fields are as follows:
54*37e28b85SXin LI.Bl -tag -width Description -offset indent
55*37e28b85SXin LI.It timestamp
56*37e28b85SXin LIThe time that the modulus was last processed as YYYYMMDDHHMMSS.
57*37e28b85SXin LI.It type
58*37e28b85SXin LIDecimal number specifying the internal structure of the prime modulus.
59*37e28b85SXin LISupported types are:
60*37e28b85SXin LI.Pp
61*37e28b85SXin LI.Bl -tag -width 0x00 -compact
62*37e28b85SXin LI.It 0
63*37e28b85SXin LIUnknown, not tested.
64*37e28b85SXin LI.It 2
65*37e28b85SXin LI"Safe" prime; (p-1)/2 is also prime.
66*37e28b85SXin LI.It 4
67*37e28b85SXin LISophie Germain; 2p+1 is also prime.
68*37e28b85SXin LI.El
69*37e28b85SXin LI.Pp
70*37e28b85SXin LIModuli candidates initially produced by
71*37e28b85SXin LI.Xr ssh-keygen 1
72*37e28b85SXin LIare Sophie Germain primes (type 4).
73*37e28b85SXin LIFurther primality testing with
74*37e28b85SXin LI.Xr ssh-keygen 1
75*37e28b85SXin LIproduces safe prime moduli (type 2) that are ready for use in
76*37e28b85SXin LI.Xr sshd 8 .
77*37e28b85SXin LIOther types are not used by OpenSSH.
78*37e28b85SXin LI.It tests
79*37e28b85SXin LIDecimal number indicating the type of primality tests that the number
80*37e28b85SXin LIhas been subjected to represented as a bitmask of the following values:
81*37e28b85SXin LI.Pp
82*37e28b85SXin LI.Bl -tag -width 0x00 -compact
83*37e28b85SXin LI.It 0x00
84*37e28b85SXin LINot tested.
85*37e28b85SXin LI.It 0x01
86*37e28b85SXin LIComposite number \(en not prime.
87*37e28b85SXin LI.It 0x02
88*37e28b85SXin LISieve of Eratosthenes.
89*37e28b85SXin LI.It 0x04
90*37e28b85SXin LIProbabilistic Miller-Rabin primality tests.
91*37e28b85SXin LI.El
92*37e28b85SXin LI.Pp
93*37e28b85SXin LIThe
94*37e28b85SXin LI.Xr ssh-keygen 1
95*37e28b85SXin LImoduli candidate generation uses the Sieve of Eratosthenes (flag 0x02).
96*37e28b85SXin LISubsequent
97*37e28b85SXin LI.Xr ssh-keygen 1
98*37e28b85SXin LIprimality tests are Miller-Rabin tests (flag 0x04).
99*37e28b85SXin LI.It trials
100*37e28b85SXin LIDecimal number indicating the number of primality trials
101*37e28b85SXin LIthat have been performed on the modulus.
102*37e28b85SXin LI.It size
103*37e28b85SXin LIDecimal number indicating the size of the prime in bits.
104*37e28b85SXin LI.It generator
105*37e28b85SXin LIThe recommended generator for use with this modulus (hexadecimal).
106*37e28b85SXin LI.It modulus
107*37e28b85SXin LIThe modulus itself in hexadecimal.
108*37e28b85SXin LI.El
109*37e28b85SXin LI.Pp
110*37e28b85SXin LIWhen performing Diffie-Hellman Group Exchange,
111323b03c5SDag-Erling Smørgrav.Xr sshd 8
112*37e28b85SXin LIfirst estimates the size of the modulus required to produce enough
113*37e28b85SXin LIDiffie-Hellman output to sufficiently key the selected symmetric cipher.
114*37e28b85SXin LI.Xr sshd 8
115*37e28b85SXin LIthen randomly selects a modulus from
116*37e28b85SXin LI.Fa /etc/ssh/moduli
117*37e28b85SXin LIthat best meets the size requirement.
118323b03c5SDag-Erling Smørgrav.Sh SEE ALSO
119*37e28b85SXin LI.Xr ssh-keygen 1 ,
120323b03c5SDag-Erling Smørgrav.Xr sshd 8
121*37e28b85SXin LI.Rs
122*37e28b85SXin LI.%R RFC 4419
123*37e28b85SXin LI.%T "Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol"
124*37e28b85SXin LI.%D 2006
125*37e28b85SXin LI.Re
126