Add TLS build support to td.

This commit is contained in:
Jordan Bancino 2023-03-22 01:17:42 +00:00
parent 996356832e
commit 6561b5bae1
2 changed files with 21 additions and 2 deletions

View file

@ -2,8 +2,11 @@
#define TELODENDRIA_TLS_H #define TELODENDRIA_TLS_H
#define TLS_LIBRESSL 1 #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 <Stream.h> #include <Stream.h>

View file

@ -32,6 +32,22 @@
. "$(pwd)/tools/lib/common.sh" . "$(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}" CFLAGS="${CFLAGS} ${DEFINES} ${INCLUDES}"
LDFLAGS="${LDFLAGS} ${STATIC}" LDFLAGS="${LDFLAGS} ${STATIC}"