Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

dldp.h

Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 2000, 2001, 2002 Virtual Unlimited B.V. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 */ 00019 00026 #ifndef _DLDP_H 00027 #define _DLDP_H 00028 00029 #include "mpbarrett.h" 00030 00031 /* 00032 * Discrete Logarithm Domain Parameters - Prime 00033 * 00034 * Standard definition where p = qr+1; in case where p=2q+1, r=2 00035 * 00036 * In IEEE P1363 naming is p = rk+1 00037 * 00038 * Hence, IEEE prime r = q and cofactor k = r 00039 * 00040 * Make sure q is large enough to foil Pohlig-Hellman attacks 00041 * See: "Handbook of Applied Cryptography", Chapter 3.6.4 00042 * 00043 * g is either a generator of a subgroup of order q, or a generator of order 00044 * n = (p-1) 00045 */ 00046 00053 typedef struct 00054 { 00059 mpbarrett p; 00065 mpbarrett q; 00070 mpnumber r; 00077 mpnumber g; 00082 mpbarrett n; 00083 } dldp_p; 00084 00085 #ifdef __cplusplus 00086 extern "C" { 00087 #endif 00088 00089 /* 00090 * Functions for setting up and copying 00091 */ 00092 00093 BEECRYPTAPI 00094 int dldp_pInit(dldp_p*); 00095 BEECRYPTAPI 00096 int dldp_pFree(dldp_p*); 00097 BEECRYPTAPI 00098 int dldp_pCopy(dldp_p*, const dldp_p*); 00099 00100 /* 00101 * Functions for generating keys 00102 */ 00103 00104 BEECRYPTAPI 00105 int dldp_pPrivate(const dldp_p*, randomGeneratorContext*, mpnumber*); 00106 BEECRYPTAPI 00107 int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*); 00108 BEECRYPTAPI 00109 int dldp_pPair (const dldp_p*, randomGeneratorContext*, mpnumber*, mpnumber*); 00110 /* 00111 * Function for comparing domain parameters 00112 */ 00113 00114 BEECRYPTAPI 00115 int dldp_pEqual (const dldp_p*, const dldp_p*); 00116 00117 /* 00118 * Functions for generating and validating dldp_pgoq variant domain parameters 00119 */ 00120 00121 BEECRYPTAPI 00122 int dldp_pgoqMake (dldp_p*, randomGeneratorContext*, size_t, size_t, int); 00123 BEECRYPTAPI 00124 int dldp_pgoqMakeSafe (dldp_p*, randomGeneratorContext*, size_t); 00125 BEECRYPTAPI 00126 int dldp_pgoqGenerator(dldp_p*, randomGeneratorContext*); 00127 BEECRYPTAPI 00128 int dldp_pgoqValidate (const dldp_p*, randomGeneratorContext*, int); 00129 00130 /* 00131 * Functions for generating and validating dldp_pgon variant domain parameters 00132 */ 00133 00134 BEECRYPTAPI 00135 int dldp_pgonMake (dldp_p*, randomGeneratorContext*, size_t, size_t); 00136 BEECRYPTAPI 00137 int dldp_pgonMakeSafe (dldp_p*, randomGeneratorContext*, size_t); 00138 BEECRYPTAPI 00139 int dldp_pgonGenerator(dldp_p*, randomGeneratorContext*); 00140 BEECRYPTAPI 00141 int dldp_pgonValidate (const dldp_p*, randomGeneratorContext*); 00142 00143 #ifdef __cplusplus 00144 } 00145 #endif 00146 00147 #endif

Generated on Sun Jun 20 22:57:54 2004 for BeeCrypt by doxygen 1.3.7