1 1.1 elad /* $NetBSD: qfile.h,v 1.1 2006/01/24 18:59:23 elad Exp $ */ 2 1.1 elad 3 1.1 elad /*- 4 1.1 elad * Copyright 1994 Phil Karn <karn (at) qualcomm.com> 5 1.1 elad * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson (at) greendragon.com> 6 1.1 elad * All rights reserved. 7 1.1 elad * 8 1.1 elad * Redistribution and use in source and binary forms, with or without 9 1.1 elad * modification, are permitted provided that the following conditions 10 1.1 elad * are met: 11 1.1 elad * 1. Redistributions of source code must retain the above copyright 12 1.1 elad * notice, this list of conditions and the following disclaimer. 13 1.1 elad * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 elad * notice, this list of conditions and the following disclaimer in the 15 1.1 elad * documentation and/or other materials provided with the distribution. 16 1.1 elad * 17 1.1 elad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 1.1 elad * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 1.1 elad * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 1.1 elad * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 1.1 elad * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 1.1 elad * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 1.1 elad * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 1.1 elad * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 1.1 elad * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 1.1 elad * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 1.1 elad */ 28 1.1 elad 29 1.1 elad #ifndef _QFILE_H_ 30 1.1 elad #define _QFILE_H_ 31 1.1 elad 32 1.1 elad #include <stdio.h> 33 1.1 elad #include <stdlib.h> 34 1.1 elad #include <openssl/bn.h> 35 1.1 elad 36 1.1 elad /* need line long enough for largest moduli plus headers */ 37 1.1 elad #define QLINESIZE (100+8192) 38 1.1 elad 39 1.1 elad /* 40 1.1 elad * Type: decimal. Specifies the internal structure of the prime modulus. 41 1.1 elad */ 42 1.1 elad #define QTYPE_UNKNOWN (0) 43 1.1 elad #define QTYPE_UNSTRUCTURED (1) 44 1.1 elad #define QTYPE_SAFE (2) 45 1.1 elad #define QTYPE_SCHNOOR (3) 46 1.1 elad #define QTYPE_SOPHIE_GERMAINE (4) 47 1.1 elad #define QTYPE_STRONG (5) 48 1.1 elad 49 1.1 elad /* 50 1.1 elad * Tests: decimal (bit field). Specifies the methods used in checking for 51 1.1 elad * primality. Usually, more than one test is used. 52 1.1 elad */ 53 1.1 elad #define QTEST_UNTESTED (0x00) 54 1.1 elad #define QTEST_COMPOSITE (0x01) 55 1.1 elad #define QTEST_SIEVE (0x02) 56 1.1 elad #define QTEST_MILLER_RABIN (0x04) 57 1.1 elad #define QTEST_JACOBI (0x08) 58 1.1 elad #define QTEST_ELLIPTIC (0x10) 59 1.1 elad 60 1.1 elad /* 61 1.1 elad * Size: decimal. Specifies the number of the most significant bit (0 to M). * 62 1.1 elad * WARNING: internally, usually 1 to N. 63 1.1 elad */ 64 1.1 elad #define QSIZE_MINIMUM (511) 65 1.1 elad 66 1.1 elad 67 1.1 elad int 68 1.1 elad qfileout(FILE *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, 69 1.1 elad BIGNUM *); 70 1.1 elad 71 1.1 elad #endif /* !_QFILE_H_ */ 72