Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: openssl/ssl/ssl_lib.c

Issue 5692003: Allow NPN enable on a per-SSL connection basis... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/openssl/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « openssl/ssl/ssl.h ('k') | openssl/ssl/t1_lib.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: openssl/ssl/ssl_lib.c
===================================================================
--- openssl/ssl/ssl_lib.c (revision 65717)
+++ openssl/ssl/ssl_lib.c (working copy)
@@ -324,6 +324,9 @@
CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
s->initial_ctx=ctx;
s->next_proto_negotiated = NULL;
+ s->next_proto_negotiated_len = 0;
+ s->next_proto_select_cb = ctx->next_proto_select_cb;
+ s->next_proto_select_cb_arg = ctx->next_proto_select_cb_arg;
#endif
s->verify_result=X509_V_OK;
@@ -2870,9 +2873,12 @@
* The length of the protocol name must be written into |outlen|. The server's
* advertised protocols are provided in |in| and |inlen|. The callback can
* assume that |in| is syntactically valid.
+ * A side effect of calling this method with a non-NULL |cb| is to enable NPN
+ * for all SSLs subsequently created from this CTX. Passing a NULL |cb| resets
+ * the CTX so future connections will not use NPN.
*
- * The client must select a protocol. It is fatal to the connection if this
- * callback returns a value other than SSL_TLSEXT_ERR_OK.
+ * When enabled, the client must select a protocol. It is fatal to the
+ * connection if this callback returns a value other than SSL_TLSEXT_ERR_OK.
*/
void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int (*cb) (SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg)
{
@@ -2880,6 +2886,19 @@
ctx->next_proto_select_cb_arg = arg;
}
+/* SSL_set_next_proto_select_cb is a per-connection alternative to
+ * SSL_CTX_set_next_proto_select_cb, see that function for full description of
+ * the parameters.
+ * This method may also be used to modify a CTX default, for example disable
+ * NPN by passing a NULL |cb| or modify the callback argument by passing a
+ * valid |cb| and an updated |arg|.
+ */
+void SSL_set_next_proto_select_cb(SSL *s, int (*cb) (SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg)
+ {
+ s->next_proto_select_cb = cb;
+ s->next_proto_select_cb_arg = arg;
+ }
+
/* SSL_CTX_set_snap_start_orbit sets the orbit value which will be echoed back
* to the client and enables Snap Start for this context.
*
« no previous file with comments | « openssl/ssl/ssl.h ('k') | openssl/ssl/t1_lib.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698