int curve25519 (u8 *mypublic, const u8 *secret, const u8 *basepoint)
{
limb bp[5], x[5], z[5], zmone[5];
- uint8_t e[32];
int i;
- for (i = 0; i < 32; ++i)
- e[i] = secret[i];
- e[0] &= 248;
- e[31] &= 127;
- e[31] |= 64;
-
fexpand (bp, basepoint);
- cmult (x, z, e, bp);
+ cmult (x, z, secret, bp);
crecip (zmone, z);
fmul (z, x, zmone);
fcontract (mypublic, z);
int curve25519 (u8 *mypublic, const u8 *secret, const u8 *basepoint)
{
limb bp[10], x[10], z[11], zmone[10];
- uint8_t e[32];
int i;
- for (i = 0; i < 32; ++i)
- e[i] = secret[i];
- e[0] &= 248;
- e[31] &= 127;
- e[31] |= 64;
-
fexpand (bp, basepoint);
- cmult (x, z, e, bp);
+ cmult (x, z, secret, bp);
crecip (zmone, z);
fmul (z, x, zmone);
fcontract (mypublic, z);
const unsigned char *p)
{
unsigned int work[96];
- unsigned char e[32];
unsigned int i;
- for (i = 0; i < 32; ++i)
- e[i] = n[i];
- e[0] &= 248;
- e[31] &= 127;
- e[31] |= 64;
+
for (i = 0; i < 32; ++i)
work[i] = p[i];
work[31] &= 127;
- mainloop (work, e);
+ mainloop (work, n);
recip (work + 32, work + 32);
mult (work + 64, work, work + 32);
freeze (work + 64);