00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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;
00036 mpw* mu;
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
00093
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
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