Skip to content

Commit b978282

Browse files
authored
Merge pull request #97 from Patater/tls-generated-sources
Use generated source files from Mbed TLS
2 parents 521dbc6 + 18d4789 commit b978282

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

library/CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ set(src_crypto
2929
ecp_curves.c
3030
entropy.c
3131
entropy_poll.c
32-
error.c
3332
gcm.c
3433
havege.c
3534
hkdf.c
@@ -65,10 +64,26 @@ set(src_crypto
6564
sha512.c
6665
threading.c
6766
timing.c
67+
xtea.c
68+
)
69+
70+
# For files generated by the parent project (Mbed TLS) when building Mbed
71+
# Crypto as a submodule, ensure that the parent project instance is used.
72+
if(USE_CRYPTO_SUBMODULE)
73+
set(src_crypto
74+
${src_crypto}
75+
${CMAKE_SOURCE_DIR}/library/version.c
76+
${CMAKE_SOURCE_DIR}/library/version_features.c
77+
${CMAKE_SOURCE_DIR}/library/error.c
78+
)
79+
else()
80+
set(src_crypto
81+
${src_crypto}
6882
version.c
6983
version_features.c
70-
xtea.c
84+
error.c
7185
)
86+
endif()
7287

7388
set(src_x509
7489
certs.c

library/Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \
7373
dhm.o ecdh.o ecdsa.o \
7474
ecjpake.o ecp.o \
7575
ecp_curves.o entropy.o entropy_poll.o \
76-
error.o gcm.o havege.o \
76+
gcm.o havege.o \
7777
hkdf.o \
7878
hmac_drbg.o md.o md2.o \
7979
md4.o md5.o md_wrap.o \
@@ -88,8 +88,22 @@ OBJS_CRYPTO= aes.o aesni.o arc4.o \
8888
psa_its_file.o \
8989
ripemd160.o rsa_internal.o rsa.o \
9090
sha1.o sha256.o sha512.o \
91-
threading.o timing.o version.o \
92-
version_features.o xtea.o
91+
threading.o timing.o \
92+
xtea.o
93+
94+
# For files generated by the parent project (Mbed TLS) when building Mbed
95+
# Crypto as a submodule, ensure that the parent project instance is used.
96+
ifeq ($(USE_CRYPTO_SUBMODULE), 1)
97+
OBJS_CRYPTO += ../../library/error.o
98+
OBJS_CRYPTO += ../../library/version.o
99+
OBJS_CRYPTO += ../../library/version_features.o
100+
else
101+
OBJS_CRYPTO += error.o
102+
OBJS_CRYPTO += version.o
103+
OBJS_CRYPTO += version_features.o
104+
endif
105+
106+
$(info $(OBJS_CRYPTO))
93107

94108
OBJS_X509= certs.o pkcs11.o x509.o \
95109
x509_create.o x509_crl.o x509_crt.o \
@@ -198,7 +212,7 @@ libmbedcrypto.dll: $(OBJS_CRYPTO)
198212

199213
.c.o:
200214
echo " CC $<"
201-
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $<
215+
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c $< -o $@
202216

203217
clean:
204218
ifndef WINDOWS

0 commit comments

Comments
 (0)