summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libtls/tls_internal.h')
-rw-r--r--src/lib/libtls/tls_internal.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h
index b203b5662e..21bf2b4613 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.26 2015/10/07 23:33:38 beck Exp $ */ 1/* $OpenBSD: tls_internal.h,v 1.27 2016/04/28 16:48:44 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>
@@ -34,7 +34,14 @@ union tls_addr {
34 struct in6_addr ip6; 34 struct in6_addr ip6;
35}; 35};
36 36
37struct tls_error {
38 char *msg;
39 int num;
40};
41
37struct tls_config { 42struct tls_config {
43 struct tls_error error;
44
38 const char *ca_file; 45 const char *ca_file;
39 const char *ca_path; 46 const char *ca_path;
40 char *ca_mem; 47 char *ca_mem;
@@ -78,12 +85,11 @@ struct tls_conninfo {
78 85
79struct tls { 86struct tls {
80 struct tls_config *config; 87 struct tls_config *config;
88 struct tls_error error;
89
81 uint32_t flags; 90 uint32_t flags;
82 uint32_t state; 91 uint32_t state;
83 92
84 char *errmsg;
85 int errnum;
86
87 char *servername; 93 char *servername;
88 int socket; 94 int socket;
89 95
@@ -104,14 +110,23 @@ int tls_configure_ssl_verify(struct tls *ctx, int verify);
104int tls_handshake_client(struct tls *ctx); 110int tls_handshake_client(struct tls *ctx);
105int tls_handshake_server(struct tls *ctx); 111int tls_handshake_server(struct tls *ctx);
106int tls_host_port(const char *hostport, char **host, char **port); 112int tls_host_port(const char *hostport, char **host, char **port);
113
114int tls_set_config_error(struct tls_config *cfg, const char *fmt, ...)
115 __attribute__((__format__ (printf, 2, 3)))
116 __attribute__((__nonnull__ (2)));
117int tls_set_config_errorx(struct tls_config *cfg, const char *fmt, ...)
118 __attribute__((__format__ (printf, 2, 3)))
119 __attribute__((__nonnull__ (2)));
107int tls_set_error(struct tls *ctx, const char *fmt, ...) 120int tls_set_error(struct tls *ctx, const char *fmt, ...)
108 __attribute__((__format__ (printf, 2, 3))) 121 __attribute__((__format__ (printf, 2, 3)))
109 __attribute__((__nonnull__ (2))); 122 __attribute__((__nonnull__ (2)));
110int tls_set_errorx(struct tls *ctx, const char *fmt, ...) 123int tls_set_errorx(struct tls *ctx, const char *fmt, ...)
111 __attribute__((__format__ (printf, 2, 3))) 124 __attribute__((__format__ (printf, 2, 3)))
112 __attribute__((__nonnull__ (2))); 125 __attribute__((__nonnull__ (2)));
126
113int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, 127int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret,
114 const char *prefix); 128 const char *prefix);
129
115int tls_get_conninfo(struct tls *ctx); 130int tls_get_conninfo(struct tls *ctx);
116void tls_free_conninfo(struct tls_conninfo *conninfo); 131void tls_free_conninfo(struct tls_conninfo *conninfo);
117 132