Skip to content

Commit

Permalink
poly1305 x86_64: Remove poly1305_vec.c.
Browse files Browse the repository at this point in the history
On x86_64, when we have SSE 4.1, which is pretty much always the case,
we use the integrated implementation. We also have the non-SSE
implementation to fall back on. This middle one is infrequently used
but creates difficulties with cross-compilation because of the use of
the <emmintrin.h> header file, which forces a dependency on stdlib.h
we wouldn't otherwise need.
  • Loading branch information
briansmith committed May 21, 2024
1 parent 03c3593 commit 53a60bf
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 871 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ include = [
"crypto/poly1305/poly1305.c",
"crypto/poly1305/poly1305_arm.c",
"crypto/poly1305/poly1305_arm_asm.S",
"crypto/poly1305/poly1305_vec.c",
"crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl",
"crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl",
"examples/**/*.rs",
Expand Down
3 changes: 0 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const RING_SRCS: &[(&[&str], &str)] = &[
(&[X86_64], "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl"),
(&[X86_64], "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl"),
(&[X86_64], "crypto/fipsmodule/modes/asm/ghash-x86_64.pl"),
(&[X86_64], "crypto/poly1305/poly1305_vec.c"),
(&[X86_64], SHA512_X86_64),
(&[X86_64], "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl"),
(&[X86_64], "third_party/fiat/asm/fiat_curve25519_adx_mul.S"),
Expand Down Expand Up @@ -574,8 +573,6 @@ fn configure_cc(c: &mut cc::Build, target: &Target, c_root_dir: &Path, include_d
}

// Allow cross-compiling without a target sysroot for these targets.
//
// poly1305_vec.c requires <emmintrin.h> which requires <stdlib.h>.
if (target.arch == WASM32)
|| (target.os == "linux" && target.env == "musl" && target.arch != X86_64)
{
Expand Down
14 changes: 0 additions & 14 deletions crypto/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,6 @@ static inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
OPENSSL_memcpy(out, &v, sizeof(v));
}

#if !defined(RING_BIG_ENDIAN)

static inline uint64_t CRYPTO_load_u64_le(const void *in) {
uint64_t v;
OPENSSL_memcpy(&v, in, sizeof(v));
return v;
}

static inline void CRYPTO_store_u64_le(void *out, uint64_t v) {
OPENSSL_memcpy(out, &v, sizeof(v));
}

#endif // !defined(RING_BIG_ENDIAN)

// Runtime CPU feature support

#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
Expand Down
4 changes: 0 additions & 4 deletions crypto/poly1305/poly1305.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include "../internal.h"


#if !defined(BORINGSSL_HAS_UINT128) || !defined(OPENSSL_X86_64)

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
Expand Down Expand Up @@ -292,5 +290,3 @@ void CRYPTO_poly1305_finish(poly1305_state *statep, uint8_t mac[16]) {
f3 += (f2 >> 32);
CRYPTO_store_u32_le(&mac[12], (uint32_t)f3);
}

#endif // !BORINGSSL_HAS_UINT128 || !OPENSSL_X86_64
Loading

0 comments on commit 53a60bf

Please sign in to comment.