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

Side by Side Diff: mozilla/security/nss/lib/cryptohi/secvfy.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 /* 1 /*
2 * Verification stuff. 2 * Verification stuff.
3 * 3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public 4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* $Id: secvfy.c,v 1.30 2012/06/25 21:48:39 rrelyea%redhat.com Exp $ */ 7 /* $Id: secvfy.c,v 1.30 2012/06/25 21:48:39 rrelyea%redhat.com Exp $ */
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include "cryptohi.h" 10 #include "cryptohi.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 * Use the "buffer" union member to reference the buffer. 96 * Use the "buffer" union member to reference the buffer.
97 * Note: do not take the size of the "buffer" union member. Take 97 * Note: do not take the size of the "buffer" union member. Take
98 * the size of the union or some other union member instead. 98 * the size of the union or some other union member instead.
99 */ 99 */
100 union { 100 union {
101 unsigned char buffer[1]; 101 unsigned char buffer[1];
102 102
103 /* the digest in the decrypted RSA signature */ 103 /* the digest in the decrypted RSA signature */
104 unsigned char rsadigest[HASH_LENGTH_MAX]; 104 unsigned char rsadigest[HASH_LENGTH_MAX];
105 /* the full DSA signature... 40 bytes */ 105 /* the full DSA signature... 40 bytes */
106 » unsigned char dsasig[DSA_SIGNATURE_LEN]; 106 » unsigned char dsasig[DSA_MAX_SIGNATURE_LEN];
107 /* the full ECDSA signature */ 107 /* the full ECDSA signature */
108 unsigned char ecdsasig[2 * MAX_ECKEY_LEN]; 108 unsigned char ecdsasig[2 * MAX_ECKEY_LEN];
109 } u; 109 } u;
110 unsigned int rsadigestlen; 110 unsigned int rsadigestlen;
111 void * wincx; 111 void * wincx;
112 void *hashcx; 112 void *hashcx;
113 const SECHashObject *hashobj; 113 const SECHashObject *hashobj;
114 SECOidTag encAlg; /* enc alg */ 114 SECOidTag encAlg; /* enc alg */
115 PRBool hasSignature; /* true if the signature was provided in the 115 PRBool hasSignature; /* true if the signature was provided in the
116 * VFY_CreateContext call. If false, the 116 * VFY_CreateContext call. If false, the
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 case SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE: 203 case SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE:
204 *hashalg = SEC_OID_SHA1; 204 *hashalg = SEC_OID_SHA1;
205 break; 205 break;
206 case SEC_OID_PKCS1_RSA_ENCRYPTION: 206 case SEC_OID_PKCS1_RSA_ENCRYPTION:
207 case SEC_OID_PKCS1_RSA_PSS_SIGNATURE: 207 case SEC_OID_PKCS1_RSA_PSS_SIGNATURE:
208 *hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */ 208 *hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */
209 break; 209 break;
210 210
211 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE: 211 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE:
212 case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION: 212 case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION:
213 case SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST:
213 *hashalg = SEC_OID_SHA224; 214 *hashalg = SEC_OID_SHA224;
214 break; 215 break;
215 case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE: 216 case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE:
216 case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: 217 case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
218 case SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST:
217 *hashalg = SEC_OID_SHA256; 219 *hashalg = SEC_OID_SHA256;
218 break; 220 break;
219 case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE: 221 case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE:
220 case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: 222 case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
221 *hashalg = SEC_OID_SHA384; 223 *hashalg = SEC_OID_SHA384;
222 break; 224 break;
223 case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE: 225 case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE:
224 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: 226 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
225 *hashalg = SEC_OID_SHA512; 227 *hashalg = SEC_OID_SHA512;
226 break; 228 break;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: 302 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
301 *encalg = SEC_OID_PKCS1_RSA_ENCRYPTION; 303 *encalg = SEC_OID_PKCS1_RSA_ENCRYPTION;
302 break; 304 break;
303 case SEC_OID_PKCS1_RSA_PSS_SIGNATURE: 305 case SEC_OID_PKCS1_RSA_PSS_SIGNATURE:
304 *encalg = SEC_OID_PKCS1_RSA_PSS_SIGNATURE; 306 *encalg = SEC_OID_PKCS1_RSA_PSS_SIGNATURE;
305 break; 307 break;
306 308
307 /* what about normal DSA? */ 309 /* what about normal DSA? */
308 case SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST: 310 case SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST:
309 case SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST: 311 case SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST:
312 case SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST:
313 case SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST:
310 *encalg = SEC_OID_ANSIX9_DSA_SIGNATURE; 314 *encalg = SEC_OID_ANSIX9_DSA_SIGNATURE;
311 break; 315 break;
312 case SEC_OID_MISSI_DSS: 316 case SEC_OID_MISSI_DSS:
313 case SEC_OID_MISSI_KEA_DSS: 317 case SEC_OID_MISSI_KEA_DSS:
314 case SEC_OID_MISSI_KEA_DSS_OLD: 318 case SEC_OID_MISSI_KEA_DSS_OLD:
315 case SEC_OID_MISSI_DSS_OLD: 319 case SEC_OID_MISSI_DSS_OLD:
316 *encalg = SEC_OID_MISSI_DSS; 320 *encalg = SEC_OID_MISSI_DSS;
317 break; 321 break;
318 case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE: 322 case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE:
319 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE: 323 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE:
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 { 724 {
721 SECOidTag encAlg, hashAlg; 725 SECOidTag encAlg, hashAlg;
722 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm); 726 SECOidTag sigAlg = SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm);
723 SECStatus rv = sec_DecodeSigAlg(key, sigAlg, 727 SECStatus rv = sec_DecodeSigAlg(key, sigAlg,
724 &sigAlgorithm->parameters, &encAlg, &hashAlg); 728 &sigAlgorithm->parameters, &encAlg, &hashAlg);
725 if (rv != SECSuccess) { 729 if (rv != SECSuccess) {
726 return rv; 730 return rv;
727 } 731 }
728 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx); 732 return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx);
729 } 733 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698