| 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 21 matching lines...) Expand all Loading... |
| 32 * in which case the provisions of the GPL or the LGPL are applicable instead | 32 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 33 * of those above. If you wish to allow use of your version of this file only | 33 * of those above. If you wish to allow use of your version of this file only |
| 34 * under the terms of either the GPL or the LGPL, and not to allow others to | 34 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 35 * use your version of this file under the terms of the MPL, indicate your | 35 * use your version of this file under the terms of the MPL, indicate your |
| 36 * decision by deleting the provisions above and replace them with the notice | 36 * decision by deleting the provisions above and replace them with the notice |
| 37 * and other provisions required by the GPL or the LGPL. If you do not delete | 37 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 38 * the provisions above, a recipient may use your version of this file under | 38 * the provisions above, a recipient may use your version of this file under |
| 39 * the terms of any one of the MPL, the GPL or the LGPL. | 39 * the terms of any one of the MPL, the GPL or the LGPL. |
| 40 * | 40 * |
| 41 * ***** END LICENSE BLOCK ***** */ | 41 * ***** END LICENSE BLOCK ***** */ |
| 42 /* $Id: ssl3con.c,v 1.142 2010/06/24 19:53:20 wtc%google.com Exp $ */ | 42 /* $Id: ssl3con.c,v 1.142.2.4 2010/09/01 19:47:11 wtc%google.com Exp $ */ |
| 43 | 43 |
| 44 #include "cert.h" | 44 #include "cert.h" |
| 45 #include "ssl.h" | 45 #include "ssl.h" |
| 46 #include "cryptohi.h" /* for DSAU_ stuff */ | 46 #include "cryptohi.h" /* for DSAU_ stuff */ |
| 47 #include "keyhi.h" | 47 #include "keyhi.h" |
| 48 #include "secder.h" | 48 #include "secder.h" |
| 49 #include "secitem.h" | 49 #include "secitem.h" |
| 50 | 50 |
| 51 #include "sslimpl.h" | 51 #include "sslimpl.h" |
| 52 #include "sslproto.h" | 52 #include "sslproto.h" |
| (...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 key_derive = CKM_TLS_KEY_AND_MAC_DERIVE; | 2843 key_derive = CKM_TLS_KEY_AND_MAC_DERIVE; |
| 2844 keyFlags = CKF_SIGN | CKF_VERIFY; | 2844 keyFlags = CKF_SIGN | CKF_VERIFY; |
| 2845 } else { | 2845 } else { |
| 2846 if (isDH) master_derive = CKM_SSL3_MASTER_KEY_DERIVE_DH; | 2846 if (isDH) master_derive = CKM_SSL3_MASTER_KEY_DERIVE_DH; |
| 2847 else master_derive = CKM_SSL3_MASTER_KEY_DERIVE; | 2847 else master_derive = CKM_SSL3_MASTER_KEY_DERIVE; |
| 2848 key_derive = CKM_SSL3_KEY_AND_MAC_DERIVE; | 2848 key_derive = CKM_SSL3_KEY_AND_MAC_DERIVE; |
| 2849 keyFlags = 0; | 2849 keyFlags = 0; |
| 2850 } | 2850 } |
| 2851 | 2851 |
| 2852 if (pms || !pwSpec->master_secret) { | 2852 if (pms || !pwSpec->master_secret) { |
| 2853 » master_params.pVersion = &pms_version; | 2853 » if (isDH) { |
| 2854 » master_params.pVersion = NULL; |
| 2855 » } else { |
| 2856 » master_params.pVersion = &pms_version; |
| 2857 » } |
| 2854 master_params.RandomInfo.pClientRandom = cr; | 2858 master_params.RandomInfo.pClientRandom = cr; |
| 2855 master_params.RandomInfo.ulClientRandomLen = SSL3_RANDOM_LENGTH; | 2859 master_params.RandomInfo.ulClientRandomLen = SSL3_RANDOM_LENGTH; |
| 2856 master_params.RandomInfo.pServerRandom = sr; | 2860 master_params.RandomInfo.pServerRandom = sr; |
| 2857 master_params.RandomInfo.ulServerRandomLen = SSL3_RANDOM_LENGTH; | 2861 master_params.RandomInfo.ulServerRandomLen = SSL3_RANDOM_LENGTH; |
| 2858 | 2862 |
| 2859 params.data = (unsigned char *) &master_params; | 2863 params.data = (unsigned char *) &master_params; |
| 2860 params.len = sizeof master_params; | 2864 params.len = sizeof master_params; |
| 2861 } | 2865 } |
| 2862 | 2866 |
| 2863 if (pms != NULL) { | 2867 if (pms != NULL) { |
| (...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5365 case kt_dh: { | 5369 case kt_dh: { |
| 5366 SECItem dh_p = {siBuffer, NULL, 0}; | 5370 SECItem dh_p = {siBuffer, NULL, 0}; |
| 5367 SECItem dh_g = {siBuffer, NULL, 0}; | 5371 SECItem dh_g = {siBuffer, NULL, 0}; |
| 5368 SECItem dh_Ys = {siBuffer, NULL, 0}; | 5372 SECItem dh_Ys = {siBuffer, NULL, 0}; |
| 5369 | 5373 |
| 5370 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_p, 2, &b, &length); | 5374 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_p, 2, &b, &length); |
| 5371 if (rv != SECSuccess) { | 5375 if (rv != SECSuccess) { |
| 5372 goto loser; /* malformed. */ | 5376 goto loser; /* malformed. */ |
| 5373 } | 5377 } |
| 5374 if (dh_p.len < 512/8) { | 5378 if (dh_p.len < 512/8) { |
| 5375 » errCode = SSL_ERROR_WEAK_SERVER_KEY; | 5379 » errCode = SSL_ERROR_WEAK_SERVER_EPHEMERAL_DH_KEY; |
| 5376 goto alert_loser; | 5380 goto alert_loser; |
| 5377 } | 5381 } |
| 5378 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_g, 2, &b, &length); | 5382 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_g, 2, &b, &length); |
| 5379 if (rv != SECSuccess) { | 5383 if (rv != SECSuccess) { |
| 5380 goto loser; /* malformed. */ | 5384 goto loser; /* malformed. */ |
| 5381 } | 5385 } |
| 5382 if (dh_g.len == 0 || dh_g.len > dh_p.len + 1 || | 5386 if (dh_g.len == 0 || dh_g.len > dh_p.len + 1 || |
| 5383 (dh_g.len == 1 && dh_g.data[0] == 0)) | 5387 (dh_g.len == 1 && dh_g.data[0] == 0)) |
| 5384 goto alert_loser; | 5388 goto alert_loser; |
| 5385 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_Ys, 2, &b, &length); | 5389 rv = ssl3_ConsumeHandshakeVariable(ss, &dh_Ys, 2, &b, &length); |
| (...skipping 4492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9878 | 9882 |
| 9879 ss->ssl3.initialized = PR_FALSE; | 9883 ss->ssl3.initialized = PR_FALSE; |
| 9880 | 9884 |
| 9881 if (ss->ssl3.nextProto.data) { | 9885 if (ss->ssl3.nextProto.data) { |
| 9882 PORT_Free(ss->ssl3.nextProto.data); | 9886 PORT_Free(ss->ssl3.nextProto.data); |
| 9883 ss->ssl3.nextProto.data = NULL; | 9887 ss->ssl3.nextProto.data = NULL; |
| 9884 } | 9888 } |
| 9885 } | 9889 } |
| 9886 | 9890 |
| 9887 /* End of ssl3con.c */ | 9891 /* End of ssl3con.c */ |
| OLD | NEW |