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

Side by Side Diff: nss/lib/certdb/alg1485.c

Issue 319593003: Update to NSS 3.16.2 Beta 3. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Remove unused function SEC_NumberOrNameStringToOIDTag Created 6 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
OLDNEW
1 /* alg1485.c - implementation of RFCs 1485, 1779 and 2253. 1 /* alg1485.c - implementation of RFCs 1485, 1779 and 2253.
2 * 2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public 3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 6
7 #include "prprf.h" 7 #include "prprf.h"
8 #include "cert.h" 8 #include "cert.h"
9 #include "certi.h" 9 #include "certi.h"
10 #include "xconst.h" 10 #include "xconst.h"
(...skipping 10 matching lines...) Expand all
21 21
22 /* local type for directory string--could be printable_string or utf8 */ 22 /* local type for directory string--could be printable_string or utf8 */
23 #define SEC_ASN1_DS SEC_ASN1_HIGH_TAG_NUMBER 23 #define SEC_ASN1_DS SEC_ASN1_HIGH_TAG_NUMBER
24 24
25 /* Add new entries to this table, and maybe to function ParseRFC1485AVA */ 25 /* Add new entries to this table, and maybe to function ParseRFC1485AVA */
26 static const NameToKind name2kinds[] = { 26 static const NameToKind name2kinds[] = {
27 /* IANA registered type names 27 /* IANA registered type names
28 * (See: http://www.iana.org/assignments/ldap-parameters) 28 * (See: http://www.iana.org/assignments/ldap-parameters)
29 */ 29 */
30 /* RFC 3280, 4630 MUST SUPPORT */ 30 /* RFC 3280, 4630 MUST SUPPORT */
31 { "CN", 64, SEC_OID_AVA_COMMON_NAME, SEC_ASN1_DS}, 31 { "CN", 640, SEC_OID_AVA_COMMON_NAME, SEC_ASN1_DS},
32 { "ST", 128, SEC_OID_AVA_STATE_OR_PROVINCE, 32 { "ST", 128, SEC_OID_AVA_STATE_OR_PROVINCE,
33 SEC_ASN1_DS}, 33 SEC_ASN1_DS},
34 { "O", 64, SEC_OID_AVA_ORGANIZATION_NAME, 34 { "O", 128, SEC_OID_AVA_ORGANIZATION_NAME,
35 SEC_ASN1_DS}, 35 SEC_ASN1_DS},
36 { "OU", 64, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME, 36 { "OU", 128, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME,
37 SEC_ASN1_DS}, 37 SEC_ASN1_DS},
38 { "dnQualifier", 32767, SEC_OID_AVA_DN_QUALIFIER, SEC_ASN1_PRINTABLE_STRING} , 38 { "dnQualifier", 32767, SEC_OID_AVA_DN_QUALIFIER, SEC_ASN1_PRINTABLE_STRING} ,
39 { "C", 2, SEC_OID_AVA_COUNTRY_NAME, SEC_ASN1_PRINTABLE_STRING} , 39 { "C", 2, SEC_OID_AVA_COUNTRY_NAME, SEC_ASN1_PRINTABLE_STRING} ,
40 { "serialNumber", 64, SEC_OID_AVA_SERIAL_NUMBER,SEC_ASN1_PRINTABLE_STRING} , 40 { "serialNumber", 64, SEC_OID_AVA_SERIAL_NUMBER,SEC_ASN1_PRINTABLE_STRING} ,
41 41
42 /* RFC 3280, 4630 SHOULD SUPPORT */ 42 /* RFC 3280, 4630 SHOULD SUPPORT */
43 { "L", 128, SEC_OID_AVA_LOCALITY, SEC_ASN1_DS}, 43 { "L", 128, SEC_OID_AVA_LOCALITY, SEC_ASN1_DS},
44 { "title", 64, SEC_OID_AVA_TITLE, SEC_ASN1_DS}, 44 { "title", 64, SEC_OID_AVA_TITLE, SEC_ASN1_DS},
45 { "SN", 64, SEC_OID_AVA_SURNAME, SEC_ASN1_DS}, 45 { "SN", 64, SEC_OID_AVA_SURNAME, SEC_ASN1_DS},
46 { "givenName", 64, SEC_OID_AVA_GIVEN_NAME, SEC_ASN1_DS}, 46 { "givenName", 64, SEC_OID_AVA_GIVEN_NAME, SEC_ASN1_DS},
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 const char *bp; 370 const char *bp;
371 int vt = -1; 371 int vt = -1;
372 int valLen; 372 int valLen;
373 SECOidTag kind = SEC_OID_UNKNOWN; 373 SECOidTag kind = SEC_OID_UNKNOWN;
374 SECStatus rv = SECFailure; 374 SECStatus rv = SECFailure;
375 SECItem derOid = { 0, NULL, 0 }; 375 SECItem derOid = { 0, NULL, 0 };
376 SECItem derVal = { 0, NULL, 0}; 376 SECItem derVal = { 0, NULL, 0};
377 char sep = 0; 377 char sep = 0;
378 378
379 char tagBuf[32]; 379 char tagBuf[32];
380 char valBuf[384]; 380 char valBuf[1024];
381 381
382 PORT_Assert(arena); 382 PORT_Assert(arena);
383 if (SECSuccess != scanTag(pbp, endptr, tagBuf, sizeof tagBuf) || 383 if (SECSuccess != scanTag(pbp, endptr, tagBuf, sizeof tagBuf) ||
384 !(valLen = scanVal(pbp, endptr, valBuf, sizeof valBuf))) { 384 !(valLen = scanVal(pbp, endptr, valBuf, sizeof valBuf))) {
385 goto loser; 385 goto loser;
386 } 386 }
387 387
388 bp = *pbp; 388 bp = *pbp;
389 if (bp < endptr) { 389 if (bp < endptr) {
390 sep = *bp++; /* skip over separator */ 390 sep = *bp++; /* skip over separator */
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 * The chief difference between CERT_N2A_STRICT and CERT_N2A_INVERTIBLE 882 * The chief difference between CERT_N2A_STRICT and CERT_N2A_INVERTIBLE
883 * is that the latter forces DirectoryStrings to be hex encoded. 883 * is that the latter forces DirectoryStrings to be hex encoded.
884 * 884 *
885 * As a simplification, we assume the value is correctly encoded for 885 * As a simplification, we assume the value is correctly encoded for
886 * its encoding type. That is, we do not test that all the characters 886 * its encoding type. That is, we do not test that all the characters
887 * in a string encoded type are allowed by that type. We assume it. 887 * in a string encoded type are allowed by that type. We assume it.
888 */ 888 */
889 static SECStatus 889 static SECStatus
890 AppendAVA(stringBuf *bufp, CERTAVA *ava, CertStrictnessLevel strict) 890 AppendAVA(stringBuf *bufp, CERTAVA *ava, CertStrictnessLevel strict)
891 { 891 {
892 #define TMPBUF_LEN 384 892 #define TMPBUF_LEN 2048
893 const NameToKind *pn2k = name2kinds; 893 const NameToKind *pn2k = name2kinds;
894 SECItem *avaValue = NULL; 894 SECItem *avaValue = NULL;
895 char *unknownTag = NULL; 895 char *unknownTag = NULL;
896 char *encodedAVA = NULL; 896 char *encodedAVA = NULL;
897 PRBool useHex = PR_FALSE; /* use =#hexXXXX form */ 897 PRBool useHex = PR_FALSE; /* use =#hexXXXX form */
898 PRBool truncateName = PR_FALSE; 898 PRBool truncateName = PR_FALSE;
899 PRBool truncateValue = PR_FALSE; 899 PRBool truncateValue = PR_FALSE;
900 SECOidTag endKind; 900 SECOidTag endKind;
901 SECStatus rv; 901 SECStatus rv;
902 unsigned int len; 902 unsigned int len;
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 { 1551 {
1552 return(CERT_GetNameElement(NULL, name, SEC_OID_AVA_DN_QUALIFIER)); 1552 return(CERT_GetNameElement(NULL, name, SEC_OID_AVA_DN_QUALIFIER));
1553 } 1553 }
1554 1554
1555 char * 1555 char *
1556 CERT_GetCertUid(const CERTName *name) 1556 CERT_GetCertUid(const CERTName *name)
1557 { 1557 {
1558 return(CERT_GetNameElement(NULL, name, SEC_OID_RFC1274_UID)); 1558 return(CERT_GetNameElement(NULL, name, SEC_OID_RFC1274_UID));
1559 } 1559 }
1560 1560
OLDNEW
« no previous file with comments | « nss.gyp ('k') | nss/lib/certdb/cert.h » ('j') | nss/lib/certdb/genname.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698