diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 32a8fbaf51..5470fbe6ef 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -133,15 +133,34 @@ int BN_get_params(int which) | |||
133 | 133 | ||
134 | const BIGNUM *BN_value_one(void) | 134 | const BIGNUM *BN_value_one(void) |
135 | { | 135 | { |
136 | static BN_ULONG data_one=1L; | 136 | static const BN_ULONG data_one=1L; |
137 | static BIGNUM const_one={&data_one,1,1,0,BN_FLG_STATIC_DATA}; | 137 | static const BIGNUM const_one={(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATIC_DATA}; |
138 | 138 | ||
139 | return(&const_one); | 139 | return(&const_one); |
140 | } | 140 | } |
141 | 141 | ||
142 | char *BN_options(void) | ||
143 | { | ||
144 | static int init=0; | ||
145 | static char data[16]; | ||
146 | |||
147 | if (!init) | ||
148 | { | ||
149 | init++; | ||
150 | #ifdef BN_LLONG | ||
151 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
152 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
153 | #else | ||
154 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
155 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
156 | #endif | ||
157 | } | ||
158 | return(data); | ||
159 | } | ||
160 | |||
142 | int BN_num_bits_word(BN_ULONG l) | 161 | int BN_num_bits_word(BN_ULONG l) |
143 | { | 162 | { |
144 | static const char bits[256]={ | 163 | static const unsigned char bits[256]={ |
145 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, | 164 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, |
146 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | 165 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, |
147 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | 166 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |
@@ -216,7 +235,7 @@ int BN_num_bits_word(BN_ULONG l) | |||
216 | else | 235 | else |
217 | #endif | 236 | #endif |
218 | { | 237 | { |
219 | #if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) | 238 | #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) |
220 | if (l & 0xff00L) | 239 | if (l & 0xff00L) |
221 | return(bits[(int)(l>>8)]+8); | 240 | return(bits[(int)(l>>8)]+8); |
222 | else | 241 | else |
@@ -744,7 +763,7 @@ int BN_is_bit_set(const BIGNUM *a, int n) | |||
744 | i=n/BN_BITS2; | 763 | i=n/BN_BITS2; |
745 | j=n%BN_BITS2; | 764 | j=n%BN_BITS2; |
746 | if (a->top <= i) return 0; | 765 | if (a->top <= i) return 0; |
747 | return(((a->d[i])>>j)&((BN_ULONG)1)); | 766 | return (int)(((a->d[i])>>j)&((BN_ULONG)1)); |
748 | } | 767 | } |
749 | 768 | ||
750 | int BN_mask_bits(BIGNUM *a, int n) | 769 | int BN_mask_bits(BIGNUM *a, int n) |