Skip to content

Commit

Permalink
Fixed unit test case. Updated a constant list to be ANSI-C compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejohnstown committed Mar 19, 2012
1 parent fc2f329 commit c4e91a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 2 additions & 5 deletions cyassl/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
};


Expand Down
10 changes: 8 additions & 2 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c4e91a8

Please sign in to comment.