From 2c39219f2adac72de1b37dc2d159f8f85dd2321a Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 29 Aug 2017 10:45:12 -0700 Subject: [PATCH 1/3] Fix issue with empty array (requires C99 compliance). --- wolfcrypt/test/test.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index b43295ab2..a0f0a8606 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -3499,8 +3499,6 @@ int poly1305_test(void) byte tag[16]; Poly1305 enc; - static const byte empty[] = { }; - static const byte msg1[] = { 0x43,0x72,0x79,0x70,0x74,0x6f,0x67,0x72, @@ -3619,8 +3617,8 @@ int poly1305_test(void) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; - const byte* msgs[] = {empty, msg1, msg2, msg3, msg5}; - word32 szm[] = {sizeof(empty), sizeof(msg1), sizeof(msg2), + const byte* msgs[] = {NULL, msg1, msg2, msg3, msg5}; + word32 szm[] = {0, sizeof(msg1), sizeof(msg2), sizeof(msg3), sizeof(msg5)}; const byte* keys[] = {key, key, key2, key2, key5}; const byte* tests[] = {correct0, correct1, correct2, correct3, correct5}; From 932773735bb7447b9ffd99d95c60f3d34c0bf76a Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 11 Sep 2017 05:48:41 -0700 Subject: [PATCH 2/3] Cleanup the wolfIO_Send function. --- src/io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/io.c b/src/io.c index 5424ad7a4..13585e7a8 100644 --- a/src/io.c +++ b/src/io.c @@ -572,9 +572,8 @@ int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags) int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags) { int sent; - int len = sz; - sent = (int)SEND_FUNCTION(sd, &buf[sz - len], len, wrFlags); + sent = (int)SEND_FUNCTION(sd, buf, sz, wrFlags); sent = TranslateReturnCode(sent, sd); return sent; From a5eaecaa0ec0a49fac64e5b7275345689bd92e19 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 11 Sep 2017 06:51:27 -0700 Subject: [PATCH 3/3] Fix unit API test call to `wolfSSL_CertManagerLoadCA` when building without file system. --- tests/api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/api.c b/tests/api.c index d43c40665..cf3b49baa 100644 --- a/tests/api.c +++ b/tests/api.c @@ -10279,12 +10279,16 @@ static void test_wc_ecc_get_curve_id_from_params(void) return -1; } + #ifndef NO_FILESYSTEM ret = wolfSSL_CertManagerLoadCA(cm, ca, 0); if (ret != SSL_SUCCESS) { printf("wolfSSL_CertManagerLoadCA failed\n"); wolfSSL_CertManagerFree(cm); return ret; } + #else + (void)ca; + #endif ret = wolfSSL_CertManagerVerifyBuffer(cm, cert_buf, cert_sz, SSL_FILETYPE_ASN1); /* Let AssertIntEQ handle return code */