Fixed importing hashlib due to missing sha3 and blake2 modules.
Bug: 154114625
Test: out/host/linux-x86/bin/py3-cmd -m hashlib
Change-Id: I957c85440235faf37f70c5fb2c72e417b4080891
diff --git a/android/Setup.local b/android/Setup.local
index 7479f04..f44afaa 100644
--- a/android/Setup.local
+++ b/android/Setup.local
@@ -51,12 +51,11 @@
#_ssl _ssl.c _ssl/debughelpers.c
#_hashlib _hashopenssl.c
-_sha256 sha256module.c
-_sha512 sha512module.c
+_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
_md5 md5module.c
_sha1 sha1module.c
-
-# TODO: _blake2
-# TODO: _sha3
+_sha256 sha256module.c
+_sha512 sha512module.c
+_sha3 _sha3/sha3module.c
_struct _struct.c
diff --git a/android/bionic/config.c b/android/bionic/config.c
index 657866c..7e1705a 100644
--- a/android/bionic/config.c
+++ b/android/bionic/config.c
@@ -67,10 +67,12 @@
extern PyObject* PyInit__codecs_iso2022(void);
extern PyObject* PyInit__multiprocessing(void);
extern PyObject* PyInit__ctypes(void);
-extern PyObject* PyInit__sha256(void);
-extern PyObject* PyInit__sha512(void);
+extern PyObject* PyInit__blake2(void);
extern PyObject* PyInit__md5(void);
extern PyObject* PyInit__sha1(void);
+extern PyObject* PyInit__sha256(void);
+extern PyObject* PyInit__sha512(void);
+extern PyObject* PyInit__sha3(void);
extern PyObject* PyInit__struct(void);
extern PyObject* PyInit_posix(void);
extern PyObject* PyInit_errno(void);
@@ -150,10 +152,12 @@
{"_codecs_iso2022", PyInit__codecs_iso2022},
{"_multiprocessing", PyInit__multiprocessing},
{"_ctypes", PyInit__ctypes},
- {"_sha256", PyInit__sha256},
- {"_sha512", PyInit__sha512},
+ {"_blake2", PyInit__blake2},
{"_md5", PyInit__md5},
{"_sha1", PyInit__sha1},
+ {"_sha256", PyInit__sha256},
+ {"_sha512", PyInit__sha512},
+ {"_sha3", PyInit__sha3},
{"_struct", PyInit__struct},
{"posix", PyInit_posix},
{"errno", PyInit_errno},
diff --git a/android/bionic/pyconfig/pyconfig.h b/android/bionic/pyconfig/pyconfig.h
index 003ea7e..40b3386 100644
--- a/android/bionic/pyconfig/pyconfig.h
+++ b/android/bionic/pyconfig/pyconfig.h
@@ -836,10 +836,10 @@
/* #undef HAVE_RL_APPEND_HISTORY */
/* Define if you can turn off readline's signal handling. */
-/* #undef HAVE_RL_CATCH_SIGNAL */
+#define HAVE_RL_CATCH_SIGNAL 1
/* Define if you have readline 2.2 */
-/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
+#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
@@ -848,7 +848,7 @@
/* #undef HAVE_RL_COMPLETION_MATCHES */
/* Define if you have rl_completion_suppress_append */
-/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
+#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_PRE_INPUT_HOOK */
@@ -1028,7 +1028,7 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
-/* Has stdatomic.h with atomic_int */
+/* Has stdatomic.h with atomic_int and atomic_uintptr_t */
#define HAVE_STD_ATOMIC 1
/* Define to 1 if you have the `strdup' function. */
diff --git a/android/linux_x86_64/config.c b/android/linux_x86_64/config.c
index cf09573..edaa899 100644
--- a/android/linux_x86_64/config.c
+++ b/android/linux_x86_64/config.c
@@ -68,10 +68,12 @@
extern PyObject* PyInit__codecs_iso2022(void);
extern PyObject* PyInit__multiprocessing(void);
extern PyObject* PyInit__ctypes(void);
-extern PyObject* PyInit__sha256(void);
-extern PyObject* PyInit__sha512(void);
+extern PyObject* PyInit__blake2(void);
extern PyObject* PyInit__md5(void);
extern PyObject* PyInit__sha1(void);
+extern PyObject* PyInit__sha256(void);
+extern PyObject* PyInit__sha512(void);
+extern PyObject* PyInit__sha3(void);
extern PyObject* PyInit__struct(void);
extern PyObject* PyInit_posix(void);
extern PyObject* PyInit_errno(void);
@@ -152,10 +154,12 @@
{"_codecs_iso2022", PyInit__codecs_iso2022},
{"_multiprocessing", PyInit__multiprocessing},
{"_ctypes", PyInit__ctypes},
- {"_sha256", PyInit__sha256},
- {"_sha512", PyInit__sha512},
+ {"_blake2", PyInit__blake2},
{"_md5", PyInit__md5},
{"_sha1", PyInit__sha1},
+ {"_sha256", PyInit__sha256},
+ {"_sha512", PyInit__sha512},
+ {"_sha3", PyInit__sha3},
{"_struct", PyInit__struct},
{"posix", PyInit_posix},
{"errno", PyInit_errno},
diff --git a/android/linux_x86_64/pyconfig/pyconfig.h b/android/linux_x86_64/pyconfig/pyconfig.h
index caa7c5b..54e1ed0 100644
--- a/android/linux_x86_64/pyconfig/pyconfig.h
+++ b/android/linux_x86_64/pyconfig/pyconfig.h
@@ -834,10 +834,10 @@
/* #undef HAVE_RL_APPEND_HISTORY */
/* Define if you can turn off readline's signal handling. */
-/* #undef HAVE_RL_CATCH_SIGNAL */
+#define HAVE_RL_CATCH_SIGNAL 1
/* Define if you have readline 2.2 */
-/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
+#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
@@ -846,7 +846,7 @@
/* #undef HAVE_RL_COMPLETION_MATCHES */
/* Define if you have rl_completion_suppress_append */
-/* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
+#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1
/* Define if you have readline 4.0 */
/* #undef HAVE_RL_PRE_INPUT_HOOK */
@@ -1026,7 +1026,7 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
-/* Has stdatomic.h with atomic_int */
+/* Has stdatomic.h with atomic_int and atomic_uintptr_t */
#define HAVE_STD_ATOMIC 1
/* Define to 1 if you have the `strdup' function. */