Fixed unit test case. Updated a constant list to be ANSI-C compliant.

This commit is contained in:
John Safranek 2012-03-19 11:30:48 -07:00
parent fc2f329acb
commit c4e91a831f
2 changed files with 10 additions and 7 deletions

View File

@ -357,6 +357,7 @@ enum Misc {
MAX_PSK_KEY_LEN = 64, /* max psk key supported */
#ifdef FORTRESS
MAX_EX_DATA = 3, /* allow for three items of ex_data */
MAX_CHAIN_DEPTH = 9, /* max cert chain peer depth, FORTRESS option */
#else
MAX_CHAIN_DEPTH = 4, /* max cert chain peer depth */
@ -376,11 +377,7 @@ enum Misc {
HASH_SIG_SIZE = 2, /* default SHA1 RSA */
NO_COPY = 0, /* should we copy static buffer for write */
COPY = 1, /* should we copy static buffer for write */
#ifdef FORTRESS
MAX_EX_DATA = 3, /* allow for three items of ex_data */
#endif
COPY = 1 /* should we copy static buffer for write */
};

View File

@ -307,7 +307,12 @@ int test_lvl(CYASSL_CTX *ctx, const char* file, const char* path, int cond,
int result;
printf(testingFmt, name);
result = CyaSSL_CTX_load_verify_locations(ctx, file, path);
/*
* CyaSSL_CTX_load_verify_locations() returns SSL_SUCCESS (1) for
* success, SSL_FAILURE (0) for a non-specific failure, or a specific
* failure code (<0). Need to normalize the return code to 1 or 0.
*/
result = CyaSSL_CTX_load_verify_locations(ctx, file, path) >= SSL_SUCCESS;
if (result != cond)
{
printf(resultFmt, failed);
@ -343,8 +348,9 @@ int test_CyaSSL_CTX_load_verify_locations(void)
"CyaSSL_CTX_load_verify_locations(ctx, NULL, NULL)");
test_lvl(NULL, caCert, NULL, SSL_FAILURE,
"CyaSSL_CTX_load_verify_locations(ctx, NULL, NULL)");
test_lvl(ctx, caCert, bogusFile, SSL_SUCCESS,
test_lvl(ctx, caCert, bogusFile, SSL_FAILURE,
"CyaSSL_CTX_load_verify_locations(ctx, caCert, bogusFile)");
/* Add a test for the certs directory path loading. */
/* There is a leak here. If you load a second cert, the first one
is lost. */
test_lvl(ctx, caCert, 0, SSL_SUCCESS,