Changes from Todd's code review.

This commit is contained in:
jrblixt
2017-05-16 10:04:30 -06:00
parent 606aca9916
commit 289f60e2c9
3 changed files with 17 additions and 17 deletions

View File

@ -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 != CHACHA_BYTE &&
ssl->options.cipherSuite0 != TLS13_BYTE) { /* normal suites */ ssl->options.cipherSuite0 != TLS13_BYTE) { /* normal suites */
switch (ssl->options.cipherSuite) { switch (ssl->options.cipherSuite) {
@ -3108,7 +3108,7 @@ int DeriveKeys(WOLFSSL* ssl)
XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN); XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN);
idx += RAN_LEN; idx += RAN_LEN;
XMEMCPY(shaInput + idx, ssl->arrays->clientRandom, 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, ret = wc_ShaUpdate(sha, shaInput,
(KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN) - KEY_PREFIX + j); (KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN) - KEY_PREFIX + j);
} }
@ -3237,7 +3237,7 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
idx += RAN_LEN; idx += RAN_LEN;
XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN); XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN);
idx += RAN_LEN; idx += RAN_LEN;
if (ret == 0) { /* ret could be PREFIX_ERROR. */ if (ret == 0) {
ret = wc_ShaUpdate(sha, shaInput, idx); ret = wc_ShaUpdate(sha, shaInput, idx);
} }
if (ret == 0) { if (ret == 0) {

View File

@ -54,16 +54,16 @@
} }
int wc_Sha256Update(Sha256* sha, const byte* data, word32 len) int wc_Sha256Update(Sha256* sha, const byte* data, word32 len)
{ {
if (sha == NULL || (data == NULL && len > 0)) { if (sha == NULL || (data == NULL && len > 0)) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
} }
return Sha256Update_fips(sha, data, len); return Sha256Update_fips(sha, data, len);
} }
int wc_Sha256Final(Sha256* sha, byte* out) int wc_Sha256Final(Sha256* sha, byte* out)
{ {
if (sha == NULL || out == NULL) { if (sha == NULL || out == NULL) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
} }
return Sha256Final_fips(sha, out); return Sha256Final_fips(sha, out);
} }
void wc_Sha256Free(Sha256* sha) void wc_Sha256Free(Sha256* sha)

View File

@ -36,9 +36,9 @@
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
int wc_InitSha512(Sha512* sha) int wc_InitSha512(Sha512* sha)
{ {
if (sha == NULL) { if (sha == NULL) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
} }
return InitSha512_fips(sha); return InitSha512_fips(sha);
} }
@ -53,17 +53,17 @@
} }
int wc_Sha512Update(Sha512* sha, const byte* data, word32 len) int wc_Sha512Update(Sha512* sha, const byte* data, word32 len)
{ {
if (sha == NULL || (data == NULL && len > 0)) { if (sha == NULL || (data == NULL && len > 0)) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
} }
return Sha512Update_fips(sha, data, len); return Sha512Update_fips(sha, data, len);
} }
int wc_Sha512Final(Sha512* sha, byte* out) int wc_Sha512Final(Sha512* sha, byte* out)
{ {
if (sha == NULL || out == NULL) { if (sha == NULL || out == NULL) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
} }
return Sha512Final_fips(sha, out); return Sha512Final_fips(sha, out);
} }