xref: /freebsd/share/man/man5/moduli.5 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
17*37e28b85SXin LI.Dd July 19, 2012
18323b03c5SDag-Erling Smørgrav.Dt MODULI 5
19323b03c5SDag-Erling Smørgrav.Os
20323b03c5SDag-Erling Smørgrav.Sh NAME
21323b03c5SDag-Erling Smørgrav.Nm moduli
22*37e28b85SXin LI.Nd Diffie-Hellman moduli
23323b03c5SDag-Erling Smørgrav.Sh DESCRIPTION
24323b03c5SDag-Erling SmørgravThe
25*37e28b85SXin LI.Pa /etc/ssh/moduli
26*37e28b85SXin LIfile contains prime numbers and generators for use by
27*37e28b85SXin LI.Xr sshd 8
28*37e28b85SXin LIin the Diffie-Hellman Group Exchange key exchange method.
29*37e28b85SXin LI.Pp
30*37e28b85SXin LINew moduli may be generated with
31*37e28b85SXin LI.Xr ssh-keygen 1
32*37e28b85SXin LIusing a two-step process.
33*37e28b85SXin LIAn initial
34*37e28b85SXin LI.Em candidate generation
35*37e28b85SXin LIpass, using
36*37e28b85SXin LI.Ic ssh-keygen -G ,
37*37e28b85SXin LIcalculates numbers that are likely to be useful.
38*37e28b85SXin LIA second
39*37e28b85SXin LI.Em primality testing
40*37e28b85SXin LIpass, using
41*37e28b85SXin LI.Ic ssh-keygen -T ,
42*37e28b85SXin LIprovides a high degree of assurance that the numbers are prime and are
43*37e28b85SXin LIsafe for use in Diffie-Hellman operations by
44*37e28b85SXin LI.Xr sshd 8 .
45*37e28b85SXin LIThis
46e4731543SRuslan Ermilov.Nm
47*37e28b85SXin LIformat is used as the output from each pass.
48*37e28b85SXin LI.Pp
49*37e28b85SXin LIThe file consists of newline-separated records, one per modulus,
50*37e28b85SXin LIcontaining seven space-separated fields.
51*37e28b85SXin LIThese fields are as follows:
52*37e28b85SXin LI.Bl -tag -width Description -offset indent
53*37e28b85SXin LI.It timestamp
54*37e28b85SXin LIThe time that the modulus was last processed as YYYYMMDDHHMMSS.
55*37e28b85SXin LI.It type
56*37e28b85SXin LIDecimal number specifying the internal structure of the prime modulus.
57*37e28b85SXin LISupported types are:
58*37e28b85SXin LI.Pp
59*37e28b85SXin LI.Bl -tag -width 0x00 -compact
60*37e28b85SXin LI.It 0
61*37e28b85SXin LIUnknown, not tested.
62*37e28b85SXin LI.It 2
63*37e28b85SXin LI"Safe" prime; (p-1)/2 is also prime.
64*37e28b85SXin LI.It 4
65*37e28b85SXin LISophie Germain; 2p+1 is also prime.
66*37e28b85SXin LI.El
67*37e28b85SXin LI.Pp
68*37e28b85SXin LIModuli candidates initially produced by
69*37e28b85SXin LI.Xr ssh-keygen 1
70*37e28b85SXin LIare Sophie Germain primes (type 4).
71*37e28b85SXin LIFurther primality testing with
72*37e28b85SXin LI.Xr ssh-keygen 1
73*37e28b85SXin LIproduces safe prime moduli (type 2) that are ready for use in
74*37e28b85SXin LI.Xr sshd 8 .
75*37e28b85SXin LIOther types are not used by OpenSSH.
76*37e28b85SXin LI.It tests
77*37e28b85SXin LIDecimal number indicating the type of primality tests that the number
78*37e28b85SXin LIhas been subjected to represented as a bitmask of the following values:
79*37e28b85SXin LI.Pp
80*37e28b85SXin LI.Bl -tag -width 0x00 -compact
81*37e28b85SXin LI.It 0x00
82*37e28b85SXin LINot tested.
83*37e28b85SXin LI.It 0x01
84*37e28b85SXin LIComposite number \(en not prime.
85*37e28b85SXin LI.It 0x02
86*37e28b85SXin LISieve of Eratosthenes.
87*37e28b85SXin LI.It 0x04
88*37e28b85SXin LIProbabilistic Miller-Rabin primality tests.
89*37e28b85SXin LI.El
90*37e28b85SXin LI.Pp
91*37e28b85SXin LIThe
92*37e28b85SXin LI.Xr ssh-keygen 1
93*37e28b85SXin LImoduli candidate generation uses the Sieve of Eratosthenes (flag 0x02).
94*37e28b85SXin LISubsequent
95*37e28b85SXin LI.Xr ssh-keygen 1
96*37e28b85SXin LIprimality tests are Miller-Rabin tests (flag 0x04).
97*37e28b85SXin LI.It trials
98*37e28b85SXin LIDecimal number indicating the number of primality trials
99*37e28b85SXin LIthat have been performed on the modulus.
100*37e28b85SXin LI.It size
101*37e28b85SXin LIDecimal number indicating the size of the prime in bits.
102*37e28b85SXin LI.It generator
103*37e28b85SXin LIThe recommended generator for use with this modulus (hexadecimal).
104*37e28b85SXin LI.It modulus
105*37e28b85SXin LIThe modulus itself in hexadecimal.
106*37e28b85SXin LI.El
107*37e28b85SXin LI.Pp
108*37e28b85SXin LIWhen performing Diffie-Hellman Group Exchange,
109323b03c5SDag-Erling Smørgrav.Xr sshd 8
110*37e28b85SXin LIfirst estimates the size of the modulus required to produce enough
111*37e28b85SXin LIDiffie-Hellman output to sufficiently key the selected symmetric cipher.
112*37e28b85SXin LI.Xr sshd 8
113*37e28b85SXin LIthen randomly selects a modulus from
114*37e28b85SXin LI.Fa /etc/ssh/moduli
115*37e28b85SXin LIthat best meets the size requirement.
116323b03c5SDag-Erling Smørgrav.Sh SEE ALSO
117*37e28b85SXin LI.Xr ssh-keygen 1 ,
118323b03c5SDag-Erling Smørgrav.Xr sshd 8
119*37e28b85SXin LI.Rs
120*37e28b85SXin LI.%R RFC 4419
121*37e28b85SXin LI.%T "Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol"
122*37e28b85SXin LI.%D 2006
123*37e28b85SXin LI.Re
124