|
iPXE
|
Weierstrass elliptic curves. More...
Go to the source code of this file.
Data Structures | |
| struct | weierstrass_curve |
| A Weierstrass elliptic curve. More... | |
Macros | |
| #define | WEIERSTRASS_AXES 2 |
| Number of axes in Weierstrass curve point representation. | |
| #define | WEIERSTRASS_MAX_MULT_LOG2 5 /* maximum reached is mod 20N */ |
| Maximum multiple of field prime encountered during calculations. | |
| #define | weierstrass_size(len) |
| Determine number of elements in scalar values for a Weierstrass curve. | |
| #define | weierstrass_t(size) |
| Define a Weierstrass projective co-ordinate type. | |
| #define | WEIERSTRASS_NUM_MONT 3 |
| Number of cached in Montgomery form for each Weierstrass curve. | |
| #define | WEIERSTRASS_NUM_CACHED |
| Number of cached big integers for each Weierstrass curve. | |
| #define | WEIERSTRASS_CURVE(_name, _curve, _len, _prime, _a, _b, _base, _order) |
| Define a Weierstrass curve. | |
Enumerations | |
| enum | weierstrass_multiple { WEIERSTRASS_N = 0 , WEIERSTRASS_2N , WEIERSTRASS_4N , WEIERSTRASS_NUM_MULTIPLES } |
| Indexes for stored multiples of the field prime. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| int | weierstrass_is_infinity (struct elliptic_curve *curve, const void *point) |
| Check if this is the point at infinity. | |
| int | weierstrass_multiply (struct elliptic_curve *curve, const void *base, const void *scalar, void *result) |
| Multiply curve point by scalar. | |
| int | weierstrass_add_once (struct elliptic_curve *curve, const void *addend, const void *augend, void *result) |
| Add curve points (as a one-off operation). | |
| void | weierstrass_share (struct exchange_algorithm *exchange, const void *private, void *public) |
| int | weierstrass_agree (struct exchange_algorithm *exchange, const void *private, const void *partner, void *shared) |
Weierstrass elliptic curves.
Definition in file weierstrass.h.
| #define WEIERSTRASS_AXES 2 |
Number of axes in Weierstrass curve point representation.
Definition at line 18 of file weierstrass.h.
Referenced by weierstrass_done_raw(), weierstrass_init_raw(), and weierstrass_is_infinity().
| #define WEIERSTRASS_MAX_MULT_LOG2 5 /* maximum reached is mod 20N */ |
Maximum multiple of field prime encountered during calculations.
Calculations are performed using values modulo a small multiple of the field prime, rather than modulo the field prime itself. This allows explicit reductions after additions, subtractions, and relaxed Montgomery multiplications to be omitted entirely, provided that we keep careful track of the field prime multiple for each intermediate value.
Relaxed Montgomery multiplication will produce a result in the range t < (1+(m^2)/k)N, where m is this maximum multiple of the field prime, and k is the constant in R > kN representing the leading zero padding in the big integer representation of the field prime. We choose to set k=m^2 so that multiplications will always produce a result in the range t < 2N.
A lower value of k would be possible, at the cost of having to keep track of the field prime multiples used at each multiplication input (rather than keeping track only of a single global maximum). This would gain nothing in practice: any value of k below around 2^32 will end up requiring just a single extra big integer element.
This is expressed as the base-two logarithm of the multiple (rounded up), to simplify compile-time calculations.
Definition at line 46 of file weierstrass.h.
| #define weierstrass_size | ( | len | ) |
Determine number of elements in scalar values for a Weierstrass curve.
| len | Length of field prime, in bytes |
| size | Number of elements |
Definition at line 54 of file weierstrass.h.
| #define weierstrass_t | ( | size | ) |
Define a Weierstrass projective co-ordinate type.
| size | Number of elements in scalar values |
| type | Projective co-ordinate type |
Definition at line 65 of file weierstrass.h.
Referenced by weierstrass_add_ladder(), weierstrass_add_once(), weierstrass_add_raw(), weierstrass_done_raw(), weierstrass_init_raw(), weierstrass_multiply(), and weierstrass_verify_raw().
| #define WEIERSTRASS_NUM_MONT 3 |
Number of cached in Montgomery form for each Weierstrass curve.
Definition at line 86 of file weierstrass.h.
Referenced by weierstrass_init_curve().
| #define WEIERSTRASS_NUM_CACHED |
Number of cached big integers for each Weierstrass curve.
Definition at line 89 of file weierstrass.h.
| #define WEIERSTRASS_CURVE | ( | _name, | |
| _curve, | |||
| _len, | |||
| _prime, | |||
| _a, | |||
| _b, | |||
| _base, | |||
| _order ) |
Define a Weierstrass curve.
Definition at line 148 of file weierstrass.h.
| enum weierstrass_multiple |
Indexes for stored multiples of the field prime.
| Enumerator | |
|---|---|
| WEIERSTRASS_N | |
| WEIERSTRASS_2N | |
| WEIERSTRASS_4N | |
| WEIERSTRASS_NUM_MULTIPLES | |
Definition at line 78 of file weierstrass.h.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
extern |
Check if this is the point at infinity.
| curve | Elliptic curve |
| point | Curve point |
| is_infinity | This is the point at infinity |
Definition at line 929 of file weierstrass.c.
References bigint_init, bigint_is_zero, bigint_ntoa, bigint_t, DBGC, len, weierstrass_curve::len, elliptic_curve::name, offset, elliptic_curve::priv, size, weierstrass_curve::size, and WEIERSTRASS_AXES.
|
extern |
Multiply curve point by scalar.
| rc | Return status code |
Definition at line 963 of file weierstrass.c.
References __attribute__, base, bigint_copy, bigint_init, bigint_ladder, bigint_ntoa, bigint_required_size, bigint_t, DBGC, len, weierstrass_curve::len, memset(), elliptic_curve::name, NULL, weierstrass_curve::one, elliptic_curve::priv, rc, result, size, weierstrass_curve::size, weierstrass_add_ladder(), weierstrass_done, weierstrass_init, and weierstrass_t.
|
extern |
Add curve points (as a one-off operation).
| curve | Elliptic curve |
| addend | Curve point to add |
| augend | Curve point to add |
| result | Curve point to hold result |
| rc | Return status code |
Definition at line 1011 of file weierstrass.c.
References elliptic_curve::priv, rc, result, size, weierstrass_curve::size, weierstrass_add, weierstrass_done, weierstrass_init, and weierstrass_t.
|
extern |
|
extern |
References partner.