Even though C specification explicitly says that constant type "stretches"
automatically to accomodate the value, some compilers fail to do so. Most notably 0x0123456789ABCDEF should come out as long long in 32-bit context, but HP compiler truncates it to 32-bit value. Which in turn breaks GF(2^m) arithmetics in hpux-parisc2-cc build. Therefore this fix...
This commit is contained in:
parent
3a160f1dc6
commit
27b2b78f90
2 changed files with 20 additions and 14 deletions
|
@ -228,7 +228,7 @@ static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const
|
|||
BN_ULONG tab[16], top3b = a >> 61;
|
||||
register BN_ULONG a1, a2, a4, a8;
|
||||
|
||||
a1 = a & (0x1FFFFFFFFFFFFFFF); a2 = a1 << 1; a4 = a2 << 1; a8 = a4 << 1;
|
||||
a1 = a & (0x1FFFFFFFFFFFFFFFULL); a2 = a1 << 1; a4 = a2 << 1; a8 = a4 << 1;
|
||||
|
||||
tab[ 0] = 0; tab[ 1] = a1; tab[ 2] = a2; tab[ 3] = a1^a2;
|
||||
tab[ 4] = a4; tab[ 5] = a1^a4; tab[ 6] = a2^a4; tab[ 7] = a1^a2^a4;
|
||||
|
|
|
@ -63,19 +63,25 @@
|
|||
#define BN_NIST_521_TOP (521+BN_BITS2-1)/BN_BITS2
|
||||
|
||||
#if BN_BITS2 == 64
|
||||
const static BN_ULONG _nist_p_192[] = {0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFE,
|
||||
0xFFFFFFFFFFFFFFFF};
|
||||
const static BN_ULONG _nist_p_224[] = {0x0000000000000001,0xFFFFFFFF00000000,
|
||||
0xFFFFFFFFFFFFFFFF,0x00000000FFFFFFFF};
|
||||
const static BN_ULONG _nist_p_256[] = {0xFFFFFFFFFFFFFFFF,0x00000000FFFFFFFF,
|
||||
0x0000000000000000,0xFFFFFFFF00000001};
|
||||
const static BN_ULONG _nist_p_384[] = {0x00000000FFFFFFFF,0xFFFFFFFF00000000,
|
||||
0xFFFFFFFFFFFFFFFE,0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,
|
||||
0xFFFFFFFFFFFFFFFF};
|
||||
const static BN_ULONG _nist_p_521[] = {0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,
|
||||
0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,
|
||||
0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF,
|
||||
0x00000000000001FF};
|
||||
const static BN_ULONG _nist_p_192[] =
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFEULL,
|
||||
0xFFFFFFFFFFFFFFFFULL};
|
||||
const static BN_ULONG _nist_p_224[] =
|
||||
{0x0000000000000001ULL,0xFFFFFFFF00000000ULL,
|
||||
0xFFFFFFFFFFFFFFFFULL,0x00000000FFFFFFFFULL};
|
||||
const static BN_ULONG _nist_p_256[] =
|
||||
{0xFFFFFFFFFFFFFFFFULL,0x00000000FFFFFFFFULL,
|
||||
0x0000000000000000ULL,0xFFFFFFFF00000001ULL};
|
||||
const static BN_ULONG _nist_p_384[] =
|
||||
{0x00000000FFFFFFFFULL,0xFFFFFFFF00000000ULL,
|
||||
0xFFFFFFFFFFFFFFFEULL,0xFFFFFFFFFFFFFFFFULL,
|
||||
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL};
|
||||
const static BN_ULONG _nist_p_521[] =
|
||||
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
|
||||
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
|
||||
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
|
||||
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
|
||||
0x00000000000001FFULL};
|
||||
#elif BN_BITS2 == 32
|
||||
const static BN_ULONG _nist_p_192[] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFE,
|
||||
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
|
||||
|
|
Loading…
Reference in a new issue