Remove a layer of indirection from fiat curve25519 assembly This fixes the generated Bazel build. Bazel is strict about having all dependencies declared, which includes files that are #included into other files. (It also is not particularly pleased about textual headers and wants them declared in a separate place.) The new fiat curve25519 assembly is currently split into a BoringSSL half, and a more generic fiat half. For now, just move the BoringSSL customizations directly into the fiat half. This isn't ideal, as we'd, long term, like something where the fiat code can be made standalone. But, to fix the build, just patch in the changes now and we can ponder how to do this better later. (Build tools and conventions for assembly are much less clear than C, sadly.) Also add the .note.GNU-stack bit at the end. Change-Id: I04aa733eabf8562dba42dee63a8fd25c86a59db9 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60566 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 5f0c160..80fd919 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt
@@ -15,9 +15,10 @@ set( CRYPTO_SOURCES_ASM curve25519/asm/x25519-asm-arm.S - curve25519/asm/fiat_curve25519_adx.S hrss/asm/poly_rq_mul.S poly1305/poly1305_arm_asm.S + ../third_party/fiat/asm/fiat_curve25519_adx_mul.S + ../third_party/fiat/asm/fiat_curve25519_adx_square.S ) perlasm(CRYPTO_SOURCES aarch64 chacha/chacha-armv8 chacha/asm/chacha-armv8.pl) perlasm(CRYPTO_SOURCES aarch64 cipher_extra/chacha20_poly1305_armv8 cipher_extra/asm/chacha20_poly1305_armv8.pl)
diff --git a/crypto/curve25519/asm/fiat_curve25519_adx.S b/crypto/curve25519/asm/fiat_curve25519_adx.S deleted file mode 100644 index 0c42181..0000000 --- a/crypto/curve25519/asm/fiat_curve25519_adx.S +++ /dev/null
@@ -1,11 +0,0 @@ -#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_SMALL) && defined(__x86_64__) - -#if defined(BORINGSSL_PREFIX) -#include <boringssl_prefix_symbols_asm.h> -#endif - -.intel_syntax noprefix -#include "../../../third_party/fiat/asm/fiat_curve25519_adx_mul.S" -#include "../../../third_party/fiat/asm/fiat_curve25519_adx_square.S" - -#endif
diff --git a/third_party/fiat/asm/fiat_curve25519_adx_mul.S b/third_party/fiat/asm/fiat_curve25519_adx_mul.S index 1d23f3f..f91e67d 100644 --- a/third_party/fiat/asm/fiat_curve25519_adx_mul.S +++ b/third_party/fiat/asm/fiat_curve25519_adx_mul.S
@@ -1,3 +1,11 @@ +#if !defined(OPENSSL_NO_ASM) && defined(__x86_64__) && \ + (defined(__APPLE__) || defined(__ELF__)) + +#if defined(BORINGSSL_PREFIX) +#include <boringssl_prefix_symbols_asm.h> +#endif + +.intel_syntax noprefix .text #if defined(__APPLE__) .private_extern fiat_curve25519_adx_mul @@ -159,3 +167,9 @@ #if defined(__ELF__) .size fiat_curve25519_adx_mul, .-fiat_curve25519_adx_mul #endif + +#endif + +#if defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif
diff --git a/third_party/fiat/asm/fiat_curve25519_adx_square.S b/third_party/fiat/asm/fiat_curve25519_adx_square.S index 71f9108..027dcf1 100644 --- a/third_party/fiat/asm/fiat_curve25519_adx_square.S +++ b/third_party/fiat/asm/fiat_curve25519_adx_square.S
@@ -1,3 +1,11 @@ +#if !defined(OPENSSL_NO_ASM) && defined(__x86_64__) && \ + (defined(__APPLE__) || defined(__ELF__)) + +#if defined(BORINGSSL_PREFIX) +#include <boringssl_prefix_symbols_asm.h> +#endif + +.intel_syntax noprefix .text #if defined(__APPLE__) .private_extern fiat_curve25519_adx_square @@ -127,3 +135,9 @@ #if defined(__ELF__) .size fiat_curve25519_adx_square, .-fiat_curve25519_adx_square #endif + +#endif + +#if defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif
diff --git a/util/generate_build_files.py b/util/generate_build_files.py index 160f911..059caed 100644 --- a/util/generate_build_files.py +++ b/util/generate_build_files.py
@@ -46,7 +46,8 @@ # perlasm system. NON_PERL_FILES = { ('apple', 'x86_64'): [ - 'src/crypto/curve25519/asm/fiat_curve25519_adx.S', + 'src/third_party/fiat/asm/fiat_curve25519_adx_mul.S', + 'src/third_party/fiat/asm/fiat_curve25519_adx_square.S', ], ('linux', 'arm'): [ 'src/crypto/curve25519/asm/x25519-asm-arm.S', @@ -54,7 +55,8 @@ ], ('linux', 'x86_64'): [ 'src/crypto/hrss/asm/poly_rq_mul.S', - 'src/crypto/curve25519/asm/fiat_curve25519_adx.S', + 'src/third_party/fiat/asm/fiat_curve25519_adx_mul.S', + 'src/third_party/fiat/asm/fiat_curve25519_adx_square.S', ], }