Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
In ECDSA we encounter operations of the form: $R = α A + β B$ where the coefficients are scalars in the field $α, β ∈ 𝔽ᵣ$ and $A, B ∈ 𝔾$ elliptic curve points. These appear both in the verification and public key recovery. Currently they are represented as: ```nim var point1 {.noinit.}: EC_ShortW_Jac[Fp[Name], G1] point2 {.noinit.}: EC_ShortW_Jac[Fp[Name], G1] point1.scalarMul(α, A) point2.scalarMul(β, B) var R {.noinit.}: EC_ShortW_Jac[Fp[Name], G1] R.sum(point1, point2) ``` but there is possible room for performance improvements. Refactoring these (and for potentially other future cases) is a good idea. [Potential avenues for optimization](https://github.com/mratsim/constantine/pull/504#discussion_r1900769022): https://github.com/mratsim/constantine/blob/6b65b0e77a4ea3435b7ba2a7a9e01aaf704653a5/constantine/math/elliptic/ec_scalar_mul_vartime.nim#L252-L331 The `scalarMulEndo` implementation handles such cases internally efficiently. We may be able to extract those internals. The two locations where this code currently appears: - https://github.com/mratsim/constantine/blob/9642ca6938108d470fb2b7afd21a4289fef9ed69/constantine/signatures/ecdsa.nim#L283-L292 - https://github.com/mratsim/constantine/blob/664d9855abf830d3fe6a53fc318d9a754316f45f/constantine/signatures/ecdsa.nim#L371-L375
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by Vindaar and has received 0 comments.