8a39cb9
commit 9e885a707d604e9528b5491b78fb9c00f41193fc
8a39cb9
Author: Tomas Mraz <tmraz@fedoraproject.org>
8a39cb9
Date:   Thu Mar 26 15:59:00 2020 +0100
8a39cb9
8a39cb9
    s_server: Properly indicate ALPN protocol mismatch
8a39cb9
    
8a39cb9
    Return SSL_TLSEXT_ERR_ALERT_FATAL from alpn_select_cb so that
8a39cb9
    an alert is sent to the client on ALPN protocol mismatch.
8a39cb9
    
8a39cb9
    Fixes: #2708
8a39cb9
    
8a39cb9
    Reviewed-by: Matt Caswell <matt@openssl.org>
8a39cb9
    (Merged from https://github.com/openssl/openssl/pull/11415)
8a39cb9
8a39cb9
diff --git a/apps/s_server.c b/apps/s_server.c
8a39cb9
index bcc83e562c..591c6c19c5 100644
8a39cb9
--- a/apps/s_server.c
8a39cb9
+++ b/apps/s_server.c
8a39cb9
@@ -707,7 +707,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
8a39cb9
     if (SSL_select_next_proto
8a39cb9
         ((unsigned char **)out, outlen, alpn_ctx->data, alpn_ctx->len, in,
8a39cb9
          inlen) != OPENSSL_NPN_NEGOTIATED) {
8a39cb9
-        return SSL_TLSEXT_ERR_NOACK;
8a39cb9
+        return SSL_TLSEXT_ERR_ALERT_FATAL;
8a39cb9
     }
8a39cb9
 
8a39cb9
     if (!s_quiet) {