From 04ebd4e17e1de9a5baa65113cce57817b05ae6f8 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 12 Feb 2018 14:03:36 +0000 Subject: [PATCH] Some style fixes Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/5105) --- crypto/ec/curve448/eddsa.c | 19 ++++++++++--------- crypto/ec/curve448/f_generic.c | 3 +-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crypto/ec/curve448/eddsa.c b/crypto/ec/curve448/eddsa.c index 22b70c3c5a..aac8a9e728 100644 --- a/crypto/ec/curve448/eddsa.c +++ b/crypto/ec/curve448/eddsa.c @@ -29,8 +29,8 @@ static c448_error_t oneshot_hash(uint8_t *out, size_t outlen, return C448_FAILURE; if (!EVP_DigestInit_ex(hashctx, EVP_shake256(), NULL) - || !EVP_DigestUpdate(hashctx, in, inlen) - || !EVP_DigestFinalXOF(hashctx, out, outlen)) { + || !EVP_DigestUpdate(hashctx, in, inlen) + || !EVP_DigestFinalXOF(hashctx, out, outlen)) { EVP_MD_CTX_free(hashctx); return C448_FAILURE; } @@ -69,9 +69,9 @@ static c448_error_t hash_init_with_dom(EVP_MD_CTX *hashctx, uint8_t prehashed, return C448_FAILURE; if (!EVP_DigestInit_ex(hashctx, EVP_shake256(), NULL) - || !EVP_DigestUpdate(hashctx, dom_s, strlen(dom_s)) - || !EVP_DigestUpdate(hashctx, dom, sizeof(dom)) - || !EVP_DigestUpdate(hashctx, context, context_len)) + || !EVP_DigestUpdate(hashctx, dom_s, strlen(dom_s)) + || !EVP_DigestUpdate(hashctx, dom, sizeof(dom)) + || !EVP_DigestUpdate(hashctx, context, context_len)) return C448_FAILURE; return C448_SUCCESS; @@ -165,10 +165,11 @@ c448_error_t c448_ed448_sign( /* Hash to create the nonce */ if (!hash_init_with_dom(hashctx, prehashed, 0, context, context_len) - || !EVP_DigestUpdate(hashctx, expanded + EDDSA_448_PRIVATE_BYTES, - EDDSA_448_PRIVATE_BYTES) - || !EVP_DigestUpdate(hashctx, message, message_len)) { - OPENSSL_cleanse(expanded, sizeof(expanded)); + || !EVP_DigestUpdate(hashctx, + expanded + EDDSA_448_PRIVATE_BYTES, + EDDSA_448_PRIVATE_BYTES) + || !EVP_DigestUpdate(hashctx, message, message_len)) { + OPENSSL_cleanse(expanded, sizeof(expanded)); goto err; } OPENSSL_cleanse(expanded, sizeof(expanded)); diff --git a/crypto/ec/curve448/f_generic.c b/crypto/ec/curve448/f_generic.c index e779f22335..81c75761a8 100644 --- a/crypto/ec/curve448/f_generic.c +++ b/crypto/ec/curve448/f_generic.c @@ -159,9 +159,8 @@ mask_t gf_eq(const gf a, const gf b) gf_sub(c, a, b); gf_strong_reduce(c); - for (i = 0; i < NLIMBS; i++) { + for (i = 0; i < NLIMBS; i++) ret |= c->limb[LIMBPERM(i)]; - } return word_is_zero(ret); } -- GitLab