summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_internal.h
diff options
context:
space:
mode:
authorjoshua <>2024-03-26 06:24:52 +0000
committerjoshua <>2024-03-26 06:24:52 +0000
commit936498dd6ef929653cff09dd6b3303e39c8ad08d (patch)
treec0d04141b5fceb9e1cb05bec1e7e8fe3d0ac35f9 /src/lib/libtls/tls_internal.h
parent7e79cc7d135c6ac69536ff44c870a4af9ecee499 (diff)
downloadopenbsd-936498dd6ef929653cff09dd6b3303e39c8ad08d.tar.gz
openbsd-936498dd6ef929653cff09dd6b3303e39c8ad08d.tar.bz2
openbsd-936498dd6ef929653cff09dd6b3303e39c8ad08d.zip
Add error code support to libtls
This adds tls_config_error_code() and tls_error_code(), which will become public API at a later date. Additional error codes will be added in follow-up commits. ok jsing@ beck@
Diffstat (limited to 'src/lib/libtls/tls_internal.h')
-rw-r--r--src/lib/libtls/tls_internal.h45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h
index c06e8218f6..5ff48ed7c9 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.84 2024/03/26 00:50:22 joshua Exp $ */ 1/* $OpenBSD: tls_internal.h,v 1.85 2024/03/26 06:24:52 joshua 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>
@@ -46,6 +46,7 @@ union tls_addr {
46 46
47struct tls_error { 47struct tls_error {
48 char *msg; 48 char *msg;
49 int code;
49 int errno_value; 50 int errno_value;
50 int tls; 51 int tls;
51}; 52};
@@ -258,27 +259,27 @@ int tls_set_cbs(struct tls *ctx,
258 tls_read_cb read_cb, tls_write_cb write_cb, void *cb_arg); 259 tls_read_cb read_cb, tls_write_cb write_cb, void *cb_arg);
259 260
260void tls_error_clear(struct tls_error *error); 261void tls_error_clear(struct tls_error *error);
261int tls_error_set(struct tls_error *error, const char *fmt, ...) 262int tls_error_set(struct tls_error *error, int code, const char *fmt, ...)
262 __attribute__((__format__ (printf, 2, 3))) 263 __attribute__((__format__ (printf, 3, 4)))
263 __attribute__((__nonnull__ (2))); 264 __attribute__((__nonnull__ (3)));
264int tls_error_setx(struct tls_error *error, const char *fmt, ...) 265int tls_error_setx(struct tls_error *error, int code, const char *fmt, ...)
265 __attribute__((__format__ (printf, 2, 3))) 266 __attribute__((__format__ (printf, 3, 4)))
266 __attribute__((__nonnull__ (2))); 267 __attribute__((__nonnull__ (3)));
267int tls_config_set_error(struct tls_config *cfg, const char *fmt, ...) 268int tls_config_set_error(struct tls_config *cfg, int code, const char *fmt, ...)
268 __attribute__((__format__ (printf, 2, 3))) 269 __attribute__((__format__ (printf, 3, 4)))
269 __attribute__((__nonnull__ (2))); 270 __attribute__((__nonnull__ (3)));
270int tls_config_set_errorx(struct tls_config *cfg, const char *fmt, ...) 271int tls_config_set_errorx(struct tls_config *cfg, int code, const char *fmt, ...)
271 __attribute__((__format__ (printf, 2, 3))) 272 __attribute__((__format__ (printf, 3, 4)))
272 __attribute__((__nonnull__ (2))); 273 __attribute__((__nonnull__ (3)));
273int tls_set_error(struct tls *ctx, const char *fmt, ...) 274int tls_set_error(struct tls *ctx, int code, const char *fmt, ...)
274 __attribute__((__format__ (printf, 2, 3))) 275 __attribute__((__format__ (printf, 3, 4)))
275 __attribute__((__nonnull__ (2))); 276 __attribute__((__nonnull__ (3)));
276int tls_set_errorx(struct tls *ctx, const char *fmt, ...) 277int tls_set_errorx(struct tls *ctx, int code, const char *fmt, ...)
277 __attribute__((__format__ (printf, 2, 3))) 278 __attribute__((__format__ (printf, 3, 4)))
278 __attribute__((__nonnull__ (2))); 279 __attribute__((__nonnull__ (3)));
279int tls_set_ssl_errorx(struct tls *ctx, const char *fmt, ...) 280int tls_set_ssl_errorx(struct tls *ctx, int code, const char *fmt, ...)
280 __attribute__((__format__ (printf, 2, 3))) 281 __attribute__((__format__ (printf, 3, 4)))
281 __attribute__((__nonnull__ (2))); 282 __attribute__((__nonnull__ (3)));
282 283
283int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, 284int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret,
284 const char *prefix); 285 const char *prefix);