Skip to content
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

[nettle] Switch from yasm to clang #30175

Merged
merged 16 commits into from
May 8, 2023
Merged
39 changes: 36 additions & 3 deletions ports/nettle/ccas.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,33 @@ index d00b565..c465d0b 100644
%.$(OBJEXT): %.asm $(srcdir)/m4-utils.m4 $(srcdir)/asm.m4 config.m4 machine.m4
$(M4) $(srcdir)/m4-utils.m4 $(srcdir)/asm.m4 config.m4 machine.m4 $< >$*.s
- $(COMPILE) -c $*.s
+ $(COMPILE_AS) -c $*.s
+ $(COMPILE_AS) -c $*.s -o $@

%.$(OBJEXT): %.c
$(COMPILE) -c $< \
diff --git a/aclocal.m4 b/aclocal.m4
index 1d218a0..1ff02c8 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -301,7 +301,7 @@ AC_DEFUN([GMP_TRY_ASSEMBLE],
[cat >conftest.s <<EOF
[$1]
EOF
-gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1"
+gmp_assemble="$CCAS $CPPFLAGS $ASMFLAGS -c conftest.s >conftest.out 2>&1"
if AC_TRY_EVAL(gmp_assemble); then
cat conftest.out >&AC_FD_CC
ifelse([$2],,:,[$2])
diff --git a/config.make.in b/config.make.in
index f8e1f74..4668884 100644
--- a/config.make.in
+++ b/config.make.in
@@ -73,6 +73,8 @@ TEST_SHLIB_DIR = ${abs_top_builddir}/.lib
@@ -73,6 +73,9 @@ TEST_SHLIB_DIR = ${abs_top_builddir}/.lib
# flags before CPPFLAGS and LDFLAGS. While EXTRA_CFLAGS are added at the end.

COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(DEP_FLAGS)
+CCAS = @CCAS@
+ASMFLAGS = @ASMFLAGS@
+COMPILE_AS = $(CCAS) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(ASMFLAGS) $(DEP_FLAGS)
COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DEP_FLAGS)
LINK = $(CC) $(CFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
Expand All @@ -28,13 +42,32 @@ diff --git a/configure.ac b/configure.ac
index 1012718..8db139d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,9 @@ LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
@@ -134,6 +134,10 @@ LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \

# Checks for programs.
AC_PROG_CC
+# Copied from gmp
+test -n "$CCAS" || CCAS='$(CC)'
+AC_SUBST(CCAS)
+AC_SUBST(ASMFLAGS)

NETTLE_CHECK_IFUNC

@@ -321,7 +325,7 @@ W64_ABI=no # For x86_64 windows
case "$host_cpu" in
[x86_64 | amd64])
AC_TRY_COMPILE([
-#if defined(__x86_64__) || defined(__arch64__)
+#if defined(__x86_64__) || defined(__arch64__) || defined(_M_AMD64)
#error 64-bit x86
#endif
], [], [
@@ -374,7 +378,7 @@ case "$host_cpu" in
;;
aarch64*)
AC_TRY_COMPILE([
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(_M_ARM64)
#error 64-bit arm
#endif
], [], [
282 changes: 282 additions & 0 deletions ports/nettle/hogweed-arm.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
EXPORTS
nettle_ed448_shake256_verify
nettle_ed448_shake256_sign
nettle_ed448_shake256_public_key
_nettle_ed448_shake256
nettle_ed25519_sha512_verify
nettle_ed25519_sha512_sign
nettle_ed25519_sha512_public_key
_nettle_ed25519_sha512
_nettle_eddsa_verify_itch
_nettle_eddsa_verify
_nettle_eddsa_sign_itch
_nettle_eddsa_sign
_nettle_eddsa_public_key_itch
_nettle_eddsa_public_key
_nettle_eddsa_hash
_nettle_eddsa_expand_key
_nettle_eddsa_decompress_itch
_nettle_eddsa_decompress
_nettle_eddsa_compress_itch
_nettle_eddsa_compress
_nettle_curve448_eh_to_x
nettle_curve448_mul
nettle_curve448_mul_g
_nettle_curve25519_eh_to_x
nettle_curve25519_mul
nettle_curve25519_mul_g
nettle_gostdsa_vko
nettle_gostdsa_verify
nettle_ecc_gostdsa_verify_itch
nettle_ecc_gostdsa_verify
nettle_gostdsa_sign
nettle_ecc_gostdsa_sign_itch
nettle_ecc_gostdsa_sign
nettle_ecdsa_generate_keypair
nettle_ecdsa_verify
nettle_ecc_ecdsa_verify_itch
nettle_ecc_ecdsa_verify
nettle_ecdsa_sign
nettle_ecc_ecdsa_sign_itch
nettle_ecc_ecdsa_sign
nettle_ecc_point_mul_g
nettle_ecc_point_mul
nettle_ecc_scalar_init
nettle_ecc_scalar_clear
nettle_ecc_scalar_set
nettle_ecc_scalar_get
nettle_ecc_point_init
nettle_ecc_point_clear
nettle_ecc_point_set
nettle_ecc_point_get
nettle_ecc_scalar_random
_nettle_ecc_mod_random
_nettle_ecc_hash
_nettle_gost_hash
_nettle_ecc_mul_a
_nettle_ecc_mul_g
_nettle_ecc_mul_m
_nettle_ecc_mul_a_eh
_nettle_ecc_mul_g_eh
_nettle_ecc_add_thh
_nettle_ecc_add_th
_nettle_ecc_dup_th
_nettle_ecc_add_ehh
_nettle_ecc_add_eh
_nettle_ecc_dup_eh
_nettle_ecc_eh_to_a
_nettle_ecc_add_jjj
_nettle_ecc_add_jja
_nettle_ecc_dup_jj
_nettle_ecc_a_to_j
_nettle_ecc_j_to_a
nettle_ecc_bit_size
nettle_ecc_size
nettle_ecc_size_a
nettle_ecc_size_j
_nettle_secp_521r1
nettle_get_secp_521r1
_nettle_secp_384r1
nettle_get_secp_384r1
_nettle_secp_256r1
nettle_get_secp_256r1
_nettle_secp_224r1
nettle_get_secp_224r1
_nettle_secp_192r1
nettle_get_secp_192r1
_nettle_gost_gc512a
nettle_get_gost_gc512a
_nettle_gost_gc256b
nettle_get_gost_gc256b
_nettle_curve448
_nettle_curve25519
_nettle_ecc_pm1_redc
_nettle_ecc_pp1_redc
_nettle_ecc_mod_zero_p
_nettle_ecc_mod_equal_p
_nettle_ecc_mod_add
_nettle_ecc_mod_sub
_nettle_ecc_mod_mul_1
_nettle_ecc_mod_addmul_1
_nettle_ecc_mod_submul_1
_nettle_ecc_mod_mul
_nettle_ecc_mod_sqr
_nettle_ecc_mod_mul_canonical
_nettle_ecc_mod_sqr_canonical
_nettle_ecc_mod_pow_2k
_nettle_ecc_mod_pow_2k_mul
_nettle_ecc_mod_inv
_nettle_ecc_mod
_nettle_cnd_copy
_nettle_sec_zero_p
_nettle_mpz_limbs_copy
_nettle_mpz_set_n
_nettle_mpn_set_base256
_nettle_mpn_set_base256_le
_nettle_mpn_get_base256
_nettle_mpn_get_base256_le
_nettle_gmp_alloc_limbs
_nettle_gmp_free_limbs
_nettle_gmp_alloc
_nettle_gmp_free
_nettle_sec_tabselect
_nettle_sec_sub_1
_nettle_sec_add_1
nettle_dsa_params_from_der_iterator
nettle_dsa_public_key_from_der_iterator
nettle_dsa_openssl_private_key_from_der_iterator
nettle_openssl_provate_key_from_der
nettle_rsa_public_key_from_der_iterator
nettle_rsa_private_key_from_der_iterator
nettle_rsa_keypair_from_der
nettle_asn1_der_get_bignum
nettle_asn1_der_iterator_first
nettle_asn1_der_iterator_next
nettle_asn1_der_decode_constructed
nettle_asn1_der_decode_constructed_last
nettle_asn1_der_decode_bitstring
nettle_asn1_der_decode_bitstring_last
nettle_asn1_der_get_uint32
nettle_rsa_keypair_to_openpgp
nettle_pgp_put_uint32
nettle_pgp_put_uint16
nettle_pgp_put_mpi
nettle_pgp_put_string
nettle_pgp_put_length
nettle_pgp_put_header
nettle_pgp_put_header_length
nettle_pgp_sub_packet_start
nettle_pgp_put_sub_packet
nettle_pgp_sub_packet_end
nettle_pgp_put_public_rsa_key
nettle_pgp_put_rsa_sha1_signature
nettle_pgp_put_userid
nettle_pgp_crc24
nettle_pgp_armor
nettle_dsa_signature_from_sexp
nettle_dsa_keypair_from_sexp_alist
nettle_dsa_sha1_keypair_from_sexp
nettle_dsa_sha256_keypair_from_sexp
nettle_dsa_keypair_to_sexp
nettle_dsa_sha256_verify
nettle_dsa_sha256_verify_digest
nettle_dsa_sha256_sign
nettle_dsa_sha256_sign_digest
nettle_dsa_sha1_verify
nettle_dsa_sha1_verify_digest
nettle_dsa_sha1_sign
nettle_dsa_sha1_sign_digest
_nettle_dsa_hash
nettle_dsa_generate_keypair
nettle_dsa_verify
nettle_dsa_sign
nettle_dsa_generate_params
nettle_dsa_compat_generate_keypair
nettle_dsa_public_key_init
nettle_dsa_public_key_clear
nettle_dsa_private_key_init
nettle_dsa_private_key_clear
nettle_dsa_params_init
nettle_dsa_params_clear
nettle_dsa_signature_init
nettle_dsa_signature_clear
nettle_rsa_keypair_from_sexp_alist
nettle_rsa_keypair_from_sexp
nettle_rsa_keypair_to_sexp
_nettle_rsa_blind
_nettle_rsa_unblind
nettle_rsa_generate_keypair
nettle_rsa_decrypt_tr
nettle_rsa_sec_decrypt
nettle_rsa_decrypt
nettle_rsa_encrypt
nettle_rsa_pss_sha384_verify_digest
nettle_rsa_pss_sha512_verify_digest
nettle_rsa_pss_sha384_sign_digest_tr
nettle_rsa_pss_sha512_sign_digest_tr
nettle_rsa_pss_sha256_verify_digest
nettle_rsa_pss_sha256_sign_digest_tr
nettle_rsa_sha512_verify
nettle_rsa_sha512_verify_digest
nettle_rsa_sha512_sign_tr
nettle_rsa_sha512_sign_digest_tr
nettle_rsa_sha512_sign
nettle_rsa_sha512_sign_digest
nettle_rsa_sha256_verify
nettle_rsa_sha256_verify_digest
nettle_rsa_sha256_sign_tr
nettle_rsa_sha256_sign_digest_tr
nettle_rsa_sha256_sign
nettle_rsa_sha256_sign_digest
nettle_rsa_sha1_verify
nettle_rsa_sha1_verify_digest
nettle_rsa_sha1_sign_tr
nettle_rsa_sha1_sign_digest_tr
nettle_rsa_sha1_sign
nettle_rsa_sha1_sign_digest
nettle_rsa_md5_verify
nettle_rsa_md5_verify_digest
nettle_rsa_md5_sign_tr
nettle_rsa_md5_sign_digest_tr
nettle_rsa_md5_sign
nettle_rsa_md5_sign_digest
nettle_rsa_pkcs1_verify
nettle_rsa_pkcs1_sign_tr
nettle_rsa_pkcs1_sign
_nettle_rsa_sec_compute_root_itch
_nettle_rsa_sec_compute_root
_nettle_rsa_verify
_nettle_rsa_verify_recover
nettle_rsa_compute_root_tr
_nettle_rsa_sec_compute_root_tr
nettle_rsa_private_key_init
nettle_rsa_private_key_clear
nettle_rsa_private_key_prepare
nettle_rsa_compute_root
nettle_rsa_public_key_init
nettle_rsa_public_key_clear
nettle_rsa_public_key_prepare
_nettle_rsa_check_size
nettle_pss_mgf1
nettle_pss_encode_mgf1
nettle_pss_verify_mgf1
nettle_pkcs1_rsa_sha512_encode
nettle_pkcs1_rsa_sha512_encode_digest
nettle_pkcs1_rsa_sha256_encode
nettle_pkcs1_rsa_sha256_encode_digest
nettle_pkcs1_rsa_sha1_encode
nettle_pkcs1_rsa_sha1_encode_digest
nettle_pkcs1_rsa_md5_encode
nettle_pkcs1_rsa_md5_encode_digest
nettle_pkcs1_rsa_digest_encode
_nettle_pkcs1_sec_decrypt
_nettle_pkcs1_sec_decrypt_variable
nettle_pkcs1_decrypt
nettle_pkcs1_encrypt
_nettle_pkcs1_signature_prefix
nettle_mpz_set_sexp
nettle_random_prime
_nettle_generate_pocklington_prime
nettle_mpz_random_size
nettle_mpz_random
nettle_mpz_sizeinbase_256_s
nettle_mpz_sizeinbase_256_u
nettle_mpz_get_str_256
nettle_mpz_set_str_256_s
nettle_mpz_init_set_str_256_s
nettle_mpz_set_str_256_u
nettle_mpz_init_set_str_256_u
nettle_sexp_transport_format
nettle_sexp_transport_vformat
nettle_sexp_transport_iterator_first
nettle_sexp_format
nettle_sexp_vformat
nettle_sexp_iterator_first
nettle_sexp_iterator_next
nettle_sexp_iterator_enter_list
nettle_sexp_iterator_exit_list
nettle_sexp_iterator_subexpr
nettle_sexp_iterator_get_uint32
nettle_sexp_iterator_check_type
nettle_sexp_iterator_check_types
nettle_sexp_iterator_assoc
Loading