Skip to content

Commit c653c29

Browse files
committed
fix
1 parent cbaaa40 commit c653c29

File tree

5 files changed

+62
-38
lines changed

5 files changed

+62
-38
lines changed

Makefile.pre.in

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ ENSUREPIP= @ENSUREPIP@
227227
# Internal static libraries
228228
LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
229229
LIBEXPAT_A= Modules/expat/libexpat.a
230+
LIBHASHLIB_INTERNAL_A=Modules/_hashlib/libhashlib.a
230231

231232
# HACL* build configuration
232233
LIBHACL_CFLAGS=@LIBHACL_CFLAGS@
@@ -761,6 +762,18 @@ LIBHACL_HMAC_HEADERS= \
761762
$(LIBHACL_BLAKE2_HEADERS) \
762763
$(LIBHACL_HEADERS)
763764

765+
##########################################################################
766+
# Internal library for cryptographic primitives
767+
768+
LIBHASHLIB_INTERNAL_OBJS= \
769+
Modules/_hashlib/hashlib_buffer.o \
770+
Modules/_hashlib/hashlib_fetch.o
771+
772+
LIBHASHLIB_INTERNAL_HEADERS= \
773+
Modules/_hashlib/hashlib_buffer.h \
774+
Modules/_hashlib/hashlib_fetch.h \
775+
Modules/_hashlib/hashlib_mutex.h
776+
764777
#########################################################################
765778
# Rules
766779

@@ -1483,9 +1496,17 @@ $(LIBEXPAT_A): $(LIBEXPAT_OBJS)
14831496

14841497
##########################################################################
14851498
# '_hashlib', '_hmac' and HACL*-based modules helpers
1499+
LIBHASHLIB_INTERNAL_CFLAGS=@LIBHASHLIB_INTERNAL_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
14861500

1487-
Modules/_hashlib/hashlib_buffer.o: $(srcdir)/Modules/_hashlib/hashlib_buffer.c $(srcdir)/Modules/_hashlib/hashlib_buffer.h $(PYTHON_HEADERS)
1488-
$(CC) -I$(srcdir)/Modules/_hashlib -c $(PY_STDMODULE_CFLAGS) $(CCSHARED) -o $@ $(srcdir)/Modules/_hashlib/hashlib_buffer.c
1501+
Modules/_hashlib/hashlib_buffer.o: Modules/_hashlib/hashlib_buffer.c $(LIBHASHLIB_INTERNAL_HEADERS) $(PYTHON_HEADERS)
1502+
$(CC) -I$(srcdir)/Modules/_hashlib -c $(LIBHASHLIB_INTERNAL_CFLAGS) -o $@ $(srcdir)/Modules/_hashlib/hashlib_buffer.c
1503+
1504+
Modules/_hashlib/hashlib_fetch.o: Modules/_hashlib/hashlib_fetch.c $(LIBHASHLIB_INTERNAL_HEADERS) $(PYTHON_HEADERS)
1505+
$(CC) -I$(srcdir)/Modules/_hashlib -c $(LIBHASHLIB_INTERNAL_CFLAGS) -o $@ $(srcdir)/Modules/_hashlib/hashlib_fetch.c
1506+
1507+
$(LIBHASHLIB_INTERNAL_A): $(LIBHASHLIB_INTERNAL_OBJS)
1508+
-rm -f $@
1509+
$(AR) $(ARFLAGS) $@ $(LIBHASHLIB_INTERNAL_OBJS)
14891510

14901511
##########################################################################
14911512
# HACL* library build
@@ -3331,14 +3352,8 @@ MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h @LIBMPDEC_INTERNAL@
33313352
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@
33323353
MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
33333354

3334-
MODULE__HASHLIB_DEPS= \
3335-
$(srcdir)/Modules/_hashlib/hashlib_buffer.h \
3336-
$(srcdir)/Modules/_hashlib/hashlib_fetch.h \
3337-
$(srcdir)/Modules/_hashlib/hashlib_mutex.h
3338-
3339-
MODULE__HASHLIB_LDEPS= \
3340-
Modules/_hashlib/hashlib_buffer.o \
3341-
Modules/_hashlib/hashlib_fetch.o
3355+
MODULE__HASHLIB_DEPS=@LIBHASHLIB_INTERNAL@
3356+
MODULE__HASHLIB_LDEPS=
33423357

33433358
# HACL*-based cryptographic primitives
33443359
MODULE__MD5_DEPS=$(MODULE__HASHLIB_DEPS) $(LIBHACL_MD5_HEADERS) $(LIBHACL_MD5_LIB_@LIBHACL_LDEPS_LIBTYPE@)

Modules/_hashlib/hashlib_fetch.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@
6565

6666
#define _Py_HASHLIB_MD_NAMES _Py_HASHLIB_MD_NAMESPACE(NAMES)
6767
#define _Py_HASHLIB_MD_COUNT Py_ARRAY_LENGTH(_Py_HASHLIB_MD_NAMES)
68-
#define _Py_HASHLIB_MD_NAME(MEMBER_ID) \
69-
( \
70-
assert(_Py_HASHLIB_MD_NAME(MEMBER_ID) < _Py_HASHLIB_MD_COUNT), \
71-
_Py_HASHLIB_MD_NAMES[_Py_HASHLIB_MD_MEMBER(MEMBER_ID)] \
68+
#define _Py_HASHLIB_MD_NAME(MEMBER_ID) \
69+
( \
70+
assert(_Py_HASHLIB_MD_MEMBER(MEMBER_ID) >= 0), \
71+
assert(_Py_HASHLIB_MD_MEMBER(MEMBER_ID) < _Py_HASHLIB_MD_COUNT), \
72+
_Py_HASHLIB_MD_NAMES[_Py_HASHLIB_MD_MEMBER(MEMBER_ID)] \
7273
)
7374

7475
typedef enum {
@@ -107,7 +108,7 @@ typedef enum {
107108
_Py_HASHLIB_MD_MEMBER(blake2s),
108109
} _Py_HASHLIB_MD_NAMESPACE(member);
109110

110-
static const char *Py_HASHLIB_MD_NAMES[] = {
111+
static const char *_Py_HASHLIB_MD_NAMES[] = {
111112
#define DECL_MESSAGE_DIGEST_NAME(ID) [_Py_HASHLIB_MD_MEMBER(ID)] = #ID
112113
/* MD-family */
113114
DECL_MESSAGE_DIGEST_NAME(md5),

Tools/wasm/wasi/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def find_wasi_sdk():
178178

179179
def wasi_sdk_env(context):
180180
"""Calculate environment variables for building with wasi-sdk."""
181-
wasi_sdk_path = context.wasi_sdk_path
181+
wasi_sdk_path = context.wasi_sdk_path.absolute()
182182
sysroot = wasi_sdk_path / "share" / "wasi-sysroot"
183183
env = {"CC": "clang", "CPP": "clang-cpp", "CXX": "clang++",
184184
"AR": "llvm-ar", "RANLIB": "ranlib"}

configure

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7961,9 +7961,12 @@ PY_STDLIB_MOD_SIMPLE([unicodedata])
79617961

79627962
###############################################################################
79637963
# Cryptographic primitives
7964-
LIBHASHLIB_INCL='-I$(srcdir)/Modules/_hashlib'
7965-
LIBHASHLIB_LIBS='Modules/_hashlib/hashlib_buffer.o Modules/_hashlib/hashlib_fetch.o'
7964+
LIBHASHLIB_INTERNAL_CFLAGS="-I\$(srcdir)/Modules/_hashlib"
7965+
LIBHASHLIB_INTERNAL_LDFLAGS="-lm \$(LIBHASHLIB_INTERNAL_A)"
7966+
LIBHASHLIB_INTERNAL="\$(LIBHASHLIB_INTERNAL_HEADERS) \$(LIBHASHLIB_INTERNAL_A)"
79667967

7968+
AC_SUBST([LIBHASHLIB_INTERNAL_CFLAGS])
7969+
AC_SUBST([LIBHASHLIB_INTERNAL])
79677970

79687971
###############################################################################
79697972
# HACL* compilation and linking configuration (contact: @picnixz)
@@ -8102,8 +8105,8 @@ AC_DEFUN([PY_HACL_CREATE_MODULE], [
81028105
AS_VAR_PUSHDEF([v], [[LIBHACL_][$1][_LDFLAGS]])
81038106
AS_VAR_SET([v], [[LIBHACL_][$1][_LIB_${LIBHACL_LDEPS_LIBTYPE}]])
81048107
PY_STDLIB_MOD([$2], [$3], [],
8105-
[$LIBHACL_CFLAGS $LIBHASHLIB_INCL],
8106-
[\$($v) $LIBHASHLIB_LIBS])
8108+
[$LIBHACL_CFLAGS $LIBHASHLIB_INTERNAL_CFLAGS],
8109+
[\$($v) $LIBHASHLIB_INTERNAL_LDFLAGS])
81078110
AS_VAR_POPDEF([v])
81088111
])
81098112

@@ -8184,8 +8187,8 @@ dnl OpenSSL bindings
81848187
PY_STDLIB_MOD([_ssl], [], [test "$ac_cv_working_openssl_ssl" = yes],
81858188
[$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS])
81868189
PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes],
8187-
[$OPENSSL_INCLUDES $LIBHASHLIB_INCL],
8188-
[$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $LIBCRYPTO_LIBS $LIBHASHLIB_LIBS])
8190+
[$OPENSSL_INCLUDES $LIBHASHLIB_INTERNAL_CFLAGS],
8191+
[$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $LIBCRYPTO_LIBS $LIBHASHLIB_INTERNAL_LDFLAGS])
81898192

81908193
dnl test modules
81918194
PY_STDLIB_MOD([_testcapi],

0 commit comments

Comments
 (0)