From 289f60e2c9881aad5e8c24f8caa32532f39debda Mon Sep 17 00:00:00 2001 From: jrblixt Date: Tue, 16 May 2017 10:04:30 -0600 Subject: [PATCH] Changes from Todd's code review. --- src/keys.c | 6 +++--- wolfcrypt/src/sha256.c | 10 +++++----- wolfcrypt/src/sha512.c | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/keys.c b/src/keys.c index 8ef2285f8..92b03d651 100644 --- a/src/keys.c +++ b/src/keys.c @@ -1153,7 +1153,7 @@ int SetCipherSpecs(WOLFSSL* ssl) } } - if (ssl->options.cipherSuite0 != ECC_BYTE && + if (ssl->options.cipherSuite0 != ECC_BYTE && ssl->options.cipherSuite0 != CHACHA_BYTE && ssl->options.cipherSuite0 != TLS13_BYTE) { /* normal suites */ switch (ssl->options.cipherSuite) { @@ -3108,7 +3108,7 @@ int DeriveKeys(WOLFSSL* ssl) XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN); idx += RAN_LEN; XMEMCPY(shaInput + idx, ssl->arrays->clientRandom, RAN_LEN); - if (ret == 0) { /* ret could be PREFIX_ERROR. */ + if (ret == 0) { ret = wc_ShaUpdate(sha, shaInput, (KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN) - KEY_PREFIX + j); } @@ -3237,7 +3237,7 @@ static int MakeSslMasterSecret(WOLFSSL* ssl) idx += RAN_LEN; XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN); idx += RAN_LEN; - if (ret == 0) { /* ret could be PREFIX_ERROR. */ + if (ret == 0) { ret = wc_ShaUpdate(sha, shaInput, idx); } if (ret == 0) { diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index e22406b64..d02290c15 100755 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -54,16 +54,16 @@ } int wc_Sha256Update(Sha256* sha, const byte* data, word32 len) { - if (sha == NULL || (data == NULL && len > 0)) { - return BAD_FUNC_ARG; + if (sha == NULL || (data == NULL && len > 0)) { + return BAD_FUNC_ARG; } return Sha256Update_fips(sha, data, len); } int wc_Sha256Final(Sha256* sha, byte* out) { - if (sha == NULL || out == NULL) { - return BAD_FUNC_ARG; - } + if (sha == NULL || out == NULL) { + return BAD_FUNC_ARG; + } return Sha256Final_fips(sha, out); } void wc_Sha256Free(Sha256* sha) diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index 40e8eb4e3..f011e2616 100755 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -36,9 +36,9 @@ #ifdef HAVE_FIPS int wc_InitSha512(Sha512* sha) { - if (sha == NULL) { - return BAD_FUNC_ARG; - } + if (sha == NULL) { + return BAD_FUNC_ARG; + } return InitSha512_fips(sha); } @@ -53,17 +53,17 @@ } int wc_Sha512Update(Sha512* sha, const byte* data, word32 len) { - if (sha == NULL || (data == NULL && len > 0)) { - return BAD_FUNC_ARG; - } + if (sha == NULL || (data == NULL && len > 0)) { + return BAD_FUNC_ARG; + } return Sha512Update_fips(sha, data, len); } int wc_Sha512Final(Sha512* sha, byte* out) { - if (sha == NULL || out == NULL) { - return BAD_FUNC_ARG; - } + if (sha == NULL || out == NULL) { + return BAD_FUNC_ARG; + } return Sha512Final_fips(sha, out); }