Go to the documentation of this file.
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
41 #if (X448_SUPPORT == ENABLED || ED448_SUPPORT == ENABLED)
58 for(i = 1; i < 14; i++)
78 for(temp = 0, i = 0; i < 14; i++)
82 r[i] = temp & 0xFFFFFFFF;
104 for(temp =
b, i = 0; i < 14; i++)
107 r[i] = temp & 0xFFFFFFFF;
129 for(temp = -1, i = 0; i < 7; i++)
133 r[i] = temp & 0xFFFFFFFF;
137 for(temp -= 1, i = 7; i < 14; i++)
141 r[i] = temp & 0xFFFFFFFF;
170 for(i = 0; i < 7; i++)
173 r[i] = temp & 0xFFFFFFFF;
177 for(temp -= 1, i = 7; i < 14; i++)
180 r[i] = temp & 0xFFFFFFFF;
212 for(i = 0; i < 28; i++)
218 for(j = 0; j <= i; j++)
220 temp += (uint64_t)
a[j] *
b[i - j];
228 for(j = i - 13; j < 14; j++)
230 temp += (uint64_t)
a[j] *
b[i - j];
237 u[i] = temp & 0xFFFFFFFF;
240 temp =
c & 0xFFFFFFFF;
245 for(temp = 0, i = 0; i < 7; i++)
250 u[i] = temp & 0xFFFFFFFF;
254 for(i = 7; i < 14; i++)
258 temp += (uint64_t)
u[i + 14] << 1;
259 u[i] = temp & 0xFFFFFFFF;
264 for(
c = temp, i = 0; i < 7; i++)
267 u[i] = temp & 0xFFFFFFFF;
271 for(temp +=
c, i = 7; i < 14; i++)
274 u[i] = temp & 0xFFFFFFFF;
298 for(temp = 0, i = 0; i < 14; i++)
300 temp += (uint64_t)
a[i] *
b;
301 u[i] = temp & 0xFFFFFFFF;
306 for(
c = temp, i = 0; i < 7; i++)
309 u[i] = temp & 0xFFFFFFFF;
313 for(temp +=
c, i = 7; i < 14; i++)
316 u[i] = temp & 0xFFFFFFFF;
353 for(i = 1; i <
n; i++)
374 for(temp = 1, i = 0; i < 7; i++)
377 b[i] = temp & 0xFFFFFFFF;
381 for(temp += 1, i = 7; i < 14; i++)
384 b[i] = temp & 0xFFFFFFFF;
389 h += (uint32_t) temp - 1;
532 for(i = 0; i < 14; i++)
556 for(i = 0; i < 14; i++)
559 dummy =
mask & (
a[i] ^
b[i]);
584 for(i = 0; i < 14; i++)
608 for(i = 0; i < 14; i++)
615 return ((uint32_t) (
mask | (~
mask + 1))) >> 31;
633 for(i = 0; i < 14; i++)
651 for(i = 0; i < 14; i++)
Curve448 elliptic curve (constant-time implementation)
void curve448Select(uint32_t *r, const uint32_t *a, const uint32_t *b, uint32_t c)
Select an integer.
void curve448Export(uint32_t *a, uint8_t *data)
Export an octet string.
void curve448Copy(uint32_t *a, const uint32_t *b)
Copy an integer.
void curve448MulInt(uint32_t *r, const uint32_t *a, uint32_t b)
Modular multiplication.
void curve448SubInt(uint32_t *r, const uint32_t *a, uint32_t b)
Modular subtraction.
#define osMemcpy(dest, src, length)
void curve448Import(uint32_t *a, const uint8_t *data)
Import an octet string.
void curve448Inv(uint32_t *r, const uint32_t *a)
Modular multiplicative inverse.
void curve448Pwr2(uint32_t *r, const uint32_t *a, uint_t n)
Raise an integer to power 2^n.
void curve448Sqr(uint32_t *r, const uint32_t *a)
Modular squaring.
General definitions for cryptographic algorithms.
void curve448SetInt(uint32_t *a, uint32_t b)
Set integer value.
void curve448Swap(uint32_t *a, uint32_t *b, uint32_t c)
Conditional swap.
uint32_t curve448Sqrt(uint32_t *r, const uint32_t *a, const uint32_t *b)
Compute the square root of (A / B) modulo p.
void curve448Add(uint32_t *r, const uint32_t *a, const uint32_t *b)
Modular addition.
void curve448Sub(uint32_t *r, const uint32_t *a, const uint32_t *b)
Modular subtraction.
void curve448Red(uint32_t *r, const uint32_t *a, uint32_t h)
Modular reduction.
void curve448AddInt(uint32_t *r, const uint32_t *a, uint32_t b)
Modular addition.
uint32_t curve448Comp(const uint32_t *a, const uint32_t *b)
Compare integers.
__weak_func void curve448Mul(uint32_t *r, const uint32_t *a, const uint32_t *b)
Modular multiplication.