[Git][NTPsec/ntpsec][master] ALPN on server has a leading 0x7

Gary E. Miller gitlab at mg.gitlab.com
Tue Aug 20 01:33:12 UTC 2019



Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
75abb750 by Dan Drown at 2019-08-20T01:28:04Z
ALPN on server has a leading 0x7

client ALPN request + current server ALPN response:
 https://dan.drown.org/ntp/ntske-alpn.html

openssl hands over the alpn in length+text format, but wants them
seperated into out+outlen on return

before:

$ ./ntske --debug --host=localhost --context=localhost --certfile=/usr/local/etc/localhost.pem
connected with TLSv1.3 / TLS_AES_256_GCM_SHA384
alpn = 076e74736b652f31
:

after:

$ ./ntske --debug --host=localhost --context=localhost --certfile=/usr/local/etc/localhost.pem
connected with TLSv1.3 / TLS_AES_256_GCM_SHA384
alpn = 6e74736b652f31
:

- - - - -


1 changed file:

- ntpd/nts_server.c


Changes:

=====================================
ntpd/nts_server.c
=====================================
@@ -61,19 +61,18 @@ static int alpn_select_cb(SSL *ssl,
 	UNUSED_ARG(ssl);
 	UNUSED_ARG(arg);
 
-	for (i = 0; i < inlen; i += len) {
-		len = in[i]+1;  /* includes length byte */
+	for (i = 0; i < inlen; i += len+1) {
+		len = in[i]; // first byte is the length
 #if 0
 		char foo[256];
 		strlcpy(foo, (const char*)in+i+1, len);
 		msyslog(LOG_DEBUG, "DEBUG: alpn_select_cb:  %u, %u, %s", inlen-i, len, foo);
 #endif
-		if (len > inlen-i) {
+		if (len+1 > inlen-i)
 			/* bogus arg: length overlaps end of in buffer */
 			return SSL_TLSEXT_ERR_ALERT_FATAL;
-		}
-		if (len == sizeof(alpn) && !memcmp(in+i, alpn, len)) {
-			*out = in+i;
+		if (len == sizeof(alpn) && !memcmp(in+i+1, alpn, len)) {
+			*out = in+i+1;
 			*outlen = len;
 			return SSL_TLSEXT_ERR_OK;
 		}



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/75abb75027ac3b1a38b182b93e79accdde284fc0

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/75abb75027ac3b1a38b182b93e79accdde284fc0
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190820/c7d3641a/attachment-0001.htm>


More information about the vc mailing list