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

mpbarrett.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003 Bob Deblier
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 _MPBARRETT_H
00027 #define _MPBARRETT_H
00028 
00029 #include "beecrypt.h"
00030 #include "mpnumber.h"
00031 
00032 typedef struct
00033 {
00034     size_t  size;
00035     mpw*    modl;   /* (size) words */
00036     mpw*    mu;     /* (size+1) words */
00037 } mpbarrett;
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 BEECRYPTAPI
00044 void mpbzero(mpbarrett*);
00045 BEECRYPTAPI
00046 void mpbinit(mpbarrett*, size_t);
00047 BEECRYPTAPI
00048 void mpbfree(mpbarrett*);
00049 BEECRYPTAPI
00050 void mpbcopy(mpbarrett*, const mpbarrett*);
00051 BEECRYPTAPI
00052 void mpbwipe(mpbarrett*);
00053 
00054 BEECRYPTAPI
00055 void mpbset(mpbarrett*, size_t, const mpw*);
00056 BEECRYPTAPI
00057 void mpbsethex(mpbarrett*, const char*);
00058 
00059 BEECRYPTAPI
00060 void mpbsubone(const mpbarrett*, mpw*);
00061 
00062 BEECRYPTAPI
00063 void mpbmu_w(mpbarrett*, mpw*);
00064 
00065 BEECRYPTAPI
00066 void mpbrnd_w   (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
00067 BEECRYPTAPI
00068 void mpbrndodd_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
00069 BEECRYPTAPI
00070 void mpbrndinv_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*, mpw*);
00071 
00072 BEECRYPTAPI
00073 void mpbneg_w(const mpbarrett*, const mpw*, mpw*);
00074 BEECRYPTAPI
00075 void mpbmod_w(const mpbarrett*, const mpw*, mpw*, mpw*);
00076 
00077 BEECRYPTAPI
00078 void mpbaddmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00079 BEECRYPTAPI
00080 void mpbsubmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00081 BEECRYPTAPI
00082 void mpbmulmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00083 BEECRYPTAPI
00084 void mpbsqrmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
00085 BEECRYPTAPI
00086 void mpbpowmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00087 BEECRYPTAPI
00088 void mpbpowmodsld_w(const mpbarrett*, const mpw*, size_t, const mpw*, mpw*, mpw*);
00089 BEECRYPTAPI
00090 void mpbtwopowmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
00091 
00092 /* To be added:
00093  * simultaneous multiple exponentiation, for use in dsa and elgamal signature verification
00094  */
00095 BEECRYPTAPI
00096 void mpbsm2powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*);
00097 BEECRYPTAPI
00098 void mpbsm3powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*);
00099 
00100 BEECRYPTAPI
00101 int  mpbpprime_w(const mpbarrett*, randomGeneratorContext*, int, mpw*);
00102 
00103 /* the next routines take mpnumbers as parameters */
00104 
00105 BEECRYPTAPI
00106 void mpbnrnd(const mpbarrett*, randomGeneratorContext*, mpnumber*);
00107 
00108 BEECRYPTAPI
00109 void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
00110 BEECRYPTAPI
00111 void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*);
00112 
00113 BEECRYPTAPI
00114 void mpbnpowmod   (const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
00115 BEECRYPTAPI
00116 void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber*);
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 
00122 #endif

Generated on Wed Mar 24 13:56:53 2004 for BeeCrypt by doxygen 1.3.6