From ac7dfdeaab1c174fe47444a8d8ff01b298857f71 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sun, 28 Dec 2014 12:36:43 -0800 Subject: [PATCH] Use BN_set_word if current word size is sufficient for uint64_t. --- src/bignum.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/bignum.h b/src/bignum.h index e3e60f5..58da20c 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -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; -- 1.7.1