Changes per Chris.

This commit is contained in:
jrblixt
2017-05-22 14:31:12 -06:00
parent 4d458831b7
commit edddd05226

View File

@ -3839,8 +3839,10 @@ static int test_wc_Des3_CbcEncryptDecrypt (void)
byte cipher[24]; byte cipher[24];
byte plain[24]; byte plain[24];
#elif defined(WOLFSSL_SMALL_STACK) #elif defined(WOLFSSL_SMALL_STACK)
byte* cipher = (byte*) malloc(sizeof(byte) * 24); byte* cipher = (byte*) XMALLOC(sizeof(byte) * 24, NULL,
byte* plain = (byte*) malloc(sizeof(byte) * 24); DYNAMIC_TYPE_TMP_BUFFER);
byte* plain = (byte*) XMALLOC(sizeof(byte) * 24, NULL,
DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif
int ret; int ret;
@ -3889,10 +3891,9 @@ static int test_wc_Des3_CbcEncryptDecrypt (void)
ret = wc_Des3_CbcEncrypt(&des, cipher, NULL, sizeof(vector)); ret = wc_Des3_CbcEncrypt(&des, cipher, NULL, sizeof(vector));
} }
if (ret != BAD_FUNC_ARG) { if (ret != BAD_FUNC_ARG) {
printf("\nReturn code: %d\n", ret); ret = SSL_FATAL_ERROR;;
ret = SSL_FAILURE;
} else { } else {
ret = 0; ret = 0;
} }
} }
@ -3905,8 +3906,7 @@ static int test_wc_Des3_CbcEncryptDecrypt (void)
ret = wc_Des3_CbcDecrypt(&des, plain, NULL, 24); ret = wc_Des3_CbcDecrypt(&des, plain, NULL, 24);
} }
if (ret != BAD_FUNC_ARG) { if (ret != BAD_FUNC_ARG) {
printf("\nReturn code: %d\n", ret); ret = SSL_FATAL_ERROR;
ret = SSL_FAILURE;
} else { } else {
ret = 0; ret = 0;
} }
@ -3915,8 +3915,8 @@ static int test_wc_Des3_CbcEncryptDecrypt (void)
printf(resultFmt, ret == 0 ? passed : failed); printf(resultFmt, ret == 0 ? passed : failed);
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(plain, NULL, DYNAMIC_TYPE_NONE); XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(cipher, NULL, DYNAMIC_TYPE_CIPHER); XFREE(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif
#endif #endif
return 0; return 0;
@ -3937,8 +3937,10 @@ static int test_wc_Des3_CbcEncryptDecryptWithKey (void)
byte cipher[24]; byte cipher[24];
byte plain[24]; byte plain[24];
#elif defined(WOLFSSL_SMALL_STACK) #elif defined(WOLFSSL_SMALL_STACK)
byte* cipher = (byte*) malloc(sizeof(byte) * 24); byte* cipher = (byte*) XMALLOC(sizeof(byte) * 24, NULL,
byte* plain = (byte*) malloc(sizeof(byte) * 24); DYNAMIC_TYPE_TMP_BUFFER);
byte* plain = (byte*) XMALLOC(sizeof(byte) * 24, NULL,
DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif
byte vector[] = /* Now is the time for all w/o trailing 0 */ byte vector[] = /* Now is the time for all w/o trailing 0 */
@ -3987,7 +3989,6 @@ static int test_wc_Des3_CbcEncryptDecryptWithKey (void)
key, NULL); key, NULL);
} else { } else {
/* Return code catch. */ /* Return code catch. */
printf("\nReturn code: %d\n", ret);
ret = SSL_FAILURE; ret = SSL_FAILURE;
} }
} }
@ -4003,7 +4004,6 @@ static int test_wc_Des3_CbcEncryptDecryptWithKey (void)
if (ret == BAD_FUNC_ARG) { if (ret == BAD_FUNC_ARG) {
ret = wc_Des3_CbcDecryptWithKey(plain, cipher, cipherSz, key, NULL); ret = wc_Des3_CbcDecryptWithKey(plain, cipher, cipherSz, key, NULL);
} else { } else {
printf("\nReturn code: %d\n", ret);
ret = SSL_FAILURE; ret = SSL_FAILURE;
} }
} }
@ -4011,8 +4011,8 @@ static int test_wc_Des3_CbcEncryptDecryptWithKey (void)
printf(resultFmt, ret == 0 ? passed : failed); printf(resultFmt, ret == 0 ? passed : failed);
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(plain, NULL, DYNAMIC_TYPE_NONE); XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(cipher, NULL, DYNAMIC_TYPE_CIPHER); XFREE(cipher, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif
#endif #endif