Added new --disable-oldnames option to allow for using openssl along-side wolfssl headers (without OPENSSL_EXTRA). Add --enable-opensslcoexist which makes sure oldnames is disabled. Refactor of SSL_ to WOLF_SSL_. Refactor of SHA, MD5, SHA224, SHA256, SHA512 and SHA384 to WC_ naming.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
|
||||
#include <wolfssl/test.h>
|
||||
|
||||
#include "examples/client/client.h"
|
||||
#include <examples/client/client.h>
|
||||
|
||||
#ifndef NO_WOLFSSL_CLIENT
|
||||
|
||||
@@ -106,14 +106,14 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
||||
error = wolfSSL_get_error(ssl, 0);
|
||||
sockfd = (SOCKET_T)wolfSSL_get_fd(ssl);
|
||||
|
||||
while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
|
||||
error == SSL_ERROR_WANT_WRITE ||
|
||||
while (ret != WOLF_SSL_SUCCESS && (error == WOLF_SSL_ERROR_WANT_READ ||
|
||||
error == WOLF_SSL_ERROR_WANT_WRITE ||
|
||||
error == WC_PENDING_E)) {
|
||||
int currTimeout = 1;
|
||||
|
||||
if (error == SSL_ERROR_WANT_READ)
|
||||
if (error == WOLF_SSL_ERROR_WANT_READ)
|
||||
printf("... client would read block\n");
|
||||
else if (error == SSL_ERROR_WANT_WRITE)
|
||||
else if (error == WOLF_SSL_ERROR_WANT_WRITE)
|
||||
printf("... client would write block\n");
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (error == WC_PENDING_E) {
|
||||
@@ -139,16 +139,16 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
||||
error = wolfSSL_get_error(ssl, 0);
|
||||
}
|
||||
else if (select_ret == TEST_TIMEOUT && !wolfSSL_dtls(ssl)) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
error = WOLF_SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#ifdef WOLFSSL_DTLS
|
||||
else if (select_ret == TEST_TIMEOUT && wolfSSL_dtls(ssl) &&
|
||||
wolfSSL_dtls_got_timeout(ssl) >= 0) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
error = WOLF_SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
error = SSL_FATAL_ERROR;
|
||||
error = WOLF_SSL_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ static void ShowCiphers(void)
|
||||
|
||||
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
||||
|
||||
if (ret == SSL_SUCCESS)
|
||||
if (ret == WOLF_SSL_SUCCESS)
|
||||
printf("%s\n", ciphers);
|
||||
}
|
||||
|
||||
@@ -232,20 +232,20 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#endif
|
||||
if (useX25519) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve x25519");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("error in setting fd");
|
||||
}
|
||||
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -255,7 +255,7 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err_sys("SSL_connect failed");
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
err_sys("unable to get SSL object");
|
||||
|
||||
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("error in setting fd");
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#ifdef HAVE_CURVE25519
|
||||
if (useX25519) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve x25519");
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -336,7 +336,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret == SSL_SUCCESS) {
|
||||
if (ret == WOLF_SSL_SUCCESS) {
|
||||
/* Perform throughput test */
|
||||
char *tx_buffer, *rx_buffer;
|
||||
|
||||
@@ -411,7 +411,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read bench error %d\n", err);
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
@@ -528,7 +528,7 @@ static int StartTLS_Init(SOCKET_T* sockfd)
|
||||
err_sys("incorrect STARTTLS command received, expected 220");
|
||||
}
|
||||
|
||||
return SSL_SUCCESS;
|
||||
return WOLF_SSL_SUCCESS;
|
||||
}
|
||||
|
||||
/* Closes down the SMTP connection */
|
||||
@@ -581,10 +581,10 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
||||
printf("%s\n", tmpBuf);
|
||||
|
||||
ret = wolfSSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
||||
if (wc_shutdown && ret == WOLF_SSL_SHUTDOWN_NOT_DONE)
|
||||
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
|
||||
return SSL_SUCCESS;
|
||||
return WOLF_SSL_SUCCESS;
|
||||
}
|
||||
|
||||
static void ClientWrite(WOLFSSL* ssl, char* msg, int msgSz)
|
||||
@@ -629,13 +629,13 @@ static void ClientRead(WOLFSSL* ssl, char* reply, int replyLen, int mustRead)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read reply error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buffer));
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
}
|
||||
} while (err == WC_PENDING_E || (mustRead && err == SSL_ERROR_WANT_READ));
|
||||
} while (err == WC_PENDING_E || (mustRead && err == WOLF_SSL_ERROR_WANT_READ));
|
||||
if (ret > 0) {
|
||||
reply[ret] = 0;
|
||||
printf("%s\n", reply);
|
||||
@@ -1411,14 +1411,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
err_sys("unable to get ctx");
|
||||
|
||||
#ifdef SINGLE_THREADED
|
||||
if (wolfSSL_CTX_new_rng(ctx) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_new_rng(ctx) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("Single Threaded new rng at CTX failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cipherList && !useDefCipherList) {
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, cipherList) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("client can't set cipher list 1");
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
||||
#endif
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx,defaultCipherList)
|
||||
!=SSL_SUCCESS) {
|
||||
!=WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("client can't set cipher list 2");
|
||||
}
|
||||
@@ -1477,7 +1477,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (cipherList == NULL || (cipherList && useDefCipherList)) {
|
||||
wolfSSL_CTX_allow_anon_cipher(ctx);
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx,"ADH-AES128-SHA")
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("client can't set cipher list 4");
|
||||
}
|
||||
@@ -1500,7 +1500,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#if defined(WOLFSSL_SNIFFER)
|
||||
if (cipherList == NULL) {
|
||||
/* don't use EDH, can't sniff tmp keys */
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "AES128-SHA") != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "AES128-SHA") != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("client can't set cipher list 3");
|
||||
}
|
||||
@@ -1531,14 +1531,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (useClientCert){
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
if (wolfSSL_CTX_use_certificate_chain_file(ctx, ourCert)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load client cert file, check file and run from"
|
||||
" wolfSSL home dir");
|
||||
}
|
||||
|
||||
if (wolfSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_use_PrivateKey_file(ctx, ourKey, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load client private key file, check file and run "
|
||||
"from wolfSSL home dir");
|
||||
@@ -1552,7 +1552,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (!usePsk && !useAnon && !useVerifyCb) {
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
if (wolfSSL_CTX_load_verify_locations(ctx, verifyCert,0)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
||||
}
|
||||
@@ -1562,7 +1562,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef HAVE_ECC
|
||||
/* load ecc verify too, echoserver uses it by default w/ ecc */
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
if (wolfSSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load ecc ca file, Please run from wolfSSL home dir");
|
||||
}
|
||||
@@ -1573,7 +1573,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#if defined(WOLFSSL_TRUST_PEER_CERT) && !defined(NO_FILESYSTEM)
|
||||
if (trustCert) {
|
||||
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
|
||||
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
|
||||
WOLF_SSL_FILETYPE_PEM)) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load trusted peer cert file");
|
||||
}
|
||||
@@ -1581,11 +1581,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#endif /* WOLFSSL_TRUST_PEER_CERT && !NO_FILESYSTEM */
|
||||
}
|
||||
if (useVerifyCb)
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_PEER, myVerify);
|
||||
else if (!usePsk && !useAnon && doPeerCheck == 0)
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_NONE, 0);
|
||||
else if (!usePsk && !useAnon && overrideDateErrors == 1)
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myDateCb);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_PEER, myDateCb);
|
||||
#endif /* !defined(NO_CERTS) */
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
@@ -1599,34 +1599,34 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef HAVE_SNI
|
||||
if (sniHostName)
|
||||
if (wolfSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName))
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseSNI failed");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_MAX_FRAGMENT
|
||||
if (maxFragment)
|
||||
if (wolfSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_UseMaxFragment(ctx, maxFragment) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseMaxFragment failed");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TRUNCATED_HMAC
|
||||
if (truncatedHMAC)
|
||||
if (wolfSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_UseTruncatedHMAC(ctx) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseTruncatedHMAC failed");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SESSION_TICKET
|
||||
if (wolfSSL_CTX_UseSessionTicket(ctx) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_UseSessionTicket(ctx) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseSessionTicket failed");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_EXTENDED_MASTER
|
||||
if (disableExtMasterSecret)
|
||||
if (wolfSSL_CTX_DisableExtendedMasterSecret(ctx) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_DisableExtendedMasterSecret(ctx) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("DisableExtendedMasterSecret failed");
|
||||
}
|
||||
@@ -1634,11 +1634,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#if defined(HAVE_CURVE25519) && defined(HAVE_SUPPORTED_CURVES)
|
||||
if (useX25519) {
|
||||
if (wolfSSL_CTX_UseSupportedCurve(ctx, WOLFSSL_ECC_X25519)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to support X25519");
|
||||
}
|
||||
if (wolfSSL_CTX_UseSupportedCurve(ctx, WOLFSSL_ECC_SECP256R1)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to support secp256r1");
|
||||
}
|
||||
}
|
||||
@@ -1662,7 +1662,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_MDK_ARM)
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_NONE, 0);
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_EXTRA)
|
||||
@@ -1670,7 +1670,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("bad read ahead default value");
|
||||
}
|
||||
if (wolfSSL_CTX_set_read_ahead(ctx, 1) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_set_read_ahead(ctx, 1) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("error setting read ahead value");
|
||||
}
|
||||
@@ -1688,7 +1688,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
if (doMcast) {
|
||||
#ifdef WOLFSSL_MULTICAST
|
||||
wolfSSL_CTX_mcast_set_member_id(ctx, mcastID);
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("Couldn't set multicast cipher list.");
|
||||
}
|
||||
@@ -1711,7 +1711,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef HAVE_CURVE25519
|
||||
if (useX25519) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve x25519");
|
||||
}
|
||||
}
|
||||
@@ -1719,13 +1719,13 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef HAVE_ECC
|
||||
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve secp256r1");
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP384R1)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve secp384r1");
|
||||
}
|
||||
#endif
|
||||
@@ -1733,7 +1733,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
}
|
||||
if (onlyKeyShare == 0 || onlyKeyShare == 1) {
|
||||
#ifdef HAVE_FFDHE_2048
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_FFDHE_2048) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use DH 2048-bit parameters");
|
||||
}
|
||||
#endif
|
||||
@@ -1756,7 +1756,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
XMEMSET(sr, 0x5A, sizeof(sr));
|
||||
|
||||
if (wolfSSL_set_secret(ssl, 1, pms, sizeof(pms), cr, sr, suite)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("unable to set mcast secret");
|
||||
}
|
||||
@@ -1778,7 +1778,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
switch (statusRequest) {
|
||||
case WOLFSSL_CSR_OCSP:
|
||||
if (wolfSSL_UseOCSPStapling(ssl, WOLFSSL_CSR_OCSP,
|
||||
WOLFSSL_CSR_OCSP_USE_NONCE) != SSL_SUCCESS) {
|
||||
WOLFSSL_CSR_OCSP_USE_NONCE) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseCertificateStatusRequest failed");
|
||||
@@ -1796,7 +1796,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
case WOLFSSL_CSR2_OCSP:
|
||||
if (wolfSSL_UseOCSPStaplingV2(ssl,
|
||||
WOLFSSL_CSR2_OCSP, WOLFSSL_CSR2_OCSP_USE_NONCE)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseCertificateStatusRequest failed");
|
||||
@@ -1805,7 +1805,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
case WOLFSSL_CSR2_OCSP_MULTI:
|
||||
if (wolfSSL_UseOCSPStaplingV2(ssl,
|
||||
WOLFSSL_CSR2_OCSP_MULTI, 0)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("UseCertificateStatusRequest failed");
|
||||
@@ -1819,7 +1819,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#endif
|
||||
|
||||
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
||||
if (wolfSSL_set_fd(ssl, sockfd) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("error in setting fd");
|
||||
@@ -1827,7 +1827,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
|
||||
/* STARTTLS */
|
||||
if (doSTARTTLS) {
|
||||
if (StartTLS_Init(&sockfd) != SSL_SUCCESS) {
|
||||
if (StartTLS_Init(&sockfd) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("error during STARTTLS protocol");
|
||||
@@ -1840,18 +1840,18 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
wolfIO_SetTimeout(DEFAULT_TIMEOUT_SEC);
|
||||
#endif
|
||||
|
||||
if (wolfSSL_EnableCRL(ssl, WOLFSSL_CRL_CHECKALL) != SSL_SUCCESS) {
|
||||
if (wolfSSL_EnableCRL(ssl, WOLFSSL_CRL_CHECKALL) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't enable crl check");
|
||||
}
|
||||
if (wolfSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0)
|
||||
!= SSL_SUCCESS) {
|
||||
if (wolfSSL_LoadCRL(ssl, crlPemDir, WOLF_SSL_FILETYPE_PEM, 0)
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't load crl, check crlfile and date validity");
|
||||
}
|
||||
if (wolfSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS) {
|
||||
if (wolfSSL_SetCRL_Cb(ssl, CRL_CallBack) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't set crl callback");
|
||||
@@ -1860,7 +1860,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#endif
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
if (scr) {
|
||||
if (wolfSSL_UseSecureRenegotiation(ssl) != SSL_SUCCESS) {
|
||||
if (wolfSSL_UseSecureRenegotiation(ssl) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't enable secure renegotiation");
|
||||
@@ -1887,7 +1887,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -1903,7 +1903,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
timeout.tv_usec = 0;
|
||||
ret = NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */
|
||||
#endif
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
printf("wolfSSL_connect error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buffer));
|
||||
wolfSSL_free(ssl);
|
||||
@@ -1953,7 +1953,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
|
||||
if (doSTARTTLS) {
|
||||
if (XSTRNCMP(starttlsProt, "smtp", 4) == 0) {
|
||||
if (SMTP_Shutdown(ssl, wc_shutdown) != SSL_SUCCESS) {
|
||||
if (SMTP_Shutdown(ssl, wc_shutdown) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("error closing STARTTLS connection");
|
||||
@@ -1975,7 +1975,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
word16 protocol_nameSz = 0;
|
||||
|
||||
err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
|
||||
if (err == SSL_SUCCESS)
|
||||
if (err == WOLF_SSL_SUCCESS)
|
||||
printf("Received ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == SSL_ALPN_NOT_FOUND)
|
||||
@@ -1991,7 +1991,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
printf("not doing secure renegotiation on example with"
|
||||
" nonblocking yet");
|
||||
} else {
|
||||
if (wolfSSL_Rehandshake(ssl) != SSL_SUCCESS) {
|
||||
if (wolfSSL_Rehandshake(ssl) != WOLF_SSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
printf("err = %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buffer));
|
||||
@@ -2056,7 +2056,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
|
||||
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
||||
ret = wolfSSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
||||
if (wc_shutdown && ret == WOLF_SSL_SHUTDOWN_NOT_DONE)
|
||||
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
}
|
||||
#ifdef ATOMIC_USER
|
||||
@@ -2078,7 +2078,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#endif
|
||||
}
|
||||
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, sslResume);
|
||||
if (wolfSSL_set_fd(sslResume, sockfd) != SSL_SUCCESS) {
|
||||
if (wolfSSL_set_fd(sslResume, sockfd) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(sslResume);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("error in setting fd");
|
||||
@@ -2092,7 +2092,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#endif
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
if (scr) {
|
||||
if (wolfSSL_UseSecureRenegotiation(sslResume) != SSL_SUCCESS) {
|
||||
if (wolfSSL_UseSecureRenegotiation(sslResume) != WOLF_SSL_SUCCESS) {
|
||||
wolfSSL_free(sslResume);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
err_sys("can't enable secure renegotiation");
|
||||
@@ -2108,23 +2108,23 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#ifdef HAVE_CURVE25519
|
||||
if (useX25519) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519) != SSL_SUCCESS) {
|
||||
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve x25519");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ECC
|
||||
if (wolfSSL_UseKeyShare(sslResume,
|
||||
WOLFSSL_ECC_SECP256R1) != SSL_SUCCESS) {
|
||||
WOLFSSL_ECC_SECP256R1) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve secp256r1");
|
||||
}
|
||||
if (wolfSSL_UseKeyShare(sslResume,
|
||||
WOLFSSL_ECC_SECP384R1) != SSL_SUCCESS) {
|
||||
WOLFSSL_ECC_SECP384R1) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use curve secp384r1");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_FFDHE_2048
|
||||
if (wolfSSL_UseKeyShare(sslResume, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
|
||||
if (wolfSSL_UseKeyShare(sslResume, WOLFSSL_FFDHE_2048) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to use DH 2048-bit parameters");
|
||||
}
|
||||
#endif
|
||||
@@ -2193,7 +2193,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = wolfSSL_connect(sslResume);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(sslResume, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -2210,7 +2210,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
timeout.tv_usec = 0;
|
||||
ret = NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */
|
||||
#endif
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
printf("wolfSSL_connect resume error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buffer));
|
||||
wolfSSL_free(sslResume);
|
||||
@@ -2233,7 +2233,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
printf("Sending ALPN accepted list : %s\n", alpnList);
|
||||
err = wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
|
||||
&protocol_nameSz);
|
||||
if (err == SSL_SUCCESS)
|
||||
if (err == WOLF_SSL_SUCCESS)
|
||||
printf("Received ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == SSL_ALPN_NOT_FOUND)
|
||||
@@ -2329,7 +2329,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
}
|
||||
}
|
||||
if (ret < 0) {
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read resume error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string(err, buffer));
|
||||
wolfSSL_free(sslResume);
|
||||
@@ -2354,7 +2354,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
} while (err == WC_PENDING_E);
|
||||
|
||||
ret = wolfSSL_shutdown(sslResume);
|
||||
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
||||
if (wc_shutdown && ret == WOLF_SSL_SHUTDOWN_NOT_DONE)
|
||||
wolfSSL_shutdown(sslResume); /* bidirectional shutdown */
|
||||
|
||||
wolfSSL_free(sslResume);
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
#include <cyassl/test.h>
|
||||
|
||||
#include "examples/echoclient/echoclient.h"
|
||||
#include <examples/echoclient/echoclient.h>
|
||||
|
||||
#ifndef NO_WOLFSSL_CLIENT
|
||||
|
||||
@@ -135,11 +135,11 @@ void echoclient_test(void* args)
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
#ifndef NO_RSA
|
||||
if (SSL_CTX_load_verify_locations(ctx, caCertFile, 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, caCertFile, 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
||||
#endif
|
||||
#ifdef HAVE_ECC
|
||||
if (SSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
||||
#endif
|
||||
#elif !defined(NO_CERTS)
|
||||
@@ -163,7 +163,7 @@ void echoclient_test(void* args)
|
||||
#else
|
||||
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
||||
#endif
|
||||
if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=WOLF_SSL_SUCCESS)
|
||||
err_sys("client can't set cipher list 2");
|
||||
#endif
|
||||
}
|
||||
@@ -173,7 +173,7 @@ void echoclient_test(void* args)
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_MDK_ARM)
|
||||
CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
CyaSSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_NONE, 0);
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
@@ -196,7 +196,7 @@ void echoclient_test(void* args)
|
||||
do {
|
||||
err = 0; /* Reset error */
|
||||
ret = SSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -206,7 +206,7 @@ void echoclient_test(void* args)
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
printf("SSL_connect error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_connect failed");
|
||||
|
||||
@@ -151,7 +151,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
#error "no valid server method built in"
|
||||
#endif
|
||||
ctx = CyaSSL_CTX_new(method);
|
||||
/* CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); */
|
||||
/* CyaSSL_CTX_set_session_cache_mode(ctx, WOLF_SSL_SESS_CACHE_OFF); */
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
|
||||
CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
|
||||
@@ -168,37 +168,37 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
if (doPSK == 0) {
|
||||
#if defined(HAVE_NTRU) && defined(WOLFSSL_STATIC_RSA)
|
||||
/* ntru */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, ntruCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, ntruCertFile, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load ntru cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKeyFile)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load ntru key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
#elif defined(HAVE_ECC) && !defined(CYASSL_SNIFFER)
|
||||
/* ecc */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, eccCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, eccCertFile, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load server cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKeyFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKeyFile, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load server key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
#elif defined(NO_CERTS)
|
||||
/* do nothing, just don't load cert files */
|
||||
#else
|
||||
/* normal */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, svrCertFile, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load server cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("can't load server key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
#endif
|
||||
@@ -228,7 +228,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
#else
|
||||
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
||||
#endif
|
||||
if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
|
||||
if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != WOLF_SSL_SUCCESS)
|
||||
err_sys("server can't set cipher list 2");
|
||||
#endif
|
||||
}
|
||||
@@ -280,7 +280,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
wolfSSL_dtls_set_peer(ssl, &client, client_len);
|
||||
#endif
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN)
|
||||
CyaSSL_SetTmpDH_file(ssl, dhParamFile, SSL_FILETYPE_PEM);
|
||||
CyaSSL_SetTmpDH_file(ssl, dhParamFile, WOLF_SSL_FILETYPE_PEM);
|
||||
#elif !defined(NO_DH)
|
||||
SetDH(ssl); /* will repick suites with DHE, higher than PSK */
|
||||
#endif
|
||||
@@ -288,7 +288,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
do {
|
||||
err = 0; /* Reset error */
|
||||
ret = CyaSSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = CyaSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -298,7 +298,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
printf("SSL_accept error = %d, %s\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
printf("SSL_accept failed\n");
|
||||
@@ -337,7 +337,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret <= 0) {
|
||||
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_ZERO_RETURN){
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ && err != WOLF_SSL_ERROR_ZERO_RETURN){
|
||||
printf("SSL_read echo error %d, %s!\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ int main()
|
||||
err_sys("ctx new dtls client failed");
|
||||
|
||||
ret = wolfSSL_CTX_dtls_set_sctp(ctx);
|
||||
if (ret != SSL_SUCCESS)
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("set sctp mode failed");
|
||||
|
||||
ret = wolfSSL_CTX_load_verify_locations(ctx, cacert, NULL);
|
||||
if (ret != SSL_SUCCESS)
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("ca cert error");
|
||||
|
||||
WOLFSSL* ssl = wolfSSL_new(ctx);
|
||||
@@ -85,12 +85,12 @@ int main()
|
||||
wolfSSL_set_fd(ssl, sd);
|
||||
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS)
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("ssl connect failed");
|
||||
|
||||
printf("TLS version is %s\n", wolfSSL_get_version(ssl));
|
||||
printf("Cipher Suite is %s\n",
|
||||
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));
|
||||
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));
|
||||
|
||||
wolfSSL_write(ssl, response, (int)strlen(response));
|
||||
int got = wolfSSL_read(ssl, buffer, sizeof(buffer));
|
||||
|
||||
@@ -77,15 +77,15 @@ int main()
|
||||
err_sys("ctx new dtls server failed");
|
||||
|
||||
ret = wolfSSL_CTX_dtls_set_sctp(ctx);
|
||||
if (ret != SSL_SUCCESS)
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("set sctp mode failed");
|
||||
|
||||
ret = wolfSSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM);
|
||||
if (ret != SSL_SUCCESS)
|
||||
ret = wolfSSL_CTX_use_PrivateKey_file(ctx, key, WOLF_SSL_FILETYPE_PEM);
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("use private key error");
|
||||
|
||||
ret = wolfSSL_CTX_use_certificate_file(ctx, cert, SSL_FILETYPE_PEM);
|
||||
if (ret != SSL_SUCCESS)
|
||||
ret = wolfSSL_CTX_use_certificate_file(ctx, cert, WOLF_SSL_FILETYPE_PEM);
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("use cert error");
|
||||
|
||||
WOLFSSL* ssl = wolfSSL_new(ctx);
|
||||
@@ -95,12 +95,12 @@ int main()
|
||||
wolfSSL_set_fd(ssl, client_sd);
|
||||
|
||||
ret = wolfSSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS)
|
||||
if (ret != WOLF_SSL_SUCCESS)
|
||||
err_sys("ssl accept failed");
|
||||
|
||||
printf("TLS version is %s\n", wolfSSL_get_version(ssl));
|
||||
printf("Cipher Suite is %s\n",
|
||||
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));
|
||||
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));
|
||||
|
||||
int got = wolfSSL_read(ssl, buffer, sizeof(buffer));
|
||||
if (got > 0) {
|
||||
|
||||
@@ -132,15 +132,15 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
|
||||
int select_ret = 0;
|
||||
|
||||
while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
|
||||
error == SSL_ERROR_WANT_WRITE ||
|
||||
while (ret != WOLF_SSL_SUCCESS && (error == WOLF_SSL_ERROR_WANT_READ ||
|
||||
error == WOLF_SSL_ERROR_WANT_WRITE ||
|
||||
error == WC_PENDING_E)) {
|
||||
int currTimeout = 1;
|
||||
|
||||
if (error == SSL_ERROR_WANT_READ) {
|
||||
if (error == WOLF_SSL_ERROR_WANT_READ) {
|
||||
/* printf("... server would read block\n"); */
|
||||
}
|
||||
else if (error == SSL_ERROR_WANT_WRITE) {
|
||||
else if (error == WOLF_SSL_ERROR_WANT_WRITE) {
|
||||
/* printf("... server would write block\n"); */
|
||||
}
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
@@ -168,16 +168,16 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
error = SSL_get_error(ssl, 0);
|
||||
}
|
||||
else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
error = WOLF_SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#ifdef CYASSL_DTLS
|
||||
else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
|
||||
CyaSSL_dtls_got_timeout(ssl) >= 0) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
error = WOLF_SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
error = SSL_FATAL_ERROR;
|
||||
error = WOLF_SSL_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +222,8 @@ int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ &&
|
||||
err != SSL_ERROR_ZERO_RETURN) {
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ &&
|
||||
err != WOLF_SSL_ERROR_ZERO_RETURN) {
|
||||
printf("SSL_read echo error %d\n", err);
|
||||
err_sys_ex(runWithErrors, "SSL_read failed");
|
||||
}
|
||||
@@ -304,7 +304,7 @@ static void ServerRead(WOLFSSL* ssl, char* input, int inputLen)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
if (err != WOLF_SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read input error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys_ex(runWithErrors, "SSL_read failed");
|
||||
@@ -335,7 +335,7 @@ static void ServerWrite(WOLFSSL* ssl, const char* output, int outputLen)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E || err == SSL_ERROR_WANT_WRITE);
|
||||
} while (err == WC_PENDING_E || err == WOLF_SSL_ERROR_WANT_WRITE);
|
||||
if (ret != outputLen) {
|
||||
printf("SSL_write msg error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
@@ -918,13 +918,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif /* DEBUG_WOLFSSL */
|
||||
|
||||
if (wolfSSL_CTX_load_static_memory(&ctx, method, memory, sizeof(memory),0,1)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "unable to load static memory and create ctx");
|
||||
|
||||
/* load in a buffer for IO */
|
||||
if (wolfSSL_CTX_load_static_memory(&ctx, NULL, memoryIO, sizeof(memoryIO),
|
||||
WOLFMEM_IO_POOL_FIXED | WOLFMEM_TRACK_STATS, 1)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "unable to load static memory and create ctx");
|
||||
#else
|
||||
ctx = SSL_CTX_new(method(NULL));
|
||||
@@ -940,7 +940,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif
|
||||
|
||||
if (cipherList && !useDefCipherList) {
|
||||
if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
|
||||
if (SSL_CTX_set_cipher_list(ctx, cipherList) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "server can't set cipher list 1");
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if ((!usePsk || usePskPlus) && !useAnon) {
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
if (SSL_CTX_use_certificate_chain_file(ctx, ourCert)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load server cert file, check file and run from"
|
||||
" wolfSSL home dir");
|
||||
#else
|
||||
@@ -983,17 +983,17 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif
|
||||
|
||||
#ifndef NO_DH
|
||||
if (wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits) != SSL_SUCCESS) {
|
||||
if (wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits) != WOLF_SSL_SUCCESS) {
|
||||
err_sys_ex(runWithErrors, "Error setting minimum DH key size");
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_RSA
|
||||
if (wolfSSL_CTX_SetMinRsaKey_Sz(ctx, minRsaKeyBits) != SSL_SUCCESS){
|
||||
if (wolfSSL_CTX_SetMinRsaKey_Sz(ctx, minRsaKeyBits) != WOLF_SSL_SUCCESS){
|
||||
err_sys_ex(runWithErrors, "Error setting minimum RSA key size");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ECC
|
||||
if (wolfSSL_CTX_SetMinEccKey_Sz(ctx, minEccKeyBits) != SSL_SUCCESS){
|
||||
if (wolfSSL_CTX_SetMinEccKey_Sz(ctx, minEccKeyBits) != WOLF_SSL_SUCCESS){
|
||||
err_sys_ex(runWithErrors, "Error setting minimum ECC key size");
|
||||
}
|
||||
#endif
|
||||
@@ -1001,7 +1001,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef HAVE_NTRU
|
||||
if (useNtruKey) {
|
||||
if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load ntru key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
}
|
||||
@@ -1009,8 +1009,8 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#if !defined(NO_CERTS)
|
||||
if (!useNtruKey && (!usePsk || usePskPlus) && !useAnon) {
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, WOLF_SSL_FILETYPE_PEM)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load server private key file, check file and run "
|
||||
"from wolfSSL home dir");
|
||||
#else
|
||||
@@ -1042,7 +1042,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#else
|
||||
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
||||
#endif
|
||||
if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
|
||||
if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "server can't set cipher list 2");
|
||||
}
|
||||
#endif
|
||||
@@ -1052,7 +1052,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef HAVE_ANON
|
||||
CyaSSL_CTX_allow_anon_cipher(ctx);
|
||||
if (cipherList == NULL || (cipherList && useDefCipherList)) {
|
||||
if (SSL_CTX_set_cipher_list(ctx, "ADH-AES128-SHA") != SSL_SUCCESS)
|
||||
if (SSL_CTX_set_cipher_list(ctx, "ADH-AES128-SHA") != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "server can't set cipher list 4");
|
||||
}
|
||||
#endif
|
||||
@@ -1062,15 +1062,15 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
/* if not using PSK, verify peer with certs
|
||||
if using PSK Plus then verify peer certs except PSK suites */
|
||||
if (doCliCertCheck && (usePsk == 0 || usePskPlus) && useAnon == 0) {
|
||||
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
|
||||
((usePskPlus)? SSL_VERIFY_FAIL_EXCEPT_PSK :
|
||||
SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
|
||||
if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
|
||||
SSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_PEER |
|
||||
((usePskPlus)? WOLF_SSL_VERIFY_FAIL_EXCEPT_PSK :
|
||||
WOLF_SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
|
||||
if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
|
||||
#ifdef WOLFSSL_TRUST_PEER_CERT
|
||||
if (trustCert) {
|
||||
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
|
||||
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
|
||||
WOLF_SSL_FILETYPE_PEM)) != WOLF_SSL_SUCCESS) {
|
||||
err_sys_ex(runWithErrors, "can't load trusted peer cert file");
|
||||
}
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#if defined(CYASSL_SNIFFER)
|
||||
/* don't use EDH, can't sniff tmp keys */
|
||||
if (cipherList == NULL) {
|
||||
if (SSL_CTX_set_cipher_list(ctx, "AES128-SHA") != SSL_SUCCESS)
|
||||
if (SSL_CTX_set_cipher_list(ctx, "AES128-SHA") != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "server can't set cipher list 3");
|
||||
}
|
||||
#endif
|
||||
@@ -1089,7 +1089,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef HAVE_SNI
|
||||
if (sniHostName)
|
||||
if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName,
|
||||
XSTRLEN(sniHostName)) != SSL_SUCCESS)
|
||||
XSTRLEN(sniHostName)) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "UseSNI failed");
|
||||
#endif
|
||||
|
||||
@@ -1144,7 +1144,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if (doMcast) {
|
||||
#ifdef WOLFSSL_MULTICAST
|
||||
wolfSSL_CTX_mcast_set_member_id(ctx, mcastID);
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != SSL_SUCCESS)
|
||||
if (wolfSSL_CTX_set_cipher_list(ctx, "WDM-NULL-SHA256") != WOLF_SSL_SUCCESS)
|
||||
err_sys("Couldn't set multicast cipher list.");
|
||||
#endif
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SEND_HRR_COOKIE
|
||||
if (hrrCookie && wolfSSL_send_hrr_cookie(ssl, NULL, 0) != SSL_SUCCESS) {
|
||||
if (hrrCookie && wolfSSL_send_hrr_cookie(ssl, NULL, 0) != WOLF_SSL_SUCCESS) {
|
||||
err_sys("unable to set use of cookie with HRR msg");
|
||||
}
|
||||
#endif
|
||||
@@ -1185,7 +1185,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
XMEMSET(sr, 0x5A, sizeof(sr));
|
||||
|
||||
if (wolfSSL_set_secret(ssl, 1, pms, sizeof(pms), cr, sr, suite)
|
||||
!= SSL_SUCCESS)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys("unable to set mcast secret");
|
||||
#endif
|
||||
}
|
||||
@@ -1197,12 +1197,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef HAVE_CRL_MONITOR
|
||||
crlFlags = CYASSL_CRL_MONITOR | CYASSL_CRL_START_MON;
|
||||
#endif
|
||||
if (CyaSSL_EnableCRL(ssl, 0) != SSL_SUCCESS)
|
||||
if (CyaSSL_EnableCRL(ssl, 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "unable to enable CRL");
|
||||
if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, crlFlags)
|
||||
!= SSL_SUCCESS)
|
||||
if (CyaSSL_LoadCRL(ssl, crlPemDir, WOLF_SSL_FILETYPE_PEM, crlFlags)
|
||||
!= WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "unable to load CRL");
|
||||
if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS)
|
||||
if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "unable to set CRL callback url");
|
||||
#endif
|
||||
#ifdef HAVE_OCSP
|
||||
@@ -1218,13 +1218,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||
if (wolfSSL_CTX_EnableOCSPStapling(ctx) != SSL_SUCCESS)
|
||||
if (wolfSSL_CTX_EnableOCSPStapling(ctx) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't enable OCSP Stapling Certificate Manager");
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate1-ca-cert.pem", 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate1-ca-cert.pem", 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate2-ca-cert.pem", 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate2-ca-cert.pem", 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate3-ca-cert.pem", 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, "certs/ocsp/intermediate3-ca-cert.pem", 0) != WOLF_SSL_SUCCESS)
|
||||
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
|
||||
#endif
|
||||
#ifdef HAVE_PK_CALLBACKS
|
||||
@@ -1241,7 +1241,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
dtlsUDP, dtlsSCTP, serverReadyFile ? 1 : 0, doListen);
|
||||
doListen = 0; /* Don't listen next time */
|
||||
|
||||
if (SSL_set_fd(ssl, clientfd) != SSL_SUCCESS) {
|
||||
if (SSL_set_fd(ssl, clientfd) != WOLF_SSL_SUCCESS) {
|
||||
err_sys_ex(runWithErrors, "error in setting fd");
|
||||
}
|
||||
|
||||
@@ -1273,7 +1273,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if ((usePsk == 0 || usePskPlus) || useAnon == 1 || cipherList != NULL
|
||||
|| needDH == 1) {
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN)
|
||||
CyaSSL_SetTmpDH_file(ssl, ourDhParam, SSL_FILETYPE_PEM);
|
||||
CyaSSL_SetTmpDH_file(ssl, ourDhParam, WOLF_SSL_FILETYPE_PEM);
|
||||
#elif !defined(NO_DH)
|
||||
SetDH(ssl); /* repick suites with DHE, higher priority than PSK */
|
||||
#endif
|
||||
@@ -1298,7 +1298,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
err = 0; /* reset error */
|
||||
ret = wolfSSL_read_early_data(ssl, input, sizeof(input)-1,
|
||||
&len);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -1317,7 +1317,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
@@ -1331,7 +1331,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#else
|
||||
ret = NonBlockingSSL_Accept(ssl);
|
||||
#endif
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLF_SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
printf("SSL_accept error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
@@ -1385,7 +1385,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
word16 protocol_nameSz = 0, listSz = 0;
|
||||
|
||||
err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
|
||||
if (err == SSL_SUCCESS)
|
||||
if (err == WOLF_SSL_SUCCESS)
|
||||
printf("Sent ALPN protocol : %s (%d)\n",
|
||||
protocol_name, protocol_nameSz);
|
||||
else if (err == SSL_ALPN_NOT_FOUND)
|
||||
@@ -1394,7 +1394,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
printf("Getting ALPN protocol name failed\n");
|
||||
|
||||
err = wolfSSL_ALPN_GetPeerProtocol(ssl, &list, &listSz);
|
||||
if (err == SSL_SUCCESS)
|
||||
if (err == WOLF_SSL_SUCCESS)
|
||||
printf("List of protocol names sent by Client: %s (%d)\n",
|
||||
list, listSz);
|
||||
else
|
||||
@@ -1407,17 +1407,17 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
|
||||
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_POST_HANDSHAKE_AUTH)
|
||||
if (postHandAuth) {
|
||||
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
|
||||
((usePskPlus)? SSL_VERIFY_FAIL_EXCEPT_PSK :
|
||||
SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
|
||||
SSL_CTX_set_verify(ctx, WOLF_SSL_VERIFY_PEER |
|
||||
((usePskPlus)? WOLF_SSL_VERIFY_FAIL_EXCEPT_PSK :
|
||||
WOLF_SSL_VERIFY_FAIL_IF_NO_PEER_CERT),0);
|
||||
if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0)
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLF_SSL_SUCCESS) {
|
||||
err_sys_ex(runWithErrors, "can't load ca file, Please run from wolfSSL home dir");
|
||||
}
|
||||
#ifdef WOLFSSL_TRUST_PEER_CERT
|
||||
if (trustCert) {
|
||||
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
|
||||
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
|
||||
WOLF_SSL_FILETYPE_PEM)) != WOLF_SSL_SUCCESS) {
|
||||
err_sys_ex(runWithErrors, "can't load trusted peer cert file");
|
||||
}
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
if (dtlsUDP == 0) {
|
||||
ret = SSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
||||
if (wc_shutdown && ret == WOLF_SSL_SHUTDOWN_NOT_DONE)
|
||||
SSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
}
|
||||
/* display collected statistics */
|
||||
|
||||
Reference in New Issue
Block a user