shithub: riscv

Download patch

ref: 5c6357de8bda7c5fe0a7fa4ab31b365a9ae8e6fb
parent: 0ca9977075a51dd9c098641f99d1abfdaf8c892f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun May 31 21:32:57 EDT 2015

devtls: ignore UnrecogniedName (112) alert message (for SNI)

--- a/sys/src/9/port/devtls.c
+++ b/sys/src/9/port/devtls.c
@@ -73,6 +73,7 @@
 	EInternalError 			= 80,
 	EUserCanceled 			= 90,
 	ENoRenegotiation 		= 100,
+	EUnrecognizedName		= 112,
 
 	EMAX = 256
 };
@@ -850,18 +851,25 @@
 		/*
 		 * propagate non-fatal alerts to handshaker
 		 */
-		if(p[1] == ECloseNotify) {
+		switch(p[1]){
+		case ECloseNotify:
 			tlsclosed(tr, SRClose);
 			if(tr->opened)
 				error("tls hungup");
 			error("close notify");
-		}
-		if(p[1] == ENoRenegotiation)
+			break;
+		case ENoRenegotiation:
 			alertHand(tr, "no renegotiation");
-		else if(p[1] == EUserCanceled)
+			break;
+		case EUserCanceled:
 			alertHand(tr, "handshake canceled by user");
-		else
+			break;
+		case EUnrecognizedName:
+			/* happens in response to SNI, can be ignored. */
+			break;
+		default:
 			rcvError(tr, EIllegalParameter, "invalid alert code");
+		}
 		break;
 	case RHandshake:
 		/*