optimize constant_time_conditional_memxor for gcc

Fixed: 42290529

While packed tables still don't give us a speedup on GCC, they are now
within a few percent, with the updated CUrve25519 code there is a net
speedup (+9%).

A loop of 64-bit XORs did not reach performance parity, so vector
extensions it is.

/tmp/m/orig-binary-from-before-packed-tables/gcc
Did 57000 Ed25519 key generation operations in 1000871us (56950.4 ops/sec)
Did 56000 Ed25519 signing operations in 1010050us (55442.8 ops/sec)
Did 20000 Ed25519 verify operations in 1023534us (19540.1 ops/sec)
Did 59000 Curve25519 base-point multiplication operations in 1001460us (58914.0 ops/sec)
Did 23000 Curve25519 arbitrary point multiplication operations in 1025589us (22426.1 ops/sec)

/tmp/m/this-cl/gcc
Did 56000 Ed25519 key generation operations in 1014283us (55211.4 ops/sec) [-3.1%]
Did 54000 Ed25519 signing operations in 1000577us (53968.9 ops/sec) [-2.7%]
Did 21000 Ed25519 verify operations in 1047461us (20048.5 ops/sec) [+2.6%]
Did 57000 Curve25519 base-point multiplication operations in 1002519us (56856.8 ops/sec) [-3.5%]
Did 25000 Curve25519 arbitrary point multiplication operations in 1019719us (24516.6 ops/sec) [+9.3%]

/tmp/m/this-cl/clang
Did 78000 Ed25519 key generation operations in 1003047us (77763.1 ops/sec) [+36.5%]
Did 75000 Ed25519 signing operations in 1002741us (74795.0 ops/sec) [+34.9%]
Did 20000 Ed25519 verify operations in 1008417us (19833.1 ops/sec) [+1.5%]
Did 82000 Curve25519 base-point multiplication operations in 1005159us (81579.1 ops/sec) [+38.5%]
Did 30000 Curve25519 arbitrary point multiplication operations in 1006715us (29799.9 ops/sec) [+32.9%]

/tmp/m/this-cl/clang
Did 79000 Ed25519 key generation operations in 1000245us (78980.6 ops/sec) [+38.7%]
Did 76000 Ed25519 signing operations in 1000323us (75975.5 ops/sec) [+37.0%]
Did 20000 Ed25519 verify operations in 1031862us (19382.4 ops/sec) [-0.8%]
Did 83000 Curve25519 base-point multiplication operations in 1001875us (82844.7 ops/sec) [+40.6%]
Did 30000 Curve25519 arbitrary point multiplication operations in 1007550us (29775.2 ops/sec) [+32.8%]

Change-Id: I9dcaa25c5fac863cd90e31caa42f5d80b63238d6
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69247
Auto-Submit: Andres Erbsen <andreser@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
1 file changed
tree: 71c336114045be452f76a8089fc83e28f4cd048f
  1. .github/
  2. cmake/
  3. crypto/
  4. decrepit/
  5. fuzz/
  6. gen/
  7. include/
  8. pki/
  9. rust/
  10. ssl/
  11. third_party/
  12. tool/
  13. util/
  14. .bazelignore
  15. .bazelrc
  16. .clang-format
  17. .gitignore
  18. API-CONVENTIONS.md
  19. BREAKING-CHANGES.md
  20. BUILD.bazel
  21. build.json
  22. BUILDING.md
  23. CMakeLists.txt
  24. codereview.settings
  25. CONTRIBUTING.md
  26. FUZZING.md
  27. go.mod
  28. go.sum
  29. INCORPORATING.md
  30. LICENSE
  31. MODULE.bazel
  32. MODULE.bazel.lock
  33. PORTING.md
  34. PrivacyInfo.xcprivacy
  35. README.md
  36. SANDBOXING.md
  37. STYLE.md
README.md

BoringSSL

BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.

Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is. We don't recommend that third parties depend upon it. Doing so is likely to be frustrating because there are no guarantees of API or ABI stability.

Programs ship their own copies of BoringSSL when they use it and we update everything as needed when deciding to make API changes. This allows us to mostly avoid compromises in the name of compatibility. It works for us, but it may not work for you.

BoringSSL arose because Google used OpenSSL for many years in various ways and, over time, built up a large number of patches that were maintained while tracking upstream OpenSSL. As Google's product portfolio became more complex, more copies of OpenSSL sprung up and the effort involved in maintaining all these patches in multiple places was growing steadily.

Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it's not part of the NDK) and a number of other apps/programs.

Project links:

There are other files in this directory which might be helpful: