mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
more Wconversion fixes: api/test* block
This commit is contained in:
62
tests/api.c
62
tests/api.c
@@ -2431,7 +2431,7 @@ static int test_cm_load_ca_buffer(const byte* cert_buf, size_t cert_sz,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wolfSSL_CertManagerLoadCABuffer(cm, cert_buf, cert_sz, file_type);
|
||||
ret = wolfSSL_CertManagerLoadCABuffer(cm, cert_buf, (sword32)cert_sz, file_type);
|
||||
|
||||
wolfSSL_CertManagerFree(cm);
|
||||
|
||||
@@ -2470,7 +2470,8 @@ static int test_cm_load_ca_file(const char* ca_cert_file)
|
||||
#if defined(WOLFSSL_PEM_TO_DER)
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* test loading DER */
|
||||
ret = wc_PemToDer(cert_buf, cert_sz, CA_TYPE, &pDer, NULL, NULL, NULL);
|
||||
ret = wc_PemToDer(cert_buf, (sword32)cert_sz, CA_TYPE, &pDer,
|
||||
NULL, NULL, NULL);
|
||||
if (ret == 0 && pDer != NULL) {
|
||||
ret = test_cm_load_ca_buffer(pDer->buffer, pDer->length,
|
||||
WOLFSSL_FILETYPE_ASN1);
|
||||
@@ -2498,7 +2499,7 @@ static int test_cm_load_ca_buffer_ex(const byte* cert_buf, size_t cert_sz,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = wolfSSL_CertManagerLoadCABuffer_ex(cm, cert_buf, cert_sz, file_type,
|
||||
ret = wolfSSL_CertManagerLoadCABuffer_ex(cm, cert_buf, (sword32)cert_sz, file_type,
|
||||
0, flags);
|
||||
|
||||
wolfSSL_CertManagerFree(cm);
|
||||
@@ -2539,7 +2540,8 @@ static int test_cm_load_ca_file_ex(const char* ca_cert_file, word32 flags)
|
||||
#if defined(WOLFSSL_PEM_TO_DER)
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* test loading DER */
|
||||
ret = wc_PemToDer(cert_buf, cert_sz, CA_TYPE, &pDer, NULL, NULL, NULL);
|
||||
ret = wc_PemToDer(cert_buf, (sword32)cert_sz, CA_TYPE, &pDer,
|
||||
NULL, NULL, NULL);
|
||||
if (ret == 0 && pDer != NULL) {
|
||||
ret = test_cm_load_ca_buffer_ex(pDer->buffer, pDer->length,
|
||||
WOLFSSL_FILETYPE_ASN1, flags);
|
||||
@@ -4808,13 +4810,13 @@ static int test_wolfSSL_CTX_use_certificate_chain_buffer_format(void)
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(ctx, NULL, 0),
|
||||
WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER));
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(NULL, buf, (long)len),
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(NULL, buf, (sword32)len),
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(NULL, NULL, 0),
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(ssl, NULL, 0),
|
||||
WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER));
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(NULL, buf, (long)len),
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(NULL, buf, (sword32)len),
|
||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer_format(ctx,
|
||||
@@ -4822,14 +4824,14 @@ static int test_wolfSSL_CTX_use_certificate_chain_buffer_format(void)
|
||||
WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
|
||||
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer_format(ctx, buf,
|
||||
(long)len, WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS);
|
||||
(sword32)len, WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS);
|
||||
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(ctx, buf, (long)len),
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(ctx, buf, (sword32)len),
|
||||
WOLFSSL_SUCCESS);
|
||||
ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(ctx,
|
||||
server_cert_der_2048, sizeof_server_cert_der_2048), WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER));
|
||||
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(ssl, buf, (long)len),
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(ssl, buf, (sword32)len),
|
||||
WOLFSSL_SUCCESS);
|
||||
ExpectIntEQ(wolfSSL_use_certificate_chain_buffer(ssl, server_cert_der_2048,
|
||||
sizeof_server_cert_der_2048), WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER));
|
||||
@@ -7272,7 +7274,7 @@ static int test_ssl_memio_do_handshake(test_ssl_memio_ctx* ctx, int max_rounds,
|
||||
err != WOLFSSL_ERROR_WANT_WRITE) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
failing_c = 1;
|
||||
hs_c = 1;
|
||||
if (failing_c && failing_s) {
|
||||
@@ -7294,7 +7296,7 @@ static int test_ssl_memio_do_handshake(test_ssl_memio_ctx* ctx, int max_rounds,
|
||||
err != WOLFSSL_ERROR_WANT_WRITE) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
failing_s = 1;
|
||||
hs_s = 1;
|
||||
if (failing_c && failing_s) {
|
||||
@@ -7804,7 +7806,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
/*err_sys("SSL_accept failed");*/
|
||||
goto done;
|
||||
}
|
||||
@@ -8252,7 +8254,7 @@ static int test_client_nofail(void* args, cbType cb)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
/*err_sys("SSL_connect failed");*/
|
||||
goto done;
|
||||
}
|
||||
@@ -8262,7 +8264,7 @@ static int test_client_nofail(void* args, cbType cb)
|
||||
cipherSuite = wolfSSL_get_current_cipher_suite(ssl);
|
||||
cipherName1 = wolfSSL_get_cipher_name(ssl);
|
||||
cipherName2 = wolfSSL_get_cipher_name_from_suite(
|
||||
(cipherSuite >> 8), cipherSuite & 0xFF);
|
||||
(byte)(cipherSuite >> 8), cipherSuite & 0xFF);
|
||||
AssertStrEQ(cipherName1, cipherName2);
|
||||
|
||||
/* IANA Cipher Suites Names */
|
||||
@@ -8275,7 +8277,7 @@ static int test_client_nofail(void* args, cbType cb)
|
||||
#if !defined(WOLFSSL_CIPHER_INTERNALNAME) && !defined(NO_ERROR_STRINGS) && \
|
||||
!defined(WOLFSSL_QT)
|
||||
cipherName1 = wolfSSL_get_cipher_name_iana_from_suite(
|
||||
(cipherSuite >> 8), cipherSuite & 0xFF);
|
||||
(byte)(cipherSuite >> 8), cipherSuite & 0xFF);
|
||||
AssertStrEQ(cipherName1, cipherName2);
|
||||
#endif
|
||||
|
||||
@@ -8822,7 +8824,7 @@ static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "accept error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
/*err_sys("SSL_accept failed");*/
|
||||
}
|
||||
else {
|
||||
@@ -9040,7 +9042,7 @@ static void run_wolfssl_client(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
char buff[WOLFSSL_MAX_ERROR_SZ];
|
||||
fprintf(stderr, "error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buff));
|
||||
wolfSSL_ERR_error_string((word32)err, buff));
|
||||
/*err_sys("SSL_connect failed");*/
|
||||
}
|
||||
else {
|
||||
@@ -11109,8 +11111,8 @@ static int test_wolfSSL_UseSNI_params(void)
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_UseSNI(NULL, 0, "ctx", 3));
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_UseSNI( NULL, 0, "ssl", 3));
|
||||
/* invalid type */
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_UseSNI(ctx, -1, "ctx", 3));
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_UseSNI( ssl, -1, "ssl", 3));
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_UseSNI(ctx, (byte)-1, "ctx", 3));
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_UseSNI( ssl, (byte)-1, "ssl", 3));
|
||||
/* invalid data */
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_CTX_UseSNI(ctx, 0, NULL, 3));
|
||||
ExpectIntNE(WOLFSSL_SUCCESS, wolfSSL_UseSNI( ssl, 0, NULL, 3));
|
||||
@@ -12411,7 +12413,7 @@ static int BufferInfoRecv(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
XMEMCPY(buf, msg->buffer, len);
|
||||
/* Move over returned data. */
|
||||
msg->buffer += len;
|
||||
msg->length -= len;
|
||||
msg->length -= (word32)len;
|
||||
|
||||
/* Amount actually copied. */
|
||||
return len;
|
||||
@@ -18682,7 +18684,7 @@ static int test_wc_Chacha_Process(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
input2[i] = i;
|
||||
input2[i] = (byte)i;
|
||||
|
||||
ExpectIntEQ(wc_Chacha_SetIV(&enc, iv2, 0), 0);
|
||||
|
||||
@@ -64229,7 +64231,7 @@ static int test_wolfSSL_MD4(void)
|
||||
|
||||
XMEMSET(out, 0, sizeof(out));
|
||||
MD4_Init(&md4);
|
||||
MD4_Update(&md4, (const void*)msg, (unsigned long)msgSz);
|
||||
MD4_Update(&md4, (const void*)msg, (word32)msgSz);
|
||||
MD4_Final(out, &md4);
|
||||
ExpectIntEQ(XMEMCMP(out, test, sizeof(out)), 0);
|
||||
#endif
|
||||
@@ -72786,7 +72788,7 @@ static int test_wolfSSL_OBJ_sn(void)
|
||||
}
|
||||
|
||||
#if !defined(NO_BIO)
|
||||
static unsigned long TXT_DB_hash(const WOLFSSL_STRING *s)
|
||||
static word32 TXT_DB_hash(const WOLFSSL_STRING *s)
|
||||
{
|
||||
return lh_strhash(s[3]);
|
||||
}
|
||||
@@ -86303,7 +86305,7 @@ static int load_ca_into_cm(WOLFSSL_CERT_MANAGER* cm, char* certA)
|
||||
if ((ret = wolfSSL_CertManagerLoadCA(cm, certA, 0)) != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "loading cert %s failed\n", certA);
|
||||
fprintf(stderr, "Error: (%d): %s\n", ret,
|
||||
wolfSSL_ERR_reason_error_string((unsigned long)ret));
|
||||
wolfSSL_ERR_reason_error_string((word32)ret));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -86317,7 +86319,7 @@ static int verify_cert_with_cm(WOLFSSL_CERT_MANAGER* cm, char* certA)
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "could not verify the cert: %s\n", certA);
|
||||
fprintf(stderr, "Error: (%d): %s\n", ret,
|
||||
wolfSSL_ERR_reason_error_string((unsigned long)ret));
|
||||
wolfSSL_ERR_reason_error_string((word32)ret));
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
@@ -86596,7 +86598,7 @@ static int test_wolfSSL_THREADID_hash(void)
|
||||
CRYPTO_THREADID id;
|
||||
|
||||
CRYPTO_THREADID_current(NULL);
|
||||
/* Hash result is unsigned long. */
|
||||
/* Hash result is word32. */
|
||||
ExpectTrue(CRYPTO_THREADID_hash(NULL) == 0UL);
|
||||
XMEMSET(&id, 0, sizeof(id));
|
||||
ExpectTrue(CRYPTO_THREADID_hash(&id) == 0UL);
|
||||
@@ -87630,7 +87632,7 @@ static int error_test(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
errStr = wolfSSL_ERR_reason_error_string((unsigned long)i);
|
||||
errStr = wolfSSL_ERR_reason_error_string((word32)i);
|
||||
|
||||
if (! this_missing) {
|
||||
ExpectIntNE(XSTRCMP(errStr, unknownStr), 0);
|
||||
@@ -87678,10 +87680,10 @@ static int test_wolfSSL_ERR_strings(void)
|
||||
ExpectNotNull(err = ERR_lib_error_string(PEM_R_PROBLEMS_GETTING_PASSWORD));
|
||||
ExpectIntEQ(XSTRNCMP(err, err2, XSTRLEN(err2)), 0);
|
||||
#else
|
||||
ExpectNotNull(err = wolfSSL_ERR_reason_error_string(WC_NO_ERR_TRACE((unsigned long)UNSUPPORTED_SUITE)));
|
||||
ExpectNotNull(err = wolfSSL_ERR_reason_error_string(WC_NO_ERR_TRACE((word32)UNSUPPORTED_SUITE)));
|
||||
ExpectIntEQ(XSTRNCMP(err, err1, XSTRLEN(err1)), 0);
|
||||
|
||||
ExpectNotNull(err = wolfSSL_ERR_func_error_string(WC_NO_ERR_TRACE((unsigned long)UNSUPPORTED_SUITE)));
|
||||
ExpectNotNull(err = wolfSSL_ERR_func_error_string(WC_NO_ERR_TRACE((word32)UNSUPPORTED_SUITE)));
|
||||
ExpectIntEQ((*err == '\0'), 1);
|
||||
|
||||
/* The value -MIN_CODE_E+2 is PEM_R_PROBLEMS_GETTING_PASSWORD. */
|
||||
@@ -93858,7 +93860,7 @@ static int test_tls_multi_handshakes_one_record(void)
|
||||
}
|
||||
rh = (RecordLayerHeader*)(test_ctx.c_buff);
|
||||
len = &rh->length[0];
|
||||
c16toa(newRecIdx - RECORD_HEADER_SZ, len);
|
||||
c16toa((word16)newRecIdx - RECORD_HEADER_SZ, len);
|
||||
test_ctx.c_len = newRecIdx;
|
||||
|
||||
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
|
||||
|
@@ -215,9 +215,7 @@
|
||||
const byte* _x = (const byte*)(x); \
|
||||
const byte* _y = (const byte*)(y); \
|
||||
int _z = (int)(z); \
|
||||
int _w = ((_x) && (_y))
|
||||
? XMEMCMP(_x, _y, (unsigned long)_z)
|
||||
: -1;
|
||||
int _w = ((_x) && (_y)) ? XMEMCMP(_x, _y, (unsigned long)_z) : -1; \
|
||||
Expect(_w op 0, ("%s " #op " %s for %s", #x, #y, #z), \
|
||||
("\"%p\" " #er " \"%p\" for \"%d\"", \
|
||||
(const void *)_x, (const void *)_y, _z)); \
|
||||
|
@@ -4092,7 +4092,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_test(void)
|
||||
/* Unaligned memory access test */
|
||||
for (i = 1; i < 16; i++) {
|
||||
ret = wc_Sha512Update(&sha, (byte*)large_input + i,
|
||||
LARGE_HASH_TEST_INPUT_SZ - i);
|
||||
LARGE_HASH_TEST_INPUT_SZ - (word32)i);
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit);
|
||||
ret = wc_Sha512Final(&sha, hash);
|
||||
@@ -4250,7 +4250,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_224_test(void)
|
||||
/* Unaligned memory access test */
|
||||
for (i = 1; i < 16; i++) {
|
||||
ret = wc_Sha512_224Update(&sha, (byte*)large_input + i,
|
||||
(word32)sizeof(large_input) - i);
|
||||
(word32)sizeof(large_input) - (word32)i);
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit);
|
||||
ret = wc_Sha512_224Final(&sha, hash);
|
||||
@@ -4403,7 +4403,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sha512_256_test(void)
|
||||
/* Unaligned memory access test */
|
||||
for (i = 1; i < 16; i++) {
|
||||
ret = wc_Sha512_256Update(&sha, (byte*)large_input + i,
|
||||
(word32)sizeof(large_input) - i);
|
||||
(word32)sizeof(large_input) - (word32)i);
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit);
|
||||
ret = wc_Sha512_256Final(&sha, hash);
|
||||
@@ -5985,14 +5985,14 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
if (exp_ret == 0) {
|
||||
ret = wc_Hash(typesGood[i], data, sizeof(data), hashOut,
|
||||
digestSz - 1);
|
||||
(word32)digestSz - 1);
|
||||
if (ret != WC_NO_ERR_TRACE(BUFFER_E))
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
}
|
||||
ret = wc_Hash(typesGood[i], data, sizeof(data), hashOut, (word32)digestSz);
|
||||
if (ret != exp_ret)
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
if (exp_ret == 0 && XMEMCMP(out, hashOut, digestSz) != 0)
|
||||
if (exp_ret == 0 && XMEMCMP(out, hashOut, (word32)digestSz) != 0)
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
|
||||
ret = wc_HashGetBlockSize(typesGood[i]);
|
||||
@@ -7790,10 +7790,10 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t chacha_test(void)
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (XMEMCMP(plain_big, input_big, block_size))
|
||||
if (XMEMCMP(plain_big, input_big, (word32)block_size))
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
|
||||
if (XMEMCMP(cipher_big, cipher_big_result, block_size))
|
||||
if (XMEMCMP(cipher_big, cipher_big_result, (word32)block_size))
|
||||
return WC_TEST_RET_ENC_I(i);
|
||||
}
|
||||
|
||||
@@ -14464,18 +14464,18 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||
ret = wc_AesGcmEncrypt(enc, resultC, plain, (word32)plainSz, iv, ivSz,
|
||||
resultT, (word32)tagSz, aad, aadSz);
|
||||
ret = wc_AesGcmEncrypt(enc, resultC, plain, (word32)plainSz, iv, (word32)ivSz,
|
||||
resultT, (word32)tagSz, aad, (word32)aadSz);
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
ret = wc_AsyncWait(ret, &enc->asyncDev, WC_ASYNC_FLAG_NONE);
|
||||
#endif
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
if (cipher != NULL) {
|
||||
if (XMEMCMP(cipher, resultC, cipherSz))
|
||||
if (XMEMCMP(cipher, resultC, (word32)cipherSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
}
|
||||
if (XMEMCMP(tag, resultT, tagSz))
|
||||
if (XMEMCMP(tag, resultT, (unsigned long)tagSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
@@ -14489,7 +14489,7 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
if (cipher != NULL) {
|
||||
if (XMEMCMP(cipher, resultC, cipherSz))
|
||||
if (XMEMCMP(cipher, resultC, (unsigned long)cipherSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
}
|
||||
if (XMEMCMP(tag, resultT, tagSz))
|
||||
@@ -14502,14 +14502,14 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
ret = wc_AesGcmDecrypt(dec, resultP, resultC, (word32)cipherSz,
|
||||
iv, (word32)ivSz, resultT, tagSz, aad, aadSz);
|
||||
iv, (word32)ivSz, resultT, (word32)tagSz, aad, (word32)aadSz);
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
ret = wc_AsyncWait(ret, &dec->asyncDev, WC_ASYNC_FLAG_NONE);
|
||||
#endif
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
if (plain != NULL) {
|
||||
if (XMEMCMP(plain, resultP, plainSz))
|
||||
if (XMEMCMP(plain, resultP, (unsigned long)plainSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
}
|
||||
|
||||
@@ -14524,7 +14524,7 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
if (plain != NULL) {
|
||||
if (XMEMCMP(plain, resultP, plainSz))
|
||||
if (XMEMCMP(plain, resultP, (unsigned long)plainSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
}
|
||||
#endif
|
||||
@@ -17719,7 +17719,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t random_test(void)
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) || !defined(WOLFSSL_NO_MALLOC)
|
||||
static int simple_mem_test(int sz)
|
||||
static int simple_mem_test(size_t sz)
|
||||
{
|
||||
int ret = 0;
|
||||
byte* b;
|
||||
@@ -17730,11 +17730,11 @@ static int simple_mem_test(int sz)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
/* utilize memory */
|
||||
for (i = 0; i < sz; i++) {
|
||||
for (i = 0; i < (int)sz; i++) {
|
||||
b[i] = (byte)i;
|
||||
}
|
||||
/* read back and verify */
|
||||
for (i = 0; i < sz; i++) {
|
||||
for (i = 0; i < (int)sz; i++) {
|
||||
if (b[i] != (byte)i) {
|
||||
ret = WC_TEST_RET_ENC_NC;
|
||||
break;
|
||||
@@ -17894,7 +17894,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memory_test(void)
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) || !defined(WOLFSSL_NO_MALLOC)
|
||||
/* simple test */
|
||||
ret = simple_mem_test(MEM_TEST_SZ);
|
||||
ret = simple_mem_test((size_t)MEM_TEST_SZ);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
#endif
|
||||
@@ -17902,7 +17902,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t memory_test(void)
|
||||
#ifdef COMPLEX_MEM_TEST
|
||||
/* test various size blocks */
|
||||
for (i = 1; i < MEM_TEST_SZ; i*=2) {
|
||||
ret = simple_mem_test(i);
|
||||
ret = simple_mem_test((size_t)i);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -19800,7 +19800,7 @@ static wc_test_ret_t rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
#endif
|
||||
if (ret >= 0) {
|
||||
ret = wc_RsaPSS_Sign_ex(digest, digestSz, out, outSz, hash[0],
|
||||
mgf[0], digestSz + 1, key, rng);
|
||||
mgf[0], (int)digestSz + 1, key, rng);
|
||||
}
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WC_NO_ERR_TRACE(PSS_SALTLEN_E))
|
||||
@@ -19828,7 +19828,7 @@ static wc_test_ret_t rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
#endif
|
||||
if (ret >= 0) {
|
||||
ret = wc_RsaPSS_VerifyInline_ex(sig, outSz, &plain, hash[0], mgf[0],
|
||||
digestSz + 1, key);
|
||||
(int)digestSz + 1, key);
|
||||
}
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WC_NO_ERR_TRACE(PSS_SALTLEN_E))
|
||||
@@ -26470,7 +26470,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_pbkdf_test(void)
|
||||
if (ret < 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (XMEMCMP(derived, verify, kLen) != 0)
|
||||
if (XMEMCMP(derived, verify, (unsigned long)kLen) != 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
|
||||
iterations = 1000;
|
||||
@@ -26755,7 +26755,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (XMEMCMP(okm1, res1, L) != 0)
|
||||
if (XMEMCMP(okm1, res1, (unsigned long)L) != 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
@@ -26766,7 +26766,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (XMEMCMP(okm1, res2, L) != 0)
|
||||
if (XMEMCMP(okm1, res2, (unsigned long)L) != 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* !NO_SHA */
|
||||
@@ -26777,7 +26777,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (XMEMCMP(okm1, res3, L) != 0)
|
||||
if (XMEMCMP(okm1, res3, (unsigned long)L) != 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
|
||||
#ifndef HAVE_FIPS
|
||||
@@ -26787,7 +26787,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hkdf_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (XMEMCMP(okm1, res4, L) != 0)
|
||||
if (XMEMCMP(okm1, res4, (unsigned long)L) != 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* !NO_SHA256 */
|
||||
@@ -26994,7 +26994,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t prf_test(void)
|
||||
int lblsdL = LBSL;
|
||||
int hash_type = sha384_mac;
|
||||
|
||||
ret = wc_PRF(dig, (word32)digL, secret, secL, lablSd, lblsdL, hash_type,
|
||||
ret = wc_PRF(dig, (word32)digL, secret, (word32)secL, lablSd,
|
||||
(word32)lblsdL, hash_type,
|
||||
HEAP_HINT, INVALID_DEVID);
|
||||
if (ret != 0) {
|
||||
printf("Failed w/ code: %d\n", ret);
|
||||
@@ -27645,111 +27646,117 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void)
|
||||
|
||||
ret = wc_Tls13_HKDF_Extract(secret, NULL, 0,
|
||||
(tv->pskSz == 0) ? zeroes : (byte*)tv->psk,
|
||||
tv->pskSz, tv->hashAlg);
|
||||
tv->pskSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)ceTrafficLabel, (word32)XSTRLEN(ceTrafficLabel),
|
||||
tv->hashHello1, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashHello1, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->clientEarlyTrafficSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->clientEarlyTrafficSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)eExpMasterLabel, (word32)XSTRLEN(eExpMasterLabel),
|
||||
tv->hashHello1, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashHello1, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->earlyExporterMasterSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->earlyExporterMasterSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(salt, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)derivedLabel, (word32)XSTRLEN(derivedLabel),
|
||||
hashZero, (word32)hashAlgSz, tv->hashAlg);
|
||||
hashZero, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Extract(secret, salt, (word32)(word32)hashAlgSz,
|
||||
(tv->dheSz == 0) ? zeroes : (byte*)tv->dhe,
|
||||
tv->dheSz, tv->hashAlg);
|
||||
tv->dheSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)cHsTrafficLabel, (word32)XSTRLEN(cHsTrafficLabel),
|
||||
tv->hashHello2, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashHello2, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->clientHandshakeTrafficSecret,
|
||||
output, hashAlgSz);
|
||||
output, (unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)sHsTrafficLabel, (word32)XSTRLEN(sHsTrafficLabel),
|
||||
tv->hashHello2, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashHello2, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->serverHandshakeTrafficSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->serverHandshakeTrafficSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(salt, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)derivedLabel, (word32)XSTRLEN(derivedLabel),
|
||||
hashZero, (word32)hashAlgSz, tv->hashAlg);
|
||||
hashZero, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Extract(secret, salt, (word32)(word32)hashAlgSz,
|
||||
zeroes, (word32)(word32)hashAlgSz, tv->hashAlg);
|
||||
zeroes, (word32)(word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)cAppTrafficLabel, (word32)XSTRLEN(cAppTrafficLabel),
|
||||
tv->hashFinished1, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashFinished1, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->clientApplicationTrafficSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->clientApplicationTrafficSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)sAppTrafficLabel, (word32)XSTRLEN(sAppTrafficLabel),
|
||||
tv->hashFinished1, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashFinished1, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->serverApplicationTrafficSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->serverApplicationTrafficSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)expMasterLabel, (word32)XSTRLEN(expMasterLabel),
|
||||
tv->hashFinished1, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashFinished1, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->exporterMasterSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->exporterMasterSecret, output, (unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = wc_Tls13_HKDF_Expand_Label(output, (word32)hashAlgSz,
|
||||
secret, (word32)hashAlgSz,
|
||||
(byte*)protocolLabel, (word32)XSTRLEN(protocolLabel),
|
||||
(byte*)resMasterLabel, (word32)XSTRLEN(resMasterLabel),
|
||||
tv->hashFinished2, (word32)hashAlgSz, tv->hashAlg);
|
||||
tv->hashFinished2, (word32)hashAlgSz, (int)tv->hashAlg);
|
||||
if (ret != 0) break;
|
||||
|
||||
ret = XMEMCMP(tv->resumptionMasterSecret, output, hashAlgSz);
|
||||
ret = XMEMCMP(tv->resumptionMasterSecret, output,
|
||||
(unsigned long)hashAlgSz);
|
||||
if (ret != 0) break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user