From 6561b5bae1ebb9512100182cc2d94f10ee9e76e5 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 22 Mar 2023 01:17:42 +0000 Subject: [PATCH] Add TLS build support to td. --- src/include/Tls.h | 7 +++++-- tools/bin/td | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/include/Tls.h b/src/include/Tls.h index a0aac0b..3f1076a 100644 --- a/src/include/Tls.h +++ b/src/include/Tls.h @@ -2,8 +2,11 @@ #define TELODENDRIA_TLS_H #define TLS_LIBRESSL 1 -#define TLS_MBEDTLS 2 -#define TLS_OPENSSL 3 + +/* + * Other TLS_* macros can be declared here as support + * for other implementations is added. + */ #include diff --git a/tools/bin/td b/tools/bin/td index b080356..bd6a033 100644 --- a/tools/bin/td +++ b/tools/bin/td @@ -32,6 +32,22 @@ . "$(pwd)/tools/lib/common.sh" +if [ -n "$TLS_IMPL" ]; then + case "$TLS_IMPL" in + "TLS_LIBRESSL") + TLS_LIBS="-ltls -lcrypto -lssl" + ;; + *) + echo "Unrecognized TLS implementation: ${TLS_IMPL}" + echo "Consult src/include/Tls.h for supported implementations." + exit 1 + ;; + esac + + DEFINES="${DEFINES} -DTLS_IMPL=${TLS_IMPL}" + LDFLAGS="${LDFLAGS} ${TLS_LIBS}" +fi + CFLAGS="${CFLAGS} ${DEFINES} ${INCLUDES}" LDFLAGS="${LDFLAGS} ${STATIC}"