forked from wolfSSL/wolfssl
Removed unnecessary comments and added HashInit's and checked that they returned errors when they should
This commit is contained in:
41
tests/api.c
41
tests/api.c
@ -22676,7 +22676,6 @@ static int test_wc_HashInit(void)
|
|||||||
|
|
||||||
/* For loop to test various arguments... */
|
/* For loop to test various arguments... */
|
||||||
for (i = 0; i < enumlen; i++) {
|
for (i = 0; i < enumlen; i++) {
|
||||||
//printf("%d", i);
|
|
||||||
/* check for bad args */
|
/* check for bad args */
|
||||||
if (wc_HashInit(&hash, enumArray[i]) == BAD_FUNC_ARG) {
|
if (wc_HashInit(&hash, enumArray[i]) == BAD_FUNC_ARG) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
@ -22711,8 +22710,6 @@ static int test_wc_HashSetFlags(void)
|
|||||||
wc_HashAlg hash;
|
wc_HashAlg hash;
|
||||||
word32 flags = 0;
|
word32 flags = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
//byte data[FOURK_BUF];
|
|
||||||
//byte hashBuf[WC_MAX_DIGEST_SIZE];
|
|
||||||
printf(testingFmt, "wc_HashSetFlags()");
|
printf(testingFmt, "wc_HashSetFlags()");
|
||||||
|
|
||||||
|
|
||||||
@ -22771,23 +22768,26 @@ static int test_wc_HashSetFlags(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wc_HashFree(&hash, enumArray[i]);
|
wc_HashFree(&hash, enumArray[i]);
|
||||||
if (ret != 0) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
/* For loop to test not supported cases */
|
||||||
/* For loop to test not supported sites */
|
|
||||||
int notSupportedLen = (sizeof(notSupported)/sizeof(enum wc_HashType));
|
int notSupportedLen = (sizeof(notSupported)/sizeof(enum wc_HashType));
|
||||||
for (j = 0; j < notSupportedLen; j++){
|
for (j = 0; j < notSupportedLen; j++){
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
ret = wc_HashInit(&hash, notSupported[j]);
|
||||||
|
if (ret == BAD_FUNC_ARG){
|
||||||
|
ret = 0;
|
||||||
|
if (ret == 0){
|
||||||
ret = wc_HashSetFlags(&hash, notSupported[j], flags);
|
ret = wc_HashSetFlags(&hash, notSupported[j], flags);
|
||||||
if (ret == BAD_FUNC_ARG) {
|
if (ret == BAD_FUNC_ARG) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wc_HashFree(&hash, notSupported[j]);
|
}
|
||||||
if (ret != 0) {
|
}
|
||||||
break;
|
ret = wc_HashFree(&hash, notSupported[j]);
|
||||||
|
if (ret == BAD_FUNC_ARG) {
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -22807,8 +22807,6 @@ static int test_wc_HashGetFlags(void)
|
|||||||
wc_HashAlg hash;
|
wc_HashAlg hash;
|
||||||
word32 flags = 0;
|
word32 flags = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
//byte data[FOURK_BUF];
|
|
||||||
//byte hashBuf[WC_MAX_DIGEST_SIZE];
|
|
||||||
printf(testingFmt, "wc_HashGetFlags()");
|
printf(testingFmt, "wc_HashGetFlags()");
|
||||||
|
|
||||||
|
|
||||||
@ -22868,20 +22866,27 @@ static int test_wc_HashGetFlags(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* For loop to test not supported sites */
|
/* For loop to test not supported cases */
|
||||||
int notSupportedLen = (sizeof(notSupported)/sizeof(enum wc_HashType));
|
int notSupportedLen = (sizeof(notSupported)/sizeof(enum wc_HashType));
|
||||||
for (j = 0; j < notSupportedLen; j++) {
|
for (j = 0; j < notSupportedLen; j++){
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
ret = wc_HashInit(&hash, notSupported[j]);
|
||||||
|
if (ret == BAD_FUNC_ARG){
|
||||||
|
ret = 0;
|
||||||
|
if (ret == 0){
|
||||||
ret = wc_HashGetFlags(&hash, notSupported[j], &flags);
|
ret = wc_HashGetFlags(&hash, notSupported[j], &flags);
|
||||||
if (ret == BAD_FUNC_ARG) {
|
if (ret == BAD_FUNC_ARG) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wc_HashFree(&hash, notSupported[j]);
|
|
||||||
if (ret != 0) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ret = wc_HashFree(&hash, notSupported[j]);
|
||||||
|
if (ret == BAD_FUNC_ARG) {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
printf(resultFmt, ret == 0 ? passed : failed);
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user