From 15dfcf5abaacb3885859dcbe5fa2c29cf259cb0d Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 30 May 2014 01:42:36 -0700 Subject: Hardened Base64, making tomcrypt to properly generate secure random numbers under windows, and ditched tomcryptmath for tommath. --- includes/Base64.h | 2 +- includes/BigInt.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/Base64.h b/includes/Base64.h index d039c73..8d0b71d 100644 --- a/includes/Base64.h +++ b/includes/Base64.h @@ -7,7 +7,7 @@ namespace Balau { class Base64 { public: static String encode(const uint8_t * data, int len); - static int decode(const String & str_in, uint8_t * data_out); + static int decode(const String & str_in, uint8_t * data_out, size_t outLen = static_cast(-1)); static const double ratio; private: diff --git a/includes/BigInt.h b/includes/BigInt.h index ae5b0f7..3a31b2e 100644 --- a/includes/BigInt.h +++ b/includes/BigInt.h @@ -30,6 +30,9 @@ class BigInt { uint32_t to_uint32() const throw (GeneralException); int32_t to_int32() const throw (GeneralException); + BigInt operator^(const BigInt &) const throw (GeneralException); + BigInt operator|(const BigInt &) const throw (GeneralException); + BigInt operator&(const BigInt &) const throw (GeneralException); BigInt operator+(unsigned int) const throw (GeneralException); BigInt operator+(const BigInt &) const throw (GeneralException); BigInt operator-(unsigned int) const throw (GeneralException); @@ -41,6 +44,9 @@ class BigInt { BigInt operator<<(unsigned int) const throw (GeneralException); BigInt operator>>(unsigned int) const; + BigInt & operator^=(const BigInt &) throw (GeneralException); + BigInt & operator|=(const BigInt &) throw (GeneralException); + BigInt & operator&=(const BigInt &) throw (GeneralException); BigInt & operator+=(unsigned int) throw (GeneralException); BigInt & operator+=(const BigInt &) throw (GeneralException); BigInt & operator-=(unsigned int) throw (GeneralException); @@ -105,6 +111,10 @@ class BigInt { void exportBin(void *) const throw (GeneralException); void importBin(const void *, size_t) throw (GeneralException); + size_t exportUSize() const; + void exportUBin(void *) const throw (GeneralException); + void importUBin(const void *, size_t) throw (GeneralException); + String toString(int radix = 10) const; char * makeString(int radix = 10) const; -- cgit v1.2.3