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

Side by Side Diff: openssl/crypto/asn1/asn1_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/asn1/asn1_gen.c ('k') | openssl/crypto/asn1/asn1_locl.h » ('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/asn1_lib.c */ 1 /* crypto/asn1/asn1_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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 { 333 {
334 c->error=ERR_R_ASN1_LENGTH_MISMATCH; 334 c->error=ERR_R_ASN1_LENGTH_MISMATCH;
335 return(0); 335 return(0);
336 } 336 }
337 if (c->inf == (1|V_ASN1_CONSTRUCTED)) 337 if (c->inf == (1|V_ASN1_CONSTRUCTED))
338 c->slen= *length+ *(c->pp)-c->p; 338 c->slen= *length+ *(c->pp)-c->p;
339 c->eos=0; 339 c->eos=0;
340 return(1); 340 return(1);
341 } 341 }
342 342
343 ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str) 343 int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
344 » {
345 » if (str == NULL)
346 » » return 0;
347 » dst->type = str->type;
348 » if (!ASN1_STRING_set(dst,str->data,str->length))
349 » » return 0;
350 » dst->flags = str->flags;
351 » return 1;
352 » }
353
354 ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)
344 { 355 {
345 ASN1_STRING *ret; 356 ASN1_STRING *ret;
346 357 » if (!str)
347 » if (str == NULL) return(NULL); 358 » » return NULL;
348 » if ((ret=ASN1_STRING_type_new(str->type)) == NULL) 359 » ret=ASN1_STRING_new();
349 » » return(NULL); 360 » if (!ret)
350 » if (!ASN1_STRING_set(ret,str->data,str->length)) 361 » » return NULL;
362 » if (!ASN1_STRING_copy(ret,str))
351 { 363 {
352 ASN1_STRING_free(ret); 364 ASN1_STRING_free(ret);
353 » » return(NULL); 365 » » return NULL;
354 } 366 }
355 » ret->flags = str->flags; 367 » return ret;
356 » return(ret);
357 } 368 }
358 369
359 int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 370 int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
360 { 371 {
361 unsigned char *c; 372 unsigned char *c;
362 const char *data=_data; 373 const char *data=_data;
363 374
364 if (len < 0) 375 if (len < 0)
365 { 376 {
366 if (data == NULL) 377 if (data == NULL)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ret->length=0; 431 ret->length=0;
421 ret->type=type; 432 ret->type=type;
422 ret->data=NULL; 433 ret->data=NULL;
423 ret->flags=0; 434 ret->flags=0;
424 return(ret); 435 return(ret);
425 } 436 }
426 437
427 void ASN1_STRING_free(ASN1_STRING *a) 438 void ASN1_STRING_free(ASN1_STRING *a)
428 { 439 {
429 if (a == NULL) return; 440 if (a == NULL) return;
430 » if (a->data != NULL) OPENSSL_free(a->data); 441 » if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
442 » » OPENSSL_free(a->data);
431 OPENSSL_free(a); 443 OPENSSL_free(a);
432 } 444 }
433 445
434 int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) 446 int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
435 { 447 {
436 int i; 448 int i;
437 449
438 i=(a->length-b->length); 450 i=(a->length-b->length);
439 if (i == 0) 451 if (i == 0)
440 { 452 {
441 i=memcmp(a->data,b->data,a->length); 453 i=memcmp(a->data,b->data,a->length);
442 if (i == 0) 454 if (i == 0)
443 return(a->type-b->type); 455 return(a->type-b->type);
444 else 456 else
445 return(i); 457 return(i);
446 } 458 }
447 else 459 else
448 return(i); 460 return(i);
449 } 461 }
450 462
451 void asn1_add_error(const unsigned char *address, int offset) 463 void asn1_add_error(const unsigned char *address, int offset)
452 { 464 {
453 char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; 465 char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1];
454 466
455 BIO_snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address); 467 BIO_snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address);
456 BIO_snprintf(buf2,sizeof buf2,"%d",offset); 468 BIO_snprintf(buf2,sizeof buf2,"%d",offset);
457 ERR_add_error_data(4,"address=",buf1," offset=",buf2); 469 ERR_add_error_data(4,"address=",buf1," offset=",buf2);
458 } 470 }
459 471
460 int ASN1_STRING_length(ASN1_STRING *x) 472 int ASN1_STRING_length(const ASN1_STRING *x)
461 { return M_ASN1_STRING_length(x); } 473 { return M_ASN1_STRING_length(x); }
462 474
463 void ASN1_STRING_length_set(ASN1_STRING *x, int len) 475 void ASN1_STRING_length_set(ASN1_STRING *x, int len)
464 { M_ASN1_STRING_length_set(x, len); return; } 476 { M_ASN1_STRING_length_set(x, len); return; }
465 477
466 int ASN1_STRING_type(ASN1_STRING *x) 478 int ASN1_STRING_type(ASN1_STRING *x)
467 { return M_ASN1_STRING_type(x); } 479 { return M_ASN1_STRING_type(x); }
468 480
469 unsigned char * ASN1_STRING_data(ASN1_STRING *x) 481 unsigned char * ASN1_STRING_data(ASN1_STRING *x)
470 { return M_ASN1_STRING_data(x); } 482 { return M_ASN1_STRING_data(x); }
OLDNEW
« no previous file with comments | « openssl/crypto/asn1/asn1_gen.c ('k') | openssl/crypto/asn1/asn1_locl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698