-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ecp_mul()
so that the group can be made const
.
#7601
Comments
It's not clear to me what you can do with the public API: can users take advantage of the runtime computation? Or can we remove the runtime computation without breaking the API?
|
let more provide some more context. The way we perform scalar multiplication for short Weierstrass curves is:
Note: the "if not" part of 1a is what we always did before #4315. Now, if never happens in normal use. It only happens during development, when you're in the process of adding a new curve, and haven't added its pre-computed table yet. We take advantage of that by running the code, letting it compute the table, then dumping it and copying the result to The "if not" part of 1a is also the only one that writes to So, what prevents us from making the group With that in mind, circling back to your questions:
Users can't see the table unless they access private fields, so I don't see how they would take advantage of runtime computation.
I was mistaken on that.:
Yes, that's out of scope of this issue, which is only about preparatory work.
We need to be more precise here. We'll always have runtime computation for variable-point multiplication (when the input point is not the conventional base point G). What we want to remove is the part where if the input point is the G and we somehow don't have its table pre-computed, then after computing it, we update |
The function
mbedtls_ecp_mul()
is still not quite ready yet to have its first argumentconst
, though that would only be a moderate amount of work now that the pre-computed multiples table are stored as static data, instead of computed at runtime. The trouble is, the code still supports computing it at runtime, which is only useful when adding a new curve, as we compute the table at runtime then dump it before we add it toecp_curves.c
, and then it never needs to be computed at runtime again - seescripts/ecp_comb_table.py
.We should really get rid of that and instead compute the table for new curves in python or using a dedicated C program, but it's ridiculous to keep code in all builds of the library that's only useful when developing the library, not when using it. Especially when it shows in the API, as some parameters that should morally be
const
are not.Specifically, we need to quit modifying
T
andT_size
.Actually these probably don't need to be part of the(Edit: yes they do, that's how we get the pre-computed table.)ecp_group
structure.The text was updated successfully, but these errors were encountered: