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 
00052 BEECRYPTAPI
00053 void mpbset(mpbarrett*, size_t, const mpw*);
00054 BEECRYPTAPI
00055 void mpbsethex(mpbarrett*, const char*);
00056 
00057 BEECRYPTAPI
00058 void mpbsubone(const mpbarrett*, mpw*);
00059 
00060 BEECRYPTAPI
00061 void mpbmu_w(mpbarrett*, mpw*);
00062 
00063 BEECRYPTAPI
00064 void mpbrnd_w   (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
00065 BEECRYPTAPI
00066 void mpbrndodd_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
00067 BEECRYPTAPI
00068 void mpbrndinv_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*, mpw*);
00069 
00070 BEECRYPTAPI
00071 void mpbneg_w(const mpbarrett*, const mpw*, mpw*);
00072 BEECRYPTAPI
00073 void mpbmod_w(const mpbarrett*, const mpw*, mpw*, mpw*);
00074 
00075 BEECRYPTAPI
00076 void mpbaddmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00077 BEECRYPTAPI
00078 void mpbsubmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00079 BEECRYPTAPI
00080 void mpbmulmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00081 BEECRYPTAPI
00082 void mpbsqrmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
00083 BEECRYPTAPI
00084 void mpbpowmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
00085 BEECRYPTAPI
00086 void mpbpowmodsld_w(const mpbarrett*, const mpw*, size_t, const mpw*, mpw*, mpw*);
00087 BEECRYPTAPI
00088 void mpbtwopowmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
00089 
00090 /* To be added:
00091  * simultaneous multiple exponentiation, for use in dsa and elgamal signature verification
00092  */
00093 BEECRYPTAPI
00094 void mpbsm2powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*);
00095 BEECRYPTAPI
00096 void mpbsm3powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*);
00097 
00098 BEECRYPTAPI
00099 int  mpbpprime_w(const mpbarrett*, randomGeneratorContext*, int, mpw*);
00100 
00101 /* the next routines take mpnumbers as parameters */
00102 
00103 BEECRYPTAPI
00104 void mpbnrnd(const mpbarrett*, randomGeneratorContext*, mpnumber*);
00105 
00106 BEECRYPTAPI
00107 void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
00108 BEECRYPTAPI
00109 void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*);
00110 
00111 BEECRYPTAPI
00112 void mpbnpowmod   (const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
00113 BEECRYPTAPI
00114 void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber*);
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 
00120 #endif

Generated on Fri Apr 2 07:56:29 2004 for BeeCrypt by doxygen1.2.18