summaryrefslogtreecommitdiff
path: root/beecrypt/mpbarrett.h
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-08-02 00:45:38 +0000
committerjbj <devnull@localhost>2004-08-02 00:45:38 +0000
commit8931f04c4dcc79d665aa703594f93ada56b6e0b9 (patch)
treef304054ab421004098182ef6051110ef3aec28bd /beecrypt/mpbarrett.h
parent8462a31960e9cfd3274b83edd59f9cc3b74c40d2 (diff)
downloadlibrpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.tar.gz
librpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.tar.bz2
librpm-tizen-8931f04c4dcc79d665aa703594f93ada56b6e0b9.zip
Upgrade to beecrypt-4.0.0.
CVS patchset: 7372 CVS date: 2004/08/02 00:45:38
Diffstat (limited to 'beecrypt/mpbarrett.h')
-rw-r--r--beecrypt/mpbarrett.h233
1 files changed, 79 insertions, 154 deletions
diff --git a/beecrypt/mpbarrett.h b/beecrypt/mpbarrett.h
index 6bfcf6008..3cb362e4b 100644
--- a/beecrypt/mpbarrett.h
+++ b/beecrypt/mpbarrett.h
@@ -26,203 +26,128 @@
#ifndef _MPBARRETT_H
#define _MPBARRETT_H
-#include "beecrypt.h"
-#include "mpnumber.h"
+#include "beecrypt/beecrypt.h"
+#include "beecrypt/mpnumber.h"
-typedef struct
+#ifdef __cplusplus
+# include <iostream>
+#endif
+
+#ifdef __cplusplus
+struct BEECRYPTAPI mpbarrett
+#else
+struct _mpbarrett
+#endif
{
size_t size;
-/*@owned@*/
mpw* modl; /* (size) words */
-/*@dependent@*/ /*@null@*/
- mpw* mu; /* (size+1) words */
-} mpbarrett;
+ mpw* mu; /* (size+1) words */
#ifdef __cplusplus
-extern "C" {
+ mpbarrett();
+ mpbarrett(const mpbarrett&);
+ ~mpbarrett();
+
+ const mpbarrett& operator=(const mpbarrett&);
+ bool operator==(const mpbarrett&);
+ bool operator!=(const mpbarrett&);
+
+ void wipe();
+ size_t bitlength() const;
#endif
+};
-/**
- */
+#ifndef __cplusplus
+typedef struct _mpbarrett mpbarrett;
+#else
BEECRYPTAPI
-void mpbzero(/*@out@*/ mpbarrett* b)
- /*@modifies b->size, b->modl, b->mu @*/;
+std::ostream& operator<<(std::ostream&, const mpbarrett&);
+#endif
-/**
- */
-BEECRYPTAPI
-void mpbinit(mpbarrett* b, size_t size)
- /*@modifies b->size, b->modl, b->mu @*/;
+#ifdef __cplusplus
+extern "C" {
+#endif
-/**
- */
BEECRYPTAPI
-void mpbfree(/*@special@*/ mpbarrett* b)
- /*@uses b->size, b->modl @*/
- /*@releases b->modl @*/
- /*@modifies b->size, b->modl, b->mu @*/;
-
-/**
- */
+void mpbzero(mpbarrett*);
BEECRYPTAPI
-void mpbcopy(mpbarrett* b, const mpbarrett* copy)
- /*@modifies b->size, b->modl, b->mu @*/;
-
-/**
- */
+void mpbinit(mpbarrett*, size_t);
BEECRYPTAPI
-void mpbset(mpbarrett* b, size_t size, const mpw* data)
- /*@modifies b->size, b->modl, b->mu @*/;
-
-/**
- */
-BEECRYPTAPI /*@unused@*/
-void mpbsethex(mpbarrett* b, const char* hex)
- /*@modifies b->size, b->modl, b->mu @*/;
-
-/**
- */
+void mpbfree(mpbarrett*);
BEECRYPTAPI
-void mpbsubone(const mpbarrett* b, mpw* result)
- /*@modifies result @*/;
-
-/**
- */
-BEECRYPTAPI /*@unused@*/
-void mpbneg(const mpbarrett* b, const mpw* data, mpw* result)
- /*@modifies result @*/;
-
-/**
- */
+void mpbcopy(mpbarrett*, const mpbarrett*);
BEECRYPTAPI
-void mpbmu_w(mpbarrett* b, /*@out@*/ mpw* wksp)
- /*@modifies b->size, b->modl, b->mu, wksp @*/;
+void mpbwipe(mpbarrett*);
-/**
- */
BEECRYPTAPI
-void mpbrnd_w (const mpbarrett* b, randomGeneratorContext* rc, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
+void mpbset(mpbarrett*, size_t, const mpw*);
-/**
- */
-/*@-exportlocal@*/
BEECRYPTAPI
-void mpbrndodd_w(const mpbarrett* b, randomGeneratorContext* rc, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
-/*@=exportlocal@*/
-
-/**
- */
+int mpbsetbin(mpbarrett*, const byte*, size_t);
BEECRYPTAPI
-void mpbrndinv_w(const mpbarrett* b, randomGeneratorContext* rc, /*@out@*/ mpw* result, /*@out@*/ mpw* inverse, /*@out@*/ mpw* wksp)
- /*@modifies result, inverse, wksp @*/;
+int mpbsethex(mpbarrett*, const char*);
-/**
- */
BEECRYPTAPI
-void mpbmod_w(const mpbarrett* b, const mpw* data, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
+void mpbsubone(const mpbarrett*, mpw*);
-/**
- */
BEECRYPTAPI
-void mpbaddmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
+void mpbmu_w(mpbarrett*, mpw*);
-/**
- */
-BEECRYPTAPI /*@unused@*/
-void mpbsubmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
-
-/**
- */
BEECRYPTAPI
-void mpbmulmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
-
-/**
- */
+void mpbrnd_w (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
BEECRYPTAPI
-void mpbsqrmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
-
-/**
- */
+void mpbrndodd_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
BEECRYPTAPI
-void mpbpowmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t psize, const mpw* pdata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
+void mpbrndinv_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*, mpw*);
-/**
- */
-/*@-exportlocal@*/
BEECRYPTAPI
-void mpbpowmodsld_w(const mpbarrett* b, const mpw* slide, size_t psize, const mpw* pdata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@globals internalState @*/
- /*@modifies result, wksp, internalState @*/;
-/*@=exportlocal@*/
+void mpbneg_w(const mpbarrett*, const mpw*, mpw*);
+BEECRYPTAPI
+void mpbmod_w(const mpbarrett*, const mpw*, mpw*, mpw*);
-/**
- */
BEECRYPTAPI
-void mpbtwopowmod_w(const mpbarrett* b, size_t psize, const mpw* pdata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
- /*@modifies result, wksp @*/;
+void mpbaddmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbsubmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbmulmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbsqrmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbpowmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbpowmodsld_w(const mpbarrett*, const mpw*, size_t, const mpw*, mpw*, mpw*);
+BEECRYPTAPI
+void mpbtwopowmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*);
-#ifdef NOTYET
-/**
- * @todo Simultaneous multiple exponentiation, for use in dsa and elgamal
- * signature verification.
+/* To be added:
+ * simultaneous multiple exponentiation, for use in dsa and elgamal signature verification
*/
-BEECRYPTAPI /*@unused@*/
-void mpbsm2powmod(const mpbarrett* b, const mpw*, const mpw*, const mpw*, const mpw*);
+BEECRYPTAPI
+void mpbsm2powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*);
+BEECRYPTAPI
+void mpbsm3powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*);
-/**
- */
-BEECRYPTAPI /*@unused@*/
-void mpbsm3powmod(const mpbarrett* b, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*);
-#endif /* NOTYET */
+BEECRYPTAPI
+int mpbpprime_w(const mpbarrett*, randomGeneratorContext*, int, mpw*);
-/**
- */
-BEECRYPTAPI /*@unused@*/
-int mpbpprime_w(const mpbarrett* b, randomGeneratorContext* r, int t, /*@out@*/ mpw* wksp)
- /*@modifies wksp @*/;
+/* the next routines take mpnumbers as parameters */
-/**
- * @note Takes mpnumber as parameter.
- */
BEECRYPTAPI
-void mpbnrnd(const mpbarrett* b, randomGeneratorContext* rc, mpnumber* result)
- /*@modifies result @*/;
-
-/**
- * @note Takes mpnumber as parameter.
- */
-BEECRYPTAPI /*@unused@*/
-void mpbnmulmod(const mpbarrett* b, const mpnumber* x, const mpnumber* y, mpnumber* result)
- /*@modifies result @*/;
+void mpbnrnd(const mpbarrett*, randomGeneratorContext*, mpnumber*);
-/**
- * @note Takes mpnumber as parameter.
- */
-BEECRYPTAPI /*@unused@*/
-void mpbnsqrmod(const mpbarrett* b, const mpnumber* x, mpnumber* result)
- /*@modifies result @*/;
+BEECRYPTAPI
+void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
+BEECRYPTAPI
+void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*);
-/**
- * @note Takes mpnumber as parameter.
- */
BEECRYPTAPI
-void mpbnpowmod (const mpbarrett* b, const mpnumber* x, const mpnumber* pow, mpnumber* y)
- /*@modifies y @*/;
+void mpbnpowmod (const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*);
+BEECRYPTAPI
+void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber*);
-/**
- * @note Takes mpnumber as parameter.
- */
-BEECRYPTAPI /*@unused@*/
-void mpbnpowmodsld(const mpbarrett* b, const mpw* slide, const mpnumber* pow, mpnumber* y)
- /*@modifies y @*/;
+BEECRYPTAPI
+size_t mpbbits(const mpbarrett*);
#ifdef __cplusplus
}