diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-22 15:46:34 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-22 15:46:34 +0000 |
commit | 4fb917263ac30373cb3e5dfe3e207369eb238def (patch) | |
tree | 992265c03c46e9fe38084336e9a87733b9e8748c /src/stls | |
parent | 47cbbb1619ace4013856843ef8f7d68279c74faa (diff) | |
download | s6-networking-4fb917263ac30373cb3e5dfe3e207369eb238def.tar.xz |
Add SSL_PROTOCOL and SSL_CIPHER support, fix some bugs
Diffstat (limited to 'src/stls')
-rw-r--r-- | src/stls/deps-lib/stls | 1 | ||||
-rw-r--r-- | src/stls/stls_send_environment.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/stls/deps-lib/stls b/src/stls/deps-lib/stls index 9416332..615ce3b 100644 --- a/src/stls/deps-lib/stls +++ b/src/stls/deps-lib/stls @@ -2,5 +2,6 @@ stls_drop.o stls_run.o stls_client_init_and_handshake.o stls_server_init_and_handshake.o +stls_send_environment.o ${CRYPTO_LIB} -lskarnet diff --git a/src/stls/stls_send_environment.c b/src/stls/stls_send_environment.c new file mode 100644 index 0000000..1c13602 --- /dev/null +++ b/src/stls/stls_send_environment.c @@ -0,0 +1,24 @@ +/* ISC license. */ + +#include <unistd.h> +#include <stdlib.h> + +#include <tls.h> + +#include <skalibs/buffer.h> + +#include <s6-networking/stls.h> + +int stls_send_environment (struct tls *ctx, int fd) +{ + char buf[4096] ; + buffer b = BUFFER_INIT(&buffer_write, fd, buf, 4096) ; + if (buffer_puts(&b, "SSL_PROTOCOL=") < 0 + || buffer_puts(&b, tls_conn_version(ctx)) < 0 + || buffer_put(&b, "", 1) < 0 + || buffer_puts(&b, "SSL_CIPHER=") < 0 + || buffer_puts(&b, tls_conn_cipher(ctx)) < 0 + || buffer_putflush(&b, "\0", 2) < 0) + return 0 ; + return 1 ; +} |