summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_nist.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-11-04 00:29:09 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-11-04 00:29:09 +0000
commitc465e7941ec785f2ce53638b351a21d6a49fe1a0 (patch)
treeb55fe5ccc4a521d1d117239f944b1325840e3fb8 /crypto/bn/bn_nist.c
parent933398f1102ba99d64f901987c5e8fe340a2c331 (diff)
This is the least unacceptable way I've found for declaring the bignum data
and structures as constant without having to cast away const at any point. There is still plenty of other code that makes gcc's "-Wcast-qual" unhappy, but crypto/bn/ is now ok. Purists are welcome to suggest alternatives.
Diffstat (limited to 'crypto/bn/bn_nist.c')
-rw-r--r--crypto/bn/bn_nist.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c
index 2ababfbed1..ed148d845c 100644
--- a/crypto/bn/bn_nist.c
+++ b/crypto/bn/bn_nist.c
@@ -127,39 +127,40 @@ const static BN_ULONG _nist_p_521[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x01};
#endif
+static const BIGNUM_C bn_nist_p_192 =
+ { _nist_p_192, BN_NIST_192_TOP, BN_NIST_192_TOP, 0, BN_FLG_STATIC_DATA };
+static const BIGNUM_C bn_nist_p_224 =
+ { _nist_p_224, BN_NIST_224_TOP, BN_NIST_224_TOP, 0, BN_FLG_STATIC_DATA };
+static const BIGNUM_C bn_nist_p_256 =
+ { _nist_p_256, BN_NIST_256_TOP, BN_NIST_256_TOP, 0, BN_FLG_STATIC_DATA };
+static const BIGNUM_C bn_nist_p_384 =
+ { _nist_p_384, BN_NIST_384_TOP, BN_NIST_384_TOP, 0, BN_FLG_STATIC_DATA };
+static const BIGNUM_C bn_nist_p_521 =
+ { _nist_p_521, BN_NIST_521_TOP, BN_NIST_521_TOP, 0, BN_FLG_STATIC_DATA };
+
const BIGNUM *BN_get0_nist_prime_192(void)
{
- static BIGNUM const_nist_192={(BN_ULONG *)_nist_p_192,BN_NIST_192_TOP,
- BN_NIST_192_TOP, 0, BN_FLG_STATIC_DATA};
- return &const_nist_192;
+ return BIGNUM_CONST(&bn_nist_p_192);
}
const BIGNUM *BN_get0_nist_prime_224(void)
{
- static BIGNUM const_nist_224={(BN_ULONG *)_nist_p_224,BN_NIST_224_TOP,
- BN_NIST_224_TOP, 0, BN_FLG_STATIC_DATA};
- return &const_nist_224;
+ return BIGNUM_CONST(&bn_nist_p_224);
}
const BIGNUM *BN_get0_nist_prime_256(void)
{
- static BIGNUM const_nist_256={(BN_ULONG *)_nist_p_256,BN_NIST_256_TOP,
- BN_NIST_256_TOP, 0, BN_FLG_STATIC_DATA};
- return &const_nist_256;
+ return BIGNUM_CONST(&bn_nist_p_256);
}
const BIGNUM *BN_get0_nist_prime_384(void)
{
- static BIGNUM const_nist_384={(BN_ULONG *)_nist_p_384,BN_NIST_384_TOP,
- BN_NIST_384_TOP, 0, BN_FLG_STATIC_DATA};
- return &const_nist_384;
+ return BIGNUM_CONST(&bn_nist_p_384);
}
const BIGNUM *BN_get0_nist_prime_521(void)
{
- static BIGNUM const_nist_521={(BN_ULONG *)_nist_p_521,BN_NIST_521_TOP,
- BN_NIST_521_TOP, 0, BN_FLG_STATIC_DATA};
- return &const_nist_521;
+ return BIGNUM_CONST(&bn_nist_p_521);
}
/* some misc internal functions */