Skip to content

py/mpconfig: Enable CRYPTOLIB, HASHLIB_MD5, HASHLIB_SHA1 if SSL enabled. #17926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ports/alif/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@

// Extended modules
#define MICROPY_EPOCH_IS_1970 (1)
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
#define MICROPY_PY_OS_INCLUDEFILE "ports/alif/modos.c"
#define MICROPY_PY_OS_DUPTERM (1)
#define MICROPY_PY_OS_SEP (1)
Expand Down
4 changes: 0 additions & 4 deletions ports/esp32/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@
#define MICROPY_BLUETOOTH_NIMBLE (1)
#define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1)
#endif
#define MICROPY_PY_HASHLIB_MD5 (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_HASHLIB_SHA256 (1)
#define MICROPY_PY_CRYPTOLIB (1)
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (esp_random())
#define MICROPY_PY_OS_INCLUDEFILE "ports/esp32/modos.c"
#define MICROPY_PY_OS_DUPTERM (1)
Expand Down
6 changes: 1 addition & 5 deletions ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#define MICROPY_READER_VFS (MICROPY_VFS)
#define MICROPY_VFS (1)

#define MICROPY_PY_CRYPTOLIB (1)

#elif defined(MICROPY_ESP8266_1M)

#define MICROPY_HW_BOARD_NAME "ESP module (1M)"
Expand All @@ -28,9 +26,6 @@
#define MICROPY_READER_VFS (MICROPY_VFS)
#define MICROPY_VFS (1)


#define MICROPY_PY_CRYPTOLIB (1)

#elif defined(MICROPY_ESP8266_512K)

#define MICROPY_HW_BOARD_NAME "ESP module (512K)"
Expand All @@ -45,6 +40,7 @@
#define MICROPY_PY_SYS_STDIO_BUFFER (0)
#define MICROPY_PY_ASYNCIO (0)
#define MICROPY_PY_RE_SUB (0)
#define MICROPY_PY_CRYPTOLIB (0)
#define MICROPY_PY_FRAMEBUF (0)

#endif
1 change: 1 addition & 0 deletions ports/esp8266/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#define MICROPY_REPL_EVENT_DRIVEN (0)
#define MICROPY_USE_INTERNAL_ERRNO (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text
#define MICROPY_PY_HASHLIB_MD5 (0)
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL && MICROPY_SSL_AXTLS)
#define MICROPY_PY_RANDOM_SEED_INIT_FUNC (*WDEV_HWRNG)
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
Expand Down
3 changes: 0 additions & 3 deletions ports/mimxrt/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ uint32_t trng_random_u32(void);
#define MICROPY_PY_WEBSOCKET (MICROPY_PY_LWIP)
#define MICROPY_PY_WEBREPL (MICROPY_PY_LWIP)
#define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
#ifndef MICROPY_PY_NETWORK_PPP_LWIP
#define MICROPY_PY_NETWORK_PPP_LWIP (MICROPY_PY_LWIP)
#endif
Expand Down
3 changes: 0 additions & 3 deletions ports/rp2/boards/ARDUINO_NANO_RP2040_CONNECT/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
// Enable networking.
#define MICROPY_PY_NETWORK (1)

// Enable MD5 hash.
#define MICROPY_PY_HASHLIB_MD5 (1)

// Disable internal error numbers.
#define MICROPY_USE_INTERNAL_ERRNO (0)

Expand Down
2 changes: 0 additions & 2 deletions ports/rp2/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@
#define MICROPY_PY_OS_URANDOM (1)
#define MICROPY_PY_RE_MATCH_GROUPS (1)
#define MICROPY_PY_RE_MATCH_SPAN_START_END (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_CRYPTOLIB (1)
#define MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME (1)
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
#define MICROPY_PY_TIME_INCLUDEFILE "ports/rp2/modtime.c"
Expand Down
3 changes: 0 additions & 3 deletions ports/stm32/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
#endif

// extended modules
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
#define MICROPY_PY_OS_INCLUDEFILE "ports/stm32/modos.c"
#define MICROPY_PY_OS_DUPTERM (3)
#define MICROPY_PY_OS_DUPTERM_BUILTIN_STREAM (1)
Expand Down
6 changes: 0 additions & 6 deletions ports/unix/variants/mpconfigvariant_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@
#define MICROPY_PY_TIME_CUSTOM_SLEEP (1)
#define MICROPY_PY_TIME_INCLUDEFILE "ports/unix/modtime.c"

#if MICROPY_PY_SSL
#define MICROPY_PY_HASHLIB_MD5 (1)
#define MICROPY_PY_HASHLIB_SHA1 (1)
#define MICROPY_PY_CRYPTOLIB (1)
#endif

// The "select" module is enabled by default, but disable select.select().
#define MICROPY_PY_SELECT_POSIX_OPTIMISATIONS (1)
#define MICROPY_PY_SELECT_SELECT (0)
Expand Down
6 changes: 3 additions & 3 deletions py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1860,19 +1860,19 @@ typedef time_t mp_timestamp_t;
#endif

#ifndef MICROPY_PY_HASHLIB_MD5
#define MICROPY_PY_HASHLIB_MD5 (0)
#define MICROPY_PY_HASHLIB_MD5 (MICROPY_PY_SSL)
#endif

#ifndef MICROPY_PY_HASHLIB_SHA1
#define MICROPY_PY_HASHLIB_SHA1 (0)
#define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL)
#endif

#ifndef MICROPY_PY_HASHLIB_SHA256
#define MICROPY_PY_HASHLIB_SHA256 (1)
#endif

#ifndef MICROPY_PY_CRYPTOLIB
#define MICROPY_PY_CRYPTOLIB (0)
#define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is worth worrying about, but the default definition of MICROPY_PY_SSL is lower down in the file than these lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fine? It's already the case for some other options (for better or worse), eg MICROPY_PY_SYS_SETTRACE is used before the default definition.

#endif

// Depends on MICROPY_PY_CRYPTOLIB
Expand Down
Loading