mmcloughlin / ec3

Elliptic Curve Cryptography Compiler: an incomplete experiment in code-generation for elliptic curves in Go
BSD 3-Clause "New" or "Revised" License
56 stars 6 forks source link

gen/fp: fields modulo group order N #77

Open mmcloughlin opened 5 years ago

mmcloughlin commented 5 years ago

We also require field operations modulo the group order N. Simple operations are required for scalar multiplication, but the main motivation is for ECDSA. In particular we would like to satisfy the invertable interface in the crypto/ecdsa package.

// A invertible implements fast inverse mod Curve.Params().N
type invertible interface {
    // Inverse returns the inverse of k in GF(P)
    Inverse(k *big.Int) *big.Int
}

https://github.com/golang/go/blob/fa7d40abe098a7d30e6cb492ee8e05306b8e537d/src/crypto/ecdsa/ecdsa.go#L42-L46

Updates #55