Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit c4e91a831fd238b8708bcec008ada62889bf2685 1 parent fc2f329
@ejohnstown ejohnstown authored
Showing with 10 additions and 7 deletions.
  1. +2 −5 cyassl/internal.h
  2. +8 −2 tests/api.c
View
7 cyassl/internal.h
@@ -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
10 tests/api.c
@@ -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,

0 comments on commit c4e91a8

Please sign in to comment.
Something went wrong with that request. Please try again.