summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <>2017-01-22 06:36:49 +0000
committerjsing <>2017-01-22 06:36:49 +0000
commit334c9196a27db4244daba48e4ba2118985c535ed (patch)
tree765f88b1c5ef0790c3644c70ffacf8e9a39b9ceb /src/lib/libssl/ssl_lib.c
parent107eff56043a3070d462256dca1675a3db9d9eab (diff)
downloadopenbsd-334c9196a27db4244daba48e4ba2118985c535ed.tar.gz
openbsd-334c9196a27db4244daba48e4ba2118985c535ed.tar.bz2
openbsd-334c9196a27db4244daba48e4ba2118985c535ed.zip
Move ALPN and NPN fields from SSL/SSL_CTX to internal.
ok beck@
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index d9e5166cdd..7031c91e1c 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.126 2017/01/22 03:50:45 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.127 2017/01/22 06:36:49 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -336,18 +336,18 @@ SSL_new(SSL_CTX *ctx)
336 s->tlsext_ocsp_resplen = -1; 336 s->tlsext_ocsp_resplen = -1;
337 CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); 337 CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
338 s->initial_ctx = ctx; 338 s->initial_ctx = ctx;
339 s->next_proto_negotiated = NULL; 339 s->internal->next_proto_negotiated = NULL;
340 340
341 if (s->ctx->alpn_client_proto_list != NULL) { 341 if (s->ctx->internal->alpn_client_proto_list != NULL) {
342 s->alpn_client_proto_list = 342 s->internal->alpn_client_proto_list =
343 malloc(s->ctx->alpn_client_proto_list_len); 343 malloc(s->ctx->internal->alpn_client_proto_list_len);
344 if (s->alpn_client_proto_list == NULL) 344 if (s->internal->alpn_client_proto_list == NULL)
345 goto err; 345 goto err;
346 memcpy(s->alpn_client_proto_list, 346 memcpy(s->internal->alpn_client_proto_list,
347 s->ctx->alpn_client_proto_list, 347 s->ctx->internal->alpn_client_proto_list,
348 s->ctx->alpn_client_proto_list_len); 348 s->ctx->internal->alpn_client_proto_list_len);
349 s->alpn_client_proto_list_len = 349 s->internal->alpn_client_proto_list_len =
350 s->ctx->alpn_client_proto_list_len; 350 s->ctx->internal->alpn_client_proto_list_len;
351 } 351 }
352 352
353 s->verify_result = X509_V_OK; 353 s->verify_result = X509_V_OK;
@@ -554,8 +554,8 @@ SSL_free(SSL *s)
554 554
555 SSL_CTX_free(s->ctx); 555 SSL_CTX_free(s->ctx);
556 556
557 free(s->next_proto_negotiated); 557 free(s->internal->next_proto_negotiated);
558 free(s->alpn_client_proto_list); 558 free(s->internal->alpn_client_proto_list);
559 559
560#ifndef OPENSSL_NO_SRTP 560#ifndef OPENSSL_NO_SRTP
561 if (s->srtp_profiles) 561 if (s->srtp_profiles)
@@ -1614,11 +1614,11 @@ void
1614SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, 1614SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
1615 unsigned *len) 1615 unsigned *len)
1616{ 1616{
1617 *data = s->next_proto_negotiated; 1617 *data = s->internal->next_proto_negotiated;
1618 if (!*data) { 1618 if (!*data) {
1619 *len = 0; 1619 *len = 0;
1620 } else { 1620 } else {
1621 *len = s->next_proto_negotiated_len; 1621 *len = s->internal->next_proto_negotiated_len;
1622 } 1622 }
1623} 1623}
1624 1624
@@ -1637,8 +1637,8 @@ void
1637SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, 1637SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl,
1638 const unsigned char **out, unsigned int *outlen, void *arg), void *arg) 1638 const unsigned char **out, unsigned int *outlen, void *arg), void *arg)
1639{ 1639{
1640 ctx->next_protos_advertised_cb = cb; 1640 ctx->internal->next_protos_advertised_cb = cb;
1641 ctx->next_protos_advertised_cb_arg = arg; 1641 ctx->internal->next_protos_advertised_cb_arg = arg;
1642} 1642}
1643 1643
1644/* 1644/*
@@ -1657,8 +1657,8 @@ SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int (*cb) (SSL *s,
1657 unsigned char **out, unsigned char *outlen, const unsigned char *in, 1657 unsigned char **out, unsigned char *outlen, const unsigned char *in,
1658 unsigned int inlen, void *arg), void *arg) 1658 unsigned int inlen, void *arg), void *arg)
1659{ 1659{
1660 ctx->next_proto_select_cb = cb; 1660 ctx->internal->next_proto_select_cb = cb;
1661 ctx->next_proto_select_cb_arg = arg; 1661 ctx->internal->next_proto_select_cb_arg = arg;
1662} 1662}
1663 1663
1664/* 1664/*
@@ -1670,11 +1670,11 @@ int
1670SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, 1670SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,
1671 unsigned int protos_len) 1671 unsigned int protos_len)
1672{ 1672{
1673 free(ctx->alpn_client_proto_list); 1673 free(ctx->internal->alpn_client_proto_list);
1674 if ((ctx->alpn_client_proto_list = malloc(protos_len)) == NULL) 1674 if ((ctx->internal->alpn_client_proto_list = malloc(protos_len)) == NULL)
1675 return (1); 1675 return (1);
1676 memcpy(ctx->alpn_client_proto_list, protos, protos_len); 1676 memcpy(ctx->internal->alpn_client_proto_list, protos, protos_len);
1677 ctx->alpn_client_proto_list_len = protos_len; 1677 ctx->internal->alpn_client_proto_list_len = protos_len;
1678 1678
1679 return (0); 1679 return (0);
1680} 1680}
@@ -1688,11 +1688,11 @@ int
1688SSL_set_alpn_protos(SSL *ssl, const unsigned char* protos, 1688SSL_set_alpn_protos(SSL *ssl, const unsigned char* protos,
1689 unsigned int protos_len) 1689 unsigned int protos_len)
1690{ 1690{
1691 free(ssl->alpn_client_proto_list); 1691 free(ssl->internal->alpn_client_proto_list);
1692 if ((ssl->alpn_client_proto_list = malloc(protos_len)) == NULL) 1692 if ((ssl->internal->alpn_client_proto_list = malloc(protos_len)) == NULL)
1693 return (1); 1693 return (1);
1694 memcpy(ssl->alpn_client_proto_list, protos, protos_len); 1694 memcpy(ssl->internal->alpn_client_proto_list, protos, protos_len);
1695 ssl->alpn_client_proto_list_len = protos_len; 1695 ssl->internal->alpn_client_proto_list_len = protos_len;
1696 1696
1697 return (0); 1697 return (0);
1698} 1698}
@@ -1707,8 +1707,8 @@ SSL_CTX_set_alpn_select_cb(SSL_CTX* ctx,
1707 int (*cb) (SSL *ssl, const unsigned char **out, unsigned char *outlen, 1707 int (*cb) (SSL *ssl, const unsigned char **out, unsigned char *outlen,
1708 const unsigned char *in, unsigned int inlen, void *arg), void *arg) 1708 const unsigned char *in, unsigned int inlen, void *arg), void *arg)
1709{ 1709{
1710 ctx->alpn_select_cb = cb; 1710 ctx->internal->alpn_select_cb = cb;
1711 ctx->alpn_select_cb_arg = arg; 1711 ctx->internal->alpn_select_cb_arg = arg;
1712} 1712}
1713 1713
1714/* 1714/*
@@ -1912,8 +1912,8 @@ SSL_CTX_new(const SSL_METHOD *meth)
1912 ret->tlsext_status_cb = 0; 1912 ret->tlsext_status_cb = 0;
1913 ret->tlsext_status_arg = NULL; 1913 ret->tlsext_status_arg = NULL;
1914 1914
1915 ret->next_protos_advertised_cb = 0; 1915 ret->internal->next_protos_advertised_cb = 0;
1916 ret->next_proto_select_cb = 0; 1916 ret->internal->next_proto_select_cb = 0;
1917#ifndef OPENSSL_NO_ENGINE 1917#ifndef OPENSSL_NO_ENGINE
1918 ret->client_cert_engine = NULL; 1918 ret->client_cert_engine = NULL;
1919#ifdef OPENSSL_SSL_CLIENT_ENGINE_AUTO 1919#ifdef OPENSSL_SSL_CLIENT_ENGINE_AUTO
@@ -2003,7 +2003,7 @@ SSL_CTX_free(SSL_CTX *a)
2003 ENGINE_finish(a->client_cert_engine); 2003 ENGINE_finish(a->client_cert_engine);
2004#endif 2004#endif
2005 2005
2006 free(a->alpn_client_proto_list); 2006 free(a->internal->alpn_client_proto_list);
2007 2007
2008 free(a->internal); 2008 free(a->internal);
2009 free(a); 2009 free(a);