summaryrefslogtreecommitdiff
path: root/src/stls
diff options
context:
space:
mode:
Diffstat (limited to 'src/stls')
-rw-r--r--src/stls/deps-lib/stls1
-rw-r--r--src/stls/stls_send_environment.c24
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 ;
+}