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}"