Support for compiling on 32-bit platforms. The main issue was BN_ULONG size and not using 'long' where

'long long' or 'uint64' should be used.
This commit is contained in:
JoelKatz
2013-01-15 23:47:42 -08:00
parent 0d7f8cbe13
commit 271bf901ec
5 changed files with 142 additions and 74 deletions

22
src/cpp/ripple/BigNum64.h Normal file
View File

@@ -0,0 +1,22 @@
// Support 64-bit word operations on 32-bit platforms
static int BN_add_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
return BN_add(a, &bn, a);
}
static int BN_mul_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
CAutoBN_CTX ctx;
return BN_mul(a, &bn, a, ctx);
}
static uint64 BN_div_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
CAutoBN_CTX ctx;
return (BN_div(a, NULL, a, &bn, ctx) == 1) ? 0 : ((uint64)-1);
}