|
@@ -45,6 +45,8 @@
|
|
|
#include <wolfssl/ssl.h> /* compatibility layer */
|
|
|
#include <wolfssl/test.h>
|
|
|
#include <tests/unit.h>
|
|
|
+#include "examples/server/server.h"
|
|
|
+ /* for testing compatibility layer callbacks */
|
|
|
|
|
|
#ifndef NO_MD5
|
|
|
#include <wolfssl/wolfcrypt/md5.h>
|
|
@@ -160,6 +162,10 @@
|
|
|
#include <wolfssl/wolfcrypt/srp.h>
|
|
|
#endif
|
|
|
|
|
|
+#if defined(SESSION_CERTS) && defined(TEST_PEER_CERT_CHAIN)
|
|
|
+#include "wolfssl/internal.h" /* for testing SSL_get_peer_cert_chain */
|
|
|
+#endif
|
|
|
+
|
|
|
/* enable testing buffer load functions */
|
|
|
#ifndef USE_CERT_BUFFERS_2048
|
|
|
#define USE_CERT_BUFFERS_2048
|
|
@@ -1007,8 +1013,8 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
|
|
} while (ret != WOLFSSL_SUCCESS && err == WC_PENDING_E);
|
|
|
|
|
|
if (ret != WOLFSSL_SUCCESS) {
|
|
|
- char buffer[WOLFSSL_MAX_ERROR_SZ];
|
|
|
- printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buffer));
|
|
|
+ char buff[WOLFSSL_MAX_ERROR_SZ];
|
|
|
+ printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buff));
|
|
|
/*err_sys("SSL_accept failed");*/
|
|
|
goto done;
|
|
|
}
|
|
@@ -1056,7 +1062,9 @@ done:
|
|
|
}
|
|
|
#endif /* !NO_WOLFSSL_SERVER */
|
|
|
|
|
|
-static void test_client_nofail(void* args)
|
|
|
+typedef int (*cbType)(WOLFSSL_CTX *ctx, WOLFSSL *ssl);
|
|
|
+
|
|
|
+static void test_client_nofail(void* args, void *cb)
|
|
|
{
|
|
|
SOCKET_T sockfd = 0;
|
|
|
|
|
@@ -1132,12 +1140,14 @@ static void test_client_nofail(void* args)
|
|
|
} while (ret != WOLFSSL_SUCCESS && err == WC_PENDING_E);
|
|
|
|
|
|
if (ret != WOLFSSL_SUCCESS) {
|
|
|
- char buffer[WOLFSSL_MAX_ERROR_SZ];
|
|
|
- printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buffer));
|
|
|
+ char buff[WOLFSSL_MAX_ERROR_SZ];
|
|
|
+ printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buff));
|
|
|
/*err_sys("SSL_connect failed");*/
|
|
|
goto done2;
|
|
|
}
|
|
|
|
|
|
+ if(cb != NULL)((cbType)cb)(ctx, ssl);
|
|
|
+
|
|
|
if (wolfSSL_write(ssl, msg, msgSz) != msgSz)
|
|
|
{
|
|
|
/*err_sys("SSL_write failed");*/
|
|
@@ -1268,8 +1278,8 @@ static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
|
|
|
} while (ret != WOLFSSL_SUCCESS && err == WC_PENDING_E);
|
|
|
|
|
|
if (ret != WOLFSSL_SUCCESS) {
|
|
|
- char buffer[WOLFSSL_MAX_ERROR_SZ];
|
|
|
- printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buffer));
|
|
|
+ char buff[WOLFSSL_MAX_ERROR_SZ];
|
|
|
+ printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buff));
|
|
|
/*err_sys("SSL_accept failed");*/
|
|
|
}
|
|
|
else {
|
|
@@ -1388,8 +1398,8 @@ static void run_wolfssl_client(void* args)
|
|
|
} while (ret != WOLFSSL_SUCCESS && err == WC_PENDING_E);
|
|
|
|
|
|
if (ret != WOLFSSL_SUCCESS) {
|
|
|
- char buffer[WOLFSSL_MAX_ERROR_SZ];
|
|
|
- printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buffer));
|
|
|
+ char buff[WOLFSSL_MAX_ERROR_SZ];
|
|
|
+ printf("error = %d, %s\n", err, wolfSSL_ERR_error_string(err, buff));
|
|
|
/*err_sys("SSL_connect failed");*/
|
|
|
}
|
|
|
else {
|
|
@@ -1465,7 +1475,7 @@ static void test_wolfSSL_read_write(void)
|
|
|
|
|
|
start_thread(test_server_nofail, &server_args, &serverThread);
|
|
|
wait_tcp_ready(&server_args);
|
|
|
- test_client_nofail(&client_args);
|
|
|
+ test_client_nofail(&client_args, NULL);
|
|
|
join_thread(serverThread);
|
|
|
|
|
|
AssertTrue(client_args.return_code);
|
|
@@ -9769,15 +9779,15 @@ static void test_wolfSSL_tmp_dh(void)
|
|
|
static void test_wolfSSL_ctrl(void)
|
|
|
{
|
|
|
#if defined(OPENSSL_EXTRA)
|
|
|
- byte buffer[5300];
|
|
|
+ byte buff[5300];
|
|
|
BIO* bio;
|
|
|
int bytes;
|
|
|
BUF_MEM* ptr = NULL;
|
|
|
|
|
|
printf(testingFmt, "wolfSSL_crtl()");
|
|
|
|
|
|
- bytes = sizeof(buffer);
|
|
|
- bio = BIO_new_mem_buf((void*)buffer, bytes);
|
|
|
+ bytes = sizeof(buff);
|
|
|
+ bio = BIO_new_mem_buf((void*)buff, bytes);
|
|
|
AssertNotNull(bio);
|
|
|
AssertNotNull(BIO_s_socket());
|
|
|
|
|
@@ -9965,7 +9975,7 @@ static void test_wolfSSL_ERR_peek_last_error_line(void)
|
|
|
#ifndef SINGLE_THREADED
|
|
|
start_thread(test_server_nofail, &server_args, &serverThread);
|
|
|
wait_tcp_ready(&server_args);
|
|
|
- test_client_nofail(&client_args);
|
|
|
+ test_client_nofail(&client_args, NULL);
|
|
|
join_thread(serverThread);
|
|
|
#endif
|
|
|
|
|
@@ -10293,7 +10303,17 @@ static void test_wolfSSL_BN(void)
|
|
|
/* check result 3^2 mod 5 */
|
|
|
value[0] = 0;
|
|
|
AssertIntEQ(BN_bn2bin(d, value), WOLFSSL_SUCCESS);
|
|
|
- AssertIntEQ((int)(value[0] & 0x04), 4);
|
|
|
+ AssertIntEQ(BN_bn2bin(d, value), SSL_SUCCESS);
|
|
|
+ AssertIntEQ((int)(value[0]), 4);
|
|
|
+
|
|
|
+ /* a*b mod c = */
|
|
|
+ AssertIntEQ(BN_mod_mul(d, NULL, b, c, NULL), SSL_FAILURE);
|
|
|
+ AssertIntEQ(BN_mod_mul(d, a, b, c, NULL), SSL_SUCCESS);
|
|
|
+
|
|
|
+ /* check result 3*2 mod 5 */
|
|
|
+ value[0] = 0;
|
|
|
+ AssertIntEQ(BN_bn2bin(d, value), SSL_SUCCESS);
|
|
|
+ AssertIntEQ((int)(value[0]), 1);
|
|
|
|
|
|
/* BN_mod_inverse test */
|
|
|
value[0] = 0;
|
|
@@ -10335,6 +10355,96 @@ static void test_wolfSSL_BN(void)
|
|
|
#endif /* defined(OPENSSL_EXTRA) && !defined(NO_ASN) */
|
|
|
}
|
|
|
|
|
|
+#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
|
|
|
+ !defined(NO_FILESYSTEM) && !defined(NO_RSA)
|
|
|
+#define TEST_ARG 0x1234
|
|
|
+static void msg_cb(int write_p, int version, int content_type,
|
|
|
+ const void *buf, size_t len, SSL *ssl, void *arg)
|
|
|
+{
|
|
|
+ (void)write_p;
|
|
|
+ (void)version;
|
|
|
+ (void)content_type;
|
|
|
+ (void)buf;
|
|
|
+ (void)len;
|
|
|
+ (void)ssl;
|
|
|
+
|
|
|
+ AssertTrue(arg == (void*)TEST_ARG);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
|
|
|
+ !defined(NO_FILESYSTEM) && defined(DEBUG_WOLFSSL) && \
|
|
|
+ !defined(NO_OLD_TLS) && defined(HAVE_IO_TESTS_DEPENDENCIES)
|
|
|
+#ifndef SINGLE_THREADED
|
|
|
+static int msgCb(SSL_CTX *ctx, SSL *ssl)
|
|
|
+{
|
|
|
+ (void) ctx;
|
|
|
+ (void) ssl;
|
|
|
+ printf("\n===== msgcb called ====\n");
|
|
|
+ #if defined(SESSION_CERTS) && defined(TEST_PEER_CERT_CHAIN)
|
|
|
+ AssertTrue(SSL_get_peer_cert_chain(ssl) != NULL);
|
|
|
+ AssertIntEQ(((WOLFSSL_X509_CHAIN *)SSL_get_peer_cert_chain(ssl))->count, 1);
|
|
|
+ #endif
|
|
|
+ return SSL_SUCCESS;
|
|
|
+}
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+
|
|
|
+static void test_wolfSSL_msgCb(void)
|
|
|
+{
|
|
|
+ #if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
|
|
|
+ !defined(NO_FILESYSTEM) && defined(DEBUG_WOLFSSL) && \
|
|
|
+ !defined(NO_OLD_TLS) && defined(HAVE_IO_TESTS_DEPENDENCIES)
|
|
|
+
|
|
|
+ tcp_ready ready;
|
|
|
+ func_args client_args;
|
|
|
+ func_args server_args;
|
|
|
+ #ifndef SINGLE_THREADED
|
|
|
+ THREAD_TYPE serverThread;
|
|
|
+ #endif
|
|
|
+ callback_functions client_cb;
|
|
|
+ callback_functions server_cb;
|
|
|
+
|
|
|
+ printf(testingFmt, "test_wolfSSL_msgCb");
|
|
|
+
|
|
|
+/* create a failed connection and inspect the error */
|
|
|
+#ifdef WOLFSSL_TIRTOS
|
|
|
+ fdOpenSession(Task_self());
|
|
|
+#endif
|
|
|
+ XMEMSET(&client_args, 0, sizeof(func_args));
|
|
|
+ XMEMSET(&server_args, 0, sizeof(func_args));
|
|
|
+
|
|
|
+ StartTCP();
|
|
|
+ InitTcpReady(&ready);
|
|
|
+
|
|
|
+ client_cb.method = wolfTLSv1_2_client_method;
|
|
|
+ server_cb.method = wolfTLSv1_2_server_method;
|
|
|
+
|
|
|
+ server_args.signal = &ready;
|
|
|
+ server_args.callbacks = &server_cb;
|
|
|
+ client_args.signal = &ready;
|
|
|
+ client_args.callbacks = &client_cb;
|
|
|
+ client_args.return_code = TEST_FAIL;
|
|
|
+
|
|
|
+ #ifndef SINGLE_THREADED
|
|
|
+ start_thread(test_server_nofail, &server_args, &serverThread);
|
|
|
+ wait_tcp_ready(&server_args);
|
|
|
+ test_client_nofail(&client_args, (void *)msgCb);
|
|
|
+ join_thread(serverThread);
|
|
|
+ AssertTrue(client_args.return_code);
|
|
|
+ AssertTrue(server_args.return_code);
|
|
|
+ #endif
|
|
|
+
|
|
|
+ FreeTcpReady(&ready);
|
|
|
+
|
|
|
+#ifdef WOLFSSL_TIRTOS
|
|
|
+ fdOpenSession(Task_self());
|
|
|
+#endif
|
|
|
+
|
|
|
+ printf(resultFmt, passed);
|
|
|
+
|
|
|
+#endif
|
|
|
+}
|
|
|
|
|
|
static void test_wolfSSL_set_options(void)
|
|
|
{
|
|
@@ -10343,11 +10453,40 @@ static void test_wolfSSL_set_options(void)
|
|
|
SSL* ssl;
|
|
|
SSL_CTX* ctx;
|
|
|
|
|
|
+ unsigned char protos[] = {
|
|
|
+ 7, 't', 'l', 's', '/', '1', '.', '2',
|
|
|
+ 8, 'h', 't', 't', 'p', '/', '1', '.', '1'
|
|
|
+ };
|
|
|
+ unsigned int len = sizeof(protos);
|
|
|
+
|
|
|
+ void *arg = (void *)TEST_ARG;
|
|
|
+
|
|
|
printf(testingFmt, "wolfSSL_set_options()");
|
|
|
|
|
|
AssertNotNull(ctx = SSL_CTX_new(wolfSSLv23_server_method()));
|
|
|
- AssertTrue(SSL_CTX_use_certificate_file(ctx, svrCertFile, WOLFSSL_FILETYPE_PEM));
|
|
|
- AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, WOLFSSL_FILETYPE_PEM));
|
|
|
+ AssertTrue(SSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM));
|
|
|
+ AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM));
|
|
|
+
|
|
|
+ AssertTrue(SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1);
|
|
|
+ AssertTrue(SSL_CTX_get_options(ctx) == SSL_OP_NO_TLSv1);
|
|
|
+
|
|
|
+ AssertIntGT((int)SSL_CTX_set_options(ctx, (SSL_OP_COOKIE_EXCHANGE |
|
|
|
+ SSL_OP_NO_SSLv2)), 0);
|
|
|
+ AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_COOKIE_EXCHANGE) &
|
|
|
+ SSL_OP_COOKIE_EXCHANGE) == SSL_OP_COOKIE_EXCHANGE);
|
|
|
+ AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_2) &
|
|
|
+ SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2);
|
|
|
+ AssertTrue((SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION) &
|
|
|
+ SSL_OP_NO_COMPRESSION) == SSL_OP_NO_COMPRESSION);
|
|
|
+ AssertNull((SSL_CTX_clear_options(ctx, SSL_OP_NO_COMPRESSION) &
|
|
|
+ SSL_OP_NO_COMPRESSION));
|
|
|
+
|
|
|
+ SSL_CTX_free(ctx);
|
|
|
+
|
|
|
+ AssertNotNull(ctx = SSL_CTX_new(wolfSSLv23_server_method()));
|
|
|
+ AssertTrue(SSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM));
|
|
|
+ AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM));
|
|
|
+
|
|
|
AssertNotNull(ssl = SSL_new(ctx));
|
|
|
|
|
|
AssertTrue(SSL_set_options(ssl, SSL_OP_NO_TLSv1) == SSL_OP_NO_TLSv1);
|
|
@@ -10361,6 +10500,13 @@ static void test_wolfSSL_set_options(void)
|
|
|
SSL_OP_NO_TLSv1_2) == SSL_OP_NO_TLSv1_2);
|
|
|
AssertTrue((SSL_set_options(ssl, SSL_OP_NO_COMPRESSION) &
|
|
|
SSL_OP_NO_COMPRESSION) == SSL_OP_NO_COMPRESSION);
|
|
|
+ AssertNull((SSL_clear_options(ssl, SSL_OP_NO_COMPRESSION) &
|
|
|
+ SSL_OP_NO_COMPRESSION));
|
|
|
+
|
|
|
+ AssertTrue(SSL_set_msg_callback(ssl, msg_cb) == SSL_SUCCESS);
|
|
|
+ SSL_set_msg_callback_arg(ssl, arg);
|
|
|
+
|
|
|
+ AssertTrue(SSL_CTX_set_alpn_protos(ctx, protos, len) == SSL_SUCCESS);
|
|
|
|
|
|
SSL_free(ssl);
|
|
|
SSL_CTX_free(ctx);
|
|
@@ -10370,6 +10516,29 @@ static void test_wolfSSL_set_options(void)
|
|
|
!defined(NO_FILESYSTEM) && !defined(NO_RSA) */
|
|
|
}
|
|
|
|
|
|
+#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
|
|
+static int verify_cb(int ok, X509_STORE_CTX *ctx)
|
|
|
+{
|
|
|
+ (void) ok;
|
|
|
+ (void) ctx;
|
|
|
+ printf("ENTER verify_cb\n");
|
|
|
+ return SSL_SUCCESS;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+static void test_wolfSSL_X509_STORE_CTX(void)
|
|
|
+{
|
|
|
+#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
|
|
+ X509_STORE_CTX *ctx = NULL ;
|
|
|
+
|
|
|
+ printf(testingFmt, "test_wolfSSL_X509_STORE_CTX(()");
|
|
|
+ AssertNotNull(ctx = X509_STORE_CTX_new());
|
|
|
+ X509_STORE_CTX_set_verify_cb(ctx, (void *)verify_cb);
|
|
|
+ X509_STORE_CTX_free(ctx);
|
|
|
+ printf(resultFmt, passed);
|
|
|
+ #endif
|
|
|
+}
|
|
|
+
|
|
|
/* Testing wolfSSL_set_tlsext_status_type funciton.
|
|
|
* PRE: OPENSSL and HAVE_CERTIFICATE_STATUS_REQUEST defined.
|
|
|
*/
|
|
@@ -10395,7 +10564,7 @@ static void test_wolfSSL_PEM_read_bio(void)
|
|
|
{
|
|
|
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
|
|
|
!defined(NO_FILESYSTEM) && !defined(NO_RSA)
|
|
|
- byte buffer[5300];
|
|
|
+ byte buff[5300];
|
|
|
FILE *f;
|
|
|
int bytes;
|
|
|
X509* x509;
|
|
@@ -10404,11 +10573,11 @@ static void test_wolfSSL_PEM_read_bio(void)
|
|
|
printf(testingFmt, "wolfSSL_PEM_read_bio()");
|
|
|
|
|
|
AssertNotNull(f = fopen(cliCertFile, "rb"));
|
|
|
- bytes = (int)fread(buffer, 1, sizeof(buffer), f);
|
|
|
+ bytes = (int)fread(buff, 1, sizeof(buff), f);
|
|
|
fclose(f);
|
|
|
|
|
|
AssertNull(x509 = PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL));
|
|
|
- AssertNotNull(bio = BIO_new_mem_buf((void*)buffer, bytes));
|
|
|
+ AssertNotNull(bio = BIO_new_mem_buf((void*)buff, bytes));
|
|
|
AssertNotNull(x509 = PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL));
|
|
|
AssertIntEQ((int)BIO_set_fd(bio, 0, BIO_NOCLOSE), 1);
|
|
|
|
|
@@ -10424,7 +10593,7 @@ static void test_wolfSSL_PEM_read_bio(void)
|
|
|
static void test_wolfSSL_BIO(void)
|
|
|
{
|
|
|
#if defined(OPENSSL_EXTRA)
|
|
|
- byte buffer[20];
|
|
|
+ byte buff[20];
|
|
|
BIO* bio1;
|
|
|
BIO* bio2;
|
|
|
BIO* bio3;
|
|
@@ -10434,7 +10603,7 @@ static void test_wolfSSL_BIO(void)
|
|
|
printf(testingFmt, "wolfSSL_BIO()");
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
- buffer[i] = i;
|
|
|
+ buff[i] = i;
|
|
|
}
|
|
|
|
|
|
/* Creating and testing type BIO_s_bio */
|
|
@@ -10443,25 +10612,25 @@ static void test_wolfSSL_BIO(void)
|
|
|
AssertNotNull(bio3 = BIO_new(BIO_s_bio()));
|
|
|
|
|
|
/* read/write before set up */
|
|
|
- AssertIntEQ(BIO_read(bio1, buffer, 2), WOLFSSL_BIO_UNSET);
|
|
|
- AssertIntEQ(BIO_write(bio1, buffer, 2), WOLFSSL_BIO_UNSET);
|
|
|
+ AssertIntEQ(BIO_read(bio1, buff, 2), WOLFSSL_BIO_UNSET);
|
|
|
+ AssertIntEQ(BIO_write(bio1, buff, 2), WOLFSSL_BIO_UNSET);
|
|
|
|
|
|
AssertIntEQ(BIO_set_write_buf_size(bio1, 20), WOLFSSL_SUCCESS);
|
|
|
AssertIntEQ(BIO_set_write_buf_size(bio2, 8), WOLFSSL_SUCCESS);
|
|
|
AssertIntEQ(BIO_make_bio_pair(bio1, bio2), WOLFSSL_SUCCESS);
|
|
|
|
|
|
AssertIntEQ(BIO_nwrite(bio1, &bufPt, 10), 10);
|
|
|
- XMEMCPY(bufPt, buffer, 10);
|
|
|
- AssertIntEQ(BIO_write(bio1, buffer + 10, 10), 10);
|
|
|
+ XMEMCPY(bufPt, buff, 10);
|
|
|
+ AssertIntEQ(BIO_write(bio1, buff + 10, 10), 10);
|
|
|
/* write buffer full */
|
|
|
- AssertIntEQ(BIO_write(bio1, buffer, 10), WOLFSSL_BIO_ERROR);
|
|
|
+ AssertIntEQ(BIO_write(bio1, buff, 10), WOLFSSL_BIO_ERROR);
|
|
|
AssertIntEQ(BIO_flush(bio1), WOLFSSL_SUCCESS);
|
|
|
AssertIntEQ((int)BIO_ctrl_pending(bio1), 0);
|
|
|
|
|
|
/* write the other direction with pair */
|
|
|
AssertIntEQ((int)BIO_nwrite(bio2, &bufPt, 10), 8);
|
|
|
- XMEMCPY(bufPt, buffer, 8);
|
|
|
- AssertIntEQ(BIO_write(bio2, buffer, 10), WOLFSSL_BIO_ERROR);
|
|
|
+ XMEMCPY(bufPt, buff, 8);
|
|
|
+ AssertIntEQ(BIO_write(bio2, buff, 10), WOLFSSL_BIO_ERROR);
|
|
|
|
|
|
/* try read */
|
|
|
AssertIntEQ((int)BIO_ctrl_pending(bio1), 8);
|
|
@@ -10492,7 +10661,7 @@ static void test_wolfSSL_BIO(void)
|
|
|
|
|
|
/* fill write buffer, read only small amount then write again */
|
|
|
AssertIntEQ(BIO_nwrite(bio1, &bufPt, 20), 20);
|
|
|
- XMEMCPY(bufPt, buffer, 20);
|
|
|
+ XMEMCPY(bufPt, buff, 20);
|
|
|
AssertIntEQ(BIO_nread(bio3, &bufPt, 4), 4);
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
AssertIntEQ(bufPt[i], i);
|
|
@@ -10510,7 +10679,7 @@ static void test_wolfSSL_BIO(void)
|
|
|
/* should read only to end of write buffer then need to read again */
|
|
|
AssertIntEQ(BIO_nread(bio3, &bufPt, 20), 16);
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
- AssertIntEQ(bufPt[i], buffer[4 + i]);
|
|
|
+ AssertIntEQ(bufPt[i], buff[4 + i]);
|
|
|
}
|
|
|
|
|
|
AssertIntEQ(BIO_nread(bio3, NULL, 0), WOLFSSL_FAILURE);
|
|
@@ -10527,14 +10696,14 @@ static void test_wolfSSL_BIO(void)
|
|
|
|
|
|
/* write and fill up buffer checking reset of index state */
|
|
|
AssertIntEQ(BIO_nwrite(bio1, &bufPt, 20), 20);
|
|
|
- XMEMCPY(bufPt, buffer, 20);
|
|
|
+ XMEMCPY(bufPt, buff, 20);
|
|
|
|
|
|
/* test reset on data in bio1 write buffer */
|
|
|
AssertIntEQ(BIO_reset(bio1), 0);
|
|
|
AssertIntEQ((int)BIO_ctrl_pending(bio3), 0);
|
|
|
AssertIntEQ(BIO_nread(bio3, &bufPt, 3), WOLFSSL_BIO_ERROR);
|
|
|
AssertIntEQ(BIO_nwrite(bio1, &bufPt, 20), 20);
|
|
|
- XMEMCPY(bufPt, buffer, 20);
|
|
|
+ XMEMCPY(bufPt, buff, 20);
|
|
|
AssertIntEQ(BIO_nread(bio3, &bufPt, 6), 6);
|
|
|
for (i = 0; i < 6; i++) {
|
|
|
AssertIntEQ(bufPt[i], i);
|
|
@@ -11291,12 +11460,16 @@ void ApiTest(void)
|
|
|
test_wolfSSL_EVP_MD_hmac_signing();
|
|
|
test_wolfSSL_CTX_add_extra_chain_cert();
|
|
|
test_wolfSSL_ERR_peek_last_error_line();
|
|
|
+ test_wolfSSL_set_options();
|
|
|
+ test_wolfSSL_X509_STORE_CTX();
|
|
|
+ test_wolfSSL_msgCb();
|
|
|
test_wolfSSL_X509_STORE_set_flags();
|
|
|
test_wolfSSL_X509_LOOKUP_load_file();
|
|
|
test_wolfSSL_X509_NID();
|
|
|
test_wolfSSL_X509_STORE_CTX_set_time();
|
|
|
test_wolfSSL_BN();
|
|
|
test_wolfSSL_set_options();
|
|
|
+ test_wolfSSL_X509_STORE_CTX();
|
|
|
test_wolfSSL_PEM_read_bio();
|
|
|
test_wolfSSL_BIO();
|
|
|
test_wolfSSL_DES_ecb_encrypt();
|