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
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
00091
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
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