mirror of
https://github.com/neocturne/libuecc.git
synced 2025-03-04 09:03:31 +01:00
Use the same key sanitization as Curve25519
This commit is contained in:
parent
f1d5eb1da9
commit
f67c3f36b9
1 changed files with 3 additions and 2 deletions
|
@ -176,12 +176,13 @@ void ecc_25519_secret_mult(ecc_secret_key_256 *out, const ecc_secret_key_256 *in
|
|||
montgomery(out->s, R, C);
|
||||
}
|
||||
|
||||
/* TODO implement properly, rule out zero etc. */
|
||||
void ecc_25519_secret_sanitize(ecc_secret_key_256 *out, const ecc_secret_key_256 *in) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
out->s[i] = in->s[i];
|
||||
|
||||
out->s[31] |= 0x80;
|
||||
out->s[0] &= 0xf8;
|
||||
out->s[31] &= 0x7f;
|
||||
out->s[31] |= 0x40;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue