diff options
author | msvensson@shellback.(none) <> | 2006-04-18 14:41:43 +0200 |
---|---|---|
committer | msvensson@shellback.(none) <> | 2006-04-18 14:41:43 +0200 |
commit | 0d1bd3b1f28a22b8d69138787f2ca0bd16be3c3f (patch) | |
tree | 34e6ec0edb6bfe0f8ac0108fdbea5716e3c3679f /extra/yassl/taocrypt/src/integer.cpp | |
parent | 1c4e31d5feb6c0c645a7672c423af37bbe3ae5a4 (diff) | |
download | mariadb-git-0d1bd3b1f28a22b8d69138787f2ca0bd16be3c3f.tar.gz |
Import from yaSSL upstream
Diffstat (limited to 'extra/yassl/taocrypt/src/integer.cpp')
-rw-r--r-- | extra/yassl/taocrypt/src/integer.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 083c5bf7d30..f50175b9b67 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -2709,22 +2709,34 @@ unsigned int Integer::Encode(byte* output, unsigned int outputLen, } -const Integer Integer::zero_; +static Integer* zero = 0; const Integer &Integer::Zero() { - return zero_; + if (!zero) + zero = NEW_TC Integer; + return *zero; } -const Integer Integer::one_(1,2); +static Integer* one = 0; const Integer &Integer::One() { - return one_; + if (!one) + one = NEW_TC Integer(1,2); + return *one; } +// Clean up static singleton holders, not a leak, but helpful to have gone +// when checking for leaks +void CleanUp() +{ + tcDelete(one); + tcDelete(zero); +} + Integer::Integer(RandomNumberGenerator& rng, const Integer& min, const Integer& max) { |