summaryrefslogtreecommitdiff
path: root/src/stls/stls_send_environment.c
blob: 1c13602b620d352bf9140ca16f5dcbea21f24ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 ;
}