7 Commits

Author SHA1 Message Date
Brian Smith
a0ce2d3c22 internal: Add generalized "noinline" attribute support.
There are some functions that we never want to be (cross-language)
inlined, and we expect to add more. Make it easier to add more, and
make it easier to extend this capability to more C compilers.
2024-01-12 17:09:36 -08:00
Jiaqi Gao
a9b88826e7 third_party/fiat: replace memcpy with OPENSSL_memcpy
Align with the other use of `OPENSSL_memcpy` in `curve25519_64_adx.h`.
`string.h` will no longer be needed.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
2023-10-30 20:01:15 -07:00
Brian Smith
5cd7ecc579 Use OPENSSL_STATIC_ASSERT instead of static_assert.
More compatibility.
2023-10-09 21:03:42 -07:00
Brian Smith
3181d96968 Curve25519: Conservatively force noinline on ADX code paths.
See https://github.com/rust-lang/rust/issues/116573.
2023-10-09 11:52:48 -07:00
David Benjamin
23ed9d3852 Add target attributes to curve25519_64_adx.h
__builtin_ia32_addcarryx_u64 is, strictly speaking, an ADX intrinsic.
GCC and newer Clang seem to actually implement it without ADX, but
Clang 7 and older will actually try to generate ADX code with it. But
since the caller is not marked target("adx"), this fails to build.

Manually add ADX and BMI2 target attributes to all these functions. The
compiler should be free to use those instructions as these functions all
call into an ADX+BMI2 assembly function anyway. (Though it doesn't do
much with this.)

Note we cannot just annotate fiat_addcarryx_u64. Clang and GCC won't
inline across incompatible targets, so if we tag fiat_addcarryx_u64, we
need to tag the callers up the chain until we're willing to stop
inlining.

Change-Id: I855bb88fea666d92997984836e664292d90df5be
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60612
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2023-06-08 21:58:02 +00:00
Andres Erbsen
9d4f833eec Use ADX asm for Curve25519 base-point multiplication
Did 75000 Ed25519 key generation operations in 1007110us (74470.5 ops/sec) [+26.9%]
Did 72000 Ed25519 signing operations in 1011133us (71207.2 ops/sec) [+25.5%]
Did 78000 Curve25519 base-point multiplication operations in 1006737us (77478.0 ops/sec) [+27.5%]

Change-Id: I32ca2056f42f9b92af315d8381e1b72be69dd331
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60386
Commit-Queue: Andres Erbsen <andreser@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-06-06 21:09:49 +00:00
Andres Erbsen
43f88915f9 Add saturated X25519 for x86_64+ADX running Linux
Did 29000 Curve25519 arbitrary point multiplication operations in 1026074us (28263.1 ops/sec) [+31.2%]

Change-Id: I9c7d47a047dc68d37202b6cf40d7d12b5b4936f8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60385
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-06-06 18:24:25 +00:00