diff options
author | Andy Polyakov <appro@openssl.org> | 2004-01-25 11:53:43 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2004-01-25 11:53:43 +0100 |
commit | 27b2b78f9053dde311378689322903b65ed2e691 (patch) | |
tree | c9fa2f9384c10048f00d00c5d2fd128b5495bbd6 /crypto/bn/bn_nist.c | |
parent | Fix declaration inconsistency in ecparam.c. (diff) | |
download | openssl-27b2b78f9053dde311378689322903b65ed2e691.tar.xz openssl-27b2b78f9053dde311378689322903b65ed2e691.zip |
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...
Diffstat (limited to 'crypto/bn/bn_nist.c')
-rw-r--r-- | crypto/bn/bn_nist.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c index 6aa196f6f8..f30f6c65d1 100644 --- a/crypto/bn/bn_nist.c +++ b/crypto/bn/bn_nist.c @@ -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}; |