Skip to content

Commit 0838248

Browse files
authored
Merge pull request #11239 from Patater/import-mbedtls-crypto-from-mbedcrypto
crypto: Copy legacy crypto from Mbed Crypto
2 parents 169ada9 + b6c24e2 commit 0838248

File tree

4 files changed

+12
-66
lines changed

4 files changed

+12
-66
lines changed

features/lwipstack/lwipopts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@
399399
#include "lwip_tcp_isn.h"
400400
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
401401
#ifdef MBEDTLS_MD5_C
402-
#include "mbedtls/inc/mbedtls/md5.h"
402+
#include "mbedtls/md5.h"
403403
#define LWIP_USE_EXTERNAL_MBEDTLS 1
404404
#endif
405405

features/mbedtls/importer/Makefile

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -41,67 +41,6 @@ MBED_TLS_DIR:=TARGET_IGNORE/mbedtls
4141
MBED_TLS_API:=$(MBED_TLS_DIR)/include/mbedtls
4242
MBED_TLS_GIT_CFG=$(MBED_TLS_DIR)/.git/config
4343

44-
CRYPTO_SRC := \
45-
$(TARGET_SRC)/aes.c \
46-
$(TARGET_SRC)/aesni.c \
47-
$(TARGET_SRC)/arc4.c \
48-
$(TARGET_SRC)/aria.c \
49-
$(TARGET_SRC)/asn1parse.c \
50-
$(TARGET_SRC)/asn1write.c \
51-
$(TARGET_SRC)/base64.c \
52-
$(TARGET_SRC)/bignum.c \
53-
$(TARGET_SRC)/blowfish.c \
54-
$(TARGET_SRC)/camellia.c \
55-
$(TARGET_SRC)/ccm.c \
56-
$(TARGET_SRC)/chacha20.c \
57-
$(TARGET_SRC)/chachapoly.c \
58-
$(TARGET_SRC)/cipher.c \
59-
$(TARGET_SRC)/cipher_wrap.c \
60-
$(TARGET_SRC)/cmac.c \
61-
$(TARGET_SRC)/ctr_drbg.c \
62-
$(TARGET_SRC)/des.c \
63-
$(TARGET_SRC)/dhm.c \
64-
$(TARGET_SRC)/ecdh.c \
65-
$(TARGET_SRC)/ecdsa.c \
66-
$(TARGET_SRC)/ecjpake.c \
67-
$(TARGET_SRC)/ecp.c \
68-
$(TARGET_SRC)/ecp_curves.c \
69-
$(TARGET_SRC)/entropy.c \
70-
$(TARGET_SRC)/entropy_poll.c \
71-
$(TARGET_SRC)/gcm.c \
72-
$(TARGET_SRC)/havege.c \
73-
$(TARGET_SRC)/hkdf.c \
74-
$(TARGET_SRC)/hmac_drbg.c \
75-
$(TARGET_SRC)/md.c \
76-
$(TARGET_SRC)/md2.c \
77-
$(TARGET_SRC)/md4.c \
78-
$(TARGET_SRC)/md5.c \
79-
$(TARGET_SRC)/md_wrap.c \
80-
$(TARGET_SRC)/memory_buffer_alloc.c \
81-
$(TARGET_SRC)/nist_kw.c \
82-
$(TARGET_SRC)/oid.c \
83-
$(TARGET_SRC)/padlock.c \
84-
$(TARGET_SRC)/pem.c \
85-
$(TARGET_SRC)/pk.c \
86-
$(TARGET_SRC)/pk_wrap.c \
87-
$(TARGET_SRC)/pkcs12.c \
88-
$(TARGET_SRC)/pkcs5.c \
89-
$(TARGET_SRC)/pkparse.c \
90-
$(TARGET_SRC)/pkwrite.c \
91-
$(TARGET_SRC)/platform.c \
92-
$(TARGET_SRC)/platform_util.c \
93-
$(TARGET_SRC)/poly1305.c \
94-
$(TARGET_SRC)/ripemd160.c \
95-
$(TARGET_SRC)/rsa_internal.c \
96-
$(TARGET_SRC)/rsa.c \
97-
$(TARGET_SRC)/sha1.c \
98-
$(TARGET_SRC)/sha256.c \
99-
$(TARGET_SRC)/sha512.c \
100-
$(TARGET_SRC)/threading.c \
101-
$(TARGET_SRC)/timing.c \
102-
$(TARGET_SRC)/xtea.c \
103-
# end
104-
10544
.PHONY: all deploy deploy-tests rsync mbedtls clean update
10645

10746
all: mbedtls
@@ -114,9 +53,6 @@ rsync:
11453
rm -rf $(TARGET_SRC)
11554
rsync -a --exclude='*.txt' $(MBED_TLS_DIR)/library/ $(TARGET_SRC)
11655
#
117-
# Remove files that duplicate Mbed Crypto
118-
rm -rf $(CRYPTO_SRC)
119-
#
12056
# Copying mbed TLS headers to mbed includes...
12157
rm -rf $(TARGET_INC)
12258
mkdir -p $(TARGET_INC)

features/mbedtls/importer/adjust-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ add_code
5757
"#else\n"
5858

5959
add_code \
60-
"#include \"check_config.h\"\n" \
60+
"#include \"mbedtls\/check_config.h\"\n" \
6161
"\n" \
6262
"#endif \/* !MBEDTLS_ENTROPY_HARDWARE_ALT && !MBEDTLS_TEST_NULL_ENTROPY && !MBEDTLS_ENTROPY_NV_SEED *\/\n" \
6363
"\n" \

features/mbedtls/mbed-crypto/importer/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ TARGET_NSPE:=$(TARGET_SRV_IMPL)/COMPONENT_NSPE
5959
# Mbed Crypto source directory - hidden from mbed via TARGET_IGNORE
6060
CRYPTO_DIR:=TARGET_IGNORE/mbed-crypto
6161
CRYPTO_API:=$(CRYPTO_DIR)/include/psa
62+
OLD_CRYPTO_API:=$(CRYPTO_DIR)/include/mbedtls
6263
CRYPTO_GIT_CFG=$(CRYPTO_DIR)/.git/config
6364

6465

@@ -72,6 +73,15 @@ rsync:
7273
rm -rf $(TARGET_INC)
7374
mkdir -p $(TARGET_INC)
7475
rsync -a --delete --exclude='crypto_struct.h' $(CRYPTO_API) $(TARGET_INC)/
76+
# Copy legacy Mbed TLS crypto headers, excluding headers duplicated in
77+
# Mbed TLS.
78+
rsync -a --delete \
79+
--exclude='check_config.h' \
80+
--exclude='compat-1.3.h' \
81+
--exclude='config.h' \
82+
--exclude='error.h' \
83+
--exclude='version.h' \
84+
$(OLD_CRYPTO_API) $(TARGET_INC)/
7585
#
7686
# Copying licenses
7787
cp $(CRYPTO_DIR)/LICENSE $(TARGET_PREFIX)/

0 commit comments

Comments
 (0)