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

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

Issue 606034: NSS: update to 3.12.6 RC0 (Closed)
Patch Set: Created 10 years, 10 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
OLDNEW
1 /* alg1485.c - implementation of RFCs 1485, 1779 and 2253. 1 /* alg1485.c - implementation of RFCs 1485, 1779 and 2253.
2 * 2 *
3 * ***** BEGIN LICENSE BLOCK ***** 3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * 5 *
6 * The contents of this file are subject to the Mozilla Public License Version 6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with 7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at 8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/ 9 * http://www.mozilla.org/MPL/
10 * 10 *
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 !IsPrintable((unsigned char*) valBuf, valLen)) 451 !IsPrintable((unsigned char*) valBuf, valLen))
452 goto loser; 452 goto loser;
453 if (vt == SEC_ASN1_DS) { 453 if (vt == SEC_ASN1_DS) {
454 /* RFC 4630: choose PrintableString or UTF8String */ 454 /* RFC 4630: choose PrintableString or UTF8String */
455 if (IsPrintable((unsigned char*) valBuf, valLen)) 455 if (IsPrintable((unsigned char*) valBuf, valLen))
456 vt = SEC_ASN1_PRINTABLE_STRING; 456 vt = SEC_ASN1_PRINTABLE_STRING;
457 else 457 else
458 vt = SEC_ASN1_UTF8_STRING; 458 vt = SEC_ASN1_UTF8_STRING;
459 } 459 }
460 460
461 » derVal.data = valBuf; 461 » derVal.data = (unsigned char*) valBuf;
462 derVal.len = valLen; 462 derVal.len = valLen;
463 a = CERT_CreateAVAFromSECItem(arena, kind, vt, &derVal); 463 a = CERT_CreateAVAFromSECItem(arena, kind, vt, &derVal);
464 } 464 }
465 return a; 465 return a;
466 466
467 loser: 467 loser:
468 /* matched no kind -- invalid tag */ 468 /* matched no kind -- invalid tag */
469 PORT_SetError(SEC_ERROR_INVALID_AVA); 469 PORT_SetError(SEC_ERROR_INVALID_AVA);
470 return 0; 470 return 0;
471 } 471 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 avaValue = get_hex_string(&ava->value); 974 avaValue = get_hex_string(&ava->value);
975 if (!avaValue) { 975 if (!avaValue) {
976 if (unknownTag) 976 if (unknownTag)
977 PR_smprintf_free(unknownTag); 977 PR_smprintf_free(unknownTag);
978 return SECFailure; 978 return SECFailure;
979 } 979 }
980 } 980 }
981 981
982 nameLen = strlen(tagName); 982 nameLen = strlen(tagName);
983 valueLen = (useHex ? avaValue->len : 983 valueLen = (useHex ? avaValue->len :
984 » » cert_RFC1485_GetRequiredLen(avaValue->data, avaValue->len, 984 » » cert_RFC1485_GetRequiredLen((char *)avaValue->data, avaValue->le n,
985 &mode)); 985 &mode));
986 len = nameLen + valueLen + 2; /* Add 2 for '=' and trailing NUL */ 986 len = nameLen + valueLen + 2; /* Add 2 for '=' and trailing NUL */
987 987
988 maxName = nameLen; 988 maxName = nameLen;
989 maxValue = valueLen; 989 maxValue = valueLen;
990 if (len <= sizeof(tmpBuf)) { 990 if (len <= sizeof(tmpBuf)) {
991 encodedAVA = tmpBuf; 991 encodedAVA = tmpBuf;
992 } else if (strict != CERT_N2A_READABLE) { 992 } else if (strict != CERT_N2A_READABLE) {
993 encodedAVA = PORT_Alloc(len); 993 encodedAVA = PORT_Alloc(len);
994 if (!encodedAVA) { 994 if (!encodedAVA) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 avaToString(PRArenaPool *arena, CERTAVA *ava) 1187 avaToString(PRArenaPool *arena, CERTAVA *ava)
1188 { 1188 {
1189 char * buf = NULL; 1189 char * buf = NULL;
1190 SECItem* avaValue; 1190 SECItem* avaValue;
1191 int valueLen; 1191 int valueLen;
1192 1192
1193 avaValue = CERT_DecodeAVAValue(&ava->value); 1193 avaValue = CERT_DecodeAVAValue(&ava->value);
1194 if(!avaValue) { 1194 if(!avaValue) {
1195 return buf; 1195 return buf;
1196 } 1196 }
1197 valueLen = cert_RFC1485_GetRequiredLen(avaValue->data, avaValue->len, 1197 valueLen = cert_RFC1485_GetRequiredLen((char *)avaValue->data,
1198 » » » » » NULL) + 1; 1198 avaValue->len, NULL) + 1;
1199 if (arena) { 1199 if (arena) {
1200 buf = (char *)PORT_ArenaZAlloc(arena, valueLen); 1200 buf = (char *)PORT_ArenaZAlloc(arena, valueLen);
1201 } else { 1201 } else {
1202 buf = (char *)PORT_ZAlloc(valueLen); 1202 buf = (char *)PORT_ZAlloc(valueLen);
1203 } 1203 }
1204 if (buf) { 1204 if (buf) {
1205 SECStatus rv = escapeAndQuote(buf, valueLen, (char *)avaValue->data, 1205 SECStatus rv = escapeAndQuote(buf, valueLen, (char *)avaValue->data,
1206 avaValue->len, NULL); 1206 avaValue->len, NULL);
1207 if (rv != SECSuccess) { 1207 if (rv != SECSuccess) {
1208 if (!arena) 1208 if (!arena)
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 { 1569 {
1570 return(CERT_GetNameElement(NULL, name, SEC_OID_AVA_DN_QUALIFIER)); 1570 return(CERT_GetNameElement(NULL, name, SEC_OID_AVA_DN_QUALIFIER));
1571 } 1571 }
1572 1572
1573 char * 1573 char *
1574 CERT_GetCertUid(CERTName *name) 1574 CERT_GetCertUid(CERTName *name)
1575 { 1575 {
1576 return(CERT_GetNameElement(NULL, name, SEC_OID_RFC1274_UID)); 1576 return(CERT_GetNameElement(NULL, name, SEC_OID_RFC1274_UID));
1577 } 1577 }
1578 1578
OLDNEW
« README.chromium ('K') | « README.chromium ('k') | mozilla/security/nss/lib/certdb/certdb.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698