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

Side by Side Diff: nss/lib/util/derenc.c

Issue 16132005: Allow NSS to be built with NO_NSPR_10_SUPPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 6 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 | « nss/lib/softoken/softoken.h ('k') | nss/lib/util/dersubr.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 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 4
5 #include "secder.h" 5 #include "secder.h"
6 #include "secerr.h" 6 #include "secerr.h"
7 7
8 #if 0 8 #if 0
9 /* 9 /*
10 * Generic templates for individual/simple items. 10 * Generic templates for individual/simple items.
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 buf += contents_len; 436 buf += contents_len;
437 } 437 }
438 break; 438 break;
439 } 439 }
440 440
441 return buf; 441 return buf;
442 } 442 }
443 443
444 444
445 SECStatus 445 SECStatus
446 DER_Encode(PRArenaPool *arena, SECItem *dest, DERTemplate *dtemplate, void *src) 446 DER_Encode(PLArenaPool *arena, SECItem *dest, DERTemplate *dtemplate, void *src)
447 { 447 {
448 unsigned int contents_len, header_len; 448 unsigned int contents_len, header_len;
449 449
450 src = (void **)((char *)src + dtemplate->offset); 450 src = (void **)((char *)src + dtemplate->offset);
451 451
452 /* 452 /*
453 * First figure out how long the encoding will be. Do this by 453 * First figure out how long the encoding will be. Do this by
454 * traversing the template from top to bottom and accumulating 454 * traversing the template from top to bottom and accumulating
455 * the length of each leaf item. 455 * the length of each leaf item.
456 */ 456 */
457 contents_len = contents_length (dtemplate, src); 457 contents_len = contents_length (dtemplate, src);
458 header_len = header_length (dtemplate, contents_len); 458 header_len = header_length (dtemplate, contents_len);
459 459
460 dest->len = contents_len + header_len; 460 dest->len = contents_len + header_len;
461 461
462 /* Allocate storage to hold the encoding */ 462 /* Allocate storage to hold the encoding */
463 dest->data = (unsigned char*) PORT_ArenaAlloc(arena, dest->len); 463 dest->data = (unsigned char*) PORT_ArenaAlloc(arena, dest->len);
464 if (dest->data == NULL) { 464 if (dest->data == NULL) {
465 PORT_SetError(SEC_ERROR_NO_MEMORY); 465 PORT_SetError(SEC_ERROR_NO_MEMORY);
466 return SECFailure; 466 return SECFailure;
467 } 467 }
468 468
469 /* Now encode into the buffer */ 469 /* Now encode into the buffer */
470 (void) der_encode (dest->data, dtemplate, src); 470 (void) der_encode (dest->data, dtemplate, src);
471 471
472 return SECSuccess; 472 return SECSuccess;
473 } 473 }
OLDNEW
« no previous file with comments | « nss/lib/softoken/softoken.h ('k') | nss/lib/util/dersubr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698