Benchmark ECDH slightly more accurately.
We really need a better ECDH API in the first place, but ECDH would not
extract the y-coordinate which saves a couple multiplications. (This is
entirely unnoticeable between everything else going on in ECDH.)
Change-Id: I663554577b0cfc373067f9db4d2116a3dfbf1478
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/40866
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
diff --git a/tool/speed.cc b/tool/speed.cc
index b87afb9..8a05a3b 100644
--- a/tool/speed.cc
+++ b/tool/speed.cc
@@ -662,17 +662,14 @@
bssl::UniquePtr<EC_POINT> point(EC_POINT_new(group));
bssl::UniquePtr<EC_POINT> peer_point(EC_POINT_new(group));
bssl::UniquePtr<BN_CTX> ctx(BN_CTX_new());
-
bssl::UniquePtr<BIGNUM> x(BN_new());
- bssl::UniquePtr<BIGNUM> y(BN_new());
-
- if (!point || !peer_point || !ctx || !x || !y ||
+ if (!point || !peer_point || !ctx || !x ||
!EC_POINT_oct2point(group, peer_point.get(), peer_value.get(),
peer_value_len, ctx.get()) ||
- !EC_POINT_mul(group, point.get(), NULL, peer_point.get(),
+ !EC_POINT_mul(group, point.get(), nullptr, peer_point.get(),
EC_KEY_get0_private_key(key.get()), ctx.get()) ||
!EC_POINT_get_affine_coordinates_GFp(group, point.get(), x.get(),
- y.get(), ctx.get())) {
+ nullptr, ctx.get())) {
return false;
}