mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-10 00:40:52 +02:00
src/internal.c: in wolfSSL_ERR_reason_error_string(), add missing error string for SCR_DIFFERENT_CERT_E, and de-gate error strings previously gated on HAVE_HTTP_CLIENT.
tests/api.c: add error_test() adapted from wolfcrypt/test/test.c, checking all error strings for expected presence/absence and length, called from existing test_wolfSSL_ERR_strings(). wolfssl/ssl.h, wolfssl/error-ssl.h, and wolfssl/wolfcrypt/error-crypt.h: * move several negative error return codes from ssl.h to error-ssl.h, * renumber them to conform to existing sequence, and * include error-ssl.h from ssl.h; * add special-case WOLFSSL_DEBUG_TRACE_ERROR_CODES macros for WOLFSSL_FAILURE; * add missing WOLFSSL_API attribute to wc_backtrace_render(). add numerous WC_NO_ERR_TRACE()s to operand error code uses, cleaning up error traces in general, and particularly when WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS. * crypto lib (36), * crypto test&benchmark (20), * TLS lib (179), * examples (122), * linuxkm (3), * tests/api.c (2272).
This commit is contained in:
@@ -184,7 +184,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -192,7 +192,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_connect(ssl);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "wolfSSL_connect error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
@@ -214,7 +214,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -222,7 +222,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_write(ssl, buff, (int)len);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != (int)len) {
|
||||
fprintf(stderr, "wolfSSL_write error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
@@ -236,7 +236,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -244,7 +244,7 @@ int client_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_read(ssl, buff, sizeof(buff)-1);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "wolfSSL_read error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
|
||||
@@ -248,7 +248,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -256,7 +256,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_accept(ssl);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "wolfSSL_accept error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
@@ -273,7 +273,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -281,7 +281,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_read(ssl, buff, sizeof(buff)-1);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "wolfSSL_read error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
@@ -308,7 +308,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0)
|
||||
break;
|
||||
@@ -316,7 +316,7 @@ int server_async_test(int argc, char** argv)
|
||||
#endif
|
||||
ret = wolfSSL_write(ssl, buff, (int)len);
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != (int)len) {
|
||||
fprintf(stderr, "wolfSSL_write error %d: %s\n",
|
||||
err, wolfSSL_ERR_error_string(err, errBuff));
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
/* This is where you would plug-in calls to your own hardware crypto */
|
||||
int AsyncTlsCryptoCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
{
|
||||
int ret = CRYPTOCB_UNAVAILABLE; /* return this to bypass HW and use SW */
|
||||
int ret = WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE); /* bypass HW by default */
|
||||
AsyncTlsCryptoCbCtx* myCtx = (AsyncTlsCryptoCbCtx*)ctx;
|
||||
|
||||
if (info == NULL)
|
||||
|
||||
@@ -1816,7 +1816,9 @@ static int SetupSupportedGroups(int verbose)
|
||||
printf("Will benchmark the following group: %s\n",
|
||||
groups[i].name);
|
||||
}
|
||||
} else if (uks_ret == BAD_FUNC_ARG || uks_ret == NOT_COMPILED_IN) {
|
||||
} else if (uks_ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG) ||
|
||||
uks_ret == WC_NO_ERR_TRACE(NOT_COMPILED_IN))
|
||||
{
|
||||
groups[i].group = 0;
|
||||
if (verbose) {
|
||||
printf("Will NOT benchmark the following group: %s\n",
|
||||
|
||||
+52
-50
@@ -183,10 +183,10 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
||||
while (ret != WOLFSSL_SUCCESS &&
|
||||
(error == WOLFSSL_ERROR_WANT_READ || error == WOLFSSL_ERROR_WANT_WRITE
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| error == WC_PENDING_E
|
||||
|| error == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
#ifdef WOLFSSL_NONBLOCK_OCSP
|
||||
|| error == OCSP_WANT_READ
|
||||
|| error == WC_NO_ERR_TRACE(OCSP_WANT_READ)
|
||||
#endif
|
||||
)) {
|
||||
int currTimeout = 1;
|
||||
@@ -197,7 +197,7 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
||||
printf("... client would write block\n");
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (error == WC_PENDING_E) {
|
||||
if (error == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -221,10 +221,10 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
||||
if ((select_ret == TEST_RECV_READY) || (select_ret == TEST_SEND_READY)
|
||||
|| (select_ret == TEST_ERROR_READY)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| error == WC_PENDING_E
|
||||
|| error == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
#ifdef WOLFSSL_NONBLOCK_OCSP
|
||||
|| error == OCSP_WANT_READ
|
||||
|| error == WC_NO_ERR_TRACE(OCSP_WANT_READ)
|
||||
#endif
|
||||
) {
|
||||
#ifndef WOLFSSL_CALLBACKS
|
||||
@@ -324,12 +324,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_X25519;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve x25519");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
else if (useX448) {
|
||||
@@ -339,12 +339,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_X448;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve x448");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@@ -355,12 +355,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_SECP256R1;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve secp256r1");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
#ifdef WOLFSSL_SM2
|
||||
do {
|
||||
@@ -368,12 +368,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_SM2P256V1;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve sm2p256v1");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -385,12 +385,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_FFDHE_2048;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use DH 2048-bit parameters");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_PQC
|
||||
@@ -471,13 +471,13 @@ static void EarlyData(WOLFSSL_CTX* ctx, WOLFSSL* ssl, const char* msg,
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != msgSz) {
|
||||
LOG_ERROR("SSL_write_early_data msg error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, buffer));
|
||||
@@ -583,14 +583,14 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
/* returns the number of polled items or <0 for error */
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
EarlyDataStatus(ssl);
|
||||
#endif
|
||||
@@ -687,13 +687,13 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* Perform throughput test */
|
||||
char *tx_buffer, *rx_buffer;
|
||||
@@ -739,13 +739,13 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != len) {
|
||||
LOG_ERROR("SSL_write bench error %d!\n", err);
|
||||
if (!exitWithRet)
|
||||
@@ -765,7 +765,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -928,13 +928,13 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
||||
if (ret < 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != (int)XSTRLEN(starttlsCmd[5])) {
|
||||
err_sys("failed to send SMTP QUIT command\n");
|
||||
}
|
||||
@@ -945,13 +945,13 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
||||
if (ret < 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret < 0) {
|
||||
err_sys("failed to read SMTP closing down response\n");
|
||||
}
|
||||
@@ -984,7 +984,7 @@ static int ClientWrite(WOLFSSL* ssl, const char* msg, int msgSz, const char* str
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -993,7 +993,7 @@ static int ClientWrite(WOLFSSL* ssl, const char* msg, int msgSz, const char* str
|
||||
} while (err == WOLFSSL_ERROR_WANT_WRITE ||
|
||||
err == WOLFSSL_ERROR_WANT_READ
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| err == WC_PENDING_E
|
||||
|| err == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
);
|
||||
if (ret != msgSz) {
|
||||
@@ -1021,14 +1021,16 @@ static int ClientRead(WOLFSSL* ssl, char* reply, int replyLen, int mustRead,
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != WOLFSSL_ERROR_WANT_READ &&
|
||||
err != WOLFSSL_ERROR_WANT_WRITE && err != APP_DATA_READY) {
|
||||
err != WOLFSSL_ERROR_WANT_WRITE &&
|
||||
err != WC_NO_ERR_TRACE(APP_DATA_READY))
|
||||
{
|
||||
LOG_ERROR("SSL_read reply error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, buffer));
|
||||
if (!exitWithRet) {
|
||||
@@ -1053,9 +1055,9 @@ static int ClientRead(WOLFSSL* ssl, char* reply, int replyLen, int mustRead,
|
||||
} while ((mustRead && err == WOLFSSL_ERROR_WANT_READ)
|
||||
|| err == WOLFSSL_ERROR_WANT_WRITE
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| err == WC_PENDING_E
|
||||
|| err == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
|| err == APP_DATA_READY
|
||||
|| err == WC_NO_ERR_TRACE(APP_DATA_READY)
|
||||
);
|
||||
if (ret > 0) {
|
||||
reply[ret] = 0; /* null terminate */
|
||||
@@ -1841,7 +1843,7 @@ static int client_srtp_test(WOLFSSL *ssl, func_args *args)
|
||||
|
||||
ret = wolfSSL_export_dtls_srtp_keying_material(ssl, NULL,
|
||||
&srtp_secret_length);
|
||||
if (ret != LENGTH_ONLY_E) {
|
||||
if (ret != WC_NO_ERR_TRACE(LENGTH_ONLY_E)) {
|
||||
LOG_ERROR("DTLS SRTP: Error getting keying material length\n");
|
||||
return ret;
|
||||
}
|
||||
@@ -3981,13 +3983,13 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
}
|
||||
#else
|
||||
timeoutConnect.tv_sec = DEFAULT_TIMEOUT_SEC;
|
||||
@@ -4168,7 +4170,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (err == WOLFSSL_SUCCESS)
|
||||
printf("Received ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == WOLFSSL_ALPN_NOT_FOUND)
|
||||
else if (err == WC_NO_ERR_TRACE(WOLFSSL_ALPN_NOT_FOUND))
|
||||
printf("No ALPN response received (no match with server)\n");
|
||||
else
|
||||
printf("Getting ALPN protocol name failed\n");
|
||||
@@ -4224,12 +4226,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
else {
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
if (err == APP_DATA_READY) {
|
||||
if (err == WC_NO_ERR_TRACE(APP_DATA_READY)) {
|
||||
if (wolfSSL_read(ssl, reply,
|
||||
sizeof(reply)-1) < 0) {
|
||||
err_sys("APP DATA should be present "
|
||||
@@ -4245,9 +4247,9 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
}
|
||||
} while (ret != WOLFSSL_SUCCESS &&
|
||||
(err == WOLFSSL_ERROR_WANT_READ ||
|
||||
err == WOLFSSL_ERROR_WANT_WRITE ||
|
||||
err == APP_DATA_READY ||
|
||||
err == WC_PENDING_E));
|
||||
err == WOLFSSL_ERROR_WANT_WRITE ||
|
||||
err == WC_NO_ERR_TRACE(APP_DATA_READY) ||
|
||||
err == WC_NO_ERR_TRACE(WC_PENDING_E)));
|
||||
}
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
@@ -4274,12 +4276,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if ((ret = wolfSSL_Rehandshake(ssl)) != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
while (err == WC_PENDING_E) {
|
||||
while (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
err = 0;
|
||||
ret = wolfSSL_negotiate(ssl);
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -4304,12 +4306,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if ((ret = wolfSSL_SecureResume(ssl)) != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
while (err == WC_PENDING_E) {
|
||||
while (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
err = 0;
|
||||
ret = wolfSSL_negotiate(ssl);
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -4573,14 +4575,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(sslResume, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(sslResume,
|
||||
WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
}
|
||||
#else
|
||||
timeoutConnect.tv_sec = DEFAULT_TIMEOUT_SEC;
|
||||
@@ -4615,7 +4617,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (err == WOLFSSL_SUCCESS)
|
||||
printf("Received ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == WOLFSSL_ALPN_NOT_FOUND)
|
||||
else if (err == WC_NO_ERR_TRACE(WOLFSSL_ALPN_NOT_FOUND))
|
||||
printf("Not received ALPN response (no match with server)\n");
|
||||
else
|
||||
printf("Getting ALPN protocol name failed\n");
|
||||
|
||||
@@ -248,13 +248,13 @@ void echoclient_test(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "SSL_connect error %d, %s\n", err,
|
||||
ERR_error_string((unsigned long)err, buffer));
|
||||
@@ -271,13 +271,13 @@ void echoclient_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != sendSz) {
|
||||
fprintf(stderr, "SSL_write msg error %d, %s\n", err,
|
||||
ERR_error_string((unsigned long)err, buffer));
|
||||
@@ -306,13 +306,13 @@ void echoclient_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret > 0) {
|
||||
reply[ret] = 0;
|
||||
LIBCALL_CHECK_RET(fputs(reply, fout));
|
||||
@@ -320,7 +320,9 @@ void echoclient_test(void* args)
|
||||
sendSz -= ret;
|
||||
}
|
||||
#ifdef WOLFSSL_DTLS
|
||||
else if (wolfSSL_dtls(ssl) && err == DECRYPT_ERROR) {
|
||||
else if (wolfSSL_dtls(ssl) &&
|
||||
err == WC_NO_ERR_TRACE(DECRYPT_ERROR))
|
||||
{
|
||||
/* This condition is OK. The packet should be dropped
|
||||
* silently when there is a decrypt or MAC error on
|
||||
* a DTLS record. */
|
||||
@@ -346,13 +348,13 @@ void echoclient_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#else
|
||||
SSL_shutdown(ssl);
|
||||
#endif
|
||||
|
||||
@@ -341,13 +341,13 @@ THREAD_RETURN WOLFSSL_THREAD echoserver_test(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "SSL_accept error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, buffer));
|
||||
@@ -381,13 +381,13 @@ THREAD_RETURN WOLFSSL_THREAD echoserver_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret <= 0) {
|
||||
if (err != WOLFSSL_ERROR_WANT_READ && err != WOLFSSL_ERROR_ZERO_RETURN){
|
||||
fprintf(stderr, "SSL_read echo error %d, %s!\n", err,
|
||||
@@ -444,13 +444,13 @@ THREAD_RETURN WOLFSSL_THREAD echoserver_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(write_ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(write_ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != echoSz) {
|
||||
fprintf(stderr, "SSL_write get error = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, buffer));
|
||||
@@ -470,13 +470,13 @@ THREAD_RETURN WOLFSSL_THREAD echoserver_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = wolfSSL_get_error(write_ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(write_ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
|
||||
if (ret != echoSz) {
|
||||
fprintf(stderr, "SSL_write echo error = %d, %s\n", err,
|
||||
|
||||
+1
-1
@@ -555,7 +555,7 @@ static int EncryptDer(unsigned char* in, word32 in_len, char* password,
|
||||
ret = wc_CreateEncryptedPKCS8Key(in, in_len, NULL, enc_len, password,
|
||||
(int)strlen(password), pbe_ver, pbe, enc_alg_id, salt, salt_sz,
|
||||
(int)iterations, &rng, NULL);
|
||||
if (ret == LENGTH_ONLY_E) {
|
||||
if (ret == WC_NO_ERR_TRACE(LENGTH_ONLY_E)) {
|
||||
ret = 0;
|
||||
}
|
||||
else if (ret == 0) {
|
||||
|
||||
+52
-45
@@ -342,7 +342,7 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
while (ret != WOLFSSL_SUCCESS &&
|
||||
(error == WOLFSSL_ERROR_WANT_READ || error == WOLFSSL_ERROR_WANT_WRITE
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| error == WC_PENDING_E
|
||||
|| error == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
)) {
|
||||
if (error == WOLFSSL_ERROR_WANT_READ) {
|
||||
@@ -353,7 +353,7 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (error == WC_PENDING_E) {
|
||||
if (error == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
if ((select_ret == TEST_RECV_READY) || (select_ret == TEST_SEND_READY)
|
||||
|| (select_ret == TEST_ERROR_READY)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| error == WC_PENDING_E
|
||||
|| error == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
#ifndef WOLFSSL_CALLBACKS
|
||||
@@ -447,16 +447,17 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int block,
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != WOLFSSL_ERROR_WANT_READ &&
|
||||
err != WOLFSSL_ERROR_WANT_WRITE &&
|
||||
err != WOLFSSL_ERROR_ZERO_RETURN &&
|
||||
err != APP_DATA_READY) {
|
||||
err != WOLFSSL_ERROR_WANT_WRITE &&
|
||||
err != WOLFSSL_ERROR_ZERO_RETURN &&
|
||||
err != WC_NO_ERR_TRACE(APP_DATA_READY))
|
||||
{
|
||||
LOG_ERROR("SSL_read echo error %d\n", err);
|
||||
err_sys_ex(runWithErrors, "SSL_read failed");
|
||||
break;
|
||||
@@ -484,13 +485,13 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int block,
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
if (ret != (int)min((word32)len, (word32)rx_pos)) {
|
||||
LOG_ERROR("SSL_write echo error %d\n", err);
|
||||
err_sys_ex(runWithErrors, "SSL_write failed");
|
||||
@@ -545,7 +546,7 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
err = SSL_get_error(ssl, ret);
|
||||
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
if (err == APP_DATA_READY) {
|
||||
if (err == WC_NO_ERR_TRACE(APP_DATA_READY)) {
|
||||
/* If we receive a message during renegotiation
|
||||
* then just print it. We return the message sent
|
||||
* after the renegotiation. */
|
||||
@@ -563,14 +564,14 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
}
|
||||
#endif
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef WOLFSSL_DTLS
|
||||
if (wolfSSL_dtls(ssl) && err == DECRYPT_ERROR) {
|
||||
if (wolfSSL_dtls(ssl) && err == WC_NO_ERR_TRACE(DECRYPT_ERROR)) {
|
||||
LOG_ERROR("Dropped client's message due to a bad MAC\n");
|
||||
}
|
||||
else
|
||||
@@ -579,7 +580,7 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
&& err != WOLFSSL_ERROR_WANT_WRITE /* Can happen during
|
||||
* handshake */
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
&& err != APP_DATA_READY
|
||||
&& err != WC_NO_ERR_TRACE(APP_DATA_READY)
|
||||
#endif
|
||||
) {
|
||||
LOG_ERROR("SSL_read input error %d, %s\n", err,
|
||||
@@ -595,14 +596,14 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
#endif
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
ret = wolfSSL_peek(ssl, buffer, 0);
|
||||
err = SSL_get_error(ssl, ret);
|
||||
} while (err == WC_PENDING_E
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
|| err == WOLFSSL_ERROR_WANT_READ
|
||||
|| err == WOLFSSL_ERROR_WANT_WRITE);
|
||||
if (err < 0) {
|
||||
@@ -611,7 +612,7 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
if (wolfSSL_pending(ssl))
|
||||
err = WOLFSSL_ERROR_WANT_READ;
|
||||
}
|
||||
} while (err == WC_PENDING_E
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
|| err == WOLFSSL_ERROR_WANT_READ
|
||||
|| err == WOLFSSL_ERROR_WANT_WRITE);
|
||||
if (ret > 0) {
|
||||
@@ -641,7 +642,7 @@ static void ServerWrite(WOLFSSL* ssl, const char* output, int outputLen)
|
||||
err = SSL_get_error(ssl, 0);
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -652,7 +653,8 @@ static void ServerWrite(WOLFSSL* ssl, const char* output, int outputLen)
|
||||
len = (outputLen -= ret);
|
||||
err = WOLFSSL_ERROR_WANT_WRITE;
|
||||
}
|
||||
} while (err == WC_PENDING_E || err == WOLFSSL_ERROR_WANT_WRITE);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E) ||
|
||||
err == WOLFSSL_ERROR_WANT_WRITE);
|
||||
if (ret != outputLen) {
|
||||
char buffer[WOLFSSL_MAX_ERROR_SZ];
|
||||
LOG_ERROR("SSL_write msg error %d, %s\n", err,
|
||||
@@ -684,12 +686,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_X25519;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve x25519");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
else if (useX448) {
|
||||
@@ -699,12 +701,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_X448;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve x448");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
else if (usePqc == 1) {
|
||||
@@ -773,24 +775,24 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_SECP256R1;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve secp256r1");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#elif defined(WOLFSSL_SM2)
|
||||
do {
|
||||
ret = wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SM2P256V1);
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_ECC_SM2P256V1;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use curve sm2p256r1");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -802,12 +804,12 @@ static void SetKeyShare(WOLFSSL* ssl, int onlyKeyShare, int useX25519,
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
groups[count++] = WOLFSSL_FFDHE_2048;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E)
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E))
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
#endif
|
||||
else
|
||||
err_sys("unable to use DH 2048-bit parameters");
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
#endif
|
||||
}
|
||||
if (count >= MAX_GROUP_NUMBER)
|
||||
@@ -1386,7 +1388,7 @@ static int server_srtp_test(WOLFSSL *ssl, func_args *args)
|
||||
|
||||
ret = wolfSSL_export_dtls_srtp_keying_material(ssl, NULL,
|
||||
&srtp_secret_length);
|
||||
if (ret != LENGTH_ONLY_E) {
|
||||
if (ret != WC_NO_ERR_TRACE(LENGTH_ONLY_E)) {
|
||||
LOG_ERROR("DTLS SRTP: Error getting key material length\n");
|
||||
return ret;
|
||||
}
|
||||
@@ -3213,14 +3215,14 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
|
||||
}
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (ret == WC_PENDING_E) {
|
||||
else if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
err_sys("Failed wolfSSL_UseKeyShare in force-curve");
|
||||
}
|
||||
} while (ret == WC_PENDING_E);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
ret = wolfSSL_set_groups(ssl, &force_curve_group_id, 1);
|
||||
if (WOLFSSL_SUCCESS != ret) {
|
||||
err_sys("Failed wolfSSL_set_groups in force-curve");
|
||||
@@ -3423,7 +3425,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
/* returns the number of polled items or <0 for
|
||||
* error */
|
||||
ret = wolfSSL_AsyncPoll(ssl,
|
||||
@@ -3436,7 +3438,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
input[ret] = 0; /* null terminate message */
|
||||
printf("Early Data Client message: %s\n", input);
|
||||
}
|
||||
} while (err == WC_PENDING_E || ret > 0);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E) || ret > 0);
|
||||
}
|
||||
#endif
|
||||
do {
|
||||
@@ -3445,13 +3447,13 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
} while (err == WC_NO_ERR_TRACE(WC_PENDING_E));
|
||||
}
|
||||
#else
|
||||
if (nonBlocking) {
|
||||
@@ -3622,7 +3624,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
if (err == WOLFSSL_SUCCESS)
|
||||
printf("Sent ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == WOLFSSL_ALPN_NOT_FOUND)
|
||||
else if (err == WC_NO_ERR_TRACE(WOLFSSL_ALPN_NOT_FOUND))
|
||||
printf("No ALPN response sent (no match)\n");
|
||||
else
|
||||
printf("Getting ALPN protocol name failed\n");
|
||||
@@ -3653,12 +3655,12 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
err == WOLFSSL_ERROR_WANT_WRITE) {
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
if (err == APP_DATA_READY) {
|
||||
if (err == WC_NO_ERR_TRACE(APP_DATA_READY)) {
|
||||
if (wolfSSL_read(ssl, input, sizeof(input)-1) < 0) {
|
||||
err_sys("APP DATA should be present but error returned");
|
||||
}
|
||||
@@ -3670,9 +3672,9 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
}
|
||||
} while (ret != WOLFSSL_SUCCESS &&
|
||||
(err == WOLFSSL_ERROR_WANT_READ ||
|
||||
err == WOLFSSL_ERROR_WANT_WRITE ||
|
||||
err == APP_DATA_READY ||
|
||||
err == WC_PENDING_E));
|
||||
err == WOLFSSL_ERROR_WANT_WRITE ||
|
||||
err == WC_NO_ERR_TRACE(APP_DATA_READY) ||
|
||||
err == WC_NO_ERR_TRACE(WC_PENDING_E)));
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
printf("NON-BLOCKING RENEGOTIATION SUCCESSFUL\n");
|
||||
@@ -3693,12 +3695,12 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
if (wolfSSL_Rehandshake(ssl) != WOLFSSL_SUCCESS) {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
while (err == WC_PENDING_E) {
|
||||
while (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
err = 0;
|
||||
ret = wolfSSL_negotiate(ssl);
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
if (err == WC_PENDING_E) {
|
||||
if (err == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
@@ -3769,11 +3771,16 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
ServerRead(ssl, input, sizeof(input)-1);
|
||||
#endif
|
||||
}
|
||||
else if (err == 0 || err == WOLFSSL_ERROR_ZERO_RETURN) {
|
||||
else if (err == 0 ||
|
||||
err == WOLFSSL_ERROR_ZERO_RETURN)
|
||||
{
|
||||
err = ServerEchoData(ssl, clientfd, echoData, block, throughput);
|
||||
/* Got close notify. Ignore it if not expecting a failure. */
|
||||
if (err == WOLFSSL_ERROR_ZERO_RETURN && exitWithRet == 0)
|
||||
if (err == WOLFSSL_ERROR_ZERO_RETURN &&
|
||||
exitWithRet == 0)
|
||||
{
|
||||
err = 0;
|
||||
}
|
||||
if (err != 0) {
|
||||
SSL_free(ssl); ssl = NULL;
|
||||
SSL_CTX_free(ctx); ctx = NULL;
|
||||
|
||||
@@ -773,7 +773,7 @@ static int km_AesGcmDecrypt(struct aead_request *req)
|
||||
pr_err("%s: wc_AesGcmDecryptFinal failed with return code %d\n",
|
||||
crypto_tfm_alg_driver_name(crypto_aead_tfm(tfm)), err);
|
||||
|
||||
if (err == AES_GCM_AUTH_E) {
|
||||
if (err == WC_NO_ERR_TRACE(AES_GCM_AUTH_E)) {
|
||||
return -EBADMSG;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -105,7 +105,7 @@ static void lkmFipsCb(int ok, int err, const char* hash)
|
||||
{
|
||||
if ((! ok) || (err != 0))
|
||||
pr_err("libwolfssl FIPS error: %s\n", wc_GetErrorString(err));
|
||||
if (err == IN_CORE_FIPS_E) {
|
||||
if (err == WC_NO_ERR_TRACE(IN_CORE_FIPS_E)) {
|
||||
pr_err("In-core integrity hash check failure.\n"
|
||||
"Update verifyCore[] in fips_test.c with new hash \"%s\" and rebuild.\n",
|
||||
hash ? hash : "<null>");
|
||||
@@ -237,7 +237,7 @@ static int wolfssl_init(void)
|
||||
ret = wolfCrypt_GetStatus_fips();
|
||||
if (ret != 0) {
|
||||
pr_err("wolfCrypt_GetStatus_fips() failed with code %d: %s\n", ret, wc_GetErrorString(ret));
|
||||
if (ret == IN_CORE_FIPS_E) {
|
||||
if (ret == WC_NO_ERR_TRACE(IN_CORE_FIPS_E)) {
|
||||
const char *newhash = wolfCrypt_GetCoreHash_fips();
|
||||
pr_err("Update verifyCore[] in fips_test.c with new hash \"%s\" and rebuild.\n",
|
||||
newhash ? newhash : "<null>");
|
||||
|
||||
@@ -353,7 +353,7 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len)
|
||||
* (cannot be used with WOLFSSL_USER_IO) */
|
||||
bio->flags &= ~WOLFSSL_BIO_FLAG_RETRY;
|
||||
ret = wolfIO_Recv(bio->num.fd, (char*)buf, len, 0);
|
||||
if (ret == WOLFSSL_CBIO_ERR_WANT_READ) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
|
||||
bio->flags |= WOLFSSL_BIO_FLAG_RETRY;
|
||||
}
|
||||
if (ret < 0) {
|
||||
@@ -377,7 +377,7 @@ int wolfSSL_BIO_read(WOLFSSL_BIO* bio, void* buf, int len)
|
||||
ret = wolfIO_RecvFrom(bio->num.fd, &bio->peer_addr,
|
||||
(char*)buf, len, 0);
|
||||
}
|
||||
if (ret == WOLFSSL_CBIO_ERR_WANT_READ) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
|
||||
bio->flags |= WOLFSSL_BIO_FLAG_RETRY;
|
||||
}
|
||||
if (ret < 0) {
|
||||
@@ -777,7 +777,7 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len)
|
||||
* (cannot be used with WOLFSSL_USER_IO) */
|
||||
bio->flags &= ~WOLFSSL_BIO_FLAG_RETRY;
|
||||
ret = wolfIO_Send(bio->num.fd, (char*)data, len, 0);
|
||||
if (ret == WOLFSSL_CBIO_ERR_WANT_WRITE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_WRITE)) {
|
||||
bio->flags |= WOLFSSL_BIO_FLAG_RETRY;
|
||||
}
|
||||
if (ret < 0) {
|
||||
@@ -800,7 +800,7 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len)
|
||||
ret = SOCKET_ERROR_E;
|
||||
else
|
||||
ret = wolfIO_SendTo(bio->num.fd, &bio->peer_addr, (char*)data, len, 0);
|
||||
if (ret == WOLFSSL_CBIO_ERR_WANT_WRITE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_WRITE)) {
|
||||
bio->flags |= WOLFSSL_BIO_FLAG_RETRY;
|
||||
}
|
||||
if (ret < 0) {
|
||||
@@ -2224,7 +2224,7 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
|
||||
/* return the context and initialize the BIO state */
|
||||
int wolfSSL_BIO_get_md_ctx(WOLFSSL_BIO *bio, WOLFSSL_EVP_MD_CTX **mdcp)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if ((bio != NULL) && (mdcp != NULL)) {
|
||||
*mdcp = bio->ptr.md_ctx;
|
||||
|
||||
+2
-2
@@ -800,7 +800,7 @@ expand_cleanup:
|
||||
{(idx)++;}
|
||||
int wolfSSL_NCONF_load(WOLFSSL_CONF *conf, const char *file, long *eline)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_BIO *in = NULL;
|
||||
char* buf = NULL;
|
||||
char* idx = NULL;
|
||||
@@ -1539,7 +1539,7 @@ static const conf_cmd_tbl* wolfssl_conf_find_cmd(WOLFSSL_CONF_CTX* cctx,
|
||||
*/
|
||||
int wolfSSL_CONF_cmd(WOLFSSL_CONF_CTX* cctx, const char* cmd, const char* value)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
const conf_cmd_tbl* confcmd = NULL;
|
||||
WOLFSSL_ENTER("wolfSSL_CONF_cmd");
|
||||
|
||||
|
||||
@@ -480,7 +480,7 @@ int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
|
||||
if (crl->crlIOCb) {
|
||||
int cbRet = crl->crlIOCb(crl, (const char*)extCrlInfo,
|
||||
extCrlInfoSz);
|
||||
if (cbRet == WOLFSSL_CBIO_ERR_WANT_READ) {
|
||||
if (cbRet == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
|
||||
ret = OCSP_WANT_READ;
|
||||
}
|
||||
else if (ret >= 0) {
|
||||
|
||||
+7
-6
@@ -395,7 +395,8 @@ int Dtls13ProcessBufferedMessages(WOLFSSL* ssl)
|
||||
* from there, the message can be considered processed successfully.
|
||||
* WANT_WRITE means that we are done with processing the msg and we are
|
||||
* waiting to flush the output buffer. */
|
||||
if ((ret == 0 || ret == WANT_WRITE) || (msg->type == certificate_request &&
|
||||
if ((ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE)) ||
|
||||
(msg->type == certificate_request &&
|
||||
ssl->options.handShakeDone &&
|
||||
ret == WC_NO_ERR_TRACE(WC_PENDING_E))) {
|
||||
if (IsAtLeastTLSv1_3(ssl->version))
|
||||
@@ -919,7 +920,7 @@ static int Dtls13SendOneFragmentRtx(WOLFSSL* ssl,
|
||||
handshakeType, hashOutput, Dtls13SendNow(ssl, handshakeType));
|
||||
|
||||
if (rtxRecord != NULL) {
|
||||
if (ret == 0 || ret == WANT_WRITE)
|
||||
if (ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
Dtls13RtxAddRecord(&ssl->dtls13Rtx, rtxRecord);
|
||||
else
|
||||
Dtls13FreeRtxBufferRecord(ssl, rtxRecord);
|
||||
@@ -979,7 +980,7 @@ static int Dtls13SendFragmentedInternal(WOLFSSL* ssl)
|
||||
ret = Dtls13SendOneFragmentRtx(ssl,
|
||||
(enum HandShakeType)ssl->dtls13FragHandshakeType,
|
||||
(word16)recordLength + MAX_MSG_EXTRA, output, (word32)recordLength, 0);
|
||||
if (ret == WANT_WRITE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE)) {
|
||||
ssl->dtls13FragOffset += fragLength;
|
||||
return ret;
|
||||
}
|
||||
@@ -1561,7 +1562,7 @@ static int Dtls13RtxSendBuffered(WOLFSSL* ssl)
|
||||
ret = Dtls13SendFragment(ssl, output, (word16)sendSz, r->length + headerLength,
|
||||
(enum HandShakeType)r->handshakeType, 0,
|
||||
isLast || !ssl->options.groupMessages);
|
||||
if (ret != 0 && ret != WANT_WRITE)
|
||||
if (ret != 0 && ret != WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
return ret;
|
||||
|
||||
if (r->rnIdx >= DTLS13_RETRANS_RN_SIZE)
|
||||
@@ -1575,7 +1576,7 @@ static int Dtls13RtxSendBuffered(WOLFSSL* ssl)
|
||||
r->seq[r->rnIdx] = seq;
|
||||
r->rnIdx++;
|
||||
|
||||
if (ret == WANT_WRITE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE)) {
|
||||
/* this fragment will be sent eventually. Move it to the end of the
|
||||
list so next time we start with a new one. */
|
||||
Dtls13RtxMoveToEndOfList(ssl, prevNext, r);
|
||||
@@ -1874,7 +1875,7 @@ int Dtls13HandshakeSend(WOLFSSL* ssl, byte* message, word16 outputSize,
|
||||
if (maxLen < maxFrag) {
|
||||
ret = Dtls13SendOneFragmentRtx(ssl, handshakeType, outputSize, message,
|
||||
length, hashOutput);
|
||||
if (ret == 0 || ret == WANT_WRITE)
|
||||
if (ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
ssl->keys.dtls_handshake_number++;
|
||||
}
|
||||
else {
|
||||
|
||||
+113
-53
@@ -7575,7 +7575,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
|
||||
/* requires valid arrays and suites unless writeDup ing */
|
||||
if ((ret = SetSSL_CTX(ssl, ctx, writeDup)) != WOLFSSL_SUCCESS
|
||||
#ifdef WOLFSSL_NO_INIT_CTX_KEY
|
||||
&& ret != NO_PRIVATE_KEY
|
||||
&& ret != WC_NO_ERR_TRACE(NO_PRIVATE_KEY)
|
||||
#endif
|
||||
) {
|
||||
WOLFSSL_MSG_EX("SetSSL_CTX failed. err = %d", ret);
|
||||
@@ -10478,7 +10478,7 @@ retry:
|
||||
recvd = ssl->CBIORecv(ssl, (char *)buf, (int)sz, ssl->IOCB_ReadCtx);
|
||||
if (recvd < 0) {
|
||||
switch (recvd) {
|
||||
case WOLFSSL_CBIO_ERR_GENERAL: /* general/unknown error */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_GENERAL):
|
||||
#ifdef WOLFSSL_APACHE_HTTPD
|
||||
#ifndef NO_BIO
|
||||
if (ssl->biord) {
|
||||
@@ -10492,15 +10492,15 @@ retry:
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_WANT_READ: /* want read, would block */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ):
|
||||
if (retryLimit > 0 && ssl->ctx->autoRetry &&
|
||||
!ssl->options.handShakeDone && !ssl->options.dtls) {
|
||||
retryLimit--;
|
||||
goto retry;
|
||||
}
|
||||
return WANT_READ;
|
||||
return WC_NO_ERR_TRACE(WANT_READ);
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_RST: /* connection reset */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_CONN_RST):
|
||||
#ifdef USE_WINDOWS_API
|
||||
if (ssl->options.dtls) {
|
||||
goto retry;
|
||||
@@ -10509,7 +10509,7 @@ retry:
|
||||
ssl->options.connReset = 1;
|
||||
return -1;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_ISR: /* interrupt */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_ISR): /* interrupt */
|
||||
/* see if we got our timeout */
|
||||
#ifdef WOLFSSL_CALLBACKS
|
||||
if (ssl->toInfoOn) {
|
||||
@@ -10529,11 +10529,11 @@ retry:
|
||||
#endif
|
||||
goto retry;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_CLOSE: /* peer closed connection */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_CONN_CLOSE):
|
||||
ssl->options.isClosed = 1;
|
||||
return -1;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_TIMEOUT:
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_TIMEOUT):
|
||||
#ifdef WOLFSSL_DTLS
|
||||
#ifdef WOLFSSL_DTLS13
|
||||
if (ssl->options.dtls && IsAtLeastTLSv1_3(ssl->version)) {
|
||||
@@ -10649,19 +10649,19 @@ retry:
|
||||
if (sent < 0) {
|
||||
switch (sent) {
|
||||
|
||||
case WOLFSSL_CBIO_ERR_WANT_WRITE: /* would block */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_WRITE):
|
||||
if (retryLimit > 0 && ssl->ctx->autoRetry &&
|
||||
!ssl->options.handShakeDone && !ssl->options.dtls) {
|
||||
retryLimit--;
|
||||
goto retry;
|
||||
}
|
||||
return WANT_WRITE;
|
||||
return WC_NO_ERR_TRACE(WANT_WRITE);
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_RST: /* connection reset */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_CONN_RST):
|
||||
ssl->options.connReset = 1;
|
||||
break;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_ISR: /* interrupt */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_ISR): /* interrupt */
|
||||
/* see if we got our timeout */
|
||||
#ifdef WOLFSSL_CALLBACKS
|
||||
if (ssl->toInfoOn) {
|
||||
@@ -10681,7 +10681,7 @@ retry:
|
||||
#endif
|
||||
continue;
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_CLOSE: /* epipe / conn closed */
|
||||
case WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_CONN_CLOSE): /* epipe */
|
||||
ssl->options.connReset = 1; /* treat same as reset */
|
||||
break;
|
||||
|
||||
@@ -15379,9 +15379,9 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
if (ssl->peerVerifyRet == 0) {
|
||||
/* Return first cert error here */
|
||||
ssl->peerVerifyRet =
|
||||
ret == OCSP_CERT_REVOKED
|
||||
? WOLFSSL_X509_V_ERR_CERT_REVOKED
|
||||
: WOLFSSL_X509_V_ERR_CERT_REJECTED;
|
||||
ret == WC_NO_ERR_TRACE(OCSP_CERT_REVOKED)
|
||||
? WOLFSSL_X509_V_ERR_CERT_REVOKED
|
||||
: WOLFSSL_X509_V_ERR_CERT_REJECTED;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -15410,7 +15410,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
if (ssl->peerVerifyRet == 0) {
|
||||
/* Return first cert error here */
|
||||
ssl->peerVerifyRet =
|
||||
ret == CRL_CERT_REVOKED
|
||||
ret == WC_NO_ERR_TRACE(CRL_CERT_REVOKED)
|
||||
? WOLFSSL_X509_V_ERR_CERT_REVOKED
|
||||
: WOLFSSL_X509_V_ERR_CERT_REJECTED;
|
||||
}
|
||||
@@ -17107,10 +17107,10 @@ int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
/* hello_request not hashed */
|
||||
if (type != hello_request
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
#ifdef WOLFSSL_NONBLOCK_OCSP
|
||||
&& ssl->error != OCSP_WANT_READ
|
||||
&& ssl->error != WC_NO_ERR_TRACE(OCSP_WANT_READ)
|
||||
#endif
|
||||
) {
|
||||
ret = HashInput(ssl, input + *inOutIdx, (int)size);
|
||||
@@ -20838,8 +20838,8 @@ static int GetInputData(WOLFSSL *ssl, word32 size)
|
||||
ssl->buffers.inputBuffer.buffer +
|
||||
ssl->buffers.inputBuffer.length,
|
||||
(word32)inSz);
|
||||
if (in == WANT_READ)
|
||||
return WANT_READ;
|
||||
if (in == WC_NO_ERR_TRACE(WANT_READ))
|
||||
return WC_NO_ERR_TRACE(WANT_READ);
|
||||
|
||||
if (in < 0) {
|
||||
WOLFSSL_ERROR_VERBOSE(SOCKET_ERROR_E);
|
||||
@@ -21078,15 +21078,17 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr)
|
||||
atomicUser = 1;
|
||||
#endif
|
||||
|
||||
if (ssl->error != 0 && ssl->error != WANT_READ && ssl->error != WANT_WRITE
|
||||
if (ssl->error != 0 &&
|
||||
ssl->error != WC_NO_ERR_TRACE(WANT_READ) &&
|
||||
ssl->error != WC_NO_ERR_TRACE(WANT_WRITE)
|
||||
#if defined(HAVE_SECURE_RENEGOTIATION) || defined(WOLFSSL_DTLS13)
|
||||
&& ssl->error != APP_DATA_READY
|
||||
&& ssl->error != WC_NO_ERR_TRACE(APP_DATA_READY)
|
||||
#endif
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
#ifdef WOLFSSL_NONBLOCK_OCSP
|
||||
&& ssl->error != OCSP_WANT_READ
|
||||
&& ssl->error != WC_NO_ERR_TRACE(OCSP_WANT_READ)
|
||||
#endif
|
||||
&& (allowSocketErr != 1 ||
|
||||
ssl->error != WC_NO_ERR_TRACE(SOCKET_ERROR_E))
|
||||
@@ -21320,7 +21322,7 @@ default:
|
||||
if (!ssl->options.dtls) {
|
||||
if ((ret = GetInputData(ssl, ssl->curSize)) < 0) {
|
||||
#ifdef WOLFSSL_EXTRA_ALERTS
|
||||
if (ret != WANT_READ)
|
||||
if (ret != WC_NO_ERR_TRACE(WANT_READ))
|
||||
SendAlert(ssl, alert_fatal, bad_record_mac);
|
||||
#endif
|
||||
return ret;
|
||||
@@ -21843,7 +21845,7 @@ default:
|
||||
* calling DtlsMsgPoolSend. This msg is done
|
||||
* processing so let's move on. */
|
||||
&& (!ssl->options.dtls
|
||||
|| ret != WANT_WRITE)
|
||||
|| ret != WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* In async case, on pending, move onto next message.
|
||||
* Current message should have been DtlsMsgStore'ed and
|
||||
@@ -23765,7 +23767,7 @@ int SendCertificate(WOLFSSL* ssl)
|
||||
ret = SendBuffered(ssl);
|
||||
}
|
||||
|
||||
if (ret != WANT_WRITE) {
|
||||
if (ret != WC_NO_ERR_TRACE(WANT_WRITE)) {
|
||||
/* Clean up the fragment offset. */
|
||||
ssl->options.buildingMsg = 0;
|
||||
ssl->fragOffset = 0;
|
||||
@@ -24488,9 +24490,9 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
|
||||
int groupMsgs = 0;
|
||||
#endif
|
||||
|
||||
if (ssl->error == WANT_WRITE
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| ssl->error == WC_PENDING_E
|
||||
|| ssl->error == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
ssl->error = 0;
|
||||
@@ -24747,7 +24749,9 @@ int ReceiveData(WOLFSSL* ssl, byte* output, int sz, int peek)
|
||||
WOLFSSL_ENTER("ReceiveData");
|
||||
|
||||
/* reset error state */
|
||||
if (ssl->error == WANT_READ || ssl->error == WOLFSSL_ERROR_WANT_READ) {
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_READ) ||
|
||||
ssl->error == WOLFSSL_ERROR_WANT_READ)
|
||||
{
|
||||
ssl->error = 0;
|
||||
}
|
||||
|
||||
@@ -24764,12 +24768,12 @@ int ReceiveData(WOLFSSL* ssl, byte* output, int sz, int peek)
|
||||
}
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
|
||||
if (ssl->error != 0 && ssl->error != WANT_WRITE
|
||||
if (ssl->error != 0 && ssl->error != WC_NO_ERR_TRACE(WANT_WRITE)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
#if defined(HAVE_SECURE_RENEGOTIATION) || defined(WOLFSSL_DTLS13)
|
||||
&& ssl->error != APP_DATA_READY
|
||||
&& ssl->error != WC_NO_ERR_TRACE(APP_DATA_READY)
|
||||
#endif
|
||||
) {
|
||||
WOLFSSL_MSG("User calling wolfSSL_read in error state, not allowed");
|
||||
@@ -24812,7 +24816,7 @@ startScr:
|
||||
|
||||
while (ssl->buffers.clearOutputBuffer.length == 0) {
|
||||
if ( (ssl->error = ProcessReply(ssl)) < 0) {
|
||||
if (ssl->error == ZERO_RETURN) {
|
||||
if (ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN)) {
|
||||
WOLFSSL_MSG("Zero return, no more data coming");
|
||||
return 0; /* no more data coming */
|
||||
}
|
||||
@@ -24964,7 +24968,7 @@ static int SendAlert_ex(WOLFSSL* ssl, int severity, int type)
|
||||
/* If CheckAvailableSize returned WANT_WRITE due to a blocking write
|
||||
* then discard pending output and just send the alert. */
|
||||
if (ssl->options.dtls) {
|
||||
if (ret != WANT_WRITE || severity != alert_fatal)
|
||||
if (ret != WC_NO_ERR_TRACE(WANT_WRITE) || severity != alert_fatal)
|
||||
return ret;
|
||||
ShrinkOutputBuffer(ssl);
|
||||
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0) {
|
||||
@@ -25434,6 +25438,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
|
||||
case SESSION_TICKET_EXPECT_E:
|
||||
return "Session Ticket Error";
|
||||
|
||||
case SCR_DIFFERENT_CERT_E:
|
||||
return "SCR Different cert error";
|
||||
|
||||
case SESSION_SECRET_CB_E:
|
||||
return "Session Secret Callback Error";
|
||||
|
||||
@@ -25599,22 +25606,27 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
|
||||
case UNSUPPORTED_CERTIFICATE:
|
||||
return "Unsupported certificate type";
|
||||
|
||||
#ifdef HAVE_HTTP_CLIENT
|
||||
case HTTP_TIMEOUT:
|
||||
return "HTTP timeout for OCSP or CRL req";
|
||||
|
||||
case HTTP_RECV_ERR:
|
||||
return "HTTP Receive error";
|
||||
|
||||
case HTTP_HEADER_ERR:
|
||||
return "HTTP Header error";
|
||||
|
||||
case HTTP_PROTO_ERR:
|
||||
return "HTTP Protocol error";
|
||||
|
||||
case HTTP_STATUS_ERR:
|
||||
return "HTTP Status error";
|
||||
|
||||
case HTTP_VERSION_ERR:
|
||||
return "HTTP Version error";
|
||||
|
||||
case HTTP_APPSTR_ERR:
|
||||
return "HTTP Application string error";
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
|
||||
/* TODO: -WOLFSSL_X509_V_ERR_CERT_SIGNATURE_FAILURE. Conflicts with
|
||||
* -WOLFSSL_ERROR_WANT_CONNECT. */
|
||||
@@ -25645,6 +25657,7 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
|
||||
case -WOLFSSL_X509_V_ERR_SUBJECT_ISSUER_MISMATCH:
|
||||
return "subject issuer mismatch";
|
||||
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL || HAVE_WEBSERVER */
|
||||
|
||||
case UNSUPPORTED_PROTO_VERSION:
|
||||
#ifdef OPENSSL_EXTRA
|
||||
return "WRONG_SSL_VERSION";
|
||||
@@ -25654,23 +25667,68 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
|
||||
|
||||
case FALCON_KEY_SIZE_E:
|
||||
return "Wrong key size for Falcon.";
|
||||
|
||||
case DILITHIUM_KEY_SIZE_E:
|
||||
return "Wrong key size for Dilithium.";
|
||||
|
||||
#ifdef WOLFSSL_QUIC
|
||||
case QUIC_TP_MISSING_E:
|
||||
return "QUIC transport parameter not set";
|
||||
|
||||
case QUIC_WRONG_ENC_LEVEL:
|
||||
return "QUIC data received at wrong encryption level";
|
||||
#endif
|
||||
|
||||
case DTLS_CID_ERROR:
|
||||
return "DTLS ConnectionID mismatch or missing";
|
||||
|
||||
case DTLS_TOO_MANY_FRAGMENTS_E:
|
||||
return "Received too many fragmented messages from peer error";
|
||||
|
||||
case DUPLICATE_TLS_EXT_E:
|
||||
return "Duplicate TLS extension in message.";
|
||||
|
||||
case WOLFSSL_ALPN_NOT_FOUND:
|
||||
return "TLS extension not found";
|
||||
|
||||
case WOLFSSL_BAD_CERTTYPE:
|
||||
return "Certificate type not supported";
|
||||
|
||||
case WOLFSSL_BAD_STAT:
|
||||
case WOLFSSL_BAD_PATH:
|
||||
return "No certificates found at designated path";
|
||||
|
||||
case WOLFSSL_BAD_FILETYPE:
|
||||
return "Data format not supported";
|
||||
|
||||
case WOLFSSL_BAD_FILE:
|
||||
return "Input/output error on file";
|
||||
|
||||
case WOLFSSL_NOT_IMPLEMENTED:
|
||||
return "Function not implemented";
|
||||
|
||||
case WOLFSSL_UNKNOWN:
|
||||
return "Unknown algorithm (EVP)";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_GENERAL:
|
||||
return "I/O callback general unexpected error";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_WANT_READ:
|
||||
return "I/O callback want read, call again";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_WANT_WRITE:
|
||||
return "I/O callback want write, call again";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_RST:
|
||||
return "I/O callback connection reset";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_ISR:
|
||||
return "I/O callback interrupt";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_CONN_CLOSE:
|
||||
return "I/O callback connection closed or epipe";
|
||||
|
||||
case WOLFSSL_CBIO_ERR_TIMEOUT:
|
||||
return "I/O callback socket timeout";
|
||||
|
||||
default :
|
||||
return "unknown error number";
|
||||
}
|
||||
@@ -26553,7 +26611,7 @@ const char* GetCipherMacStr(char n[][MAX_SEGMENT_SZ]) {
|
||||
|
||||
/* Returns the number of bits based on the cipher enc string, or 0 on failure */
|
||||
int SetCipherBits(const char* enc) {
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if ((XSTRCMP(enc,"AESGCM(256)") == 0) ||
|
||||
(XSTRCMP(enc,"AES(256)") == 0) ||
|
||||
@@ -32672,7 +32730,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
);
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_CURVE25519,
|
||||
@@ -32693,7 +32751,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
);
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_CURVE448,
|
||||
@@ -32740,7 +32798,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
);
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_CURVE25519,
|
||||
@@ -32761,7 +32819,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
);
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_CURVE448,
|
||||
@@ -32784,7 +32842,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
&& !ssl->options.keepResources) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_ECC,
|
||||
@@ -33046,7 +33104,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
|
||||
if (!ssl->options.groupMessages) {
|
||||
ret = SendBuffered(ssl);
|
||||
}
|
||||
if (ret == 0 || ret == WANT_WRITE) {
|
||||
if (ret == 0 || ret == WC_NO_ERR_TRACE(WANT_WRITE)) {
|
||||
int tmpRet = MakeMasterSecret(ssl);
|
||||
if (tmpRet != 0) {
|
||||
ret = tmpRet; /* save WANT_WRITE unless more serious */
|
||||
@@ -33076,7 +33134,9 @@ exit_scke:
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_IO
|
||||
/* Handle async operation */
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) || ret == WANT_WRITE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E) ||
|
||||
ret == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
{
|
||||
if (ssl->options.buildingMsg)
|
||||
return ret;
|
||||
/* If we have completed all states then we will not enter this function
|
||||
@@ -33629,9 +33689,9 @@ exit_scv:
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_IO
|
||||
/* Handle async operation */
|
||||
if (ret == WANT_WRITE
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| ret == WC_PENDING_E
|
||||
|| ret == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
)
|
||||
return ret;
|
||||
@@ -35860,9 +35920,9 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_IO
|
||||
/* Handle async operation */
|
||||
if (ret == WANT_WRITE
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| ret == WC_PENDING_E
|
||||
|| ret == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
)
|
||||
return ret;
|
||||
@@ -40457,7 +40517,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
|
||||
);
|
||||
if (!ssl->specs.static_ecdh
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
FreeKey(ssl, DYNAMIC_TYPE_ECC,
|
||||
|
||||
+5
-2
@@ -533,7 +533,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
responseSz = ocsp->cm->ocspIOCb(ioCtx, url, urlSz,
|
||||
request, requestSz, &response);
|
||||
}
|
||||
if (responseSz == WOLFSSL_CBIO_ERR_WANT_READ) {
|
||||
if (responseSz == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
|
||||
ret = OCSP_WANT_READ;
|
||||
}
|
||||
|
||||
@@ -1667,8 +1667,11 @@ int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx)
|
||||
if (ret <= 0) {
|
||||
if (resp != NULL)
|
||||
XFREE(resp, NULL, DYNAMIC_TYPE_OCSP);
|
||||
if (ret == WOLFSSL_CBIO_ERR_WANT_READ || ret == OCSP_WANT_READ)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ) ||
|
||||
ret == WC_NO_ERR_TRACE(OCSP_WANT_READ))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
respLen = ret;
|
||||
|
||||
+4
-2
@@ -614,7 +614,7 @@ int wolfSSL_quic_do_handshake(WOLFSSL* ssl)
|
||||
else {
|
||||
ret = wolfSSL_read_early_data(ssl, tmpbuffer,
|
||||
sizeof(tmpbuffer), &len);
|
||||
if (ret < 0 && ssl->error == ZERO_RETURN) {
|
||||
if (ret < 0 && ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN)) {
|
||||
/* this is expected, since QUIC handles the actual early
|
||||
* data separately. */
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
@@ -634,7 +634,9 @@ int wolfSSL_quic_do_handshake(WOLFSSL* ssl)
|
||||
cleanup:
|
||||
if (ret <= 0
|
||||
&& ssl->options.handShakeState == HANDSHAKE_DONE
|
||||
&& (ssl->error == ZERO_RETURN || ssl->error == WANT_READ)) {
|
||||
&& (ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN) ||
|
||||
ssl->error == WC_NO_ERR_TRACE(WANT_READ)))
|
||||
{
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
}
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
|
||||
@@ -2046,7 +2046,7 @@ static int DtlsSrtpSelProfiles(word16* id, const char* profile_str)
|
||||
|
||||
int wolfSSL_CTX_set_tlsext_use_srtp(WOLFSSL_CTX* ctx, const char* profile_str)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL) {
|
||||
ret = DtlsSrtpSelProfiles(&ctx->dtlsSrtpProfiles, profile_str);
|
||||
}
|
||||
@@ -2054,7 +2054,7 @@ int wolfSSL_CTX_set_tlsext_use_srtp(WOLFSSL_CTX* ctx, const char* profile_str)
|
||||
}
|
||||
int wolfSSL_set_tlsext_use_srtp(WOLFSSL* ssl, const char* profile_str)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ssl != NULL) {
|
||||
ret = DtlsSrtpSelProfiles(&ssl->dtlsSrtpProfiles, profile_str);
|
||||
}
|
||||
@@ -2399,7 +2399,7 @@ int wolfSSL_mcast_set_highwater_ctx(WOLFSSL* ssl, void* ctx)
|
||||
/* return underlying connect or accept, WOLFSSL_SUCCESS on ok */
|
||||
int wolfSSL_negotiate(WOLFSSL* ssl)
|
||||
{
|
||||
int err = WOLFSSL_FATAL_ERROR;
|
||||
int err = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_negotiate");
|
||||
|
||||
@@ -2905,9 +2905,9 @@ static int wolfSSL_read_internal(WOLFSSL* ssl, void* data, int sz, int peek)
|
||||
|
||||
#ifdef HAVE_WRITE_DUP
|
||||
if (ssl->dupWrite) {
|
||||
if (ssl->error != 0 && ssl->error != WANT_READ
|
||||
if (ssl->error != 0 && ssl->error != WC_NO_ERR_TRACE(WANT_READ)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
int notifyErr;
|
||||
@@ -3980,7 +3980,7 @@ int wolfSSL_recv(WOLFSSL* ssl, void* data, int sz, int flags)
|
||||
|
||||
int wolfSSL_SendUserCanceled(WOLFSSL* ssl)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_ENTER("wolfSSL_recv");
|
||||
|
||||
if (ssl != NULL) {
|
||||
@@ -4002,7 +4002,7 @@ int wolfSSL_SendUserCanceled(WOLFSSL* ssl)
|
||||
WOLFSSL_ABI
|
||||
int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
{
|
||||
int ret = WOLFSSL_FATAL_ERROR;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
|
||||
WOLFSSL_ENTER("wolfSSL_shutdown");
|
||||
|
||||
if (ssl == NULL)
|
||||
@@ -4044,7 +4044,7 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
/* call wolfSSL_shutdown again for bidirectional shutdown */
|
||||
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
||||
ret = ProcessReply(ssl);
|
||||
if ((ret == ZERO_RETURN) ||
|
||||
if ((ret == WC_NO_ERR_TRACE(ZERO_RETURN)) ||
|
||||
(ret == WC_NO_ERR_TRACE(SOCKET_ERROR_E))) {
|
||||
/* simulate OpenSSL behavior */
|
||||
ssl->options.shutdownDone = 1;
|
||||
@@ -4102,12 +4102,15 @@ int wolfSSL_get_error(WOLFSSL* ssl, int ret)
|
||||
WOLFSSL_LEAVE("wolfSSL_get_error", ssl->error);
|
||||
|
||||
/* make sure converted types are handled in SetErrorString() too */
|
||||
if (ssl->error == WANT_READ)
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_READ))
|
||||
return WOLFSSL_ERROR_WANT_READ; /* convert to OpenSSL type */
|
||||
else if (ssl->error == WANT_WRITE)
|
||||
else if (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
return WOLFSSL_ERROR_WANT_WRITE; /* convert to OpenSSL type */
|
||||
else if (ssl->error == ZERO_RETURN || ssl->options.shutdownDone)
|
||||
else if (ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN) ||
|
||||
ssl->options.shutdownDone)
|
||||
{
|
||||
return WOLFSSL_ERROR_ZERO_RETURN; /* convert to OpenSSL type */
|
||||
}
|
||||
#ifdef OPENSSL_EXTRA
|
||||
else if (ssl->error == WC_NO_ERR_TRACE(SOCKET_PEER_CLOSED_E))
|
||||
return WOLFSSL_ERROR_SYSCALL; /* convert to OpenSSL type */
|
||||
@@ -4131,9 +4134,9 @@ int wolfSSL_want(WOLFSSL* ssl)
|
||||
{
|
||||
int rw_state = SSL_NOTHING;
|
||||
if (ssl) {
|
||||
if (ssl->error == WANT_READ)
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_READ))
|
||||
rw_state = SSL_READING;
|
||||
else if (ssl->error == WANT_WRITE)
|
||||
else if (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
rw_state = SSL_WRITING;
|
||||
}
|
||||
return rw_state;
|
||||
@@ -4144,7 +4147,7 @@ int wolfSSL_want(WOLFSSL* ssl)
|
||||
int wolfSSL_want_read(WOLFSSL* ssl)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_want_read");
|
||||
if (ssl->error == WANT_READ)
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_READ))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
@@ -4155,7 +4158,7 @@ int wolfSSL_want_read(WOLFSSL* ssl)
|
||||
int wolfSSL_want_write(WOLFSSL* ssl)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_want_write");
|
||||
if (ssl->error == WANT_WRITE)
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
@@ -8903,7 +8906,7 @@ int wolfSSL_dtls_got_timeout(WOLFSSL* ssl)
|
||||
if (ssl->options.dtls && IsAtLeastTLSv1_3(ssl->version)) {
|
||||
result = Dtls13RtxTimeout(ssl);
|
||||
if (result < 0) {
|
||||
if (result == WANT_WRITE)
|
||||
if (result == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
ssl->dtls13SendingAckOrRtx = 1;
|
||||
ssl->error = result;
|
||||
WOLFSSL_ERROR(result);
|
||||
@@ -9243,7 +9246,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* do not send buffered or advance state if last error was an
|
||||
async pending operation */
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
ret = SendBuffered(ssl);
|
||||
@@ -9342,7 +9345,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
||||
* should just ignore the message */
|
||||
ssl->dtls13Rtx.sendAcks = 0;
|
||||
if ((ssl->error = SendDtls13Ack(ssl)) < 0) {
|
||||
if (ssl->error == WANT_WRITE)
|
||||
if (ssl->error == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
ssl->dtls13SendingAckOrRtx = 1;
|
||||
WOLFSSL_ERROR(ssl->error);
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
@@ -9443,7 +9446,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
||||
ProcessReplyEx(ssl, 1); /* See if an alert was sent. */
|
||||
#endif
|
||||
#ifdef WOLFSSL_EXTRA_ALERTS
|
||||
if (ssl->error == NO_PEER_KEY ||
|
||||
if (ssl->error == WC_NO_ERR_TRACE(NO_PEER_KEY) ||
|
||||
ssl->error == WC_NO_ERR_TRACE(PSK_KEY_ERROR)) {
|
||||
SendAlert(ssl, alert_fatal, handshake_failure);
|
||||
}
|
||||
@@ -9794,7 +9797,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* do not send buffered or advance state if last error was an
|
||||
async pending operation */
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
ret = SendBuffered(ssl);
|
||||
@@ -10918,8 +10921,11 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_OpenSSL_add_all_algorithms_noconf");
|
||||
|
||||
if (wolfSSL_add_all_algorithms() == WOLFSSL_FATAL_ERROR)
|
||||
if (wolfSSL_add_all_algorithms() ==
|
||||
WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR))
|
||||
{
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
@@ -10932,7 +10938,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
the use of a wolfssl.cnf type configuration file and is only used for
|
||||
OpenSSL compatibility. */
|
||||
|
||||
if (wolfSSL_add_all_algorithms() == WOLFSSL_FATAL_ERROR) {
|
||||
if (wolfSSL_add_all_algorithms() ==
|
||||
WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR))
|
||||
{
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
return WOLFSSL_SUCCESS;
|
||||
@@ -12583,7 +12591,7 @@ static int Set_CTX_max_proto_version(WOLFSSL_CTX* ctx, int ver)
|
||||
int wolfSSL_CTX_set_max_proto_version(WOLFSSL_CTX* ctx, int version)
|
||||
{
|
||||
int i;
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int minProto;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_CTX_set_max_proto_version");
|
||||
@@ -12704,7 +12712,7 @@ static int Set_SSL_min_proto_version(WOLFSSL* ssl, int ver)
|
||||
int wolfSSL_set_min_proto_version(WOLFSSL* ssl, int version)
|
||||
{
|
||||
int i;
|
||||
int ret = WOLFSSL_FAILURE;;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_set_min_proto_version");
|
||||
|
||||
@@ -12772,7 +12780,7 @@ static int Set_SSL_max_proto_version(WOLFSSL* ssl, int ver)
|
||||
int wolfSSL_set_max_proto_version(WOLFSSL* ssl, int version)
|
||||
{
|
||||
int i;
|
||||
int ret = WOLFSSL_FAILURE;;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_set_max_proto_version");
|
||||
|
||||
@@ -12910,7 +12918,7 @@ int wolfSSL_CTX_get_max_proto_version(WOLFSSL_CTX* ctx)
|
||||
|
||||
WOLFSSL_LEAVE("wolfSSL_CTX_get_max_proto_version", ret);
|
||||
|
||||
if (ret == WOLFSSL_FATAL_ERROR) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)) {
|
||||
WOLFSSL_MSG("Error getting max proto version");
|
||||
ret = 0; /* setting ret to 0 to match compat return */
|
||||
}
|
||||
@@ -13509,7 +13517,7 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ssl)
|
||||
* first if we have one for this cert */
|
||||
SSL_CM_WARNING(ssl);
|
||||
if (PushCAx509Chain(SSL_CM(ssl), x509, sk)
|
||||
== WOLFSSL_FATAL_ERROR) {
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)) {
|
||||
ret = WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -14669,7 +14677,9 @@ int wolfSSL_sk_CIPHER_description(WOLFSSL_CIPHER* cipher)
|
||||
authStr = GetCipherAuthStr(n);
|
||||
/* encStr */
|
||||
encStr = GetCipherEncStr(n);
|
||||
if ((cipher->bits = SetCipherBits(encStr)) == WOLFSSL_FAILURE) {
|
||||
if ((cipher->bits = SetCipherBits(encStr)) ==
|
||||
WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
WOLFSSL_MSG("Cipher Bits Not Set.");
|
||||
}
|
||||
/* macStr */
|
||||
@@ -17030,7 +17040,7 @@ int wolfSSL_sk_SSL_COMP_num(WOLF_STACK_OF(WOLFSSL_COMP)* sk)
|
||||
#if defined(HAVE_EX_DATA) && !defined(NO_FILESYSTEM)
|
||||
int wolfSSL_cmp_peer_cert_to_file(WOLFSSL* ssl, const char *fname)
|
||||
{
|
||||
int ret = WOLFSSL_FATAL_ERROR;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_cmp_peer_cert_to_file");
|
||||
if (ssl != NULL && fname != NULL)
|
||||
@@ -19323,11 +19333,11 @@ unsigned long wolfSSL_ERR_peek_last_error_line(const char **file, int *line)
|
||||
}
|
||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) \
|
||||
|| defined(WOLFSSL_HAPROXY)
|
||||
if (ret == -ASN_NO_PEM_HEADER)
|
||||
if (ret == -WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER))
|
||||
return (ERR_LIB_PEM << 24) | PEM_R_NO_START_LINE;
|
||||
#endif
|
||||
#if defined(OPENSSL_ALL) && defined(WOLFSSL_PYTHON)
|
||||
if (ret == ASN1_R_HEADER_TOO_LONG) {
|
||||
if (ret == WC_NO_ERR_TRACE(ASN1_R_HEADER_TOO_LONG)) {
|
||||
return (ERR_LIB_ASN1 << 24) | ASN1_R_HEADER_TOO_LONG;
|
||||
}
|
||||
#endif
|
||||
@@ -20157,7 +20167,7 @@ int wolfSSL_FIPS_mode_set(int r)
|
||||
|
||||
int wolfSSL_CIPHER_get_bits(const WOLFSSL_CIPHER *c, int *alg_bits)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_ENTER("wolfSSL_CIPHER_get_bits");
|
||||
|
||||
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
|
||||
@@ -20478,10 +20488,10 @@ unsigned long wolfSSL_ERR_peek_last_error(void)
|
||||
WOLFSSL_MSG("Issue peeking at error node in queue");
|
||||
return 0;
|
||||
}
|
||||
if (ret == -ASN_NO_PEM_HEADER)
|
||||
if (ret == -WC_NO_ERR_TRACE(ASN_NO_PEM_HEADER))
|
||||
return (ERR_LIB_PEM << 24) | PEM_R_NO_START_LINE;
|
||||
#if defined(WOLFSSL_PYTHON)
|
||||
if (ret == ASN1_R_HEADER_TOO_LONG)
|
||||
if (ret == WC_NO_ERR_TRACE(ASN1_R_HEADER_TOO_LONG))
|
||||
return (ERR_LIB_ASN1 << 24) | ASN1_R_HEADER_TOO_LONG;
|
||||
#endif
|
||||
return (unsigned long)ret;
|
||||
@@ -23835,7 +23845,7 @@ static int wolfSSL_RAND_InitMutex(void)
|
||||
*/
|
||||
int wolfSSL_RAND_Init(void)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
#ifdef HAVE_GLOBAL_RNG
|
||||
if (wc_LockMutex(&globalRNGMutex) == 0) {
|
||||
if (initGlobalRNG == 0) {
|
||||
@@ -24851,7 +24861,7 @@ void wolfSSL_aes_ctr_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset,
|
||||
#if defined(OPENSSL_EXTRA) && !defined(WC_NO_RNG) && defined(HAVE_HASHDRBG)
|
||||
int wolfSSL_FIPS_drbg_init(WOLFSSL_DRBG_CTX *ctx, int type, unsigned int flags)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL) {
|
||||
XMEMSET(ctx, 0, sizeof(WOLFSSL_DRBG_CTX));
|
||||
ctx->type = type;
|
||||
@@ -24863,7 +24873,7 @@ int wolfSSL_FIPS_drbg_init(WOLFSSL_DRBG_CTX *ctx, int type, unsigned int flags)
|
||||
}
|
||||
WOLFSSL_DRBG_CTX* wolfSSL_FIPS_drbg_new(int type, unsigned int flags)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_DRBG_CTX* ctx = (WOLFSSL_DRBG_CTX*)XMALLOC(sizeof(WOLFSSL_DRBG_CTX),
|
||||
NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
ret = wolfSSL_FIPS_drbg_init(ctx, type, flags);
|
||||
@@ -24880,7 +24890,7 @@ WOLFSSL_DRBG_CTX* wolfSSL_FIPS_drbg_new(int type, unsigned int flags)
|
||||
int wolfSSL_FIPS_drbg_instantiate(WOLFSSL_DRBG_CTX* ctx,
|
||||
const unsigned char* pers, size_t perslen)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL && ctx->rng == NULL) {
|
||||
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \
|
||||
(defined(HAVE_FIPS) && FIPS_VERSION_GE(5,0)))
|
||||
@@ -24914,7 +24924,7 @@ int wolfSSL_FIPS_drbg_set_callbacks(WOLFSSL_DRBG_CTX* ctx,
|
||||
size_t entropy_blocklen,
|
||||
drbg_nonce_get none_get, drbg_nonce_clean nonce_clean)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL) {
|
||||
ctx->entropy_get = entropy_get;
|
||||
ctx->entropy_clean = entropy_clean;
|
||||
@@ -24935,7 +24945,7 @@ void wolfSSL_FIPS_rand_add(const void* buf, int num, double entropy)
|
||||
int wolfSSL_FIPS_drbg_reseed(WOLFSSL_DRBG_CTX* ctx, const unsigned char* adin,
|
||||
size_t adinlen)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL && ctx->rng != NULL) {
|
||||
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \
|
||||
(defined(HAVE_FIPS) && FIPS_VERSION_GE(2,0)))
|
||||
@@ -24954,7 +24964,7 @@ int wolfSSL_FIPS_drbg_generate(WOLFSSL_DRBG_CTX* ctx, unsigned char* out,
|
||||
size_t outlen, int prediction_resistance, const unsigned char* adin,
|
||||
size_t adinlen)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
if (ctx != NULL && ctx->rng != NULL) {
|
||||
ret = wc_RNG_GenerateBlock(ctx->rng, out, (word32)outlen);
|
||||
if (ret == 0) {
|
||||
|
||||
+1
-1
@@ -4604,7 +4604,7 @@ void wolfSSL_ASN1_TYPE_free(WOLFSSL_ASN1_TYPE* at)
|
||||
|
||||
int wolfSSL_i2d_ASN1_TYPE(WOLFSSL_ASN1_TYPE* at, unsigned char** pp)
|
||||
{
|
||||
int ret = WOLFSSL_FATAL_ERROR;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
|
||||
|
||||
if (at == NULL)
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
|
||||
+4
-4
@@ -913,7 +913,7 @@ static int ProcessBufferTryDecodeFalcon(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
||||
/* Free dynamically allocated data in key. */
|
||||
wc_falcon_free(key);
|
||||
}
|
||||
else if ((ret == ALGO_ID_E) && (*keyFormat == 0)) {
|
||||
else if ((ret == WC_NO_ERR_TRACE(ALGO_ID_E)) && (*keyFormat == 0)) {
|
||||
WOLFSSL_MSG("Not a Falcon key");
|
||||
/* Format unknown so keep trying. */
|
||||
ret = 0;
|
||||
@@ -1021,7 +1021,7 @@ static int ProcessBufferTryDecodeDilithium(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
||||
/* Free dynamically allocated data in key. */
|
||||
wc_dilithium_free(key);
|
||||
}
|
||||
else if ((ret == ALGO_ID_E) && (*keyFormat == 0)) {
|
||||
else if ((ret == WC_NO_ERR_TRACE(ALGO_ID_E)) && (*keyFormat == 0)) {
|
||||
WOLFSSL_MSG("Not a Dilithium key");
|
||||
/* Format unknown so keep trying. */
|
||||
ret = 0;
|
||||
@@ -2369,7 +2369,7 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff, long sz,
|
||||
if (ret == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
else if (ret == WOLFSSL_FATAL_ERROR) {
|
||||
else if (ret == WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)) {
|
||||
ret = 0;
|
||||
}
|
||||
WOLFSSL_LEAVE("ProcessBuffer", ret);
|
||||
@@ -5143,7 +5143,7 @@ int wolfSSL_CTX_set_default_verify_paths(WOLFSSL_CTX* ctx)
|
||||
#elif defined(WOLFSSL_SYS_CA_CERTS)
|
||||
/* Load the system CA certificates. */
|
||||
ret = wolfSSL_CTX_load_system_CA_certs(ctx);
|
||||
if (ret == WOLFSSL_BAD_PATH) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_BAD_PATH)) {
|
||||
/* OpenSSL doesn't treat the lack of a system CA cert directory as a
|
||||
* failure. We do the same here.
|
||||
*/
|
||||
|
||||
+11
-7
@@ -351,7 +351,7 @@ int wolfSSL_i2d_PKCS7(PKCS7 *p7, unsigned char **out)
|
||||
int localBuf = 0;
|
||||
int len;
|
||||
WC_RNG rng;
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_ENTER("wolfSSL_i2d_PKCS7");
|
||||
|
||||
if (!out || !p7) {
|
||||
@@ -396,9 +396,9 @@ cleanup:
|
||||
wc_FreeRng(&rng);
|
||||
p7->rng = NULL;
|
||||
}
|
||||
if (ret == WOLFSSL_FAILURE && localBuf && output)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE) && localBuf)
|
||||
XFREE(output, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (ret != WOLFSSL_FAILURE)
|
||||
if (ret != WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
*out = output;
|
||||
return ret;
|
||||
}
|
||||
@@ -407,7 +407,7 @@ int wolfSSL_i2d_PKCS7_bio(WOLFSSL_BIO *bio, PKCS7 *p7)
|
||||
{
|
||||
byte* output = NULL;
|
||||
int len;
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_ENTER("wolfSSL_i2d_PKCS7_bio");
|
||||
|
||||
if (!bio || !p7) {
|
||||
@@ -415,7 +415,9 @@ int wolfSSL_i2d_PKCS7_bio(WOLFSSL_BIO *bio, PKCS7 *p7)
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
if ((len = wolfSSL_i2d_PKCS7(p7, &output)) == WOLFSSL_FAILURE) {
|
||||
if ((len = wolfSSL_i2d_PKCS7(p7, &output)) ==
|
||||
WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
WOLFSSL_MSG("wolfSSL_i2d_PKCS7 error");
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -1474,7 +1476,9 @@ int wolfSSL_SMIME_write_PKCS7(WOLFSSL_BIO* out, PKCS7* pkcs7, WOLFSSL_BIO* in,
|
||||
|
||||
if (ret > 0) {
|
||||
/* Generate signedData bundle, DER in output (dynamic) */
|
||||
if ((len = wolfSSL_i2d_PKCS7((PKCS7*)p7, &p7out)) == WOLFSSL_FAILURE) {
|
||||
if ((len = wolfSSL_i2d_PKCS7((PKCS7*)p7, &p7out)) ==
|
||||
WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
WOLFSSL_MSG("Error in wolfSSL_i2d_PKCS7");
|
||||
ret = 0;
|
||||
}
|
||||
@@ -1703,7 +1707,7 @@ WC_PKCS12* wolfSSL_d2i_PKCS12_bio(WOLFSSL_BIO* bio, WC_PKCS12** pkcs12)
|
||||
*/
|
||||
int wolfSSL_i2d_PKCS12_bio(WOLFSSL_BIO *bio, WC_PKCS12 *pkcs12)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_i2d_PKCS12_bio");
|
||||
|
||||
|
||||
+6
-4
@@ -1988,10 +1988,12 @@ int AddSessionToCache(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* addSession,
|
||||
#if defined(HAVE_SESSION_TICKET) && defined(WOLFSSL_TLS13) && \
|
||||
defined(WOLFSSL_TICKET_NONCE_MALLOC) && \
|
||||
(!defined(HAVE_FIPS) || (defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,3)))
|
||||
ret = wolfSSL_DupSessionEx(addSession, cacheSession, 1, preallocNonce,
|
||||
&preallocNonceLen, &preallocNonceUsed) == WOLFSSL_FAILURE;
|
||||
ret = (wolfSSL_DupSessionEx(addSession, cacheSession, 1, preallocNonce,
|
||||
&preallocNonceLen, &preallocNonceUsed)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE));
|
||||
#else
|
||||
ret = wolfSSL_DupSession(addSession, cacheSession, 1) == WOLFSSL_FAILURE;
|
||||
ret = (wolfSSL_DupSession(addSession, cacheSession, 1)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE));
|
||||
#endif /* HAVE_SESSION_TICKET && WOLFSSL_TLS13 && WOLFSSL_TICKET_NONCE_MALLOC
|
||||
&& FIPS_VERSION_GE(5,3)*/
|
||||
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
|
||||
@@ -4230,7 +4232,7 @@ const byte* wolfSSL_get_sessionID(const WOLFSSL_SESSION* session)
|
||||
|
||||
int wolfSSL_SESSION_set_ex_data(WOLFSSL_SESSION* session, int idx, void* data)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_ENTER("wolfSSL_SESSION_set_ex_data");
|
||||
#ifdef HAVE_EX_DATA
|
||||
session = ClientSessionToSession(session);
|
||||
|
||||
@@ -9919,7 +9919,7 @@ int TLSX_KeyShare_Setup(WOLFSSL *ssl, KeyShareEntry* clientKSE)
|
||||
/* for async do setup of serverKSE below, but return WC_PENDING_E */
|
||||
if (ret != 0
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& ret != WC_PENDING_E
|
||||
&& ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
TLSX_KeyShare_FreeAll(list, ssl->heap);
|
||||
|
||||
+8
-8
@@ -8722,7 +8722,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != WANT_WRITE) {
|
||||
if (ret != WC_NO_ERR_TRACE(WANT_WRITE)) {
|
||||
/* Clean up the fragment offset. */
|
||||
ssl->options.buildingMsg = 0;
|
||||
ssl->fragOffset = 0;
|
||||
@@ -10903,7 +10903,7 @@ static int SendTls13Finished(WOLFSSL* ssl)
|
||||
dtlsRet = Dtls13HandshakeSend(ssl, output, (word16)outputSz,
|
||||
(word16)(Dtls13GetRlHeaderLength(ssl, 1) + headerSz + finishedSz), finished,
|
||||
1);
|
||||
if (dtlsRet != 0 && dtlsRet != WANT_WRITE)
|
||||
if (dtlsRet != 0 && dtlsRet != WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
return ret;
|
||||
|
||||
} else
|
||||
@@ -11141,7 +11141,7 @@ static int SendTls13KeyUpdate(WOLFSSL* ssl)
|
||||
ret = SendBuffered(ssl);
|
||||
|
||||
|
||||
if (ret != 0 && ret != WANT_WRITE)
|
||||
if (ret != 0 && ret != WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -12932,7 +12932,7 @@ int wolfSSL_connect_TLSv13(WOLFSSL* ssl)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* do not send buffered or advance state if last error was an
|
||||
async pending operation */
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
if ((ret = SendBuffered(ssl)) == 0) {
|
||||
@@ -13614,7 +13614,7 @@ int wolfSSL_update_keys(WOLFSSL* ssl)
|
||||
{
|
||||
int ret;
|
||||
ret = Tls13UpdateKeys(ssl);
|
||||
if (ret == WANT_WRITE)
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
ret = WOLFSSL_ERROR_WANT_WRITE;
|
||||
else if (ret == 0)
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
@@ -13715,7 +13715,7 @@ int wolfSSL_request_certificate(WOLFSSL* ssl)
|
||||
ssl->msgsReceived.got_finished = 0;
|
||||
|
||||
ret = SendTls13CertificateRequest(ssl, &certReqCtx->ctx, certReqCtx->len);
|
||||
if (ret == WANT_WRITE)
|
||||
if (ret == WC_NO_ERR_TRACE(WANT_WRITE))
|
||||
ret = WOLFSSL_ERROR_WANT_WRITE;
|
||||
else if (ret == 0)
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
@@ -14070,7 +14070,7 @@ int wolfSSL_accept_TLSv13(WOLFSSL* ssl)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
/* do not send buffered or advance state if last error was an
|
||||
async pending operation */
|
||||
&& ssl->error != WC_PENDING_E
|
||||
&& ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
|
||||
@@ -14682,7 +14682,7 @@ int wolfSSL_read_early_data(WOLFSSL* ssl, void* data, int sz, int* outSz)
|
||||
ret = ReceiveData(ssl, (byte*)data, sz, FALSE);
|
||||
if (ret > 0)
|
||||
*outSz = ret;
|
||||
if (ssl->error == ZERO_RETURN) {
|
||||
if (ssl->error == WC_NO_ERR_TRACE(ZERO_RETURN)) {
|
||||
ssl->error = WOLFSSL_ERROR_NONE;
|
||||
#ifdef WOLFSSL_DTLS13
|
||||
if (ssl->options.dtls) {
|
||||
|
||||
+5
-5
@@ -273,7 +273,7 @@ int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr, char* buf,
|
||||
int sz)
|
||||
{
|
||||
int recvd = WOLFSSL_CBIO_ERR_GENERAL;
|
||||
int recvd = WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_GENERAL);
|
||||
|
||||
WOLFSSL_ENTER("SslBioReceive");
|
||||
|
||||
@@ -352,7 +352,7 @@ int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
*/
|
||||
int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx)
|
||||
{
|
||||
int sent = WOLFSSL_CBIO_ERR_GENERAL;
|
||||
int sent = WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_GENERAL);
|
||||
|
||||
WOLFSSL_ENTER("SslBioSend");
|
||||
|
||||
@@ -781,7 +781,7 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
|
||||
|
||||
if (recvd < 0) {
|
||||
WOLFSSL_MSG("Embed Receive From error");
|
||||
if (recvd == WOLFSSL_CBIO_ERR_WANT_READ &&
|
||||
if (recvd == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ) &&
|
||||
!wolfSSL_dtls_get_using_nonblock(ssl)) {
|
||||
recvd = WOLFSSL_CBIO_ERR_TIMEOUT;
|
||||
}
|
||||
@@ -894,7 +894,7 @@ int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf, int sz, void *ctx)
|
||||
|
||||
if (recvd < 0) {
|
||||
WOLFSSL_MSG("Embed Receive From error");
|
||||
if (recvd == WOLFSSL_CBIO_ERR_WANT_READ &&
|
||||
if (recvd == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ) &&
|
||||
!wolfSSL_dtls_get_using_nonblock(ssl)) {
|
||||
recvd = WOLFSSL_CBIO_ERR_TIMEOUT;
|
||||
}
|
||||
@@ -1795,7 +1795,7 @@ int wolfIO_HttpProcessResponseGenericIO(WolfSSLGenericIORecvCb ioCb,
|
||||
start[len] = 0;
|
||||
}
|
||||
else {
|
||||
if (result == WOLFSSL_CBIO_ERR_WANT_READ) {
|
||||
if (result == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
|
||||
return OCSP_WANT_READ;
|
||||
}
|
||||
|
||||
|
||||
+35
-33
@@ -1297,7 +1297,7 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
|
||||
word32 len = 0;
|
||||
|
||||
len = SetOthername(gn->d.otherName, NULL);
|
||||
if (len == WOLFSSL_FAILURE) {
|
||||
if (len == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1313,7 +1313,7 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
|
||||
ret = wolfSSL_X509_add_altname_ex(x509, buf, len,
|
||||
ASN_OTHER_TYPE);
|
||||
XFREE(buf, x509->heap, DYNAMIC_TYPE_X509_EXT);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("wolfSSL_X509_add_altname_ex() failed");
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
@@ -1448,7 +1448,7 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
|
||||
ASN1_OBJECT* obj;
|
||||
ASN1_STRING* str;
|
||||
int nid;
|
||||
int rc = WOLFSSL_FAILURE;
|
||||
int rc = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
char tmp[CTC_NAME_SIZE*2 + 1];
|
||||
const int tmpSz = sizeof(tmp);
|
||||
int tmpLen = 0;
|
||||
@@ -5000,7 +5000,7 @@ int wolfSSL_GENERAL_NAME_print(WOLFSSL_BIO* out, WOLFSSL_GENERAL_NAME* gen)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == WOLFSSL_FAILURE)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
return WOLFSSL_FAILURE;
|
||||
else
|
||||
return WOLFSSL_SUCCESS;
|
||||
@@ -6181,7 +6181,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
for (i = 0; (i < count) && (ret != WOLFSSL_FAILURE); i++) {
|
||||
for (i = 0; (i < count) && (ret != WC_NO_ERR_TRACE(WOLFSSL_FAILURE)); i++) {
|
||||
WOLFSSL_X509_EXTENSION* ext;
|
||||
|
||||
ext = wolfSSL_X509_get_ext(x509, i);
|
||||
@@ -6198,7 +6198,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
||||
break;
|
||||
}
|
||||
if (wolfSSL_OBJ_obj2txt(buf, MAX_WIDTH, obj, 0)
|
||||
== WOLFSSL_FAILURE)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
ret = WOLFSSL_FAILURE;
|
||||
break;
|
||||
@@ -6261,7 +6261,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
||||
XMEMCPY(scratch + scratchLen, val, valLen);
|
||||
scratchLen += valLen;
|
||||
}
|
||||
if (ret == WOLFSSL_FAILURE)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
break;
|
||||
if (wolfSSL_BIO_write(bio, scratch,
|
||||
scratchLen) <= 0) {
|
||||
@@ -6310,7 +6310,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
||||
XMEMCPY(scratch + scratchLen, val, valLen);
|
||||
scratchLen += valLen;
|
||||
}
|
||||
if (ret == WOLFSSL_FAILURE)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
break;
|
||||
if (wolfSSL_BIO_write(bio, scratch,
|
||||
scratchLen) <= 0) {
|
||||
@@ -6408,7 +6408,7 @@ static int X509PrintSignature_ex(WOLFSSL_BIO* bio, byte* sig,
|
||||
}
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
if (wolfSSL_OBJ_obj2txt(scratch, MAX_WIDTH, obj, 0)
|
||||
== WOLFSSL_FAILURE)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
@@ -6703,7 +6703,7 @@ static int X509PrintReqAttributes(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
|
||||
const byte* data;
|
||||
|
||||
if (wolfSSL_OBJ_obj2txt(lName, lNameSz, attr->object, 0)
|
||||
== WOLFSSL_FAILURE)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
@@ -7327,7 +7327,7 @@ static int x509AddCertDir(WOLFSSL_BY_DIR *ctx, const char *argc, long argl)
|
||||
int wolfSSL_X509_LOOKUP_ctrl(WOLFSSL_X509_LOOKUP *ctx, int cmd,
|
||||
const char *argc, long argl, char **ret)
|
||||
{
|
||||
int lret = WOLFSSL_FAILURE;
|
||||
int lret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_X509_LOOKUP_ctrl");
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
@@ -7386,7 +7386,7 @@ static int wolfssl_x509_make_der(WOLFSSL_X509* x509, int req,
|
||||
*/
|
||||
static int loadX509orX509REQFromBio(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int req)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
/* Get large buffer to hold cert der */
|
||||
int derSz = X509_BUFFER_SZ;
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
@@ -7960,7 +7960,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
const char *file, int type)
|
||||
{
|
||||
#ifndef NO_BIO
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int count = 0;
|
||||
WOLFSSL_BIO *bio = NULL;
|
||||
WOLFSSL_X509_CRL *crl = NULL;
|
||||
@@ -7994,7 +7994,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
}
|
||||
|
||||
ret = wolfSSL_X509_STORE_add_crl(ctx->store, crl);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("Adding crl failed");
|
||||
break;
|
||||
}
|
||||
@@ -8011,7 +8011,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
WOLFSSL_MSG("Load crl failed");
|
||||
} else {
|
||||
ret = wolfSSL_X509_STORE_add_crl(ctx->store, crl);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("Adding crl failed");
|
||||
} else {
|
||||
ret = 1;/* handled a file */
|
||||
@@ -8027,7 +8027,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
WOLFSSL_LEAVE("wolfSSL_X509_load_crl_file", ret);
|
||||
return ret;
|
||||
#else
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int count = 0;
|
||||
XFILE fp;
|
||||
WOLFSSL_X509_CRL *crl = NULL;
|
||||
@@ -8051,7 +8051,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
}
|
||||
|
||||
ret = wolfSSL_X509_STORE_add_crl(ctx->store, crl);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("Adding crl failed");
|
||||
break;
|
||||
}
|
||||
@@ -8070,7 +8070,7 @@ WOLFSSL_API int wolfSSL_X509_load_crl_file(WOLFSSL_X509_LOOKUP *ctx,
|
||||
}
|
||||
else {
|
||||
ret = wolfSSL_X509_STORE_add_crl(ctx->store, crl);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("Adding crl failed");
|
||||
}
|
||||
else {
|
||||
@@ -8683,7 +8683,7 @@ void wolfSSL_X509_VERIFY_PARAM_free(WOLFSSL_X509_VERIFY_PARAM *param)
|
||||
int wolfSSL_X509_VERIFY_PARAM_set_flags(WOLFSSL_X509_VERIFY_PARAM *param,
|
||||
unsigned long flags)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if (param != NULL) {
|
||||
param->flags |= flags;
|
||||
@@ -8709,7 +8709,7 @@ int wolfSSL_X509_VERIFY_PARAM_get_flags(WOLFSSL_X509_VERIFY_PARAM *param)
|
||||
int wolfSSL_X509_VERIFY_PARAM_clear_flags(WOLFSSL_X509_VERIFY_PARAM *param,
|
||||
unsigned long flags)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if (param != NULL) {
|
||||
param->flags &= ~flags;
|
||||
@@ -8869,7 +8869,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_host(WOLFSSL_X509_VERIFY_PARAM* pParam,
|
||||
int wolfSSL_X509_VERIFY_PARAM_set1(WOLFSSL_X509_VERIFY_PARAM *to,
|
||||
const WOLFSSL_X509_VERIFY_PARAM *from)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
unsigned int _inherit_flags;
|
||||
|
||||
if (!to) {
|
||||
@@ -8911,7 +8911,7 @@ void wolfSSL_X509_VERIFY_PARAM_set_hostflags(WOLFSSL_X509_VERIFY_PARAM* param,
|
||||
int wolfSSL_X509_VERIFY_PARAM_set1_ip_asc(WOLFSSL_X509_VERIFY_PARAM *param,
|
||||
const char *ipasc)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if (param != NULL) {
|
||||
if (ipasc == NULL) {
|
||||
@@ -8936,7 +8936,7 @@ int wolfSSL_X509_VERIFY_PARAM_set1_ip_asc(WOLFSSL_X509_VERIFY_PARAM *param,
|
||||
int wolfSSL_X509_VERIFY_PARAM_set1_ip(WOLFSSL_X509_VERIFY_PARAM* param,
|
||||
const unsigned char* ip, size_t iplen)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
#ifndef NO_FILESYSTEM
|
||||
char* buf = NULL;
|
||||
char* p = NULL;
|
||||
@@ -9072,7 +9072,7 @@ int wolfSSL_X509_cmp_current_time(const WOLFSSL_ASN1_TIME* asnTime)
|
||||
*/
|
||||
int wolfSSL_X509_cmp_time(const WOLFSSL_ASN1_TIME* asnTime, time_t* cmpTime)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
time_t tmpTime, *pTime = &tmpTime;
|
||||
struct tm ts, *tmpTs, *ct;
|
||||
#if defined(NEED_TMP_TIME)
|
||||
@@ -9829,7 +9829,7 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_chain_up_ref(
|
||||
static int CopyX509NameToCert(WOLFSSL_X509_NAME* n, byte* out)
|
||||
{
|
||||
unsigned char* der = NULL;
|
||||
int length = BAD_FUNC_ARG, ret;
|
||||
int length = WC_NO_ERR_TRACE(BAD_FUNC_ARG), ret;
|
||||
word32 idx = 0;
|
||||
|
||||
ret = wolfSSL_i2d_X509_NAME(n, &der);
|
||||
@@ -9896,7 +9896,7 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_chain_up_ref(
|
||||
#if defined(OPENSSL_ALL)
|
||||
idx = wolfSSL_X509_REQ_get_attr_by_NID(req,
|
||||
NID_pkcs9_unstructuredName, -1);
|
||||
if (idx != WOLFSSL_FATAL_ERROR) {
|
||||
if (idx != WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR)) {
|
||||
WOLFSSL_X509_ATTRIBUTE *attr;
|
||||
attr = wolfSSL_X509_REQ_get_attr(req, idx);
|
||||
if (attr != NULL) {
|
||||
@@ -10180,7 +10180,9 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_chain_up_ref(
|
||||
int sigType = WOLFSSL_FAILURE;
|
||||
|
||||
/* Convert key type and hash algorithm to a signature algorithm */
|
||||
if (wolfSSL_EVP_get_hashinfo(md, &hashType, NULL) == WOLFSSL_FAILURE) {
|
||||
if (wolfSSL_EVP_get_hashinfo(md, &hashType, NULL)
|
||||
== WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
@@ -10275,7 +10277,7 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_chain_up_ref(
|
||||
static int wolfssl_x509_make_der(WOLFSSL_X509* x509, int req,
|
||||
unsigned char* der, int* derSz, int includeSig)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int totalLen;
|
||||
Cert* cert = NULL;
|
||||
void* key = NULL;
|
||||
@@ -10719,7 +10721,7 @@ cleanup:
|
||||
WOLFSSL_ENTER("wolfSSL_X509_resign_cert");
|
||||
|
||||
sigType = wolfSSL_sigTypeFromPKEY(md, pkey);
|
||||
if (sigType == WOLFSSL_FAILURE) {
|
||||
if (sigType == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("Error getting signature type from pkey");
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
@@ -12335,7 +12337,7 @@ WOLFSSL_ASN1_OBJECT* wolfSSL_X509_NAME_ENTRY_get_object(
|
||||
const unsigned char *bytes, int len,
|
||||
int loc, int set)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int nid;
|
||||
WOLFSSL_X509_NAME_ENTRY* entry;
|
||||
|
||||
@@ -13557,7 +13559,7 @@ out:
|
||||
int wolfSSL_X509_check_ip_asc(WOLFSSL_X509 *x, const char *ipasc,
|
||||
unsigned int flags)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
DecodedCert *dCert = NULL;
|
||||
#else
|
||||
@@ -14272,7 +14274,7 @@ void wolfSSL_X509V3_set_ctx(WOLFSSL_X509V3_CTX* ctx, WOLFSSL_X509* issuer,
|
||||
int wolfSSL_i2d_X509_REQ(WOLFSSL_X509* req, unsigned char** out)
|
||||
{
|
||||
int derSz = 0;
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
WOLFSSL_BIO* bio = NULL;
|
||||
WOLFSSL_ENTER("wolfSSL_i2d_X509_REQ");
|
||||
|
||||
@@ -14384,7 +14386,7 @@ int wolfSSL_X509_REQ_sign_ctx(WOLFSSL_X509 *req,
|
||||
static int regenX509REQDerBuffer(WOLFSSL_X509* x509)
|
||||
{
|
||||
int derSz = X509_BUFFER_SZ;
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* der;
|
||||
der = (byte*)XMALLOC(derSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
+1
-1
@@ -1007,7 +1007,7 @@ WOLFSSL_X509_LOOKUP* wolfSSL_X509_STORE_add_lookup(WOLFSSL_X509_STORE* store,
|
||||
|
||||
int wolfSSL_X509_STORE_add_cert(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509)
|
||||
{
|
||||
int result = WOLFSSL_FATAL_ERROR;
|
||||
int result = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_X509_STORE_add_cert");
|
||||
if (store != NULL && store->cm != NULL && x509 != NULL
|
||||
|
||||
+2357
-2271
File diff suppressed because it is too large
Load Diff
@@ -526,7 +526,7 @@
|
||||
wc_GetErrorString(err));
|
||||
printf("%shash = %s\n", ok ? info_prefix : err_prefix, hash);
|
||||
|
||||
if (err == IN_CORE_FIPS_E) {
|
||||
if (err == WC_NO_ERR_TRACE(IN_CORE_FIPS_E)) {
|
||||
printf("%sIn core integrity hash check failure, copy above hash\n",
|
||||
err_prefix);
|
||||
printf("%sinto verifyCore[] in fips_test.c and rebuild\n",
|
||||
@@ -1798,7 +1798,7 @@ static const char* bench_result_words2[][5] = {
|
||||
{
|
||||
WOLF_EVENT_STATE state = asyncDev->event.state;
|
||||
|
||||
if (*ret == WC_PENDING_E) {
|
||||
if (*ret == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
if (state == WOLF_EVENT_STATE_DONE) {
|
||||
*ret = asyncDev->event.ret;
|
||||
asyncDev->event.state = WOLF_EVENT_STATE_READY;
|
||||
@@ -8956,7 +8956,7 @@ void bench_rsa_key(int useDeviceID, word32 rsaKeySz)
|
||||
|
||||
/* create the RSA key */
|
||||
ret = wc_MakeRsaKey(rsaKey[i], (int)rsaKeySz, exp, &gRng);
|
||||
if (ret == WC_PENDING_E) {
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)) {
|
||||
isPending[i] = 1;
|
||||
pending = 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -8862,7 +8862,7 @@ int WARN_UNUSED_RESULT AES_GCM_decrypt_C(
|
||||
/* now use res as a mask for constant time return of ret, unless tag
|
||||
* mismatch, whereupon AES_GCM_AUTH_E is returned.
|
||||
*/
|
||||
ret = (ret & ~res) | (res & AES_GCM_AUTH_E);
|
||||
ret = (ret & ~res) | (res & WC_NO_ERR_TRACE(AES_GCM_AUTH_E));
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
+2
-2
@@ -16658,7 +16658,7 @@ static int ConfirmSignature(SignatureCtx* sigCtx,
|
||||
const byte* sigParams, word32 sigParamsSz,
|
||||
byte* rsaKeyIdx)
|
||||
{
|
||||
int ret = ASN_SIG_CONFIRM_E; /* default to failure */
|
||||
int ret = WC_NO_ERR_TRACE(ASN_SIG_CONFIRM_E); /* default to failure */
|
||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_FSPSM_TLS)
|
||||
CertAttribute* certatt = NULL;
|
||||
#endif
|
||||
@@ -32025,7 +32025,7 @@ int wc_MakeSelfCert(Cert* cert, byte* buf, word32 buffSz,
|
||||
WOLFSSL_ABI
|
||||
int wc_GetSubjectRaw(byte **subjectRaw, Cert *cert)
|
||||
{
|
||||
int rc = BAD_FUNC_ARG;
|
||||
int rc = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
if ((subjectRaw != NULL) && (cert != NULL)) {
|
||||
*subjectRaw = cert->sbjRaw;
|
||||
rc = 0;
|
||||
|
||||
@@ -306,7 +306,7 @@ static const wc_dilithium_params dilithium_params[] = {
|
||||
static int dilithium_get_params(int level, const wc_dilithium_params** params)
|
||||
{
|
||||
unsigned int i;
|
||||
int ret = NOT_COMPILED_IN;
|
||||
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
|
||||
|
||||
for (i = 0; i < DILITHIUM_PARAMS_CNT; i++) {
|
||||
if (dilithium_params[i].level == level) {
|
||||
@@ -8559,7 +8559,7 @@ void wc_dilithium_free(dilithium_key* key)
|
||||
*/
|
||||
int wc_dilithium_size(dilithium_key* key)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
if (key != NULL) {
|
||||
if (key->level == WC_ML_DSA_44) {
|
||||
@@ -8585,7 +8585,7 @@ int wc_dilithium_size(dilithium_key* key)
|
||||
*/
|
||||
int wc_dilithium_priv_size(dilithium_key* key)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
if (key != NULL) {
|
||||
if (key->level == WC_ML_DSA_44) {
|
||||
@@ -8632,7 +8632,7 @@ int wc_MlDsaKey_GetPrivLen(MlDsaKey* key, int* len)
|
||||
*/
|
||||
int wc_dilithium_pub_size(dilithium_key* key)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
if (key != NULL) {
|
||||
if (key->level == WC_ML_DSA_44) {
|
||||
@@ -8678,7 +8678,7 @@ int wc_MlDsaKey_GetPubLen(MlDsaKey* key, int* len)
|
||||
*/
|
||||
int wc_dilithium_sig_size(dilithium_key* key)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
if (key != NULL) {
|
||||
if (key->level == WC_ML_DSA_44) {
|
||||
@@ -9712,7 +9712,7 @@ int wc_Dilithium_PublicKeyToDer(dilithium_key* key, byte* output, word32 len,
|
||||
*/
|
||||
int wc_Dilithium_KeyToDer(dilithium_key* key, byte* output, word32 len)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
/* Validate parameters and check public and private key set. */
|
||||
if ((key != NULL) && key->prvKeySet && key->pubKeySet) {
|
||||
@@ -9748,7 +9748,7 @@ int wc_Dilithium_KeyToDer(dilithium_key* key, byte* output, word32 len)
|
||||
*/
|
||||
int wc_Dilithium_PrivateKeyToDer(dilithium_key* key, byte* output, word32 len)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
/* Validate parameters and check private key set. */
|
||||
if ((key != NULL) && key->prvKeySet) {
|
||||
|
||||
+3
-3
@@ -5518,7 +5518,7 @@ static int ecc_make_pub_ex(ecc_key* key, ecc_curve_spec* curve,
|
||||
/* Map in a separate call as this should be constant time */
|
||||
err = wc_ecc_mulmod_ex2(ecc_get_k(key), base, pub, curve->Af,
|
||||
curve->prime, curve->order, rng, 0, key->heap);
|
||||
if (err == MP_MEM) {
|
||||
if (err == WC_NO_ERR_TRACE(MP_MEM)) {
|
||||
err = MEMORY_E;
|
||||
}
|
||||
}
|
||||
@@ -5534,7 +5534,7 @@ static int ecc_make_pub_ex(ecc_key* key, ecc_curve_spec* curve,
|
||||
|
||||
if (err != MP_OKAY
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
&& err != WC_PENDING_E
|
||||
&& err != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
/* clean up if failed */
|
||||
@@ -5988,7 +5988,7 @@ static int _ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key,
|
||||
|
||||
if (err == MP_OKAY
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|| err == WC_PENDING_E
|
||||
|| err == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#endif
|
||||
) {
|
||||
key->type = ECC_PRIVATEKEY;
|
||||
|
||||
+18
-15
@@ -489,7 +489,7 @@ void wolfSSL_EVP_CIPHER_CTX_free(WOLFSSL_EVP_CIPHER_CTX *ctx)
|
||||
|
||||
int wolfSSL_EVP_CIPHER_CTX_reset(WOLFSSL_EVP_CIPHER_CTX *ctx)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
if (ctx != NULL) {
|
||||
WOLFSSL_ENTER("wolfSSL_EVP_CIPHER_CTX_reset");
|
||||
@@ -3143,7 +3143,7 @@ int wolfSSL_EVP_PKEY_sign(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *sig,
|
||||
if (!ctx->pkey->dsa)
|
||||
return WOLFSSL_FAILURE;
|
||||
bytes = wolfSSL_BN_num_bytes(ctx->pkey->dsa->q);
|
||||
if (bytes == WOLFSSL_FAILURE)
|
||||
if (bytes == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
return WOLFSSL_FAILURE;
|
||||
bytes *= 2;
|
||||
if (!sig) {
|
||||
@@ -3156,7 +3156,7 @@ int wolfSSL_EVP_PKEY_sign(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *sig,
|
||||
/* wolfSSL_DSA_do_sign() can return WOLFSSL_FATAL_ERROR */
|
||||
if (ret != WOLFSSL_SUCCESS)
|
||||
return ret;
|
||||
if (bytes == WOLFSSL_FAILURE)
|
||||
if (bytes == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
return WOLFSSL_FAILURE;
|
||||
*siglen = (size_t)bytes;
|
||||
return WOLFSSL_SUCCESS;
|
||||
@@ -3437,7 +3437,7 @@ int wolfSSL_EVP_PKEY_keygen_init(WOLFSSL_EVP_PKEY_CTX *ctx)
|
||||
int wolfSSL_EVP_PKEY_keygen(WOLFSSL_EVP_PKEY_CTX *ctx,
|
||||
WOLFSSL_EVP_PKEY **ppkey)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
int ownPkey = 0;
|
||||
WOLFSSL_EVP_PKEY* pkey;
|
||||
|
||||
@@ -3842,7 +3842,7 @@ static int DH_param_check(WOLFSSL_DH* dh_key)
|
||||
}
|
||||
else
|
||||
if (ret == WOLFSSL_SUCCESS &&
|
||||
wolfSSL_BN_is_one(num1) == WOLFSSL_FAILURE) {
|
||||
wolfSSL_BN_is_one(num1) == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
WOLFSSL_MSG("dh_key->g is not suitable generator");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
@@ -4022,8 +4022,11 @@ int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret,
|
||||
if (ret != WOLFSSL_SUCCESS)
|
||||
return ret;
|
||||
bytes = wolfSSL_BN_num_bytes(pkey->dsa->q);
|
||||
if (bytes == WOLFSSL_FAILURE || (int)*siglen < bytes * 2)
|
||||
if (bytes == WC_NO_ERR_TRACE(WOLFSSL_FAILURE) ||
|
||||
(int)*siglen < bytes * 2)
|
||||
{
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
*siglen = (unsigned int)(bytes * 2);
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
@@ -4202,7 +4205,7 @@ WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_CMAC_key(WOLFSSL_ENGINE* e,
|
||||
}
|
||||
|
||||
ret = wolfSSL_CMAC_Init(ctx, priv, len, cipher, e);
|
||||
if (ret == WOLFSSL_FAILURE) {
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
wolfSSL_CMAC_CTX_free(ctx);
|
||||
WOLFSSL_LEAVE("wolfSSL_EVP_PKEY_new_CMAC_key", 0);
|
||||
return NULL;
|
||||
@@ -4814,7 +4817,7 @@ int wolfSSL_EVP_DigestVerifyFinal(WOLFSSL_EVP_MD_CTX *ctx,
|
||||
int wolfSSL_EVP_read_pw_string(char* buf, int bufSz, const char* banner, int v)
|
||||
{
|
||||
printf("%s", banner);
|
||||
if (XGETPASSWD(buf, bufSz) == WOLFSSL_FAILURE) {
|
||||
if (XGETPASSWD(buf, bufSz) == WC_NO_ERR_TRACE(WOLFSSL_FAILURE)) {
|
||||
return -1;
|
||||
}
|
||||
(void)v; /* fgets always sanity checks size of input vs buffer */
|
||||
@@ -5971,7 +5974,7 @@ void wolfSSL_EVP_init(void)
|
||||
int wolfSSL_EVP_CIPHER_CTX_ctrl(WOLFSSL_EVP_CIPHER_CTX *ctx, int type, \
|
||||
int arg, void *ptr)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
#if defined(HAVE_AESGCM) || (defined(HAVE_CHACHA) && defined(HAVE_POLY1305))
|
||||
#ifndef WC_NO_RNG
|
||||
WC_RNG rng;
|
||||
@@ -6415,7 +6418,7 @@ void wolfSSL_EVP_init(void)
|
||||
}
|
||||
|
||||
ret = wolfSSL_EVP_get_hashinfo(md, &hashType, NULL);
|
||||
if (ret == WOLFSSL_FAILURE)
|
||||
if (ret == WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
goto end;
|
||||
|
||||
ret = wc_PBKDF1_ex(key, (int)info->keySz, iv, (int)info->ivSz, data, sz,
|
||||
@@ -6572,7 +6575,7 @@ void wolfSSL_EVP_init(void)
|
||||
static int EvpCipherAesGCM(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* dst,
|
||||
byte* src, word32 len)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
#ifndef WOLFSSL_AESGCM_STREAM
|
||||
/* No destination means only AAD. */
|
||||
@@ -6764,7 +6767,7 @@ void wolfSSL_EVP_init(void)
|
||||
static int EvpCipherAesCCM(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* dst,
|
||||
byte* src, word32 len)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
/* No destination means only AAD. */
|
||||
if (src != NULL && dst == NULL) {
|
||||
@@ -8268,7 +8271,7 @@ void wolfSSL_EVP_init(void)
|
||||
int wolfSSL_EVP_Cipher(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* dst, byte* src,
|
||||
word32 len)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_EVP_Cipher");
|
||||
|
||||
@@ -10601,7 +10604,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
|
||||
int wolfSSL_EVP_DigestUpdate(WOLFSSL_EVP_MD_CTX* ctx, const void* data,
|
||||
size_t sz)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
enum wc_HashType macType;
|
||||
|
||||
WOLFSSL_ENTER("EVP_DigestUpdate");
|
||||
@@ -10729,7 +10732,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
|
||||
int wolfSSL_EVP_DigestFinal(WOLFSSL_EVP_MD_CTX* ctx, unsigned char* md,
|
||||
unsigned int* s)
|
||||
{
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
|
||||
enum wc_HashType macType;
|
||||
|
||||
WOLFSSL_ENTER("EVP_DigestFinal");
|
||||
|
||||
+8
-6
@@ -2948,7 +2948,7 @@ int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz,
|
||||
}
|
||||
|
||||
/* if async pending then skip cleanup*/
|
||||
if (ret == WC_PENDING_E
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#ifdef WC_RSA_NONBLOCK
|
||||
|| ret == FP_WOULDBLOCK
|
||||
#endif
|
||||
@@ -3177,7 +3177,7 @@ static int wc_RsaFunction_ex(const byte* in, word32 inLen, byte* out,
|
||||
RESTORE_VECTOR_REGISTERS();
|
||||
|
||||
/* handle error */
|
||||
if (ret < 0 && ret != WC_PENDING_E
|
||||
if (ret < 0 && ret != WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#ifdef WC_RSA_NONBLOCK
|
||||
&& ret != FP_WOULDBLOCK
|
||||
#endif
|
||||
@@ -3363,7 +3363,7 @@ static int RsaPublicEncryptEx(const byte* in, word32 inLen, byte* out,
|
||||
}
|
||||
|
||||
/* if async pending then return and skip done cleanup below */
|
||||
if (ret == WC_PENDING_E
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#ifdef WC_RSA_NONBLOCK
|
||||
|| ret == FP_WOULDBLOCK
|
||||
#endif
|
||||
@@ -3579,9 +3579,11 @@ static int RsaPrivateDecryptEx(const byte* in, word32 inLen, byte* out,
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_RSA_VERIFY_ONLY)
|
||||
ret = ctMaskSelInt(ctMaskLTE(ret, (int)outLen), ret, RSA_BUFFER_E);
|
||||
ret = ctMaskSelInt(ctMaskLTE(ret, (int)outLen), ret,
|
||||
WC_NO_ERR_TRACE(RSA_BUFFER_E));
|
||||
#ifndef WOLFSSL_RSA_DECRYPT_TO_0_LEN
|
||||
ret = ctMaskSelInt(ctMaskNotEq(ret, 0), ret, RSA_BUFFER_E);
|
||||
ret = ctMaskSelInt(ctMaskNotEq(ret, 0), ret,
|
||||
WC_NO_ERR_TRACE(RSA_BUFFER_E));
|
||||
#endif
|
||||
#else
|
||||
if (outLen < (word32)ret)
|
||||
@@ -3616,7 +3618,7 @@ static int RsaPrivateDecryptEx(const byte* in, word32 inLen, byte* out,
|
||||
}
|
||||
|
||||
/* if async pending then return and skip done cleanup below */
|
||||
if (ret == WC_PENDING_E
|
||||
if (ret == WC_NO_ERR_TRACE(WC_PENDING_E)
|
||||
#ifdef WC_RSA_NONBLOCK
|
||||
|| ret == FP_WOULDBLOCK
|
||||
#endif
|
||||
|
||||
@@ -80,7 +80,7 @@ static int wc_SignatureDerEncode(enum wc_HashType hash_type, byte* hash_data,
|
||||
int wc_SignatureGetSize(enum wc_SignatureType sig_type,
|
||||
const void* key, word32 key_len)
|
||||
{
|
||||
int sig_len = BAD_FUNC_ARG;
|
||||
int sig_len = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
/* Suppress possible unused args if all signature types are disabled */
|
||||
(void)key;
|
||||
|
||||
+1
-1
@@ -656,7 +656,7 @@ static int wc_SrpSetKey(Srp* srp, byte* secret, word32 size)
|
||||
byte digest[SRP_MAX_DIGEST_SIZE];
|
||||
word32 i, j, digestSz = SrpHashSize(srp->type);
|
||||
byte counter[4];
|
||||
int r = BAD_FUNC_ARG;
|
||||
int r = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
|
||||
|
||||
XMEMSET(digest, 0, SRP_MAX_DIGEST_SIZE);
|
||||
|
||||
|
||||
+36
-34
@@ -940,7 +940,7 @@ static int wolfssl_pb_print(const char* msg, ...)
|
||||
/* Enable support for RNG with crypto callback */
|
||||
static int rng_crypto_cb(int thisDevId, wc_CryptoInfo* info, void* ctx)
|
||||
{
|
||||
int rc = CRYPTOCB_UNAVAILABLE;
|
||||
int rc = WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE);
|
||||
if (info->algo_type == WC_ALGO_TYPE_RNG) {
|
||||
rc = wc_GenerateSeed(&info->rng.rng->seed, info->rng.out, info->rng.sz);
|
||||
}
|
||||
@@ -17409,7 +17409,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t XChaCha20Poly1305_test(void) {
|
||||
#endif /* defined(HAVE_XCHACHA) && defined(HAVE_POLY1305) */
|
||||
|
||||
#ifndef WC_NO_RNG
|
||||
static wc_test_ret_t _rng_test(WC_RNG* rng, int errorOffset)
|
||||
static wc_test_ret_t _rng_test(WC_RNG* rng)
|
||||
{
|
||||
byte block[32];
|
||||
wc_test_ret_t ret;
|
||||
@@ -17419,8 +17419,7 @@ static wc_test_ret_t _rng_test(WC_RNG* rng, int errorOffset)
|
||||
|
||||
ret = wc_RNG_GenerateBlock(rng, block, sizeof(block));
|
||||
if (ret != 0) {
|
||||
ret = 1;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
|
||||
/* Check for 0's */
|
||||
@@ -17431,49 +17430,36 @@ static wc_test_ret_t _rng_test(WC_RNG* rng, int errorOffset)
|
||||
}
|
||||
/* All zeros count check */
|
||||
if (ret >= (int)sizeof(block)) {
|
||||
ret = 2;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
|
||||
ret = wc_RNG_GenerateByte(rng, block);
|
||||
if (ret != 0) {
|
||||
ret = 3;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
|
||||
/* Parameter validation testing. */
|
||||
ret = wc_RNG_GenerateBlock(NULL, block, sizeof(block));
|
||||
if (ret != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) {
|
||||
ret = 4;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
ret = wc_RNG_GenerateBlock(rng, NULL, sizeof(block));
|
||||
if (ret != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) {
|
||||
ret = 5;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
|
||||
ret = wc_RNG_GenerateByte(NULL, block);
|
||||
if (ret != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) {
|
||||
ret = 6;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
ret = wc_RNG_GenerateByte(rng, NULL);
|
||||
if (ret != WC_NO_ERR_TRACE(BAD_FUNC_ARG)) {
|
||||
ret = 7;
|
||||
goto exit;
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
if (ret != 0)
|
||||
ret = errorOffset - (ret * 1000000);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static wc_test_ret_t random_rng_test(void)
|
||||
{
|
||||
WC_RNG localRng;
|
||||
@@ -17490,7 +17476,7 @@ static wc_test_ret_t random_rng_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
ret = _rng_test(rng, WC_TEST_RET_ENC_NC);
|
||||
ret = _rng_test(rng);
|
||||
|
||||
/* Make sure and free RNG */
|
||||
wc_FreeRng(rng);
|
||||
@@ -17507,7 +17493,7 @@ static wc_test_ret_t random_rng_test(void)
|
||||
if (rng == NULL)
|
||||
return WC_TEST_RET_ENC_ERRNO;
|
||||
|
||||
ret = _rng_test(rng, WC_TEST_RET_ENC_NC);
|
||||
ret = _rng_test(rng);
|
||||
wc_rng_free(rng);
|
||||
rng = NULL;
|
||||
|
||||
@@ -17520,7 +17506,7 @@ static wc_test_ret_t random_rng_test(void)
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
ret = _rng_test(rng, WC_TEST_RET_ENC_NC);
|
||||
ret = _rng_test(rng);
|
||||
wc_rng_free(rng);
|
||||
|
||||
if (ret != 0)
|
||||
@@ -20262,7 +20248,9 @@ static wc_test_ret_t rsa_even_mod_test(WC_RNG* rng, RsaKey* key)
|
||||
}
|
||||
|
||||
ret = wc_RsaSSL_Verify(out, outSz, tmp, inLen, key);
|
||||
if (ret != MP_VAL && ret != WC_NO_ERR_TRACE(MP_EXPTMOD_E)) {
|
||||
if (ret != WC_NO_ERR_TRACE(MP_VAL) &&
|
||||
ret != WC_NO_ERR_TRACE(MP_EXPTMOD_E))
|
||||
{
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_even_mod);
|
||||
}
|
||||
#endif
|
||||
@@ -20277,7 +20265,9 @@ static wc_test_ret_t rsa_even_mod_test(WC_RNG* rng, RsaKey* key)
|
||||
/* test encrypt and decrypt using WC_RSA_NO_PAD */
|
||||
#if !defined(WOLFSSL_RSA_VERIFY_ONLY) && !defined(WOLFSSL_RSA_PUBLIC_ONLY)
|
||||
ret = wc_RsaPublicEncrypt(tmp, inLen, out, (int)outSz, key, rng);
|
||||
if (ret != MP_VAL && ret != WC_NO_ERR_TRACE(MP_EXPTMOD_E)) {
|
||||
if (ret != WC_NO_ERR_TRACE(MP_VAL) &&
|
||||
ret != WC_NO_ERR_TRACE(MP_EXPTMOD_E))
|
||||
{
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa_even_mod);
|
||||
}
|
||||
#endif /* WOLFSSL_RSA_VERIFY_ONLY */
|
||||
@@ -25522,11 +25512,17 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_test(void)
|
||||
(unsigned char*)key, (unsigned char*)iv) == 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
|
||||
if (wolfSSL_EVP_EncryptFinal_ex(NULL, NULL, NULL) != WOLFSSL_FAILURE)
|
||||
if (wolfSSL_EVP_EncryptFinal_ex(NULL, NULL, NULL)
|
||||
!= WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
|
||||
if (wolfSSL_EVP_EncryptFinal(NULL, NULL, NULL) != WOLFSSL_FAILURE)
|
||||
if (wolfSSL_EVP_EncryptFinal(NULL, NULL, NULL)
|
||||
!= WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
|
||||
if (wolfSSL_EVP_CIPHER_CTX_cleanup(de) != WOLFSSL_SUCCESS)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
@@ -25538,11 +25534,17 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_test(void)
|
||||
(unsigned char*)key, (unsigned char*)iv) == 0)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
|
||||
if (wolfSSL_EVP_DecryptFinal(NULL, NULL, NULL) != WOLFSSL_FAILURE)
|
||||
if (wolfSSL_EVP_DecryptFinal(NULL, NULL, NULL)
|
||||
!= WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
|
||||
if (wolfSSL_EVP_DecryptFinal_ex(NULL, NULL, NULL) != WOLFSSL_FAILURE)
|
||||
if (wolfSSL_EVP_DecryptFinal_ex(NULL, NULL, NULL)
|
||||
!= WC_NO_ERR_TRACE(WOLFSSL_FAILURE))
|
||||
{
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
}
|
||||
|
||||
if (EVP_CIPHER_CTX_block_size(NULL) != WC_NO_ERR_TRACE(BAD_FUNC_ARG))
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
@@ -52119,7 +52121,7 @@ static wc_test_ret_t mp_test_param(mp_int* a, mp_int* b, mp_int* r, WC_RNG* rng)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
#ifdef WOLFSSL_SP_MATH
|
||||
ret = mp_grow(a, SP_INT_DIGITS + 1);
|
||||
if (ret != MP_MEM)
|
||||
if (ret != WC_NO_ERR_TRACE(MP_MEM))
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+24
-8
@@ -35,6 +35,8 @@
|
||||
#endif
|
||||
|
||||
enum wolfSSL_ErrorCodes {
|
||||
WOLFSSL_FATAL_ERROR = -1, /* note, must be -1 for backward
|
||||
* compat. */
|
||||
WOLFSSL_FIRST_E = -301,
|
||||
|
||||
INPUT_CASE_ERROR = -301, /* process input state error */
|
||||
@@ -81,12 +83,14 @@ enum wolfSSL_ErrorCodes {
|
||||
ZERO_RETURN = -343, /* peer sent close notify */
|
||||
SIDE_ERROR = -344, /* wrong client/server type */
|
||||
NO_PEER_CERT = -345, /* peer didn't send key */
|
||||
|
||||
ECC_CURVETYPE_ERROR = -350, /* Bad ECC Curve Type */
|
||||
ECC_CURVE_ERROR = -351, /* Bad ECC Curve */
|
||||
ECC_PEERKEY_ERROR = -352, /* Bad Peer ECC Key */
|
||||
ECC_MAKEKEY_ERROR = -353, /* Bad Make ECC Key */
|
||||
ECC_EXPORT_ERROR = -354, /* Bad ECC Export Key */
|
||||
ECC_SHARED_ERROR = -355, /* Bad ECC Shared Secret */
|
||||
|
||||
NOT_CA_ERROR = -357, /* Not a CA cert error */
|
||||
|
||||
BAD_CERT_MANAGER_ERROR = -359, /* Bad Cert Manager */
|
||||
@@ -187,11 +191,28 @@ enum wolfSSL_ErrorCodes {
|
||||
DTLS_CID_ERROR = -454, /* Wrong or missing CID */
|
||||
DTLS_TOO_MANY_FRAGMENTS_E = -455, /* Received too many fragments */
|
||||
QUIC_WRONG_ENC_LEVEL = -456, /* QUIC data received on wrong encryption level */
|
||||
|
||||
DUPLICATE_TLS_EXT_E = -457, /* Duplicate TLS extension in msg. */
|
||||
/* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
|
||||
|
||||
/* begin negotiation parameter errors */
|
||||
/* legacy CyaSSL compat layer error codes */
|
||||
WOLFSSL_ALPN_NOT_FOUND = -458, /* TLS extension not found */
|
||||
WOLFSSL_BAD_CERTTYPE = -459, /* Certificate type not supported */
|
||||
WOLFSSL_BAD_STAT = -460, /* not used */
|
||||
WOLFSSL_BAD_PATH = -461, /* No certificates found at designated path */
|
||||
WOLFSSL_BAD_FILETYPE = -462, /* Data format not supported */
|
||||
WOLFSSL_BAD_FILE = -463, /* Input/output error on file */
|
||||
WOLFSSL_NOT_IMPLEMENTED = -464, /* Function not implemented */
|
||||
WOLFSSL_UNKNOWN = -465, /* Unknown algorithm (EVP) */
|
||||
|
||||
/* I/O Callback errors */
|
||||
WOLFSSL_CBIO_ERR_GENERAL = -466, /* I/O callback general unexpected error */
|
||||
WOLFSSL_CBIO_ERR_WANT_READ = -467, /* I/O callback want read, call again */
|
||||
WOLFSSL_CBIO_ERR_WANT_WRITE = -468, /* I/O callback want write, call again */
|
||||
WOLFSSL_CBIO_ERR_CONN_RST = -469, /* I/O callback connection reset */
|
||||
WOLFSSL_CBIO_ERR_ISR = -470, /* I/O callback interrupt */
|
||||
WOLFSSL_CBIO_ERR_CONN_CLOSE = -471, /* I/O callback connection closed or epipe */
|
||||
WOLFSSL_CBIO_ERR_TIMEOUT = -472, /* I/O callback socket timeout */
|
||||
|
||||
/* negotiation parameter errors */
|
||||
UNSUPPORTED_SUITE = -500, /* unsupported cipher suite */
|
||||
MATCH_SUITE_ERROR = -501, /* can't match cipher suite */
|
||||
COMPRESSION_ERROR = -502, /* compression mismatch */
|
||||
@@ -199,13 +220,8 @@ enum wolfSSL_ErrorCodes {
|
||||
POST_HAND_AUTH_ERROR = -504, /* client won't do post-hand auth */
|
||||
HRR_COOKIE_ERROR = -505, /* HRR msg cookie mismatch */
|
||||
UNSUPPORTED_CERTIFICATE = -506, /* unsupported certificate type */
|
||||
/* end negotiation parameter errors only 10 for now */
|
||||
|
||||
WOLFSSL_LAST_E = -506
|
||||
|
||||
/* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
|
||||
|
||||
/* no error strings go down here, add above negotiation errors !!!! */
|
||||
};
|
||||
|
||||
|
||||
|
||||
+9
-23
@@ -32,8 +32,8 @@
|
||||
/* for users not using preprocessor flags*/
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/version.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
#include <wolfssl/wolfcrypt/asn_public.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/memory.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
@@ -2599,6 +2599,14 @@ WOLFSSL_API void wolfSSL_ERR_print_errors(WOLFSSL_BIO *bio);
|
||||
enum { /* ssl Constants */
|
||||
WOLFSSL_ERROR_NONE = 0, /* for most functions */
|
||||
WOLFSSL_FAILURE = 0, /* for some functions */
|
||||
|
||||
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && \
|
||||
(defined(BUILDING_WOLFSSL) || \
|
||||
defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS))
|
||||
#define WOLFSSL_FAILURE WC_ERR_TRACE(WOLFSSL_FAILURE)
|
||||
#define CONST_NUM_ERR_WOLFSSL_FAILURE 0
|
||||
#endif
|
||||
|
||||
WOLFSSL_SUCCESS = 1,
|
||||
|
||||
/* WOLFSSL_SHUTDOWN_NOT_DONE is returned by wolfSSL_shutdown and
|
||||
@@ -2616,16 +2624,6 @@ enum { /* ssl Constants */
|
||||
WOLFSSL_SHUTDOWN_NOT_DONE = 2,
|
||||
#endif
|
||||
|
||||
WOLFSSL_ALPN_NOT_FOUND = -9,
|
||||
WOLFSSL_BAD_CERTTYPE = -8,
|
||||
WOLFSSL_BAD_STAT = -7,
|
||||
WOLFSSL_BAD_PATH = -6,
|
||||
WOLFSSL_BAD_FILETYPE = -5,
|
||||
WOLFSSL_BAD_FILE = -4,
|
||||
WOLFSSL_NOT_IMPLEMENTED = -3,
|
||||
WOLFSSL_UNKNOWN = -2,
|
||||
WOLFSSL_FATAL_ERROR = -1,
|
||||
|
||||
WOLFSSL_FILETYPE_ASN1 = CTC_FILETYPE_ASN1,
|
||||
WOLFSSL_FILETYPE_PEM = CTC_FILETYPE_PEM,
|
||||
WOLFSSL_FILETYPE_DEFAULT = CTC_FILETYPE_ASN1, /* ASN1 */
|
||||
@@ -3235,18 +3233,6 @@ WOLFSSL_API void wolfSSL_SetFuzzerCb(WOLFSSL* ssl, CallbackFuzzer cbf, void* fCt
|
||||
WOLFSSL_API int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, const byte* secret, word32 secretSz);
|
||||
|
||||
|
||||
/* I/O Callback default errors */
|
||||
enum IOerrors {
|
||||
WOLFSSL_CBIO_ERR_GENERAL = -1, /* general unexpected err */
|
||||
WOLFSSL_CBIO_ERR_WANT_READ = -2, /* need to call read again */
|
||||
WOLFSSL_CBIO_ERR_WANT_WRITE = -2, /* need to call write again */
|
||||
WOLFSSL_CBIO_ERR_CONN_RST = -3, /* connection reset */
|
||||
WOLFSSL_CBIO_ERR_ISR = -4, /* interrupt */
|
||||
WOLFSSL_CBIO_ERR_CONN_CLOSE = -5, /* connection closed or epipe */
|
||||
WOLFSSL_CBIO_ERR_TIMEOUT = -6 /* socket timeout */
|
||||
};
|
||||
|
||||
|
||||
/* CA cache callbacks */
|
||||
enum {
|
||||
WOLFSSL_SSLV3 = 0,
|
||||
|
||||
@@ -43,6 +43,10 @@ the error status.
|
||||
|
||||
/* error codes, add string for new errors !!! */
|
||||
enum {
|
||||
/* note that WOLFSSL_FATAL_ERROR is defined as -1 in error-ssl.h, for
|
||||
* reasons of backward compatibility.
|
||||
*/
|
||||
|
||||
MAX_CODE_E = -96, /* errors -97 - -299 */
|
||||
WC_FIRST_E = -97, /* errors -97 - -299 */
|
||||
|
||||
@@ -307,7 +311,7 @@ WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error);
|
||||
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && \
|
||||
(defined(BUILDING_WOLFSSL) || \
|
||||
defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS))
|
||||
extern void wc_backtrace_render(void);
|
||||
WOLFSSL_API extern void wc_backtrace_render(void);
|
||||
#define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label)
|
||||
#ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE
|
||||
#ifdef WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES
|
||||
|
||||
Reference in New Issue
Block a user