diff options
author | Matt Caswell <matt@openssl.org> | 2018-02-07 13:40:56 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-02-20 12:59:31 +0000 |
commit | 9c9d6ff41c7cbd6c551bd056bf9cc06390de8290 (patch) | |
tree | 966facfffb20948c4c40c70d7d998a2933da9ac3 /crypto/ec/curve448/eddsa.c | |
parent | a7232276fef30a63070fd9dbb53d3820d3761d5b (diff) |
Simplify some code
The original curve448 code was templated to allow for a 25519
implementation. We've just imported the 448 stuff - but a remnant of
the original templated approach remained. This just simplifies that.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5105)
Diffstat (limited to 'crypto/ec/curve448/eddsa.c')
-rw-r--r-- | crypto/ec/curve448/eddsa.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/crypto/ec/curve448/eddsa.c b/crypto/ec/curve448/eddsa.c index 92892f305d..7175715703 100644 --- a/crypto/ec/curve448/eddsa.c +++ b/crypto/ec/curve448/eddsa.c @@ -40,17 +40,9 @@ static c448_error_t oneshot_hash(uint8_t *out, size_t outlen, static void clamp(uint8_t secret_scalar_ser[EDDSA_448_PRIVATE_BYTES]) { - uint8_t hibit = (1 << 0) >> 1; - - /* Blarg */ secret_scalar_ser[0] &= -COFACTOR; - if (hibit == 0) { - secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 1] = 0; - secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80; - } else { - secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 1] &= hibit - 1; - secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 1] |= hibit; - } + secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 1] = 0; + secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80; } static c448_error_t hash_init_with_dom(EVP_MD_CTX *hashctx, uint8_t prehashed, |