Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5e7255

Browse filesBrowse files
davidbenevanlucas
authored andcommitted
crypto: make ALPN the same for OpenSSL 1.0.2 & 1.1.0
This is kind of hairy. OpenSSL 1.0.2 ignored the return value and always treated everything as SSL_TLSEXT_ERR_NOACK (so the comment was wrong and Node was never sending a warning alert). OpenSSL 1.1.0 honors SSL_TLSEXT_ERR_NOACK vs SSL_TLSEXT_ERR_FATAL_ALERT and treats everything unknown as SSL_TLSEXT_ERR_FATAL_ALERT. Since this is a behavior change (tests break too), start by aligning everything on SSL_TLSEXT_ERR_NOACK. If sending no_application_protocol is desirable in the future, this can by changed to SSL_TLSEXT_ERR_FATAL_ALERT with whatever deprecation process is appropriate. However, note that, contrary to https://rt.openssl.org/Ticket/Display.html?id=3463#txn-54498, SSL_TLSEXT_ERR_FATAL_ALERT is *not* useful to a server with no fallback protocol. Even if such mismatches were rejected, such a server must *still* account for the fallback protocol case when the client does not advertise ALPN at all. Thus this may not be worth bothering. PR-URL: #16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 8c29420 commit a5e7255
Copy full SHA for a5e7255

File tree

Expand file treeCollapse file tree

1 file changed

+6
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-14
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+6-14Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,20 +2509,12 @@ int SSLWrap<Base>::SelectALPNCallback(SSL* s,
25092509
unsigned alpn_protos_len = Buffer::Length(alpn_buffer);
25102510
int status = SSL_select_next_proto(const_cast<unsigned char**>(out), outlen,
25112511
alpn_protos, alpn_protos_len, in, inlen);
2512-
2513-
switch (status) {
2514-
case OPENSSL_NPN_NO_OVERLAP:
2515-
// According to 3.2. Protocol Selection of RFC7301,
2516-
// fatal no_application_protocol alert shall be sent
2517-
// but current openssl does not support it yet. See
2518-
// https://rt.openssl.org/Ticket/Display.html?id=3463&user=guest&pass=guest
2519-
// Instead, we send a warning alert for now.
2520-
return SSL_TLSEXT_ERR_ALERT_WARNING;
2521-
case OPENSSL_NPN_NEGOTIATED:
2522-
return SSL_TLSEXT_ERR_OK;
2523-
default:
2524-
return SSL_TLSEXT_ERR_ALERT_FATAL;
2525-
}
2512+
// According to 3.2. Protocol Selection of RFC7301, fatal
2513+
// no_application_protocol alert shall be sent but OpenSSL 1.0.2 does not
2514+
// support it yet. See
2515+
// https://rt.openssl.org/Ticket/Display.html?id=3463&user=guest&pass=guest
2516+
return status == OPENSSL_NPN_NEGOTIATED ? SSL_TLSEXT_ERR_OK
2517+
: SSL_TLSEXT_ERR_NOACK;
25262518
}
25272519
#endif // TLSEXT_TYPE_application_layer_protocol_negotiation
25282520

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.