OLD | NEW |
1 /* | 1 /* |
2 * SSL3 Protocol | 2 * SSL3 Protocol |
3 * | 3 * |
4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 * | 6 * |
7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
(...skipping 22 matching lines...) Expand all Loading... |
33 * under the terms of either the GPL or the LGPL, and not to allow others to | 33 * under the terms of either the GPL or the LGPL, and not to allow others to |
34 * use your version of this file under the terms of the MPL, indicate your | 34 * use your version of this file under the terms of the MPL, indicate your |
35 * decision by deleting the provisions above and replace them with the notice | 35 * decision by deleting the provisions above and replace them with the notice |
36 * and other provisions required by the GPL or the LGPL. If you do not delete | 36 * and other provisions required by the GPL or the LGPL. If you do not delete |
37 * the provisions above, a recipient may use your version of this file under | 37 * the provisions above, a recipient may use your version of this file under |
38 * the terms of any one of the MPL, the GPL or the LGPL. | 38 * the terms of any one of the MPL, the GPL or the LGPL. |
39 * | 39 * |
40 * ***** END LICENSE BLOCK ***** */ | 40 * ***** END LICENSE BLOCK ***** */ |
41 | 41 |
42 /* ECC code moved here from ssl3con.c */ | 42 /* ECC code moved here from ssl3con.c */ |
43 /* $Id: ssl3ecc.c,v 1.24 2010/03/15 08:03:14 nelson%bolyard.com Exp $ */ | 43 /* $Id: ssl3ecc.c,v 1.26 2012/02/13 17:19:40 kaie%kuix.de Exp $ */ |
44 | 44 |
45 #include "nss.h" | 45 #include "nss.h" |
46 #include "cert.h" | 46 #include "cert.h" |
47 #include "ssl.h" | 47 #include "ssl.h" |
48 #include "cryptohi.h" /* for DSAU_ stuff */ | 48 #include "cryptohi.h" /* for DSAU_ stuff */ |
49 #include "keyhi.h" | 49 #include "keyhi.h" |
50 #include "secder.h" | 50 #include "secder.h" |
51 #include "secitem.h" | 51 #include "secitem.h" |
52 | 52 |
53 #include "sslimpl.h" | 53 #include "sslimpl.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0); | 311 isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0); |
312 | 312 |
313 /* Generate ephemeral EC keypair */ | 313 /* Generate ephemeral EC keypair */ |
314 if (svrPubKey->keyType != ecKey) { | 314 if (svrPubKey->keyType != ecKey) { |
315 PORT_SetError(SEC_ERROR_BAD_KEY); | 315 PORT_SetError(SEC_ERROR_BAD_KEY); |
316 goto loser; | 316 goto loser; |
317 } | 317 } |
318 /* XXX SHOULD CALL ssl3_CreateECDHEphemeralKeys here, instead! */ | 318 /* XXX SHOULD CALL ssl3_CreateECDHEphemeralKeys here, instead! */ |
319 privKey = SECKEY_CreateECPrivateKey(&svrPubKey->u.ec.DEREncodedParams, | 319 privKey = SECKEY_CreateECPrivateKey(&svrPubKey->u.ec.DEREncodedParams, |
320 » &pubKey, NULL); | 320 » &pubKey, ss->pkcs11PinArg); |
321 if (!privKey || !pubKey) { | 321 if (!privKey || !pubKey) { |
322 ssl_MapLowLevelError(SEC_ERROR_KEYGEN_FAIL); | 322 ssl_MapLowLevelError(SEC_ERROR_KEYGEN_FAIL); |
323 rv = SECFailure; | 323 rv = SECFailure; |
324 goto loser; | 324 goto loser; |
325 } | 325 } |
326 PRINT_BUF(50, (ss, "ECDH public value:", | 326 PRINT_BUF(50, (ss, "ECDH public value:", |
327 pubKey->u.ec.publicValue.data, | 327 pubKey->u.ec.publicValue.data, |
328 pubKey->u.ec.publicValue.len)); | 328 pubKey->u.ec.publicValue.len)); |
329 | 329 |
330 if (isTLS) target = CKM_TLS_MASTER_KEY_DERIVE_DH; | 330 if (isTLS) target = CKM_TLS_MASTER_KEY_DERIVE_DH; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 ssl3_DisableECCSuites(ss, ecdhe_ecdsa_suites); | 961 ssl3_DisableECCSuites(ss, ecdhe_ecdsa_suites); |
962 } else { | 962 } else { |
963 SECOidTag sigTag = SECOID_GetAlgorithmTag(&svrCert->signature); | 963 SECOidTag sigTag = SECOID_GetAlgorithmTag(&svrCert->signature); |
964 | 964 |
965 switch (sigTag) { | 965 switch (sigTag) { |
966 case SEC_OID_PKCS1_RSA_ENCRYPTION: | 966 case SEC_OID_PKCS1_RSA_ENCRYPTION: |
967 case SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION: | 967 case SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION: |
968 case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION: | 968 case SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION: |
969 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: | 969 case SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION: |
970 case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: | 970 case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION: |
| 971 case SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION: |
971 case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: | 972 case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION: |
972 case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: | 973 case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION: |
973 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: | 974 case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION: |
974 ssl3_DisableECCSuites(ss, ecdh_ecdsa_suites); | 975 ssl3_DisableECCSuites(ss, ecdh_ecdsa_suites); |
975 break; | 976 break; |
976 case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE: | 977 case SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE: |
977 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE: | 978 case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE: |
978 case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE: | 979 case SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE: |
979 case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE: | 980 case SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE: |
980 case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE: | 981 case SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE: |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 ssl3_DisableECCSuites(ss, ecdhe_ecdsa_suites); | 1185 ssl3_DisableECCSuites(ss, ecdhe_ecdsa_suites); |
1185 return SECFailure; | 1186 return SECFailure; |
1186 | 1187 |
1187 loser: | 1188 loser: |
1188 /* no common curve supported */ | 1189 /* no common curve supported */ |
1189 ssl3_DisableECCSuites(ss, ecSuites); | 1190 ssl3_DisableECCSuites(ss, ecSuites); |
1190 return SECFailure; | 1191 return SECFailure; |
1191 } | 1192 } |
1192 | 1193 |
1193 #endif /* NSS_ENABLE_ECC */ | 1194 #endif /* NSS_ENABLE_ECC */ |
OLD | NEW |