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

Side by Side Diff: mozilla/security/nss/lib/cryptohi/seckey.c

Issue 10961060: Update NSS to NSS 3.14 Beta 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Merge nss-static2.patch into nss-static.patch Created 8 years, 3 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 /* 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 "cryptohi.h" 4 #include "cryptohi.h"
5 #include "keyhi.h" 5 #include "keyhi.h"
6 #include "secoid.h" 6 #include "secoid.h"
7 #include "secitem.h" 7 #include "secitem.h"
8 #include "secder.h" 8 #include "secder.h"
9 #include "base64.h" 9 #include "base64.h"
10 #include "secasn1.h" 10 #include "secasn1.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 /* check if cert chain length exceeds the maximum length*/ 319 /* check if cert chain length exceeds the maximum length*/
320 if (count > CERT_MAX_CERT_CHAIN) { 320 if (count > CERT_MAX_CERT_CHAIN) {
321 return SECFailure; 321 return SECFailure;
322 } 322 }
323 323
324 oid = SECOID_FindOID(&subjectCert->subjectPublicKeyInfo.algorithm.algorithm) ; 324 oid = SECOID_FindOID(&subjectCert->subjectPublicKeyInfo.algorithm.algorithm) ;
325 if (oid != NULL) { 325 if (oid != NULL) {
326 tag = oid->offset; 326 tag = oid->offset;
327 327
328 /* Check if cert has a DSA public key. If not, return 328 /* Check if cert has a DSA or EC public key. If not, return
329 * success since no PQG params need to be updated. */ 329 * success since no PQG params need to be updated.
330 » *
331 » * Question: do we really need to do this for EC keys. They don't have
332 » * PQG parameters, but they do have parameters. The question is does
333 » * the child cert inherit thost parameters for EC from the parent, or
334 » * do we always include those parameters in each cert.
335 » */
330 336
331 if ( (tag != SEC_OID_ANSIX9_DSA_SIGNATURE) && 337 if ( (tag != SEC_OID_ANSIX9_DSA_SIGNATURE) &&
332 (tag != SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) && 338 (tag != SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) &&
339 (tag != SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST) &&
340 (tag != SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST) &&
333 (tag != SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST) && 341 (tag != SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST) &&
334 (tag != SEC_OID_SDN702_DSA_SIGNATURE) && 342 (tag != SEC_OID_SDN702_DSA_SIGNATURE) &&
335 (tag != SEC_OID_ANSIX962_EC_PUBLIC_KEY) ) { 343 (tag != SEC_OID_ANSIX962_EC_PUBLIC_KEY) ) {
336 344
337 return SECSuccess; 345 return SECSuccess;
338 } 346 }
339 } else { 347 } else {
340 return SECFailure; /* return failure if oid is NULL */ 348 return SECFailure; /* return failure if oid is NULL */
341 } 349 }
342 350
(...skipping 22 matching lines...) Expand all
365 373
366 oid = SECOID_FindOID(&issuerCert->subjectPublicKeyInfo.algorithm.algorithm); 374 oid = SECOID_FindOID(&issuerCert->subjectPublicKeyInfo.algorithm.algorithm);
367 if (oid != NULL) { 375 if (oid != NULL) {
368 tag = oid->offset; 376 tag = oid->offset;
369 377
370 /* Check if issuer cert has a DSA public key. If not, 378 /* Check if issuer cert has a DSA public key. If not,
371 * return failure. */ 379 * return failure. */
372 380
373 if ( (tag != SEC_OID_ANSIX9_DSA_SIGNATURE) && 381 if ( (tag != SEC_OID_ANSIX9_DSA_SIGNATURE) &&
374 (tag != SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) && 382 (tag != SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST) &&
383 (tag != SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST) &&
384 (tag != SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST) &&
375 (tag != SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST) && 385 (tag != SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST) &&
376 (tag != SEC_OID_SDN702_DSA_SIGNATURE) && 386 (tag != SEC_OID_SDN702_DSA_SIGNATURE) &&
377 (tag != SEC_OID_ANSIX962_EC_PUBLIC_KEY) ) { 387 (tag != SEC_OID_ANSIX962_EC_PUBLIC_KEY) ) {
378 rv = SECFailure; 388 rv = SECFailure;
379 goto loser; 389 goto loser;
380 } 390 }
381 } else { 391 } else {
382 rv = SECFailure; /* return failure if oid is NULL */ 392 rv = SECFailure; /* return failure if oid is NULL */
383 goto loser; 393 goto loser;
384 } 394 }
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 SECKEY_SignatureLen(const SECKEYPublicKey *pubk) 1003 SECKEY_SignatureLen(const SECKEYPublicKey *pubk)
994 { 1004 {
995 unsigned char b0; 1005 unsigned char b0;
996 unsigned size; 1006 unsigned size;
997 1007
998 switch (pubk->keyType) { 1008 switch (pubk->keyType) {
999 case rsaKey: 1009 case rsaKey:
1000 b0 = pubk->u.rsa.modulus.data[0]; 1010 b0 = pubk->u.rsa.modulus.data[0];
1001 return b0 ? pubk->u.rsa.modulus.len : pubk->u.rsa.modulus.len - 1; 1011 return b0 ? pubk->u.rsa.modulus.len : pubk->u.rsa.modulus.len - 1;
1002 case dsaKey: 1012 case dsaKey:
1003 » return DSA_SIGNATURE_LEN; 1013 » return pubk->u.dsa.params.subPrime.len * 2;
1004 case ecKey: 1014 case ecKey:
1005 /* Get the base point order length in bits and adjust */ 1015 /* Get the base point order length in bits and adjust */
1006 size = SECKEY_ECParamsToBasePointOrderLen( 1016 size = SECKEY_ECParamsToBasePointOrderLen(
1007 &pubk->u.ec.DEREncodedParams); 1017 &pubk->u.ec.DEREncodedParams);
1008 return ((size + 7)/8) * 2; 1018 return ((size + 7)/8) * 2;
1009 default: 1019 default:
1010 break; 1020 break;
1011 } 1021 }
1012 PORT_SetError(SEC_ERROR_INVALID_KEY); 1022 PORT_SetError(SEC_ERROR_INVALID_KEY);
1013 return 0; 1023 return 0;
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 key->staticflags &= (~SECKEY_##attribute); \ 1924 key->staticflags &= (~SECKEY_##attribute); \
1915 } 1925 }
1916 1926
1917 SECStatus 1927 SECStatus
1918 SECKEY_CacheStaticFlags(SECKEYPrivateKey* key) 1928 SECKEY_CacheStaticFlags(SECKEYPrivateKey* key)
1919 { 1929 {
1920 SECStatus rv = SECFailure; 1930 SECStatus rv = SECFailure;
1921 if (key && key->pkcs11Slot && key->pkcs11ID) { 1931 if (key && key->pkcs11Slot && key->pkcs11ID) {
1922 key->staticflags |= SECKEY_Attributes_Cached; 1932 key->staticflags |= SECKEY_Attributes_Cached;
1923 SECKEY_CacheAttribute(key, CKA_PRIVATE); 1933 SECKEY_CacheAttribute(key, CKA_PRIVATE);
1934 SECKEY_CacheAttribute(key, CKA_ALWAYS_AUTHENTICATE);
1924 rv = SECSuccess; 1935 rv = SECSuccess;
1925 } 1936 }
1926 return rv; 1937 return rv;
1927 } 1938 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698