Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Side by Side Diff: openssl/crypto/bn/bn_lib.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/bn/bn_lcl.h ('k') | openssl/crypto/bn/bn_mont.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypto/bn/bn_lib.c */ 1 /* crypto/bn/bn_lib.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (which == 0) return(bn_limit_bits); 126 if (which == 0) return(bn_limit_bits);
127 else if (which == 1) return(bn_limit_bits_high); 127 else if (which == 1) return(bn_limit_bits_high);
128 else if (which == 2) return(bn_limit_bits_low); 128 else if (which == 2) return(bn_limit_bits_low);
129 else if (which == 3) return(bn_limit_bits_mont); 129 else if (which == 3) return(bn_limit_bits_mont);
130 else return(0); 130 else return(0);
131 } 131 }
132 #endif 132 #endif
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,
148 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 167 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
149 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 168 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
150 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 169 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
151 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 170 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
152 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 171 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
153 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 172 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
154 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 173 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT _LONG) 228 #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT _LONG)
210 if (l & 0xffff0000L) 229 if (l & 0xffff0000L)
211 { 230 {
212 if (l & 0xff000000L) 231 if (l & 0xff000000L)
213 return(bits[(int)(l>>24L)]+24); 232 return(bits[(int)(l>>24L)]+24);
214 else return(bits[(int)(l>>16L)]+16); 233 else return(bits[(int)(l>>16L)]+16);
215 } 234 }
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
223 #endif 242 #endif
224 return(bits[(int)(l )] ); 243 return(bits[(int)(l )] );
225 } 244 }
226 } 245 }
227 } 246 }
228 247
229 int BN_num_bits(const BIGNUM *a) 248 int BN_num_bits(const BIGNUM *a)
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 756
738 int BN_is_bit_set(const BIGNUM *a, int n) 757 int BN_is_bit_set(const BIGNUM *a, int n)
739 { 758 {
740 int i,j; 759 int i,j;
741 760
742 bn_check_top(a); 761 bn_check_top(a);
743 if (n < 0) return 0; 762 if (n < 0) return 0;
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)
751 { 770 {
752 int b,w; 771 int b,w;
753 772
754 bn_check_top(a); 773 bn_check_top(a);
755 if (n < 0) return 0; 774 if (n < 0) return 0;
756 775
757 w=n/BN_BITS2; 776 w=n/BN_BITS2;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 if (dl > 0) 836 if (dl > 0)
818 { 837 {
819 for (i=dl; i>0; i--) 838 for (i=dl; i>0; i--)
820 { 839 {
821 if (a[n+i] != 0) 840 if (a[n+i] != 0)
822 return 1; /* a > b */ 841 return 1; /* a > b */
823 } 842 }
824 } 843 }
825 return bn_cmp_words(a,b,cl); 844 return bn_cmp_words(a,b,cl);
826 } 845 }
OLDNEW
« no previous file with comments | « openssl/crypto/bn/bn_lcl.h ('k') | openssl/crypto/bn/bn_mont.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698