summaryrefslogtreecommitdiff
path: root/mpi.h
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-12-12 16:10:58 +0000
committerErwin Nindl <nine@wirdorange.org>2007-12-12 16:10:58 +0000
commit974d6973f4479c0f5bacc0a5ce07a5cfc62bb01c (patch)
treed537dabd53431fd071e24812982964ebdae2f2f7 /mpi.h
parentadded newline (diff)
* renamed HmacAuthAlgo to Sha1AuthAlgo
* removed a memleak at the IV generation in kd, cypher
Diffstat (limited to 'mpi.h')
-rw-r--r--mpi.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/mpi.h b/mpi.h
index de7aa98..2638e1d 100644
--- a/mpi.h
+++ b/mpi.h
@@ -37,6 +37,11 @@
#include <gcrypt.h>
+/**
+ * This class is a wrapper for the libgcrypt multi precision integer library.
+ *
+ */
+
class Mpi
{
public:
@@ -52,10 +57,23 @@ public:
Mpi operator^(const Mpi &b) const;
Mpi operator*(const unsigned long int n) const;
+ /**
+ * shift the bits to the right
+ * (LSB on the right side)
+ * @param n number of bits to shift
+ */
void rShift(u_int8_t n); // LSB on the right side!
Mpi mul2exp(u_int32_t e) const; // value * 2^e
void clearHighBit(u_int32_t n);
- u_int8_t *getBuf(u_int32_t buf_len) const;
+
+ /**
+ * returns a new[] u_int8_t* buffer with the MPI value in the
+ * GCRYMPI_FMT_STD (2-complement stored without a length header).
+ * you have to delete it by hand with delete[]!
+ * @param buf_len size of the new buffer that is returned
+ * @return a byte buffer of size buf_len
+ */
+ u_int8_t *getNewBuf(u_int32_t buf_len) const;
u_int32_t getLen() const;
protected: