shithub: riscv

Download patch

ref: 02ffb19904f03cad21dd10a774705b9152d89010
parent: 1d891d163e814a93ee5346cf05b4fac297bf3a5c
parent: 6ff5c10ffb06d10eee06f1d432f9cc4738496c07
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Apr 2 22:50:36 EDT 2017

merge

--- a/sys/src/libsec/port/tlshand.c
+++ b/sys/src/libsec/port/tlshand.c
@@ -1402,12 +1402,10 @@
 		if(m->u.clientKeyExchange.key == nil)
 			break;
 		n = m->u.clientKeyExchange.key->len;
-		if(c->version != SSL3Version){
-			if(isECDHE(c->cipher))
-				*p++ = n;
-			else
-				put16(p, n), p += 2;
-		}
+		if(isECDHE(c->cipher))
+			*p++ = n;
+		else if(isDHE(c->cipher) || c->version != SSL3Version)
+			put16(p, n), p += 2;
 		memmove(p, m->u.clientKeyExchange.key->data, n);
 		p += n;
 		break;
@@ -1786,18 +1784,14 @@
 			if(n == 0)
 				break;
 		}
-		if(c->version == SSL3Version)
+		if(n < 2)
+			goto Short;
+		if(isECDHE(c->cipher))
+			nn = *p++, n--;
+		else if(isDHE(c->cipher) || c->version != SSL3Version)
+			nn = get16(p), p += 2, n -= 2;
+		else
 			nn = n;
-		else{
-			if(n < 2)
-				goto Short;
-			if(isECDHE(c->cipher))
-				nn = *p++, n--;
-			else {
-				nn = get16(p);
-				p += 2, n -= 2;
-			}
-		}
 		if(n < nn)
 			goto Short;
 		m->u.clientKeyExchange.key = makebytes(p, nn);