Feature request: p256 avx2 affine point table selection #148
+115
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I was hoping you might consider offering a function like this. This is mainly for discussion rather than a real contribution; notably, I have not written any proof for this or even added it to any makefiles (but I'm happy to do both those things, though would certainly need help with the proof!). It is effectively a specialisation of
bignum_copy_row_from_table
using AVX2 to improve throughput.Background: I've been building upon s2n-bignum to make a new crypto library in Rust. For p256 base point multiplication I'm using the same approach as BoringSSL/AWS-LC which work through the exponent in 7-bit chunks, in wNAF form, and have a table of 37x64 multiples of the curve generator, at a cost of ~148KB of data. (Most of this predates the new
scalarmul
functions; I haven't measured these to see how they compare yet.)I was using
bignum_copy_row_from_table
for this, but identified that it was relatively slow for such a large amount of data.Compared to using
bignum_copy_row_from_table
the performance improvement looks like:For comparison:
(BoringSSL/AWS-LC has a similar, but more aggressive version; see
ecp_nistz256_select_w7
, this implementation is not derived from that one.)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.