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

Side by Side Diff: nss/lib/certhigh/certhigh.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/certdb/xconst.c ('k') | nss/lib/certhigh/certreq.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 #include "nspr.h" 4 #include "nspr.h"
5 #include "secerr.h" 5 #include "secerr.h"
6 #include "secasn1.h" 6 #include "secasn1.h"
7 #include "seccomon.h" 7 #include "seccomon.h"
8 #include "pk11func.h" 8 #include "pk11func.h"
9 #include "certdb.h" 9 #include "certdb.h"
10 #include "certt.h" 10 #include "certt.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 PRBool oneCertPerName, 73 PRBool oneCertPerName,
74 PRBool validOnly, 74 PRBool validOnly,
75 void *proto_win) 75 void *proto_win)
76 { 76 {
77 CERTCertNicknames *nicknames = NULL; 77 CERTCertNicknames *nicknames = NULL;
78 char **nnptr; 78 char **nnptr;
79 int nn; 79 int nn;
80 CERTCertificate *cert = NULL; 80 CERTCertificate *cert = NULL;
81 CERTCertList *certList = NULL; 81 CERTCertList *certList = NULL;
82 SECStatus rv; 82 SECStatus rv;
83 int64 time; 83 PRTime time;
84 CERTCertListNode *node = NULL; 84 CERTCertListNode *node = NULL;
85 CERTCertListNode *freenode = NULL; 85 CERTCertListNode *freenode = NULL;
86 int n; 86 int n;
87 87
88 time = PR_Now(); 88 time = PR_Now();
89 89
90 nicknames = CERT_GetCertNicknames(handle, SEC_CERT_NICKNAMES_USER, 90 nicknames = CERT_GetCertNicknames(handle, SEC_CERT_NICKNAMES_USER,
91 proto_win); 91 proto_win);
92 92
93 if ( ( nicknames == NULL ) || ( nicknames->numnicknames == 0 ) ) { 93 if ( ( nicknames == NULL ) || ( nicknames->numnicknames == 0 ) ) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 CERTCertificate * 221 CERTCertificate *
222 CERT_FindUserCertByUsage(CERTCertDBHandle *handle, 222 CERT_FindUserCertByUsage(CERTCertDBHandle *handle,
223 const char *nickname, 223 const char *nickname,
224 SECCertUsage usage, 224 SECCertUsage usage,
225 PRBool validOnly, 225 PRBool validOnly,
226 void *proto_win) 226 void *proto_win)
227 { 227 {
228 CERTCertificate *cert = NULL; 228 CERTCertificate *cert = NULL;
229 CERTCertList *certList = NULL; 229 CERTCertList *certList = NULL;
230 SECStatus rv; 230 SECStatus rv;
231 int64 time; 231 PRTime time;
232 232
233 time = PR_Now(); 233 time = PR_Now();
234 234
235 /* use the pk11 call so that we pick up any certs on tokens, 235 /* use the pk11 call so that we pick up any certs on tokens,
236 * which may require login 236 * which may require login
237 */ 237 */
238 /* XXX - why is this restricted? */ 238 /* XXX - why is this restricted? */
239 if ( proto_win != NULL ) { 239 if ( proto_win != NULL ) {
240 cert = PK11_FindCertFromNickname(nickname,proto_win); 240 cert = PK11_FindCertFromNickname(nickname,proto_win);
241 } 241 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 names->numnicknames++; 451 names->numnicknames++;
452 } 452 }
453 453
454 if (nickname) PORT_Free(nickname); 454 if (nickname) PORT_Free(nickname);
455 return(PR_SUCCESS); 455 return(PR_SUCCESS);
456 } 456 }
457 457
458 CERTCertNicknames * 458 CERTCertNicknames *
459 CERT_GetCertNicknames(CERTCertDBHandle *handle, int what, void *wincx) 459 CERT_GetCertNicknames(CERTCertDBHandle *handle, int what, void *wincx)
460 { 460 {
461 PRArenaPool *arena; 461 PLArenaPool *arena;
462 CERTCertNicknames *names; 462 CERTCertNicknames *names;
463 int i; 463 int i;
464 stringNode *node; 464 stringNode *node;
465 465
466 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 466 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
467 if ( arena == NULL ) { 467 if ( arena == NULL ) {
468 PORT_SetError(SEC_ERROR_NO_MEMORY); 468 PORT_SetError(SEC_ERROR_NO_MEMORY);
469 return(NULL); 469 return(NULL);
470 } 470 }
471 471
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 return(SECSuccess); 582 return(SECSuccess);
583 } 583 }
584 584
585 /* 585 /*
586 * Return all of the CAs that are "trusted" for SSL. 586 * Return all of the CAs that are "trusted" for SSL.
587 */ 587 */
588 CERTDistNames * 588 CERTDistNames *
589 CERT_DupDistNames(CERTDistNames *orig) 589 CERT_DupDistNames(CERTDistNames *orig)
590 { 590 {
591 PRArenaPool *arena; 591 PLArenaPool *arena;
592 CERTDistNames *names; 592 CERTDistNames *names;
593 int i; 593 int i;
594 SECStatus rv; 594 SECStatus rv;
595 595
596 /* allocate an arena to use */ 596 /* allocate an arena to use */
597 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 597 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
598 if (arena == NULL) { 598 if (arena == NULL) {
599 PORT_SetError(SEC_ERROR_NO_MEMORY); 599 PORT_SetError(SEC_ERROR_NO_MEMORY);
600 return(NULL); 600 return(NULL);
601 } 601 }
(...skipping 27 matching lines...) Expand all
629 return(names); 629 return(names);
630 630
631 loser: 631 loser:
632 PORT_FreeArena(arena, PR_FALSE); 632 PORT_FreeArena(arena, PR_FALSE);
633 return(NULL); 633 return(NULL);
634 } 634 }
635 635
636 CERTDistNames * 636 CERTDistNames *
637 CERT_GetSSLCACerts(CERTCertDBHandle *handle) 637 CERT_GetSSLCACerts(CERTCertDBHandle *handle)
638 { 638 {
639 PRArenaPool *arena; 639 PLArenaPool *arena;
640 CERTDistNames *names; 640 CERTDistNames *names;
641 int i; 641 int i;
642 SECStatus rv; 642 SECStatus rv;
643 dnameNode *node; 643 dnameNode *node;
644 644
645 /* allocate an arena to use */ 645 /* allocate an arena to use */
646 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 646 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
647 if ( arena == NULL ) { 647 if ( arena == NULL ) {
648 PORT_SetError(SEC_ERROR_NO_MEMORY); 648 PORT_SetError(SEC_ERROR_NO_MEMORY);
649 return(NULL); 649 return(NULL);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 691
692 loser: 692 loser:
693 PORT_FreeArena(arena, PR_FALSE); 693 PORT_FreeArena(arena, PR_FALSE);
694 return(NULL); 694 return(NULL);
695 } 695 }
696 696
697 CERTDistNames * 697 CERTDistNames *
698 CERT_DistNamesFromCertList(CERTCertList *certList) 698 CERT_DistNamesFromCertList(CERTCertList *certList)
699 { 699 {
700 CERTDistNames * dnames = NULL; 700 CERTDistNames * dnames = NULL;
701 PRArenaPool * arena; 701 PLArenaPool * arena;
702 CERTCertListNode *node = NULL; 702 CERTCertListNode *node = NULL;
703 SECItem * names = NULL; 703 SECItem * names = NULL;
704 int listLen = 0, i = 0; 704 int listLen = 0, i = 0;
705 705
706 if (certList == NULL) { 706 if (certList == NULL) {
707 PORT_SetError(SEC_ERROR_INVALID_ARGS); 707 PORT_SetError(SEC_ERROR_INVALID_ARGS);
708 return NULL; 708 return NULL;
709 } 709 }
710 710
711 node = CERT_LIST_HEAD(certList); 711 node = CERT_LIST_HEAD(certList);
(...skipping 27 matching lines...) Expand all
739 PORT_FreeArena(arena, PR_FALSE); 739 PORT_FreeArena(arena, PR_FALSE);
740 } 740 }
741 return NULL; 741 return NULL;
742 } 742 }
743 743
744 CERTDistNames * 744 CERTDistNames *
745 CERT_DistNamesFromNicknames(CERTCertDBHandle *handle, char **nicknames, 745 CERT_DistNamesFromNicknames(CERTCertDBHandle *handle, char **nicknames,
746 int nnames) 746 int nnames)
747 { 747 {
748 CERTDistNames *dnames = NULL; 748 CERTDistNames *dnames = NULL;
749 PRArenaPool *arena; 749 PLArenaPool *arena;
750 int i, rv; 750 int i, rv;
751 SECItem *names = NULL; 751 SECItem *names = NULL;
752 CERTCertificate *cert = NULL; 752 CERTCertificate *cert = NULL;
753 753
754 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 754 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
755 if (arena == NULL) goto loser; 755 if (arena == NULL) goto loser;
756 dnames = PORT_ArenaZNew(arena, CERTDistNames); 756 dnames = PORT_ArenaZNew(arena, CERTDistNames);
757 if (dnames == NULL) goto loser; 757 if (dnames == NULL) goto loser;
758 758
759 dnames->arena = arena; 759 dnames->arena = arena;
(...skipping 21 matching lines...) Expand all
781 /* [ from pcertdb.c - calls Ascii to Name ] */ 781 /* [ from pcertdb.c - calls Ascii to Name ] */
782 /* 782 /*
783 * Lookup a certificate in the database by name 783 * Lookup a certificate in the database by name
784 */ 784 */
785 CERTCertificate * 785 CERTCertificate *
786 CERT_FindCertByNameString(CERTCertDBHandle *handle, char *nameStr) 786 CERT_FindCertByNameString(CERTCertDBHandle *handle, char *nameStr)
787 { 787 {
788 CERTName *name; 788 CERTName *name;
789 SECItem *nameItem; 789 SECItem *nameItem;
790 CERTCertificate *cert = NULL; 790 CERTCertificate *cert = NULL;
791 PRArenaPool *arena = NULL; 791 PLArenaPool *arena = NULL;
792 792
793 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 793 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
794 794
795 if ( arena == NULL ) { 795 if ( arena == NULL ) {
796 goto loser; 796 goto loser;
797 } 797 }
798 798
799 name = CERT_AsciiToName(nameStr); 799 name = CERT_AsciiToName(nameStr);
800 800
801 if ( name ) { 801 if ( name ) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 CERTCertificate *cert; 1017 CERTCertificate *cert;
1018 } certNode; 1018 } certNode;
1019 1019
1020 CERTCertificateList * 1020 CERTCertificateList *
1021 CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage, 1021 CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage,
1022 PRBool includeRoot) 1022 PRBool includeRoot)
1023 { 1023 {
1024 CERTCertificateList *chain = NULL; 1024 CERTCertificateList *chain = NULL;
1025 NSSCertificate **stanChain; 1025 NSSCertificate **stanChain;
1026 NSSCertificate *stanCert; 1026 NSSCertificate *stanCert;
1027 PRArenaPool *arena; 1027 PLArenaPool *arena;
1028 NSSUsage nssUsage; 1028 NSSUsage nssUsage;
1029 int i, len; 1029 int i, len;
1030 NSSTrustDomain *td = STAN_GetDefaultTrustDomain(); 1030 NSSTrustDomain *td = STAN_GetDefaultTrustDomain();
1031 NSSCryptoContext *cc = STAN_GetDefaultCryptoContext(); 1031 NSSCryptoContext *cc = STAN_GetDefaultCryptoContext();
1032 1032
1033 stanCert = STAN_GetNSSCertificate(cert); 1033 stanCert = STAN_GetNSSCertificate(cert);
1034 if (!stanCert) { 1034 if (!stanCert) {
1035 /* error code is set */ 1035 /* error code is set */
1036 return NULL; 1036 return NULL;
1037 } 1037 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 } 1109 }
1110 1110
1111 /* Builds a CERTCertificateList holding just one DER-encoded cert, namely 1111 /* Builds a CERTCertificateList holding just one DER-encoded cert, namely
1112 ** the one for the cert passed as an argument. 1112 ** the one for the cert passed as an argument.
1113 */ 1113 */
1114 CERTCertificateList * 1114 CERTCertificateList *
1115 CERT_CertListFromCert(CERTCertificate *cert) 1115 CERT_CertListFromCert(CERTCertificate *cert)
1116 { 1116 {
1117 CERTCertificateList *chain = NULL; 1117 CERTCertificateList *chain = NULL;
1118 int rv; 1118 int rv;
1119 PRArenaPool *arena; 1119 PLArenaPool *arena;
1120 1120
1121 /* arena for SecCertificateList */ 1121 /* arena for SecCertificateList */
1122 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 1122 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
1123 if (arena == NULL) goto no_memory; 1123 if (arena == NULL) goto no_memory;
1124 1124
1125 /* build the CERTCertificateList */ 1125 /* build the CERTCertificateList */
1126 chain = (CERTCertificateList *)PORT_ArenaAlloc(arena, sizeof(CERTCertificate List)); 1126 chain = (CERTCertificateList *)PORT_ArenaAlloc(arena, sizeof(CERTCertificate List));
1127 if (chain == NULL) goto no_memory; 1127 if (chain == NULL) goto no_memory;
1128 chain->certs = (SECItem*)PORT_ArenaAlloc(arena, 1 * sizeof(SECItem)); 1128 chain->certs = (SECItem*)PORT_ArenaAlloc(arena, 1 * sizeof(SECItem));
1129 if (chain->certs == NULL) goto no_memory; 1129 if (chain->certs == NULL) goto no_memory;
(...skipping 10 matching lines...) Expand all
1140 if (arena != NULL) { 1140 if (arena != NULL) {
1141 PORT_FreeArena(arena, PR_FALSE); 1141 PORT_FreeArena(arena, PR_FALSE);
1142 } 1142 }
1143 return NULL; 1143 return NULL;
1144 } 1144 }
1145 1145
1146 CERTCertificateList * 1146 CERTCertificateList *
1147 CERT_DupCertList(const CERTCertificateList * oldList) 1147 CERT_DupCertList(const CERTCertificateList * oldList)
1148 { 1148 {
1149 CERTCertificateList *newList = NULL; 1149 CERTCertificateList *newList = NULL;
1150 PRArenaPool *arena = NULL; 1150 PLArenaPool *arena = NULL;
1151 SECItem *newItem; 1151 SECItem *newItem;
1152 SECItem *oldItem; 1152 SECItem *oldItem;
1153 int len = oldList->len; 1153 int len = oldList->len;
1154 int rv; 1154 int rv;
1155 1155
1156 /* arena for SecCertificateList */ 1156 /* arena for SecCertificateList */
1157 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); 1157 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
1158 if (arena == NULL) 1158 if (arena == NULL)
1159 goto no_memory; 1159 goto no_memory;
1160 1160
(...skipping 23 matching lines...) Expand all
1184 } 1184 }
1185 return NULL; 1185 return NULL;
1186 } 1186 }
1187 1187
1188 void 1188 void
1189 CERT_DestroyCertificateList(CERTCertificateList *list) 1189 CERT_DestroyCertificateList(CERTCertificateList *list)
1190 { 1190 {
1191 PORT_FreeArena(list->arena, PR_FALSE); 1191 PORT_FreeArena(list->arena, PR_FALSE);
1192 } 1192 }
1193 1193
OLDNEW
« no previous file with comments | « nss/lib/certdb/xconst.c ('k') | nss/lib/certhigh/certreq.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698