Use BN_set_word if current word size is sufficient for uint64_t.
authorCryptoManiac <balthazar@yandex.ru>
Sun, 28 Dec 2014 20:36:43 +0000 (12:36 -0800)
committerCryptoManiac <balthazar@yandex.ru>
Sun, 28 Dec 2014 20:36:43 +0000 (12:36 -0800)
src/bignum.h

index e3e60f5..58da20c 100644 (file)
@@ -208,6 +208,13 @@ public:
 
     void setuint64(uint64_t n)
     {
+        if (sizeof(n) == sizeof(size_t))
+        {
+            if (!BN_set_word(this, n))
+                throw bignum_error("CBigNum conversion from uint64_t : BN_set_word failed");
+            return;
+        }
+
         unsigned char pch[sizeof(n) + 6];
         unsigned char* p = pch + 4;
         bool fLeadingZeroes = true;