Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen,...

36
Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 1 2 1 + 2

Transcript of Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen,...

Page 1: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Elliptic curve arithmetic

Wouter Castryck

ECC school, Nijmegen, 9-11 November 2017

๐‘ƒ1

๐‘ƒ2

๐‘ƒ1 + ๐‘ƒ2

Page 2: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Tangent-chord arithmeticon cubic curves

Page 3: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

IntroductionConsequence of Bรฉzoutโ€™s theorem: on a cubic curve

๐ถ โˆถ ๐‘“ ๐‘ฅ, ๐‘ฆ = ฯƒ๐‘–+๐‘—=3๐‘Ž๐‘–๐‘—๐‘ฅ๐‘–๐‘ฆ๐‘— = 0,

new points can be constructed from known points using tangents and chords.

This principle was already known to 17th century natives like Fermat and Newton.

๐‘“ ๐‘ฅ, ๐‘ฆ = 0

Pierre de Fermat

Isaac Newton

Page 4: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Introduction

This construction was known to respect the base field.

This means: if ๐‘“ ๐‘ฅ, ๐‘ฆ โˆˆ ๐‘˜[๐‘ฅ, ๐‘ฆ] with ๐‘˜ some field, and one starts from points having coordinates in ๐‘˜, then new points obtained through the tangent-chord method also have coordinates in ๐‘˜.

Informal reason:

Consider two points on the ๐‘ฅ-axis ๐‘ƒ1 = ๐‘Ž, 0 and ๐‘ƒ2 = (๐‘, 0).Then the โ€œchordโ€ is ๐‘ฆ = 0.

The intersection is computed by ๐‘“ ๐‘ฅ, 0 = ๐‘ฅ โˆ’ ๐‘Ž โ‹… ๐‘ฅ โˆ’ ๐‘ โ‹… linear factor

always has a root over ๐’Œ!

๐‘ƒ1

๐‘ƒ2

๐‘“ ๐‘ฅ, ๐‘ฆ = 0

Page 5: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

IntroductionThus: tangents and chords give some sort of composition law on the set of ๐‘˜-rational points of a cubic curve.

Later it was realized that by adding in a second step, this gives the curve an abelian group structure! only after an incredible historical detour which took more than 200 yearsโ€ฆ

First formalized by Poincarรฉ in 1901.

Henri Poincarรฉ

choose a base point

๐‘‚

๐‘ƒ1

๐‘ƒ2

๐‘ƒ1 + ๐‘ƒ2

๐‘ƒ

2๐‘ƒ commutativity:๐‘ƒ1 + ๐‘ƒ2 = ๐‘ƒ2 + ๐‘ƒ1

associativity: ๐‘ƒ1 + ๐‘ƒ2 + ๐‘ƒ3 = ๐‘ƒ1 + (๐‘ƒ2 + ๐‘ƒ3)

neutral element:๐‘ƒ + ๐‘‚ = ๐‘ƒ

inverse element:โˆƒ โˆ’๐‘ƒ โˆถ ๐‘ƒ + โˆ’๐‘ƒ = ๐‘‚

Page 6: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Introduction

Conditions for this to work:

1) One should work projectively (as opposed to affinely):

Homogenize

๐‘“ ๐‘ฅ, ๐‘ฆ = ฯƒ๐‘–+๐‘—=3๐‘Ž๐‘–๐‘—๐‘ฅ๐‘–๐‘ฆ๐‘— to ๐น ๐‘ฅ, ๐‘ฆ, ๐‘ง = ฯƒ๐‘–+๐‘—=3๐‘Ž๐‘–๐‘—๐‘ฅ

๐‘–๐‘ฆ๐‘—๐‘ง3โˆ’๐‘–โˆ’๐‘—

and consider points ๐‘ฅ: ๐‘ฆ: ๐‘ง โ‰  (0: 0: 0), up to scaling.

Two types of points:

affine points points at infinity

๐‘ง = 0

๐‘ง โ‰  0: the point is of the form (๐‘ฅ: ๐‘ฆ: 1)

But then ๐‘ฅ, ๐‘ฆ is an affine point!

๐‘ง = 0: points of the form (๐‘ฅ: ๐‘ฆ: 0) up to scaling.

(Up to three such points.)

Page 7: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Introduction

Conditions for this to work:

2) The curve should be smooth, meaning that

๐‘“ =๐œ•๐‘“

๐œ•๐‘ฅ=

๐œ•๐‘“

๐œ•๐‘ฆ=

๐œ•๐‘“

๐œ•๐‘ง= 0

has no solutions.

This ensures that every point ๐‘ƒ has a well-defined tangent line

๐‘‡ โˆถ๐œ•๐‘“

๐œ•๐‘ฅ๐‘ƒ โ‹… ๐‘ฅ +

๐œ•๐‘“

๐œ•๐‘ฆ๐‘ƒ โ‹… ๐‘ฆ +

๐œ•๐‘“

๐œ•๐‘ง๐‘ƒ โ‹… ๐‘ง = 0.

Page 8: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Introduction

Conditions for this to work:

3) ๐‘‚ should have coordinates in ๐‘˜, in order for the arithmetic to work over ๐‘˜.

๐‘‚

Definition: an elliptic curve over ๐‘˜ is a smooth projectivecubic curve ๐ธ/๐‘˜ equipped with a ๐‘˜-rational base point ๐‘‚.

(Caution: there exist more general and less general definitions.)

Under these assumptions we have as wanted:Tangent-chord arithmetic turns ๐ธ into an abelian group with neutral element ๐‘‚.The set of ๐‘˜-rational points ๐ธ(๐‘˜) form a subgroup.

Page 9: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Exercises

1) Describe geometrically what it means to invert a point ๐‘ƒ, i.e. to find a point โˆ’๐‘ƒ such that

๐‘ƒ + โˆ’๐‘ƒ = ๐‘‚.

๐‘‚

2) Why does this construction simplify considerably if ๐‘‚ is a flex (= point at which its tangent line meets the curve triply)?

3) If ๐‘‚ is a flex then

3๐‘ƒ โ‰” ๐‘ƒ + ๐‘ƒ + ๐‘ƒ = ๐‘‚ if and only if ๐‘ƒ is a flex.

Explain why.

Page 10: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

On the terminologyโ€œelliptic curvesโ€

Page 11: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

On the terminology

In the 18th century, unrelated to all this, Fagnano and Euler revisited the unsolvedproblem of determining the circumference of an ellipse.

Giulio Fagnano

Leonhard Euler

?

They got stuck on difficult integrals, now called elliptic integrals.

Page 12: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

On the terminology

In the 19th century Abel and Jacobi studied the inverse functions of elliptic integrals.

๐‘ก = ๐‘“(๐‘ ) ?

When viewed as complex functions, they observeddoubly periodic behaviour: there exist ๐œ”1, ๐œ”2 โˆˆ ๐‚ suchthat

๐‘“ ๐‘ง + ๐œ†1๐œ”1 + ๐œ†2๐œ”2 = ๐‘“ ๐‘ง for all ๐œ†1, ๐œ†2 โˆˆ ๐™.

Niels H. Abel

Carl G. Jacobi

Compare to: sin ๐‘ฅ + ๐œ† โ‹… 2๐‘˜๐œ‹ = sin ๐‘ฅ for all ๐œ† โˆˆ ๐™, etc.

Such generalized trigonometric functions became known as elliptic functions.

Page 13: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

On the terminology

In other words: elliptic functions on ๐‚ are well-defined modulo ๐™๐œ”1 + ๐™๐œ”2.

๐œ”1

๐œ”2

Karl Weierstrass

Mid 19th century Weierstrass classified all elliptic functions forany given ๐œ”1, ๐œ”2, and used this to define a biholomorphism

๐‚/(๐™๐œ”1 + ๐™๐œ”2) โ†’ ๐ธ: ๐‘ง โ†ฆ (โ„˜ ๐‘ง ,โ„˜โ€ฒ ๐‘ง )

to a certain algebraic curve ๐ธโ€ฆ

Note that ๐‚/(๐™๐œ”1 + ๐™๐œ”2) is an abelian group, almost by definition.

The biholomorphism endows ๐ธ with the same group structureโ€ฆ โ€ฆ where it turns out to correspond to tangent-chord arithmetic!

โ€ฆ which he called an elliptic curve!

Page 14: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Weierstrass curves andtheir arithmetic

Page 15: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

The concrete type of elliptic curves found by Weierstrassnow carry his name. They are the most famous shapes ofelliptic curves.

Assume char ๐‘˜ โ‰  2,3.

๐‘ฆ2 = ๐‘ฅ3 + ๐ด๐‘ฅ + ๐ต๐‘ฆ2๐‘ง = ๐‘ฅ3 + ๐ด๐‘ฅ๐‘ง2 + ๐ต๐‘ง3

(typical plot for ๐‘˜ = ๐‘)

Weierstrass curves๐‘ง = 0 ๐‘‚ = (0: 1: 0)

Definition: a Weierstrass elliptic curve is defined by

where ๐ด, ๐ต โˆˆ ๐‘˜ satisfy 4๐ด3 + 27๐ต2 โ‰  0.The base point ๐‘‚ is the unique point at infinity.

Can be shown: up to โ€œisomorphismโ€ every elliptic curve is Weierstrass.

Page 16: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Note:

1) the lines through ๐‘‚ = (0: 1: 0) are thevertical lines (except for the line at infinity๐‘ง = 0).

2) The equation ๐‘ฆ2 = ๐‘ฅ3 + ๐ด๐‘ฅ + ๐ต is symmetric in ๐‘ฆ.

Weierstrass curves

(๐‘ฅ, ๐‘ฆ)This gives a first feature: inverting a point on a Weierstrass curve is super easy!

Indeed: if ๐‘ƒ = (๐‘ฅ, ๐‘ฆ) is an affine point then

โˆ’๐‘ƒ = ๐‘ฅ,โˆ’๐‘ฆ .

๐‘‚

๐‘ƒ

(๐‘ฅ, โˆ’๐‘ฆ)

Page 17: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

What about point addition?

Weierstrass curves

Write ๐‘ƒ1 + ๐‘ƒ2 = ๐‘ฅ3, ๐‘ฆ3 .

Line through ๐‘ƒ1 = (๐‘ฅ1, ๐‘ฆ1) and ๐‘ƒ2 = (๐‘ฅ2, ๐‘ฆ2) is

๐‘ฆ โˆ’ ๐‘ฆ1 = ๐œ† ๐‘ฅ โˆ’ ๐‘ฅ1 where ๐œ† =๐‘ฆ2โˆ’๐‘ฆ1

๐‘ฅ2โˆ’๐‘ฅ1.

๐‘ƒ1

๐‘ƒ2

๐‘ƒ1 + ๐‘ƒ2

Substituting ๐‘ฆ โ† ๐‘ฆ1 + ๐œ† ๐‘ฅ โˆ’ ๐‘ฅ1 in the curve equation ๐‘ฅ3 + ๐ด๐‘ฅ + ๐ต โˆ’ ๐‘ฆ2 = 0:

๐‘ฅ3 + ๐ด๐‘ฅ + ๐ต โˆ’ (๐œ†2๐‘ฅ2 +โ‹ฏ) = 0.๐‘ฅ3 + ๐ด๐‘ฅ + ๐ต โˆ’ ๐‘ฆ1 + ๐œ† ๐‘ฅ โˆ’ ๐‘ฅ12= 0.๐‘ฅ3 โˆ’ ๐œ†2๐‘ฅ2 +โ‹ฏ = 0.

So, sum of the roots is ๐œ†2. But ๐‘ฅ1, ๐‘ฅ2 are roots!

We find: แ‰Š๐‘ฅ3 = ๐œ†2 โˆ’ ๐‘ฅ1 โˆ’ ๐‘ฅ2๐‘ฆ3 = โˆ’๐‘ฆ1 โˆ’ ๐œ†(๐‘ฅ3 โˆ’ ๐‘ฅ1)

Page 18: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Weierstrass curves

๐‘ƒ

2๐‘ƒ

where ๐œ† =๐‘ฆ2โˆ’๐‘ฆ1

๐‘ฅ2โˆ’๐‘ฅ1.

We find: แ‰Š๐‘ฅ3 = ๐œ†2 โˆ’ ๐‘ฅ1 โˆ’ ๐‘ฅ2๐‘ฆ3 = โˆ’๐‘ฆ1 โˆ’ ๐œ†(๐‘ฅ3 โˆ’ ๐‘ฅ1)

But what if ๐‘ฅ1 = ๐‘ฅ2?

Two cases:

Either ๐‘ฆ1 = ๐‘ฆ2 โ‰  0, i.e. ๐‘ƒ1 = ๐‘ƒ2 = ๐‘ƒ.

In this case we need to replace ๐œ† by

๐œ† =3๐‘ฅ1

2+2๐ด๐‘ฅ1

2๐‘ฆ1.

Or ๐‘ฆ1 = โˆ’๐‘ฆ2, in which case ๐‘ƒ1 + ๐‘ƒ2 = ๐‘‚.

๐‘‚

๐‘ƒ1

๐‘ƒ2

Conclusion: formulas for computing on a Weierstrass curve are not too bad, but case distinctive.

Page 19: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

More efficient elliptic curve arithmetic?

The Weierstrass addition formulas are reasonably good for several purposesโ€ฆโ€ฆ but can they be boosted? Huge amount of activity starting in the 1980โ€™s.

One reason: Koblitz and Millerโ€™s suggestion to use elliptic curves in crypto!

Initial reason: Lenstraโ€™s elliptic curve method (ECM) for integer factorization.

agree on ๐ธ/๐…๐‘ž and ๐‘ƒ โˆˆ ๐ธ(๐…๐‘ž)

chooses secret ๐’‚ โˆˆ ๐™ chooses secret ๐’ƒ โˆˆ ๐™

computes ๐’‚๐‘ƒ computes ๐’ƒ๐‘ƒreceives receivescomputes ๐’‚ ๐’ƒ๐‘ƒ = ๐’‚๐’ƒ๐‘ƒ computes ๐’ƒ ๐’‚๐‘ƒ = ๐’‚๐’ƒ๐‘ƒ

(Example: Diffie-Hellman key exchange.)

Victor Miller

Neal Koblitz

Page 20: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Generic methods for efficientscalar multiplication

Page 21: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Efficient scalar multiplication

The most important operation in both(discrete-log based) elliptic curve cryptography,the elliptic curve method for integer factorization,

is scalar multiplication: given a point ๐‘ƒ and a positive integer ๐‘Ž, compute

๐‘Ž๐‘ƒ โ‰” ๐‘ƒ + ๐‘ƒ +โ‹ฏ+ ๐‘ƒ

๐‘Ž times.

Note: adding ๐‘ƒ consecutively to itself ๐‘Ž โˆ’ 1 times is not an option!

in practice ๐‘Ž consists of hundreds of bits!

Page 22: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Efficient scalar multiplication: double-and-add

Much better idea: double-and-add, walking through the binary expansion of ๐‘Ž.

Toy example: replace the 15 additions in

16๐‘ƒ = ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ + ๐‘ƒ

by the 4 doublings in

16๐‘ƒ = 2 2 2 2๐‘ƒ .

General method:

๐‘Ž = 101100010โ€ฆ0101 ๐‘ท

double

๐Ÿ๐‘ท

double and add

๐Ÿ ๐Ÿ๐‘ท + ๐‘ท

double and add

๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท

double

๐Ÿ(๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท)

double

๐Ÿ(๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท )

double

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท

double and add

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท + ๐‘ท

double

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท + ๐‘ท + ๐‘ท + ๐‘ท

Exercise: verify that this computes ๐‘Ž๐‘ƒ using ๐‘‚(log ๐‘Ž) additions or doublings, as opposed to ๐‘‚(๐‘Ž).(Hornerโ€™s rule, basically.)

Page 23: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Warning: finding the most optimal chain of additions and doublings to compute ๐‘Ž๐‘ƒ is a very difficult combinatorial problem.

We donโ€™t want to spend more time on it than on computing ๐‘Ž๐‘ƒ itself!

Efficient scalar multiplication: double-and-add

Asymptotically this is as good as we can expectโ€ฆ

โ€ฆ but in practice, considerable speed-ups over naive double-and-add are possible!

Example: double-and-add computes 15๐‘ƒ as

๐‘ƒ, 2๐‘ƒ, 3๐‘ƒ, 6๐‘ƒ, 7๐‘ƒ, 14๐‘ƒ, 15๐‘ƒ.

However it would have been more efficient to compute it as

๐‘ƒ, 2๐‘ƒ, 3๐‘ƒ, 6๐‘ƒ, 12๐‘ƒ, 15๐‘ƒ

Page 24: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

๐Ÿ๐‘ท

Efficient scalar multiplication: windowing

In double-and-add, processing a 0 (doubling) is less costly than processing a 1 (doubling and adding ๐‘ƒ). Is there a structural way of reducing the number of additions?

Example with ๐‘ค = 2:

๐‘Ž = 101100010โ€ฆ0101 ๐Ÿ’ ๐Ÿ๐‘ท + ๐Ÿ‘๐‘ท

quadruple and add ๐Ÿ‘๐‘ท

๐Ÿ’(๐Ÿ’ ๐Ÿ๐‘ท + ๐Ÿ‘๐‘ท)

quadruple

๐Ÿ’ ๐Ÿ’ ๐Ÿ’ ๐Ÿ๐‘ท + ๐Ÿ‘๐‘ท + ๐‘ท

quadruple and add ๐‘ทRequires precomputation of ๐‘ƒ,โ€ฆ , 2๐‘คโˆ’1๐‘ƒ which grows exponentially with ๐‘ค.

Method can be spiced up by allowing the window to slide to the next window starting with a 1.

One idea to achieve this: windowing, which is the same as double-and-add, but we now processblocks (= windows ) of ๐‘ค bits in one time.

Page 25: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Efficient scalar multiplication: signed digitsRecall that on a Weierstrass elliptic curve, inverting a point is quasi cost-free:

โˆ’ ๐‘ฅ, ๐‘ฆ = (๐‘ฅ,โˆ’๐‘ฆ).

Idea: use negative digits in the expansion, at the benefit of having more 0โ€™s.

The non-adjacent form (NAF) of an integer ๐‘Ž is a base 2 expansion-> with digits taken from {โˆ’1,0,1}-> in which no two consecutive digits are non-zero.

Such an expansion always exists, is unique, and easy to find.

๐‘ท

double

๐Ÿ๐‘ท

double

๐Ÿ ๐Ÿ๐‘ท

double and subtract

๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท

double

๐Ÿ(๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท)

double and subtract

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท โˆ’ ๐‘ท

double

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท โˆ’ ๐‘ท

double and add

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท โˆ’ ๐‘ท + ๐‘ท

double

๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ ๐Ÿ๐‘ท โˆ’ ๐‘ท โˆ’ ๐‘ท + ๐‘ท๐‘Ž = 1 0 0 -1 0 -1 0 1 0 โ€ฆ 0 1 0 0 1

This method also comes in a windowing version (๐‘ค-NAF).

Page 26: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Efficient scalar multiplication

Tons of variations to the foregoing ideas have been investigated and proposed.

Some examples (far from exhaustive!):

Work with respect to base 3 and use an expansion with digits โˆˆ {โˆ’1,0,1}.(Requires a tripling formula.)

If ๐‘ƒ has a known finite order ๐‘›, check if ๐‘Ž ยฑ ๐œ†๐‘› has better properties for some small ๐œ† โˆˆ ๐™.

Multi-exponentiation: efficient methods for computing a ๐™-linear combination ฯƒ๐‘– ๐‘Ž๐‘–๐‘ƒ๐‘–.

Exercise: find a smarter way to compute ๐‘Ž๐‘ƒ + ๐‘๐‘„ than first computing ๐‘Ž๐‘ƒ, ๐‘๐‘„ separately.

Page 27: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Caution with double-and-add and its variants

When working through the digits of the scalar

๐‘Ž = 110100110101100010โ€ฆ1110,

an attacker might notice differences betweenprocessing a 0 and processing a 1. Parameters he can monitor are time, power consumption, noise, โ€ฆ

If one is uncareful then this will give away ๐’‚ for free!Huge threat, unless ๐‘Ž is public anyway (as in signature verification).

Countermeasures:

Adding unnecessary computations, using uniform addition formulas, โ€ฆ but the problem is somewhat inherent to double-and-add.

Use a Montgomery ladder for scalar multiplication.

Page 28: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Elliptic-curve-specificspeed-ups

Page 29: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Using projective coordinatesRemember the addition resp. doubling formula for Weierstrass curve arithmetic:

แ‰Š๐‘ฅ3 = ๐œ†2 โˆ’ ๐‘ฅ1 โˆ’ ๐‘ฅ2๐‘ฆ3 = โˆ’๐‘ฆ1 โˆ’ ๐œ†(๐‘ฅ3 โˆ’ ๐‘ฅ1)

where ๐œ† =๐‘ฆ2โˆ’๐‘ฆ1

๐‘ฅ2โˆ’๐‘ฅ1resp. ๐œ† =

3๐‘ฅ12+2๐ด๐‘ฅ1

2๐‘ฆ1.

Each step in the addition/subtraction chain requires a computation of ๐œ†, which involves a costlyfield inversion.

Way around: use projective coordinates, computing

๐‘ƒ3 = (๐‘ฅ3: ๐‘ฆ3: ๐‘ง3) from ๐‘ƒ1 = ๐‘ฅ1: ๐‘ฆ1: ๐‘ง1 and ๐‘ƒ2 = ๐‘ฅ2: ๐‘ฆ2: ๐‘ง2 .

Resulting formulas are inversion-free and even less case distinctive!

At the end of the double-and-add iteration, we can do a single inversion of the ๐‘ง-coordinate to finda point of the form ๐‘ฅ, ๐‘ฆ = (๐‘ฅ: ๐‘ฆ: 1), as wanted.

Page 30: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Using projective coordinates

Formulas for this are easy to establish: replace ๐‘ฅ1 โ†๐‘ฅ1

๐‘ง1, ๐‘ฆ1 โ†

๐‘ฆ1

๐‘ง1, ๐‘ฅ2 โ†

๐‘ฅ2

๐‘ง2, ๐‘ฆ2 โ†

๐‘ฆ2

๐‘ง2and put on

common denominators. For example in the case of addition this gives:

๐‘ƒ3 = ( ๐‘ฅ2๐‘ง1 โˆ’ ๐‘ฅ1๐‘ง2 ๐‘ฆ2๐‘ง1 โˆ’ ๐‘ฆ1๐‘ง22๐‘ง1๐‘ง2 โˆ’ ๐‘ฅ2๐‘ง1 + ๐‘ฅ1๐‘ง2 ๐‘ฅ2๐‘ง1 โˆ’ ๐‘ฅ1๐‘ง2

3: โ€ฆ : ๐‘ฅ2๐‘ง1 โˆ’ ๐‘ฅ1๐‘ง23๐‘ง1๐‘ง2).

Looks ugly, but is more efficient!

Remember the addition resp. doubling formula for Weierstrass curve arithmetic:

แ‰Š๐‘ฅ3 = ๐œ†2 โˆ’ ๐‘ฅ1 โˆ’ ๐‘ฅ2๐‘ฆ3 = โˆ’๐‘ฆ1 โˆ’ ๐œ†(๐‘ฅ3 โˆ’ ๐‘ฅ1)

where ๐œ† =๐‘ฆ2โˆ’๐‘ฆ1

๐‘ฅ2โˆ’๐‘ฅ1resp. ๐œ† =

3๐‘ฅ12+2๐ด๐‘ฅ1

2๐‘ฆ1.

Each step in the addition/subtraction chain requires a computation of ๐œ†, which involves a costlyfield inversion.

Literature contains various clever ways of evaluating these formulas efficiently.Useful other types of homogeneous coordinates (e.g. weighted).

Page 31: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Other formulasThe formulas for addition and doubling on a Weierstrass curve are not unique. Using the identities

๐‘ฆ12 = ๐‘ฅ1

3 + ๐ด๐‘ฅ1 + ๐ต and ๐‘ฆ22 = ๐‘ฅ2

3 + ๐ด๐‘ฅ2 + ๐ต,

it is possible to rewrite them.

One possibility: obtain a single formula that works for both addition and doubling! Interestingagainst side-channel attacks. Example:

๐‘ฅ3 =๐‘ฅ1๐‘ฅ2 โˆ’ 2๐ด ๐‘ฅ1๐‘ฅ2 โˆ’ 4๐ต ๐‘ฅ1 + ๐‘ฅ2 + ๐ด2

๐‘ฅ1๐‘ฅ2 + ๐ด ๐‘ฅ1 + ๐‘ฅ2 + 2๐‘ฆ1๐‘ฆ2 + 2๐ต

๐‘ฆ3 =๐‘ฅ1๐‘ฅ2 ๐‘ฅ1 + ๐‘ฅ2 โˆ’ ๐‘ฅ3 ๐‘ฅ1 + ๐‘ฅ2

2 โˆ’ ๐‘ฅ1๐‘ฅ2 + ๐ด โˆ’ ๐‘ฆ1๐‘ฆ2 โˆ’ ๐ต

๐‘ฆ1 + ๐‘ฆ2

Remark: new exceptional point pairs will appear, but they are less likely to be hit by anaddition/subtraction chain.

Page 32: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Other curve shapes

Weierstrass curves are not the only shapes of elliptic curves that have been studied! Among themother cubics: Hessian curves, Montgomery curves, โ€ฆ

But itโ€™s worth even leaving the realm of cubics! Annoying feature for this talk: arithmetic is no longer using tangents and chords.

Most prominent example: if char ๐‘˜ โ‰  2 then we can consider the (twisted) Edwards curves

๐‘Ž๐‘ฅ2 + ๐‘ฆ2 = 1 + ๐‘‘๐‘ฅ2๐‘ฆ2

where ๐‘Ž, ๐‘‘ โˆˆ ๐‘˜ satisfy ๐‘Ž๐‘‘ ๐‘Ž โˆ’ ๐‘‘ โ‰  0 and ๐‘‚ = (0,1). It admits the amazing addition formula

๐‘ฅ1, ๐‘ฆ1 + ๐‘ฅ2, ๐‘ฆ2 =๐‘ฅ1๐‘ฆ2 + ๐‘ฆ1๐‘ฅ2

1 + ๐‘‘๐‘ฅ1๐‘ฅ2๐‘ฆ1๐‘ฆ2,๐‘ฆ1๐‘ฆ2 โˆ’ ๐‘Ž๐‘ฅ1๐‘ฅ21 โˆ’ ๐‘‘๐‘ฅ1๐‘ฅ2๐‘ฆ1๐‘ฆ2

,

which are very efficient and can be used for doubling as well (uniformity).

Page 33: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Other curve shapes

A priori annoying aspect of Edwards curves: there are two singular points at infinity, each of whichsecretly corresponds to two points on the complete non-singular model.

But in fact this is a feature!

If ๐‘Ž is a non-zero square and ๐‘‘ is a non-square, then these four points are not defined over ๐‘˜.

Therefore they are never encountered duringarithmetic over ๐‘˜, or in other words we have an entirely affine group structure.

๐‘Ž๐‘ฅ2 + ๐‘ฆ2 = 1 + ๐‘‘๐‘ฅ2๐‘ฆ2

Moreover, the addition formula is complete in this case, i.e. it has no exceptional points.

Page 34: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

๐’™-coordinate only arithmetic and the Montgomery ladder

As we have observed earlier:

๐‘ƒ and ๐‘„ have the same ๐‘ฅ-coordinate โ‡” ๐‘ƒ = ยฑ๐‘„

Therefore the ๐‘ฅ-coordinate of ๐‘Ž๐‘ƒ only depends on the ๐‘ฅ-coordinate of ๐‘ƒ, so it should be possibleto compute it without any involvement of ๐‘ฆ-coordinates.

Problem: every double-and-add routine involves addition steps, and there the idea breaks down: ๐‘ฅ(๐‘ƒ) and ๐‘ฅ(๐‘„) do not suffice to find ๐‘ฅ(๐‘ƒ + ๐‘„).

Page 35: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

๐’™-coordinate only arithmetic and the Montgomery ladder

But it is true that ๐‘ฅ(๐‘ƒ + ๐‘„) is determined by ๐‘ฅ ๐‘ƒ , ๐‘ฅ(๐‘„) and ๐‘ฅ(๐‘ƒ โˆ’ ๐‘„).

Peter L. Montgomery

Montgomery found a way to exploit this: recursively compute

๐‘ฅ ๐‘Ž๐‘ƒ , ๐‘ฅ( ๐‘Ž + 1 ๐‘ƒ) from ๐‘ฅ๐‘Ž

2๐‘ƒ , ๐‘ฅ(

๐‘Ž

2+ 1 ๐‘ƒ)

using one doubling and one appropriate addition. Note that ๐‘ฅ(๐‘ƒ) is known.

Very fast.Very uniform: good against side-channel attacks.Possible to recover the ๐‘ฆ-coordinate from the end result (Lopez-Dahab).Comes in projective version: coordinates ๐‘ฅ: ๐‘ง โˆˆ ๐‘ƒ1(๐‘˜).Montgomery chose a more efficient curve form: ๐ต๐‘ฆ2 = ๐‘ฅ3 + ๐ด๐‘ฅ2 + ๐‘ฅ

Page 36: Elliptic curve arithmetic - ECC 2017Elliptic curve arithmetic Wouter Castryck ECC school, Nijmegen, 9-11 November 2017 ... The concrete type of elliptic curves found by Weierstrass

Questions?