From afdf8ba983b4f3c58d031b8518b186920ad6bce1 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 20 Sep 2024 10:12:00 +0200 Subject: [PATCH 1/7] Ssl: add makefile for static mbedtls build --- libs/ssl/Makefile | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 libs/ssl/Makefile diff --git a/libs/ssl/Makefile b/libs/ssl/Makefile new file mode 100644 index 000000000..80a8575aa --- /dev/null +++ b/libs/ssl/Makefile @@ -0,0 +1,125 @@ +INCLUDES_BASE_DIR = ../../include +CFLAGS = -fPIC -O3 -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src +LFLAGS = -L../.. -lhl + +SRC = \ + ${INCLUDES_BASE_DIR}/mbedtls/library/aes.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/aesce.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/aesni.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/aria.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/asn1parse.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/asn1write.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/base64.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/bignum.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_core.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_mod.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_mod_raw.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/block_cipher.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/camellia.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ccm.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/chacha20.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/chachapoly.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/cipher.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/cipher_wrap.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/cmac.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/constant_time.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ctr_drbg.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/debug.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/des.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/dhm.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecdh.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecdsa.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecjpake.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecp.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecp_curves.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ecp_curves_new.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/entropy.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/entropy_poll.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/error.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/gcm.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/hkdf.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/hmac_drbg.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/lmots.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/lms.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/md.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/md5.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/memory_buffer_alloc.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/mps_reader.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/mps_trace.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/net_sockets.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/nist_kw.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/oid.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/padlock.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pem.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pk.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pk_ecc.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pk_wrap.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs12.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs5.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs7.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pkparse.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/pkwrite.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/platform.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/platform_util.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/poly1305.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_aead.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_cipher.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_client.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_driver_wrappers_no_static.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_ecp.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_ffdh.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_hash.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_mac.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_pake.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_rsa.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_se.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_slot_management.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_storage.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_its_file.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/psa_util.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ripemd160.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/rsa.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/rsa_alt_helpers.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/sha1.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/sha256.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/sha3.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/sha512.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_cache.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_ciphersuites.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_client.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_cookie.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_debug_helpers_generated.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_msg.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_ticket.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls12_client.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls12_server.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_client.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_generic.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_keys.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_server.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/threading.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/timing.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/version.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/version_features.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509_create.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509_crl.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509_crt.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509_csr.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509write.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509write_crt.o \ + ${INCLUDES_BASE_DIR}/mbedtls/library/x509write_csr.o \ + ssl.o + +all: ssl.hdll + +ssl.hdll: ${SRC} + ${CC} ${CFLAGS} -shared -o $@ $< ${LFLAGS} + +%.o: %.c + ${CC} ${CFLAGS} -o $@ -c $< + +clean: + rm -f ${SRC} *.hdll From d996b10da30dc83d6fbfd646955ec57b0d7d258f Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 20 Sep 2024 12:17:59 +0200 Subject: [PATCH 2/7] Fix build, add flags as main makefile, and visibility hidden to prevent all mbedtls function been export --- libs/ssl/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/ssl/Makefile b/libs/ssl/Makefile index 80a8575aa..1945d8074 100644 --- a/libs/ssl/Makefile +++ b/libs/ssl/Makefile @@ -1,5 +1,6 @@ INCLUDES_BASE_DIR = ../../include -CFLAGS = -fPIC -O3 -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src +CFLAGS = -Wall -O3 -std=c11 -m64 -fPIC -pthread -fno-omit-frame-pointer +CFLAGS += -fvisibility=hidden -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src LFLAGS = -L../.. -lhl SRC = \ @@ -116,7 +117,7 @@ SRC = \ all: ssl.hdll ssl.hdll: ${SRC} - ${CC} ${CFLAGS} -shared -o $@ $< ${LFLAGS} + ${CC} ${CFLAGS} -shared -o $@ $^ ${LFLAGS} %.o: %.c ${CC} ${CFLAGS} -o $@ -c $< From e12498222b371f93e262d532f86b85ecdead297a Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 20 Sep 2024 12:38:38 +0200 Subject: [PATCH 3/7] Allow build with SSL_STATIC=1 from main makefile --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 3b6db5c7f..870aad61a 100644 --- a/Makefile +++ b/Makefile @@ -221,8 +221,14 @@ sdl: ${SDL} libhl openal: ${OPENAL} libhl ${CC} ${CFLAGS} -shared -o openal.hdll ${OPENAL} ${LIBFLAGS} -L. -lhl $(LIBOPENAL) +ifdef SSL_STATIC +ssl: libhl + ${MAKE} -C "libs/ssl" + mv libs/ssl/ssl.hdll . +else ssl: ${SSL} libhl ${CC} ${CFLAGS} -shared -o ssl.hdll ${SSL} ${LIBFLAGS} -L. -lhl -lmbedtls -lmbedx509 -lmbedcrypto $(LIBSSL) +endif ui: ${UI} libhl ${CC} ${CFLAGS} -shared -o ui.hdll ${UI} ${LIBFLAGS} -L. -lhl @@ -310,6 +316,9 @@ codesign_osx: clean_o: rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HL_DEBUG} +ifdef SSL_STATIC + make -C "libs/ssl" clean +endif clean: clean_o rm -f hl hl.exe libhl.$(LIBEXT) *.hdll From 6af9ecfdd6e7e87f7fd7cd9e04aa50985b819412 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 20 Sep 2024 14:48:01 +0200 Subject: [PATCH 4/7] Makefile rename SRC to SSL, add osx lib --- libs/ssl/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/ssl/Makefile b/libs/ssl/Makefile index 1945d8074..1472bf240 100644 --- a/libs/ssl/Makefile +++ b/libs/ssl/Makefile @@ -3,7 +3,12 @@ CFLAGS = -Wall -O3 -std=c11 -m64 -fPIC -pthread -fno-omit-frame-pointer CFLAGS += -fvisibility=hidden -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src LFLAGS = -L../.. -lhl -SRC = \ +UNAME := $(shell uname) +ifeq ($(UNAME),Darwin) +CFLAGS += -framework Security -framework CoreFoundation +endif + +SSL = \ ${INCLUDES_BASE_DIR}/mbedtls/library/aes.o \ ${INCLUDES_BASE_DIR}/mbedtls/library/aesce.o \ ${INCLUDES_BASE_DIR}/mbedtls/library/aesni.o \ @@ -116,11 +121,11 @@ SRC = \ all: ssl.hdll -ssl.hdll: ${SRC} +ssl.hdll: ${SSL} ${CC} ${CFLAGS} -shared -o $@ $^ ${LFLAGS} %.o: %.c ${CC} ${CFLAGS} -o $@ -c $< clean: - rm -f ${SRC} *.hdll + rm -f ${SSL} *.hdll From 45de3b62d64d36dffe2ad5c56e262e77f68bd473 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Mon, 23 Sep 2024 08:56:07 +0200 Subject: [PATCH 5/7] Add user config file --- libs/ssl/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/ssl/Makefile b/libs/ssl/Makefile index 1472bf240..32fc96516 100644 --- a/libs/ssl/Makefile +++ b/libs/ssl/Makefile @@ -1,6 +1,7 @@ INCLUDES_BASE_DIR = ../../include CFLAGS = -Wall -O3 -std=c11 -m64 -fPIC -pthread -fno-omit-frame-pointer CFLAGS += -fvisibility=hidden -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src +CFLAGS += -D MBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\" LFLAGS = -L../.. -lhl UNAME := $(shell uname) From 7f8e14241a4b794631e27de2ef4d1b84ce5a058e Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 27 Sep 2024 12:14:14 +0200 Subject: [PATCH 6/7] Merge ssl makefile with main makefile --- Makefile | 136 ++++++++++++++++++++++++++++++++++++++++++---- libs/ssl/Makefile | 132 -------------------------------------------- 2 files changed, 125 insertions(+), 143 deletions(-) delete mode 100644 libs/ssl/Makefile diff --git a/Makefile b/Makefile index 870aad61a..231c1cdbe 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,121 @@ OPENAL = libs/openal/openal.o SSL = libs/ssl/ssl.o +ifdef SSL_STATIC +SSL += \ + include/mbedtls/library/aes.o \ + include/mbedtls/library/aesce.o \ + include/mbedtls/library/aesni.o \ + include/mbedtls/library/aria.o \ + include/mbedtls/library/asn1parse.o \ + include/mbedtls/library/asn1write.o \ + include/mbedtls/library/base64.o \ + include/mbedtls/library/bignum.o \ + include/mbedtls/library/bignum_core.o \ + include/mbedtls/library/bignum_mod.o \ + include/mbedtls/library/bignum_mod_raw.o \ + include/mbedtls/library/block_cipher.o \ + include/mbedtls/library/camellia.o \ + include/mbedtls/library/ccm.o \ + include/mbedtls/library/chacha20.o \ + include/mbedtls/library/chachapoly.o \ + include/mbedtls/library/cipher.o \ + include/mbedtls/library/cipher_wrap.o \ + include/mbedtls/library/cmac.o \ + include/mbedtls/library/constant_time.o \ + include/mbedtls/library/ctr_drbg.o \ + include/mbedtls/library/debug.o \ + include/mbedtls/library/des.o \ + include/mbedtls/library/dhm.o \ + include/mbedtls/library/ecdh.o \ + include/mbedtls/library/ecdsa.o \ + include/mbedtls/library/ecjpake.o \ + include/mbedtls/library/ecp.o \ + include/mbedtls/library/ecp_curves.o \ + include/mbedtls/library/ecp_curves_new.o \ + include/mbedtls/library/entropy.o \ + include/mbedtls/library/entropy_poll.o \ + include/mbedtls/library/error.o \ + include/mbedtls/library/gcm.o \ + include/mbedtls/library/hkdf.o \ + include/mbedtls/library/hmac_drbg.o \ + include/mbedtls/library/lmots.o \ + include/mbedtls/library/lms.o \ + include/mbedtls/library/md.o \ + include/mbedtls/library/md5.o \ + include/mbedtls/library/memory_buffer_alloc.o \ + include/mbedtls/library/mps_reader.o \ + include/mbedtls/library/mps_trace.o \ + include/mbedtls/library/net_sockets.o \ + include/mbedtls/library/nist_kw.o \ + include/mbedtls/library/oid.o \ + include/mbedtls/library/padlock.o \ + include/mbedtls/library/pem.o \ + include/mbedtls/library/pk.o \ + include/mbedtls/library/pk_ecc.o \ + include/mbedtls/library/pk_wrap.o \ + include/mbedtls/library/pkcs12.o \ + include/mbedtls/library/pkcs5.o \ + include/mbedtls/library/pkcs7.o \ + include/mbedtls/library/pkparse.o \ + include/mbedtls/library/pkwrite.o \ + include/mbedtls/library/platform.o \ + include/mbedtls/library/platform_util.o \ + include/mbedtls/library/poly1305.o \ + include/mbedtls/library/psa_crypto.o \ + include/mbedtls/library/psa_crypto_aead.o \ + include/mbedtls/library/psa_crypto_cipher.o \ + include/mbedtls/library/psa_crypto_client.o \ + include/mbedtls/library/psa_crypto_driver_wrappers_no_static.o \ + include/mbedtls/library/psa_crypto_ecp.o \ + include/mbedtls/library/psa_crypto_ffdh.o \ + include/mbedtls/library/psa_crypto_hash.o \ + include/mbedtls/library/psa_crypto_mac.o \ + include/mbedtls/library/psa_crypto_pake.o \ + include/mbedtls/library/psa_crypto_rsa.o \ + include/mbedtls/library/psa_crypto_se.o \ + include/mbedtls/library/psa_crypto_slot_management.o \ + include/mbedtls/library/psa_crypto_storage.o \ + include/mbedtls/library/psa_its_file.o \ + include/mbedtls/library/psa_util.o \ + include/mbedtls/library/ripemd160.o \ + include/mbedtls/library/rsa.o \ + include/mbedtls/library/rsa_alt_helpers.o \ + include/mbedtls/library/sha1.o \ + include/mbedtls/library/sha256.o \ + include/mbedtls/library/sha3.o \ + include/mbedtls/library/sha512.o \ + include/mbedtls/library/ssl_cache.o \ + include/mbedtls/library/ssl_ciphersuites.o \ + include/mbedtls/library/ssl_client.o \ + include/mbedtls/library/ssl_cookie.o \ + include/mbedtls/library/ssl_debug_helpers_generated.o \ + include/mbedtls/library/ssl_msg.o \ + include/mbedtls/library/ssl_ticket.o \ + include/mbedtls/library/ssl_tls.o \ + include/mbedtls/library/ssl_tls12_client.o \ + include/mbedtls/library/ssl_tls12_server.o \ + include/mbedtls/library/ssl_tls13_client.o \ + include/mbedtls/library/ssl_tls13_generic.o \ + include/mbedtls/library/ssl_tls13_keys.o \ + include/mbedtls/library/ssl_tls13_server.o \ + include/mbedtls/library/threading.o \ + include/mbedtls/library/timing.o \ + include/mbedtls/library/version.o \ + include/mbedtls/library/version_features.o \ + include/mbedtls/library/x509.o \ + include/mbedtls/library/x509_create.o \ + include/mbedtls/library/x509_crl.o \ + include/mbedtls/library/x509_crt.o \ + include/mbedtls/library/x509_csr.o \ + include/mbedtls/library/x509write.o \ + include/mbedtls/library/x509write_crt.o \ + include/mbedtls/library/x509write_csr.o +SSL_CFLAGS = -fvisibility=hidden -I libs/ssl -I include/mbedtls/include -D MBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\" +else +SSL_LDLIBS = -lmbedtls -lmbedx509 -lmbedcrypto +endif + UV = libs/uv/uv.o UI = libs/ui/ui_stub.o @@ -108,7 +223,7 @@ CFLAGS += -m$(MARCH) -I include -I $(BREW_LIBJPEG)/include \ -I $(BREW_MBEDTLS)/include -I $(BREW_LIBPNG)/include -I $(BREW_LIBOGG)/include \ -I $(BREW_LIBUV)/include \ -I $(BREW_OPENAL)/include -Dopenal_soft -DGL_SILENCE_DEPRECATION -LFLAGS += -Wl,-export_dynamic +LFLAGS += -Wl,-export_dynamic CFLAGS += -m$(MARCH) -I include -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include \ -I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include -I /usr/local/opt/libvorbis/include \ @@ -221,14 +336,16 @@ sdl: ${SDL} libhl openal: ${OPENAL} libhl ${CC} ${CFLAGS} -shared -o openal.hdll ${OPENAL} ${LIBFLAGS} -L. -lhl $(LIBOPENAL) -ifdef SSL_STATIC -ssl: libhl - ${MAKE} -C "libs/ssl" - mv libs/ssl/ssl.hdll . -else +./include/mbedtls/%.o: ./include/mbedtls/%.c + ${CC} ${CFLAGS} -o $@ -c $< ${SSL_CFLAGS} + +# force rebuild ssl.o in case we mix SSL_STATIC with normal build +.PHONY: libs/ssl/ssl.o +libs/ssl/ssl.o: libs/ssl/ssl.c + ${CC} ${CFLAGS} -o $@ -c $< ${SSL_CFLAGS} + ssl: ${SSL} libhl - ${CC} ${CFLAGS} -shared -o ssl.hdll ${SSL} ${LIBFLAGS} -L. -lhl -lmbedtls -lmbedx509 -lmbedcrypto $(LIBSSL) -endif + ${CC} ${CFLAGS} ${SSL_CFLAGS} -shared -o ssl.hdll ${SSL} ${LIBFLAGS} -L. -lhl ${SSL_LDLIBS} $(LIBSSL) ui: ${UI} libhl ${CC} ${CFLAGS} -shared -o ui.hdll ${UI} ${LIBFLAGS} -L. -lhl @@ -316,9 +433,6 @@ codesign_osx: clean_o: rm -f ${STD} ${BOOT} ${RUNTIME} ${PCRE} ${HL} ${FMT} ${SDL} ${SSL} ${OPENAL} ${UI} ${UV} ${MYSQL} ${SQLITE} ${HL_DEBUG} -ifdef SSL_STATIC - make -C "libs/ssl" clean -endif clean: clean_o rm -f hl hl.exe libhl.$(LIBEXT) *.hdll diff --git a/libs/ssl/Makefile b/libs/ssl/Makefile deleted file mode 100644 index 32fc96516..000000000 --- a/libs/ssl/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -INCLUDES_BASE_DIR = ../../include -CFLAGS = -Wall -O3 -std=c11 -m64 -fPIC -pthread -fno-omit-frame-pointer -CFLAGS += -fvisibility=hidden -I. -I${INCLUDES_BASE_DIR}/mbedtls/include -I ../../src -CFLAGS += -D MBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\" -LFLAGS = -L../.. -lhl - -UNAME := $(shell uname) -ifeq ($(UNAME),Darwin) -CFLAGS += -framework Security -framework CoreFoundation -endif - -SSL = \ - ${INCLUDES_BASE_DIR}/mbedtls/library/aes.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/aesce.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/aesni.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/aria.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/asn1parse.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/asn1write.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/base64.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/bignum.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_core.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_mod.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/bignum_mod_raw.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/block_cipher.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/camellia.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ccm.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/chacha20.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/chachapoly.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/cipher.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/cipher_wrap.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/cmac.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/constant_time.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ctr_drbg.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/debug.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/des.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/dhm.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecdh.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecdsa.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecjpake.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecp.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecp_curves.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ecp_curves_new.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/entropy.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/entropy_poll.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/error.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/gcm.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/hkdf.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/hmac_drbg.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/lmots.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/lms.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/md.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/md5.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/memory_buffer_alloc.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/mps_reader.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/mps_trace.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/net_sockets.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/nist_kw.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/oid.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/padlock.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pem.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pk.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pk_ecc.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pk_wrap.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs12.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs5.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pkcs7.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pkparse.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/pkwrite.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/platform.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/platform_util.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/poly1305.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_aead.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_cipher.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_client.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_driver_wrappers_no_static.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_ecp.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_ffdh.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_hash.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_mac.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_pake.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_rsa.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_se.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_slot_management.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_crypto_storage.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_its_file.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/psa_util.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ripemd160.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/rsa.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/rsa_alt_helpers.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/sha1.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/sha256.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/sha3.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/sha512.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_cache.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_ciphersuites.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_client.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_cookie.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_debug_helpers_generated.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_msg.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_ticket.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls12_client.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls12_server.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_client.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_generic.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_keys.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/ssl_tls13_server.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/threading.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/timing.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/version.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/version_features.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509_create.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509_crl.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509_crt.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509_csr.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509write.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509write_crt.o \ - ${INCLUDES_BASE_DIR}/mbedtls/library/x509write_csr.o \ - ssl.o - -all: ssl.hdll - -ssl.hdll: ${SSL} - ${CC} ${CFLAGS} -shared -o $@ $^ ${LFLAGS} - -%.o: %.c - ${CC} ${CFLAGS} -o $@ -c $< - -clean: - rm -f ${SSL} *.hdll From d62cf65fb12cb9784c38f48a4f4b21a5462caa4a Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 27 Sep 2024 12:34:29 +0200 Subject: [PATCH 7/7] Reduce line for mbedtls obj list --- Makefile | 147 +++++++++++++++---------------------------------------- 1 file changed, 39 insertions(+), 108 deletions(-) diff --git a/Makefile b/Makefile index 231c1cdbe..3b93bda3c 100644 --- a/Makefile +++ b/Makefile @@ -52,114 +52,45 @@ OPENAL = libs/openal/openal.o SSL = libs/ssl/ssl.o ifdef SSL_STATIC -SSL += \ - include/mbedtls/library/aes.o \ - include/mbedtls/library/aesce.o \ - include/mbedtls/library/aesni.o \ - include/mbedtls/library/aria.o \ - include/mbedtls/library/asn1parse.o \ - include/mbedtls/library/asn1write.o \ - include/mbedtls/library/base64.o \ - include/mbedtls/library/bignum.o \ - include/mbedtls/library/bignum_core.o \ - include/mbedtls/library/bignum_mod.o \ - include/mbedtls/library/bignum_mod_raw.o \ - include/mbedtls/library/block_cipher.o \ - include/mbedtls/library/camellia.o \ - include/mbedtls/library/ccm.o \ - include/mbedtls/library/chacha20.o \ - include/mbedtls/library/chachapoly.o \ - include/mbedtls/library/cipher.o \ - include/mbedtls/library/cipher_wrap.o \ - include/mbedtls/library/cmac.o \ - include/mbedtls/library/constant_time.o \ - include/mbedtls/library/ctr_drbg.o \ - include/mbedtls/library/debug.o \ - include/mbedtls/library/des.o \ - include/mbedtls/library/dhm.o \ - include/mbedtls/library/ecdh.o \ - include/mbedtls/library/ecdsa.o \ - include/mbedtls/library/ecjpake.o \ - include/mbedtls/library/ecp.o \ - include/mbedtls/library/ecp_curves.o \ - include/mbedtls/library/ecp_curves_new.o \ - include/mbedtls/library/entropy.o \ - include/mbedtls/library/entropy_poll.o \ - include/mbedtls/library/error.o \ - include/mbedtls/library/gcm.o \ - include/mbedtls/library/hkdf.o \ - include/mbedtls/library/hmac_drbg.o \ - include/mbedtls/library/lmots.o \ - include/mbedtls/library/lms.o \ - include/mbedtls/library/md.o \ - include/mbedtls/library/md5.o \ - include/mbedtls/library/memory_buffer_alloc.o \ - include/mbedtls/library/mps_reader.o \ - include/mbedtls/library/mps_trace.o \ - include/mbedtls/library/net_sockets.o \ - include/mbedtls/library/nist_kw.o \ - include/mbedtls/library/oid.o \ - include/mbedtls/library/padlock.o \ - include/mbedtls/library/pem.o \ - include/mbedtls/library/pk.o \ - include/mbedtls/library/pk_ecc.o \ - include/mbedtls/library/pk_wrap.o \ - include/mbedtls/library/pkcs12.o \ - include/mbedtls/library/pkcs5.o \ - include/mbedtls/library/pkcs7.o \ - include/mbedtls/library/pkparse.o \ - include/mbedtls/library/pkwrite.o \ - include/mbedtls/library/platform.o \ - include/mbedtls/library/platform_util.o \ - include/mbedtls/library/poly1305.o \ - include/mbedtls/library/psa_crypto.o \ - include/mbedtls/library/psa_crypto_aead.o \ - include/mbedtls/library/psa_crypto_cipher.o \ - include/mbedtls/library/psa_crypto_client.o \ - include/mbedtls/library/psa_crypto_driver_wrappers_no_static.o \ - include/mbedtls/library/psa_crypto_ecp.o \ - include/mbedtls/library/psa_crypto_ffdh.o \ - include/mbedtls/library/psa_crypto_hash.o \ - include/mbedtls/library/psa_crypto_mac.o \ - include/mbedtls/library/psa_crypto_pake.o \ - include/mbedtls/library/psa_crypto_rsa.o \ - include/mbedtls/library/psa_crypto_se.o \ - include/mbedtls/library/psa_crypto_slot_management.o \ - include/mbedtls/library/psa_crypto_storage.o \ - include/mbedtls/library/psa_its_file.o \ - include/mbedtls/library/psa_util.o \ - include/mbedtls/library/ripemd160.o \ - include/mbedtls/library/rsa.o \ - include/mbedtls/library/rsa_alt_helpers.o \ - include/mbedtls/library/sha1.o \ - include/mbedtls/library/sha256.o \ - include/mbedtls/library/sha3.o \ - include/mbedtls/library/sha512.o \ - include/mbedtls/library/ssl_cache.o \ - include/mbedtls/library/ssl_ciphersuites.o \ - include/mbedtls/library/ssl_client.o \ - include/mbedtls/library/ssl_cookie.o \ - include/mbedtls/library/ssl_debug_helpers_generated.o \ - include/mbedtls/library/ssl_msg.o \ - include/mbedtls/library/ssl_ticket.o \ - include/mbedtls/library/ssl_tls.o \ - include/mbedtls/library/ssl_tls12_client.o \ - include/mbedtls/library/ssl_tls12_server.o \ - include/mbedtls/library/ssl_tls13_client.o \ - include/mbedtls/library/ssl_tls13_generic.o \ - include/mbedtls/library/ssl_tls13_keys.o \ - include/mbedtls/library/ssl_tls13_server.o \ - include/mbedtls/library/threading.o \ - include/mbedtls/library/timing.o \ - include/mbedtls/library/version.o \ - include/mbedtls/library/version_features.o \ - include/mbedtls/library/x509.o \ - include/mbedtls/library/x509_create.o \ - include/mbedtls/library/x509_crl.o \ - include/mbedtls/library/x509_crt.o \ - include/mbedtls/library/x509_csr.o \ - include/mbedtls/library/x509write.o \ - include/mbedtls/library/x509write_crt.o \ +SSL += include/mbedtls/library/aes.o include/mbedtls/library/aesce.o include/mbedtls/library/aesni.o \ + include/mbedtls/library/aria.o include/mbedtls/library/asn1parse.o include/mbedtls/library/asn1write.o \ + include/mbedtls/library/base64.o include/mbedtls/library/bignum.o include/mbedtls/library/bignum_core.o \ + include/mbedtls/library/bignum_mod.o include/mbedtls/library/bignum_mod_raw.o \ + include/mbedtls/library/block_cipher.o include/mbedtls/library/camellia.o include/mbedtls/library/ccm.o \ + include/mbedtls/library/chacha20.o include/mbedtls/library/chachapoly.o include/mbedtls/library/cipher.o \ + include/mbedtls/library/cipher_wrap.o include/mbedtls/library/cmac.o include/mbedtls/library/constant_time.o \ + include/mbedtls/library/ctr_drbg.o include/mbedtls/library/debug.o include/mbedtls/library/des.o \ + include/mbedtls/library/dhm.o include/mbedtls/library/ecdh.o include/mbedtls/library/ecdsa.o \ + include/mbedtls/library/ecjpake.o include/mbedtls/library/ecp.o include/mbedtls/library/ecp_curves.o \ + include/mbedtls/library/ecp_curves_new.o include/mbedtls/library/entropy.o include/mbedtls/library/entropy_poll.o \ + include/mbedtls/library/error.o include/mbedtls/library/gcm.o include/mbedtls/library/hkdf.o \ + include/mbedtls/library/hmac_drbg.o include/mbedtls/library/lmots.o include/mbedtls/library/lms.o \ + include/mbedtls/library/md.o include/mbedtls/library/md5.o include/mbedtls/library/memory_buffer_alloc.o \ + include/mbedtls/library/mps_reader.o include/mbedtls/library/mps_trace.o include/mbedtls/library/net_sockets.o \ + include/mbedtls/library/nist_kw.o include/mbedtls/library/oid.o include/mbedtls/library/padlock.o \ + include/mbedtls/library/pem.o include/mbedtls/library/pk.o include/mbedtls/library/pk_ecc.o \ + include/mbedtls/library/pk_wrap.o include/mbedtls/library/pkcs12.o include/mbedtls/library/pkcs5.o \ + include/mbedtls/library/pkcs7.o include/mbedtls/library/pkparse.o include/mbedtls/library/pkwrite.o \ + include/mbedtls/library/platform.o include/mbedtls/library/platform_util.o include/mbedtls/library/poly1305.o \ + include/mbedtls/library/psa_crypto.o include/mbedtls/library/psa_crypto_aead.o include/mbedtls/library/psa_crypto_cipher.o \ + include/mbedtls/library/psa_crypto_client.o include/mbedtls/library/psa_crypto_driver_wrappers_no_static.o \ + include/mbedtls/library/psa_crypto_ecp.o include/mbedtls/library/psa_crypto_ffdh.o \ + include/mbedtls/library/psa_crypto_hash.o include/mbedtls/library/psa_crypto_mac.o \ + include/mbedtls/library/psa_crypto_pake.o include/mbedtls/library/psa_crypto_rsa.o \ + include/mbedtls/library/psa_crypto_se.o include/mbedtls/library/psa_crypto_slot_management.o \ + include/mbedtls/library/psa_crypto_storage.o include/mbedtls/library/psa_its_file.o \ + include/mbedtls/library/psa_util.o include/mbedtls/library/ripemd160.o include/mbedtls/library/rsa.o \ + include/mbedtls/library/rsa_alt_helpers.o include/mbedtls/library/sha1.o include/mbedtls/library/sha256.o \ + include/mbedtls/library/sha3.o include/mbedtls/library/sha512.o include/mbedtls/library/ssl_cache.o \ + include/mbedtls/library/ssl_ciphersuites.o include/mbedtls/library/ssl_client.o include/mbedtls/library/ssl_cookie.o \ + include/mbedtls/library/ssl_debug_helpers_generated.o include/mbedtls/library/ssl_msg.o \ + include/mbedtls/library/ssl_ticket.o include/mbedtls/library/ssl_tls.o include/mbedtls/library/ssl_tls12_client.o \ + include/mbedtls/library/ssl_tls12_server.o include/mbedtls/library/ssl_tls13_client.o \ + include/mbedtls/library/ssl_tls13_generic.o include/mbedtls/library/ssl_tls13_keys.o \ + include/mbedtls/library/ssl_tls13_server.o include/mbedtls/library/threading.o include/mbedtls/library/timing.o \ + include/mbedtls/library/version.o include/mbedtls/library/version_features.o include/mbedtls/library/x509.o \ + include/mbedtls/library/x509_create.o include/mbedtls/library/x509_crl.o include/mbedtls/library/x509_crt.o \ + include/mbedtls/library/x509_csr.o include/mbedtls/library/x509write.o include/mbedtls/library/x509write_crt.o \ include/mbedtls/library/x509write_csr.o SSL_CFLAGS = -fvisibility=hidden -I libs/ssl -I include/mbedtls/include -D MBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\" else