summaryrefslogtreecommitdiff
path: root/ssl/s3_srvr.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2005-12-13 07:41:47 +0000
committerBodo Möller <bodo@openssl.org>2005-12-13 07:41:47 +0000
commitbc9320452c6846af6b40ee9cbfbb15c17c3dd7ac (patch)
treec887f9c4eb5e08c60cabede76a5b9ba6b26c25bb /ssl/s3_srvr.c
parent23d43aae27bb16ce35cb4a78598bea67434d5cb9 (diff)
downloadopenssl-new-bc9320452c6846af6b40ee9cbfbb15c17c3dd7ac.tar.gz
update TLS-ECC code
Submitted by: Douglas Stebila
Diffstat (limited to 'ssl/s3_srvr.c')
-rw-r--r--ssl/s3_srvr.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 39a6aeba68..1a52d1b7ff 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -1366,11 +1366,11 @@ int ssl3_send_server_key_exchange(SSL *s)
/* XXX: For now, we only support named (not
* generic) curves in ECDH ephemeral key exchanges.
- * In this situation, we need three additional bytes
+ * In this situation, we need four additional bytes
* to encode the entire ServerECDHParams
* structure.
*/
- n = 3 + encodedlen;
+ n = 4 + encodedlen;
/* We'll generate the serverKeyExchange message
* explicitly so we can set these to NULLs
@@ -1378,6 +1378,7 @@ int ssl3_send_server_key_exchange(SSL *s)
r[0]=NULL;
r[1]=NULL;
r[2]=NULL;
+ r[3]=NULL;
}
else
#endif /* !OPENSSL_NO_ECDH */
@@ -1428,12 +1429,14 @@ int ssl3_send_server_key_exchange(SSL *s)
{
/* XXX: For now, we only support named (not generic) curves.
* In this situation, the serverKeyExchange message has:
- * [1 byte CurveType], [1 byte CurveName]
+ * [1 byte CurveType], [2 byte CurveName]
* [1 byte length of encoded point], followed by
* the actual encoded point itself
*/
*p = NAMED_CURVE_TYPE;
p += 1;
+ *p = 0;
+ p += 1;
*p = curve_id;
p += 1;
*p = encodedlen;
@@ -1637,23 +1640,6 @@ err:
return(-1);
}
-
-#ifndef OPENSSL_NO_ECDH
-static const int KDF1_SHA1_len = 20;
-static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen)
- {
-#ifndef OPENSSL_NO_SHA
- if (*outlen < SHA_DIGEST_LENGTH)
- return NULL;
- else
- *outlen = SHA_DIGEST_LENGTH;
- return SHA1(in, inlen, out);
-#else
- return NULL;
-#endif /* OPENSSL_NO_SHA */
- }
-#endif /* OPENSSL_NO_ECDH */
-
int ssl3_get_client_key_exchange(SSL *s)
{
int i,al,ok;
@@ -2156,14 +2142,7 @@ int ssl3_get_client_key_exchange(SSL *s)
ERR_R_ECDH_LIB);
goto err;
}
- /* If field size is not more than 24 octets, then use SHA-1 hash of result;
- * otherwise, use result (see section 4.8 of draft-ietf-tls-ecc-03.txt;
- * this is new with this version of the Internet Draft).
- */
- if (field_size <= 24 * 8)
- i = ECDH_compute_key(p, KDF1_SHA1_len, clnt_ecpoint, srvr_ecdh, KDF1_SHA1);
- else
- i = ECDH_compute_key(p, (field_size+7)/8, clnt_ecpoint, srvr_ecdh, NULL);
+ i = ECDH_compute_key(p, (field_size+7)/8, clnt_ecpoint, srvr_ecdh, NULL);
if (i <= 0)
{
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,