Bugzilla Bug 363073: verify that the peer's ephemeral public key is the

type we expect before using it.  r=nelsonb
Modified Files: ssl3con.c ssl3ecc.c


git-svn-id: svn://10.0.0.236/trunk@216773 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtchang%redhat.com 2006-12-08 22:37:29 +00:00
parent ee9615098b
commit 1cb5d3ccbb
2 changed files with 10 additions and 2 deletions

View File

@ -39,7 +39,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: ssl3con.c,v 1.98 2006-10-09 22:26:44 alexei.volkov.bugs%sun.com Exp $ */
/* $Id: ssl3con.c,v 1.99 2006-12-08 22:37:29 wtchang%redhat.com Exp $ */
#include "nssrenam.h"
#include "cert.h"
@ -4195,6 +4195,10 @@ sendDHClientKeyExchange(sslSocket * ss, SECKEYPublicKey * svrPubKey)
/* Copy DH parameters from server key */
if (svrPubKey->keyType != dhKey) {
PORT_SetError(SEC_ERROR_BAD_KEY);
goto loser;
}
dhParam.prime.data = svrPubKey->u.dh.prime.data;
dhParam.prime.len = svrPubKey->u.dh.prime.len;
dhParam.base.data = svrPubKey->u.dh.base.data;

View File

@ -40,7 +40,7 @@
* ***** END LICENSE BLOCK ***** */
/* ECC code moved here from ssl3con.c */
/* $Id: ssl3ecc.c,v 1.17 2006-12-06 23:00:17 wtchang%redhat.com Exp $ */
/* $Id: ssl3ecc.c,v 1.18 2006-12-08 22:37:29 wtchang%redhat.com Exp $ */
#include "nssrenam.h"
#include "nss.h"
@ -346,6 +346,10 @@ ssl3_SendECDHClientKeyExchange(sslSocket * ss, SECKEYPublicKey * svrPubKey)
isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0);
/* Generate ephemeral EC keypair */
if (svrPubKey->keyType != ecKey) {
PORT_SetError(SEC_ERROR_BAD_KEY);
goto loser;
}
/* XXX SHOULD CALL ssl3_CreateECDHEphemeralKeys here, instead! */
privKey = SECKEY_CreateECPrivateKey(&svrPubKey->u.ec.DEREncodedParams,
&pubKey, NULL);