Support building TLS examples with `--disable-oldnames`.
parent
005e08db5a
commit
ed2549cfbe
|
@ -97,7 +97,7 @@ static void CaCb(unsigned char* der, int sz, int type)
|
|||
}
|
||||
|
||||
ret = wolfSSL_X509_get_serial_number(x509, serial, &sz);
|
||||
if (ret == SSL_SUCCESS) {
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
int i;
|
||||
int strLen;
|
||||
char serialMsg[80];
|
||||
|
@ -155,7 +155,7 @@ int Security(int sock)
|
|||
wolfSSL_set_fd(ssl, sock);
|
||||
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret == SSL_SUCCESS) {
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = ClientGreet(sock, ssl);
|
||||
}
|
||||
|
||||
|
|
|
@ -541,7 +541,7 @@ int main(int argc, char** argv)
|
|||
|
||||
/* Load client certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, CA_FILE, NULL))
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CA_FILE);
|
||||
goto exit;
|
||||
|
@ -561,7 +561,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
/* Connect to wolfSSL on the server side */
|
||||
if ((ret = wolfSSL_connect(ssl)) != SSL_SUCCESS) {
|
||||
if ((ret = wolfSSL_connect(ssl)) != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
|
||||
goto exit;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
/* Load client ecc key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
|||
wolfSSL_CTX_SetIORecv(ctx, uartIORx);
|
||||
|
||||
/* For testing disable peer cert verification */
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, NULL);
|
||||
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
|
|
|
@ -108,7 +108,7 @@ int main(int argc, char** argv)
|
|||
|
||||
/* Load client certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, CERT_FILE, NULL))
|
||||
!= SSL_SUCCESS) {
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
goto ctx_cleanup;
|
||||
|
@ -128,7 +128,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
/* Connect to wolfSSL on the server side */
|
||||
if ((ret = wolfSSL_connect(ssl)) != SSL_SUCCESS) {
|
||||
if ((ret = wolfSSL_connect(ssl)) != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ int main(int argc, char** argv)
|
|||
printf("Server: %s\n", buff);
|
||||
|
||||
/* Bidirectional shutdown */
|
||||
while (wolfSSL_shutdown(ssl) == SSL_SHUTDOWN_NOT_DONE) {
|
||||
while (wolfSSL_shutdown(ssl) == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
printf("Shutdown not complete\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ static void* client_thread(void* args)
|
|||
if (cli_ctx == NULL) err_sys("bad client ctx new");
|
||||
|
||||
int ret = wolfSSL_CTX_load_verify_locations(cli_ctx, cacert, NULL);
|
||||
if (ret != SSL_SUCCESS) err_sys("bad ca load");
|
||||
if (ret != WOLFSSL_SUCCESS) err_sys("bad ca load");
|
||||
|
||||
wolfSSL_SetIOSend(cli_ctx, ClientSend);
|
||||
wolfSSL_SetIORecv(cli_ctx, ClientRecv);
|
||||
|
@ -156,7 +156,7 @@ static void* client_thread(void* args)
|
|||
if (cli_ctx == NULL) err_sys("bad client new");
|
||||
|
||||
ret = wolfSSL_connect(cli_ssl);
|
||||
if (ret != SSL_SUCCESS) err_sys("bad client tls connect");
|
||||
if (ret != WOLFSSL_SUCCESS) err_sys("bad client tls connect");
|
||||
printf("wolfSSL client success!\n");
|
||||
|
||||
ret = wolfSSL_write(cli_ssl, "hello memory wolfSSL!", 21);
|
||||
|
@ -175,11 +175,11 @@ int main()
|
|||
WOLFSSL_CTX* srv_ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method());
|
||||
if (srv_ctx == NULL) err_sys("bad server ctx new");
|
||||
|
||||
int ret = wolfSSL_CTX_use_PrivateKey_file(srv_ctx, key, SSL_FILETYPE_PEM);
|
||||
if (ret != SSL_SUCCESS) err_sys("bad server key file load");
|
||||
int ret = wolfSSL_CTX_use_PrivateKey_file(srv_ctx, key, WOLFSSL_FILETYPE_PEM);
|
||||
if (ret != WOLFSSL_SUCCESS) err_sys("bad server key file load");
|
||||
|
||||
ret = wolfSSL_CTX_use_certificate_file(srv_ctx, cert, SSL_FILETYPE_PEM);
|
||||
if (ret != SSL_SUCCESS) err_sys("bad server cert file load");
|
||||
ret = wolfSSL_CTX_use_certificate_file(srv_ctx, cert, WOLFSSL_FILETYPE_PEM);
|
||||
if (ret != WOLFSSL_SUCCESS) err_sys("bad server cert file load");
|
||||
|
||||
wolfSSL_SetIOSend(srv_ctx, ServerSend);
|
||||
wolfSSL_SetIORecv(srv_ctx, ServerRecv);
|
||||
|
@ -193,7 +193,7 @@ int main()
|
|||
|
||||
/* accept tls connection without tcp sockets */
|
||||
ret = wolfSSL_accept(srv_ssl);
|
||||
if (ret != SSL_SUCCESS) err_sys("bad server tls accept");
|
||||
if (ret != WOLFSSL_SUCCESS) err_sys("bad server tls accept");
|
||||
printf("wolfSSL accept success!\n");
|
||||
|
||||
/* read msg post handshake from client */
|
||||
|
|
|
@ -184,7 +184,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -192,7 +192,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -490,7 +490,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -498,7 +498,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -86,7 +86,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -94,7 +94,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -138,7 +138,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -146,7 +146,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if (wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM)
|
||||
if (wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM)
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -86,7 +86,7 @@ void* ClientHandler(void* args)
|
|||
ret = wolfSSL_accept(ssl);
|
||||
} while(wolfSSL_want_read(ssl));
|
||||
|
||||
if (ret != SSL_SUCCESS) {
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
printf("ret = %d\n", ret);
|
||||
fprintf(stderr, "wolfSSL_accept error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
|
@ -207,7 +207,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -215,7 +215,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
|
@ -207,16 +207,16 @@ int main(int argc, char** argv)
|
|||
wolfSSL_CTX_SetIORecv(ctx, uartIORx);
|
||||
|
||||
/* For testing disable peer cert verification */
|
||||
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
|
||||
wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, NULL);
|
||||
|
||||
/* Set server key and certificate (required) */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n", CERT_FILE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n", KEY_FILE);
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server certificates into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
CERT_FILE);
|
||||
|
@ -95,7 +95,7 @@ int main()
|
|||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, SSL_FILETYPE_PEM))
|
||||
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE, WOLFSSL_FILETYPE_PEM))
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
|
||||
KEY_FILE);
|
||||
|
|
Loading…
Reference in New Issue