Added wolfSSL_SetMinVersion

This commit is contained in:
John Blixt 2016-08-17 14:05:37 -06:00
parent 584733b138
commit cddc771829
1 changed files with 36 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#endif
#include <wolfssl/wolfcrypt/settings.h>
#if defined(WOLFSSL_STATIC_MEMORY)
#include <wolfssl/wolfcrypt/memory.h>
#endif /* WOLFSSL_STATIC_MEMORY */
@ -502,6 +503,40 @@ static void test_wolfSSL_SetTmpDH_buffer(void)
#endif
}
/* Test function for wolfSSL_SetMinVersion
* POST: return 1 on success.
*/
static int test_wolfSSL_SetMinVersion(void)
{
WOLFSSL_CTX* ctx;
WOLFSSL* ssl;
int version, ret;
AssertTrue(wolfSSL_Init());
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
ssl = wolfSSL_new(ctx);
version = 3;
printf(testingFmt, "wolfSSL_SetMinVersion()");
ret = wolfSSL_SetMinVersion(ssl, version);
printf(resultFmt, ret == SSL_SUCCESS ? passed : failed);
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
AssertTrue(wolfSSL_Cleanup());
if(ret != SSL_SUCCESS) { return SSL_FAILURE; }
return SSL_SUCCESS;
} /* END test_wolfSSL_SetMinVersion */
/*----------------------------------------------------------------------------*
| IO
*----------------------------------------------------------------------------*/
@ -1945,6 +1980,7 @@ void ApiTest(void)
test_wolfSSL_SetTmpDH_buffer();
test_wolfSSL_read_write();
test_wolfSSL_dtls_export();
AssertTrue(test_wolfSSL_SetMinVersion());
/* TLS extensions tests */