1.\" $NetBSD: qsieve.1,v 1.2 2006/01/24 19:17:19 wiz Exp $ 2.\" 3.\" Copyright 1997, 2003 William Allen Simpson <wsimpson@greendragon.com> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software designed by William Allen Simpson. 17.\" 4. The name of the author may not be used to endorse or promote products 18.\" derived from this software without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30.\" 31.\" Manual page, using -mandoc macros 32.\" 33.Dd July 28, 1997 34.Dt QSIEVE 1 35.Os 36.Sh NAME 37.Nm qsieve , 38.Nm qsafe 39.Nd generate system moduli file 40.Sh SYNOPSIS 41.Nm 42.Op Ar megabytes Ar bits Op Ar initial 43.Nm qsafe 44.Op Ar trials Op Ar generator 45.Sh DESCRIPTION 46The 47.Nm 48utility will list candidates for Sophie-Germaine primes 49(where q = (p-1)/2) 50to standard output. 51The list is checked against small known primes 52(less than 2**30). 53This step is both processor and memory intensive. 54.Pp 55The 56.Ar megabytes 57value 58sets a limit for the internal sieve buffer. 59This should be small enough to remain entirely in memory. 60Swap thrashing can increase the run time 61from hours to days or weeks! 62When the 63.Ar megabytes 64value is zero (0), 65.Nm 66will select a default suitable for the 67.Ar bits . 68.Pp 69The 70.Ar bits 71value 72sets the length of the generated possible primes 73(typically 768, 1024, 1536, 2048, 3072, or 4096, 74although others can be used for variety). 75.Pp 76The optional 77.Ar initial 78value (hex) 79specifies the beginning of the search. 80Otherwise, 81.Nm 82generates a randomly selected number. 83.Pp 84The 85.Nm qsafe 86utility will perform a Miller-Rabin primality test 87on the list of candidates 88(checking both q and p) 89from standard input. 90The result is a list of so-call "safe" primes 91to standard output, 92suitable for use as Diffie-Hellman moduli. 93This step is merely processor intensive. 94.Pp 95The 96.Ar trials 97value 98sets the number of Miller-Rabin interations 99(typically 16 to 128). 100.Pp 101The optional 102.Ar generator 103value (hex) 104limits testing to candidates with a specific generator 105(usually 2). 106Otherwise, 107.Nm qsafe 108will test each candidate 109and suggest a generator. 110.Sh SEE ALSO 111.Xr moduli 5 112.Sh HISTORY 113These programs were originally developed for 114the Photuris project, 115and later 116the OpenSSH project. 117