diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-06 17:15:08 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-06 17:15:08 +0000 |
commit | 5773d9e998e626328bf49a655d49df4810e6f980 (patch) | |
tree | 963502b686aeb0d5a250dcbc146e23fb15c0c59c /src/libcryptobox/curve25519 | |
parent | e8b71e4179c343e3707fb5a1b94dae6cc8b90681 (diff) | |
download | rspamd-5773d9e998e626328bf49a655d49df4810e6f980.tar.gz rspamd-5773d9e998e626328bf49a655d49df4810e6f980.zip |
Set curve25519 bits on keypair generation.
Diffstat (limited to 'src/libcryptobox/curve25519')
-rw-r--r-- | src/libcryptobox/curve25519/curve25519-donna-c64.c | 9 | ||||
-rw-r--r-- | src/libcryptobox/curve25519/curve25519-donna.c | 9 | ||||
-rw-r--r-- | src/libcryptobox/curve25519/ref.c | 9 |
3 files changed, 4 insertions, 23 deletions
diff --git a/src/libcryptobox/curve25519/curve25519-donna-c64.c b/src/libcryptobox/curve25519/curve25519-donna-c64.c index 2d693ee44..e6a5045ad 100644 --- a/src/libcryptobox/curve25519/curve25519-donna-c64.c +++ b/src/libcryptobox/curve25519/curve25519-donna-c64.c @@ -482,17 +482,10 @@ int curve25519 (u8 *, const u8 *, const u8 *); 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); diff --git a/src/libcryptobox/curve25519/curve25519-donna.c b/src/libcryptobox/curve25519/curve25519-donna.c index f9f19a632..e6a50b87f 100644 --- a/src/libcryptobox/curve25519/curve25519-donna.c +++ b/src/libcryptobox/curve25519/curve25519-donna.c @@ -894,17 +894,10 @@ static void crecip (limb *out, const limb *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); diff --git a/src/libcryptobox/curve25519/ref.c b/src/libcryptobox/curve25519/ref.c index ac3827c27..7e4820906 100644 --- a/src/libcryptobox/curve25519/ref.c +++ b/src/libcryptobox/curve25519/ref.c @@ -303,17 +303,12 @@ int curve25519 (unsigned char *q, const unsigned char *n, 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); |