diff options
author | jsing <> | 2015-09-29 13:10:53 +0000 |
---|---|---|
committer | jsing <> | 2015-09-29 13:10:53 +0000 |
commit | 709c2c131d5d5d3f3c8ecb110b01f3d5afa6ddfd (patch) | |
tree | 0c312edb7d4149622244dbffd24cd841a31acbd4 /src/lib | |
parent | a5f8b1e3beaca544186a330e0f61427c67779c1f (diff) | |
download | openbsd-709c2c131d5d5d3f3c8ecb110b01f3d5afa6ddfd.tar.gz openbsd-709c2c131d5d5d3f3c8ecb110b01f3d5afa6ddfd.tar.bz2 openbsd-709c2c131d5d5d3f3c8ecb110b01f3d5afa6ddfd.zip |
Instead of declaring a union in multiple places, move it to tls_internal.h.
ok deraadt@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libtls/tls_client.c | 7 | ||||
-rw-r--r-- | src/lib/libtls/tls_internal.h | 10 | ||||
-rw-r--r-- | src/lib/libtls/tls_verify.c | 12 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c index cea01d17fe..af1b05ab71 100644 --- a/src/lib/libtls/tls_client.c +++ b/src/lib/libtls/tls_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_client.c,v 1.29 2015/09/29 10:17:04 deraadt Exp $ */ | 1 | /* $OpenBSD: tls_client.c,v 1.30 2015/09/29 13:10:53 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -166,10 +166,7 @@ int | |||
166 | tls_connect_fds(struct tls *ctx, int fd_read, int fd_write, | 166 | tls_connect_fds(struct tls *ctx, int fd_read, int fd_write, |
167 | const char *servername) | 167 | const char *servername) |
168 | { | 168 | { |
169 | union { | 169 | union tls_addr addrbuf; |
170 | struct in_addr ip4; | ||
171 | struct in6_addr ip6; | ||
172 | } addrbuf; | ||
173 | int rv = -1; | 170 | int rv = -1; |
174 | 171 | ||
175 | if ((ctx->flags & TLS_CLIENT) == 0) { | 172 | if ((ctx->flags & TLS_CLIENT) == 0) { |
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index 8128c05dfc..b070b326c1 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.24 2015/09/14 16:16:38 jsing Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.25 2015/09/29 13:10:53 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -19,6 +19,9 @@ | |||
19 | #ifndef HEADER_TLS_INTERNAL_H | 19 | #ifndef HEADER_TLS_INTERNAL_H |
20 | #define HEADER_TLS_INTERNAL_H | 20 | #define HEADER_TLS_INTERNAL_H |
21 | 21 | ||
22 | #include <arpa/inet.h> | ||
23 | #include <netinet/in.h> | ||
24 | |||
22 | #include <openssl/ssl.h> | 25 | #include <openssl/ssl.h> |
23 | 26 | ||
24 | #define _PATH_SSL_CA_FILE "/etc/ssl/cert.pem" | 27 | #define _PATH_SSL_CA_FILE "/etc/ssl/cert.pem" |
@@ -26,6 +29,11 @@ | |||
26 | #define TLS_CIPHERS_COMPAT "ALL:!aNULL:!eNULL" | 29 | #define TLS_CIPHERS_COMPAT "ALL:!aNULL:!eNULL" |
27 | #define TLS_CIPHERS_DEFAULT "TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE" | 30 | #define TLS_CIPHERS_DEFAULT "TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE" |
28 | 31 | ||
32 | union tls_addr { | ||
33 | struct in_addr ip4; | ||
34 | struct in6_addr ip6; | ||
35 | }; | ||
36 | |||
29 | struct tls_config { | 37 | struct tls_config { |
30 | const char *ca_file; | 38 | const char *ca_file; |
31 | const char *ca_path; | 39 | const char *ca_path; |
diff --git a/src/lib/libtls/tls_verify.c b/src/lib/libtls/tls_verify.c index 2b0ac653be..eec72bade8 100644 --- a/src/lib/libtls/tls_verify.c +++ b/src/lib/libtls/tls_verify.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_verify.c,v 1.14 2015/09/29 10:17:04 deraadt Exp $ */ | 1 | /* $OpenBSD: tls_verify.c,v 1.15 2015/09/29 13:10:53 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * | 4 | * |
@@ -88,10 +88,7 @@ static int | |||
88 | tls_check_subject_altname(struct tls *ctx, X509 *cert, const char *name) | 88 | tls_check_subject_altname(struct tls *ctx, X509 *cert, const char *name) |
89 | { | 89 | { |
90 | STACK_OF(GENERAL_NAME) *altname_stack = NULL; | 90 | STACK_OF(GENERAL_NAME) *altname_stack = NULL; |
91 | union { | 91 | union tls_addr addrbuf; |
92 | struct in_addr ip4; | ||
93 | struct in6_addr ip6; | ||
94 | } addrbuf; | ||
95 | int addrlen, type; | 92 | int addrlen, type; |
96 | int count, i; | 93 | int count, i; |
97 | int rv = -1; | 94 | int rv = -1; |
@@ -202,12 +199,9 @@ tls_check_common_name(struct tls *ctx, X509 *cert, const char *name) | |||
202 | { | 199 | { |
203 | X509_NAME *subject_name; | 200 | X509_NAME *subject_name; |
204 | char *common_name = NULL; | 201 | char *common_name = NULL; |
202 | union tls_addr addrbuf; | ||
205 | int common_name_len; | 203 | int common_name_len; |
206 | int rv = -1; | 204 | int rv = -1; |
207 | union { | ||
208 | struct in_addr ip4; | ||
209 | struct in6_addr ip6; | ||
210 | } addrbuf; | ||
211 | 205 | ||
212 | subject_name = X509_get_subject_name(cert); | 206 | subject_name = X509_get_subject_name(cert); |
213 | if (subject_name == NULL) | 207 | if (subject_name == NULL) |