Skip to content

Commit b5fcb33

Browse files
committed
py/mpconfig: Enable CRYPTOLIB, HASHLIB_MD5, HASHLIB_SHA1 if SSL enabled.
This commit unifies the configuration of MICROPY_PY_CRYPTOLIB, MICROPY_PY_HASHLIB_MD5 and MICROPY_PY_HASHLIB_SHA1, so they are enabled by default if MICROPY_PY_SSL is enabled. This matches the existing configuration of most of the ports. With this change, all ports remain the same except: - reneses-ra now enables MICROPY_PY_CRYPTOLIB, MICROPY_PY_HASHLIB_MD5 and MICROPY_PY_HASHLIB_SHA1. - rp2 now enables MICROPY_PY_HASHLIB_MD5. Signed-off-by: Damien George <damien@micropython.org>
1 parent 989abae commit b5fcb33

File tree

10 files changed

+5
-32
lines changed

10 files changed

+5
-32
lines changed

ports/alif/mpconfigport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@
112112

113113
// Extended modules
114114
#define MICROPY_EPOCH_IS_1970 (1)
115-
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
116-
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
117-
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
118115
#define MICROPY_PY_OS_INCLUDEFILE "ports/alif/modos.c"
119116
#define MICROPY_PY_OS_DUPTERM (1)
120117
#define MICROPY_PY_OS_SEP (1)

ports/esp32/mpconfigport.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@
105105
#define MICROPY_BLUETOOTH_NIMBLE (1)
106106
#define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1)
107107
#endif
108-
#define MICROPY_PY_HASHLIB_MD5 (1)
109-
#define MICROPY_PY_HASHLIB_SHA1 (1)
110-
#define MICROPY_PY_HASHLIB_SHA256 (1)
111-
#define MICROPY_PY_CRYPTOLIB (1)
112108
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (esp_random())
113109
#define MICROPY_PY_OS_INCLUDEFILE "ports/esp32/modos.c"
114110
#define MICROPY_PY_OS_DUPTERM (1)

ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#define MICROPY_READER_VFS (MICROPY_VFS)
1313
#define MICROPY_VFS (1)
1414

15-
#define MICROPY_PY_CRYPTOLIB (1)
16-
1715
#elif defined(MICROPY_ESP8266_1M)
1816

1917
#define MICROPY_HW_BOARD_NAME "ESP module (1M)"
@@ -28,9 +26,6 @@
2826
#define MICROPY_READER_VFS (MICROPY_VFS)
2927
#define MICROPY_VFS (1)
3028

31-
32-
#define MICROPY_PY_CRYPTOLIB (1)
33-
3429
#elif defined(MICROPY_ESP8266_512K)
3530

3631
#define MICROPY_HW_BOARD_NAME "ESP module (512K)"
@@ -45,6 +40,7 @@
4540
#define MICROPY_PY_SYS_STDIO_BUFFER (0)
4641
#define MICROPY_PY_ASYNCIO (0)
4742
#define MICROPY_PY_RE_SUB (0)
43+
#define MICROPY_PY_CRYPTOLIB (0)
4844
#define MICROPY_PY_FRAMEBUF (0)
4945

5046
#endif

ports/esp8266/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define MICROPY_REPL_EVENT_DRIVEN (0)
5757
#define MICROPY_USE_INTERNAL_ERRNO (1)
5858
#define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text
59+
#define MICROPY_PY_HASHLIB_MD5 (0)
5960
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL && MICROPY_SSL_AXTLS)
6061
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (*WDEV_HWRNG)
6162
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)

ports/mimxrt/mpconfigport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ uint32_t trng_random_u32(void);
145145
#define MICROPY_PY_WEBSOCKET (MICROPY_PY_LWIP)
146146
#define MICROPY_PY_WEBREPL (MICROPY_PY_LWIP)
147147
#define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)
148-
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
149-
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
150-
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
151148
#ifndef MICROPY_PY_NETWORK_PPP_LWIP
152149
#define MICROPY_PY_NETWORK_PPP_LWIP (MICROPY_PY_LWIP)
153150
#endif

ports/rp2/boards/ARDUINO_NANO_RP2040_CONNECT/mpconfigboard.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
// Enable networking.
1111
#define MICROPY_PY_NETWORK (1)
1212

13-
// Enable MD5 hash.
14-
#define MICROPY_PY_HASHLIB_MD5 (1)
15-
1613
// Disable internal error numbers.
1714
#define MICROPY_USE_INTERNAL_ERRNO (0)
1815

ports/rp2/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@
150150
#define MICROPY_PY_OS_URANDOM (1)
151151
#define MICROPY_PY_RE_MATCH_GROUPS (1)
152152
#define MICROPY_PY_RE_MATCH_SPAN_START_END (1)
153-
#define MICROPY_PY_HASHLIB_SHA1 (1)
154-
#define MICROPY_PY_CRYPTOLIB (1)
155153
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
156154
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
157155
#define MICROPY_PY_TIME_INCLUDEFILE "ports/rp2/modtime.c"

ports/stm32/mpconfigport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@
9797
#endif
9898

9999
// extended modules
100-
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
101-
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
102-
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
103100
#define MICROPY_PY_OS_INCLUDEFILE "ports/stm32/modos.c"
104101
#define MICROPY_PY_OS_DUPTERM (3)
105102
#define MICROPY_PY_OS_DUPTERM_BUILTIN_STREAM (1)

ports/unix/variants/mpconfigvariant_common.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@
104104
#define MICROPY_PY_TIME_CUSTOM_SLEEP (1)
105105
#define MICROPY_PY_TIME_INCLUDEFILE "ports/unix/modtime.c"
106106

107-
#if MICROPY_PY_SSL
108-
#define MICROPY_PY_HASHLIB_MD5 (1)
109-
#define MICROPY_PY_HASHLIB_SHA1 (1)
110-
#define MICROPY_PY_CRYPTOLIB (1)
111-
#endif
112-
113107
// The "select" module is enabled by default, but disable select.select().
114108
#define MICROPY_PY_SELECT_POSIX_OPTIMISATIONS (1)
115109
#define MICROPY_PY_SELECT_SELECT (0)

py/mpconfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,19 +1860,19 @@ typedef time_t mp_timestamp_t;
18601860
#endif
18611861

18621862
#ifndef MICROPY_PY_HASHLIB_MD5
1863-
#define MICROPY_PY_HASHLIB_MD5 (0)
1863+
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
18641864
#endif
18651865

18661866
#ifndef MICROPY_PY_HASHLIB_SHA1
1867-
#define MICROPY_PY_HASHLIB_SHA1 (0)
1867+
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
18681868
#endif
18691869

18701870
#ifndef MICROPY_PY_HASHLIB_SHA256
18711871
#define MICROPY_PY_HASHLIB_SHA256 (1)
18721872
#endif
18731873

18741874
#ifndef MICROPY_PY_CRYPTOLIB
1875-
#define MICROPY_PY_CRYPTOLIB (0)
1875+
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
18761876
#endif
18771877

18781878
// Depends on MICROPY_PY_CRYPTOLIB

0 commit comments

Comments
 (0)