summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_config.c
diff options
context:
space:
mode:
authoreric <>2022-01-25 21:51:24 +0000
committereric <>2022-01-25 21:51:24 +0000
commit5bc45eb57d3df492a992eb97f4f9efadef0b060c (patch)
treef7e1f8bcb82bc7a21b3720f212d7fbf3f1d02872 /src/lib/libtls/tls_config.c
parentc8578f33457bc1465ca08176ebca6e8aac53fcd3 (diff)
downloadopenbsd-5bc45eb57d3df492a992eb97f4f9efadef0b060c.tar.gz
openbsd-5bc45eb57d3df492a992eb97f4f9efadef0b060c.tar.bz2
openbsd-5bc45eb57d3df492a992eb97f4f9efadef0b060c.zip
Introduce a signer interface intented to make TLS privsep simpler
to implement. Add a tls_config_set_sign_cb() function that allows to register a callback for the signing operation on a tls_config. When used, the context installs fake pivate keys internally, and the callback receives the hash of the public key. Add a tls_signer_*() set of functions to manage tls_signer objects. A tls_signer is an opaque structure on which keys are added. It is used to compute signatures with private keys identified by their associated public key hash. Discussed with and ok jsing@ tb@
Diffstat (limited to 'src/lib/libtls/tls_config.c')
-rw-r--r--src/lib/libtls/tls_config.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c
index 4ca497a032..15e218b4e0 100644
--- a/src/lib/libtls/tls_config.c
+++ b/src/lib/libtls/tls_config.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_config.c,v 1.64 2021/10/21 08:33:07 tb Exp $ */ 1/* $OpenBSD: tls_config.c,v 1.65 2022/01/25 21:51:24 eric Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -738,6 +738,17 @@ tls_config_set_session_fd(struct tls_config *config, int session_fd)
738} 738}
739 739
740int 740int
741tls_config_set_sign_cb(struct tls_config *config, tls_sign_cb cb, void *cb_arg)
742{
743 config->use_fake_private_key = 1;
744 config->skip_private_key_check = 1;
745 config->sign_cb = cb;
746 config->sign_cb_arg = cb_arg;
747
748 return (0);
749}
750
751int
741tls_config_set_verify_depth(struct tls_config *config, int verify_depth) 752tls_config_set_verify_depth(struct tls_config *config, int verify_depth)
742{ 753{
743 config->verify_depth = verify_depth; 754 config->verify_depth = verify_depth;