diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-09-29 13:10:54 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-09-29 13:10:54 +0000 |
commit | fb0413b0d769282ba6acd58809f56d9046293a45 (patch) | |
tree | cba28d8499d6ddff74995a0be8b95a549c993548 /lib | |
parent | 8342a6922e5585c4e5da844737d369b908547ef5 (diff) |
Instead of declaring a union in multiple places, move it to tls_internal.h.
ok deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtls/tls_client.c | 7 | ||||
-rw-r--r-- | lib/libtls/tls_internal.h | 10 | ||||
-rw-r--r-- | lib/libtls/tls_verify.c | 12 |
3 files changed, 14 insertions, 15 deletions
diff --git a/lib/libtls/tls_client.c b/lib/libtls/tls_client.c index cea01d17fec..af1b05ab713 100644 --- a/lib/libtls/tls_client.c +++ b/lib/libtls/tls_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_client.c,v 1.29 2015/09/29 10:17:04 deraadt Exp $ */ +/* $OpenBSD: tls_client.c,v 1.30 2015/09/29 13:10:53 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -166,10 +166,7 @@ int tls_connect_fds(struct tls *ctx, int fd_read, int fd_write, const char *servername) { - union { - struct in_addr ip4; - struct in6_addr ip6; - } addrbuf; + union tls_addr addrbuf; int rv = -1; if ((ctx->flags & TLS_CLIENT) == 0) { diff --git a/lib/libtls/tls_internal.h b/lib/libtls/tls_internal.h index 8128c05dfce..b070b326c11 100644 --- a/lib/libtls/tls_internal.h +++ b/lib/libtls/tls_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_internal.h,v 1.24 2015/09/14 16:16:38 jsing Exp $ */ +/* $OpenBSD: tls_internal.h,v 1.25 2015/09/29 13:10:53 jsing Exp $ */ /* * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> @@ -19,6 +19,9 @@ #ifndef HEADER_TLS_INTERNAL_H #define HEADER_TLS_INTERNAL_H +#include <arpa/inet.h> +#include <netinet/in.h> + #include <openssl/ssl.h> #define _PATH_SSL_CA_FILE "/etc/ssl/cert.pem" @@ -26,6 +29,11 @@ #define TLS_CIPHERS_COMPAT "ALL:!aNULL:!eNULL" #define TLS_CIPHERS_DEFAULT "TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE" +union tls_addr { + struct in_addr ip4; + struct in6_addr ip6; +}; + struct tls_config { const char *ca_file; const char *ca_path; diff --git a/lib/libtls/tls_verify.c b/lib/libtls/tls_verify.c index 2b0ac653be5..eec72bade8c 100644 --- a/lib/libtls/tls_verify.c +++ b/lib/libtls/tls_verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_verify.c,v 1.14 2015/09/29 10:17:04 deraadt Exp $ */ +/* $OpenBSD: tls_verify.c,v 1.15 2015/09/29 13:10:53 jsing Exp $ */ /* * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> * @@ -88,10 +88,7 @@ static int tls_check_subject_altname(struct tls *ctx, X509 *cert, const char *name) { STACK_OF(GENERAL_NAME) *altname_stack = NULL; - union { - struct in_addr ip4; - struct in6_addr ip6; - } addrbuf; + union tls_addr addrbuf; int addrlen, type; int count, i; int rv = -1; @@ -202,12 +199,9 @@ tls_check_common_name(struct tls *ctx, X509 *cert, const char *name) { X509_NAME *subject_name; char *common_name = NULL; + union tls_addr addrbuf; int common_name_len; int rv = -1; - union { - struct in_addr ip4; - struct in6_addr ip6; - } addrbuf; subject_name = X509_get_subject_name(cert); if (subject_name == NULL) |