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

Side by Side Diff: openssl/crypto/asn1/a_bitstr.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/asn1/Makefile ('k') | openssl/crypto/asn1/a_dup.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/asn1/a_bitstr.c */ 1 /* crypto/asn1/a_bitstr.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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 { 216 {
217 int w,v; 217 int w,v;
218 218
219 w=n/8; 219 w=n/8;
220 v=1<<(7-(n&0x07)); 220 v=1<<(7-(n&0x07));
221 if ((a == NULL) || (a->length < (w+1)) || (a->data == NULL)) 221 if ((a == NULL) || (a->length < (w+1)) || (a->data == NULL))
222 return(0); 222 return(0);
223 return((a->data[w]&v) != 0); 223 return((a->data[w]&v) != 0);
224 } 224 }
225 225
226 /*
227 * Checks if the given bit string contains only bits specified by
228 * the flags vector. Returns 0 if there is at least one bit set in 'a'
229 * which is not specified in 'flags', 1 otherwise.
230 * 'len' is the length of 'flags'.
231 */
232 int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
233 unsigned char *flags, int flags_len)
234 {
235 int i, ok;
236 /* Check if there is one bit set at all. */
237 if (!a || !a->data) return 1;
238
239 /* Check each byte of the internal representation of the bit string. */
240 ok = 1;
241 for (i = 0; i < a->length && ok; ++i)
242 {
243 unsigned char mask = i < flags_len ? ~flags[i] : 0xff;
244 /* We are done if there is an unneeded bit set. */
245 ok = (a->data[i] & mask) == 0;
246 }
247 return ok;
248 }
OLDNEW
« no previous file with comments | « openssl/crypto/asn1/Makefile ('k') | openssl/crypto/asn1/a_dup.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698