diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index d23921acc..a4484429b 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -171,23 +171,17 @@ if(USE_STATIC_MBEDTLS_LIBRARY) target_include_directories(${mbedcrypto_static_target} PUBLIC ${MBEDTLS_DIR}/include/) - if(USE_CRYPTO_SUBMODULE) - install(TARGETS ${mbedcrypto_static_target} - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - else() - add_library(${mbedx509_static_target} STATIC ${src_x509}) - set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509) - target_link_libraries(${mbedx509_static_target} ${libs} ${mbedcrypto_static_target}) + add_library(${mbedx509_static_target} STATIC ${src_x509}) + set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509) + target_link_libraries(${mbedx509_static_target} ${libs} ${mbedcrypto_static_target}) - add_library(${mbedtls_static_target} STATIC ${src_tls}) - set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls) - target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) + add_library(${mbedtls_static_target} STATIC ${src_tls}) + set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls) + target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) - install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif() + install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} + DESTINATION ${LIB_INSTALL_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(USE_STATIC_MBEDTLS_LIBRARY) if(USE_SHARED_MBEDTLS_LIBRARY) @@ -210,33 +204,20 @@ if(USE_SHARED_MBEDTLS_LIBRARY) target_include_directories(mbedtls PUBLIC ${MBEDTLS_DIR}/include/) - if(USE_CRYPTO_SUBMODULE) - install(TARGETS mbedcrypto - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - else() - add_library(mbedx509 SHARED ${src_x509}) - set_target_properties(mbedx509 PROPERTIES VERSION 2.16.0 SOVERSION 0) - target_link_libraries(mbedx509 ${libs} mbedcrypto) + add_library(mbedx509 SHARED ${src_x509}) + set_target_properties(mbedx509 PROPERTIES VERSION 2.16.0 SOVERSION 0) + target_link_libraries(mbedx509 ${libs} mbedcrypto) - add_library(mbedtls SHARED ${src_tls}) - set_target_properties(mbedtls PROPERTIES VERSION 2.16.0 SOVERSION 12) - target_link_libraries(mbedtls ${libs} mbedx509) + add_library(mbedtls SHARED ${src_tls}) + set_target_properties(mbedtls PROPERTIES VERSION 2.16.0 SOVERSION 12) + target_link_libraries(mbedtls ${libs} mbedx509) - install(TARGETS mbedtls mbedx509 mbedcrypto - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif() + install(TARGETS mbedtls mbedx509 mbedcrypto + DESTINATION ${LIB_INSTALL_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(USE_SHARED_MBEDTLS_LIBRARY) -if(USE_CRYPTO_SUBMODULE) - add_custom_target(crypto_lib DEPENDS mbedcrypto) - if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) - add_dependencies(crypto_lib mbedcrypto_static) - endif() -else() - add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls) - if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) - add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static) - endif() +add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls) +if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) + add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static) endif() diff --git a/library/Makefile b/library/Makefile index 07247f150..e4f92e51a 100644 --- a/library/Makefile +++ b/library/Makefile @@ -5,8 +5,7 @@ CFLAGS ?= -O2 WARNING_CFLAGS ?= -Wall -Wextra LDFLAGS ?= -CRYPTO_INCLUDES ?= -I../include -LOCAL_CFLAGS = $(WARNING_CFLAGS) $(CRYPTO_INCLUDES) -D_FILE_OFFSET_BITS=64 +LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = ifdef DEBUG @@ -73,7 +72,7 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \ dhm.o ecdh.o ecdsa.o \ ecjpake.o ecp.o \ ecp_curves.o entropy.o entropy_poll.o \ - gcm.o havege.o \ + error.o gcm.o havege.o \ hkdf.o \ hmac_drbg.o md.o md2.o \ md4.o md5.o \ @@ -89,20 +88,9 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \ ripemd160.o rsa_internal.o rsa.o \ sha1.o sha256.o sha512.o \ threading.o timing.o \ + version.o version_features.o \ xtea.o -# For files generated by the parent project (Mbed TLS) when building Mbed -# Crypto as a submodule, ensure that the parent project instance is used. -ifeq ($(USE_CRYPTO_SUBMODULE), 1) -OBJS_CRYPTO += $(patsubst %.c,%.o, $(realpath ../../library/error.c)) -OBJS_CRYPTO += $(patsubst %.c,%.o, $(realpath ../../library/version.c)) -OBJS_CRYPTO += $(patsubst %.c,%.o, $(realpath ../../library/version_features.c)) -else -OBJS_CRYPTO += error.o -OBJS_CRYPTO += version.o -OBJS_CRYPTO += version_features.o -endif - include ../3rdparty/Makefile.inc LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES) OBJS_CRYPTO+=$(THIRDPARTY_CRYPTO_OBJECTS) @@ -221,9 +209,8 @@ libmbedcrypto.$(DLEXT): | libmbedcrypto.a clean: ifndef WINDOWS - rm -f *.o libmbed* $(OBJS_CRYPTO) + rm -f *.o libmbed* else if exist *.o del /Q /F *.o if exist libmbed* del /Q /F libmbed* - if exist $(OBJS_CRYPTO) del /Q /F $(OBJS_CRYPTO) endif