Jenkins fixes.

This commit is contained in:
jrblixt 2017-05-19 14:37:51 -06:00
parent 47b0a62c88
commit 0e22752af4
2 changed files with 26 additions and 10 deletions

View File

@ -4473,13 +4473,14 @@ static int test_wc_Md5HmacFinal (void)
}
}
#ifndef HAVE_FIPS
if (!flag) {
ret = wc_HmacFinal(&hmac, NULL);
if (ret != BAD_FUNC_ARG) {
flag = SSL_FATAL_ERROR;
}
}
#endif
printf(resultFmt, flag == 0 ? passed : failed);
#endif
@ -4544,13 +4545,14 @@ static int test_wc_ShaHmacFinal (void)
}
}
#ifndef HAVE_FIPS
if (!flag) {
ret = wc_HmacFinal(&hmac, NULL);
if (ret != BAD_FUNC_ARG) {
flag = SSL_FATAL_ERROR;
}
}
#endif
printf(resultFmt, flag == 0 ? passed : failed);
#endif
@ -4616,13 +4618,14 @@ static int test_wc_Sha224HmacFinal (void)
}
}
#ifndef HAVE_FIPS
if (!flag) {
ret = wc_HmacFinal(&hmac, NULL);
if (ret != BAD_FUNC_ARG) {
flag = SSL_FATAL_ERROR;
}
}
#endif
printf(resultFmt, flag == 0 ? passed : failed);
#endif
@ -4687,13 +4690,14 @@ static int test_wc_Sha256HmacFinal (void)
}
}
#ifndef HAVE_FIPS
if (!flag) {
ret = wc_HmacFinal(&hmac, NULL);
if (ret != BAD_FUNC_ARG) {
flag = SSL_FATAL_ERROR;
}
}
#endif
printf(resultFmt, flag == 0 ? passed : failed);
#endif
@ -4758,14 +4762,14 @@ static int test_wc_Sha384HmacFinal (void)
flag = SSL_FATAL_ERROR;
}
}
#ifndef HAVE_FIPS
if (!flag) {
ret = wc_HmacFinal(&hmac, NULL);
if (ret != BAD_FUNC_ARG) {
flag = SSL_FATAL_ERROR;
}
}
#endif
printf(resultFmt, flag == 0 ? passed : failed);
#endif

View File

@ -25,6 +25,7 @@
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#ifndef NO_HMAC
@ -43,14 +44,28 @@
/* does init */
int wc_HmacSetKey(Hmac* hmac, int type, const byte* key, word32 keySz)
{
if (hmac == NULL || (key == NULL && keySz != 0) ||
!(type == MD5 || type == SHA || type == SHA256 || type == SHA384
|| type == SHA512 || type == BLAKE2B_ID)) {
return BAD_FUNC_ARG;
}
return HmacSetKey_fips(hmac, type, key, keySz);
}
int wc_HmacUpdate(Hmac* hmac, const byte* in, word32 sz)
{
if (hmac == NULL || in == NULL) {
return BAD_FUNC_ARG;
}
return HmacUpdate_fips(hmac, in, sz);
}
int wc_HmacFinal(Hmac* hmac, byte* out)
{
if (hmac == NULL) {
return BAD_FUNC_ARG;
}
return HmacFinal_fips(hmac, out);
}
int wolfSSL_GetHmacMaxSize(void)
@ -88,9 +103,6 @@
#else /* else build without fips */
#include <wolfssl/wolfcrypt/error-crypt.h>
#ifdef WOLFSSL_PIC32MZ_HASH
#define wc_InitMd5 wc_InitMd5_sw
#define wc_Md5Update wc_Md5Update_sw
@ -510,7 +522,7 @@ int wc_HmacUpdate(Hmac* hmac, const byte* msg, word32 length)
{
int ret = 0;
if (hmac == NULL || msg == NULL) {
if (hmac == NULL) {
return BAD_FUNC_ARG;
}