touch-up
parent
9554457a33
commit
58dce0062b
|
@ -30,10 +30,10 @@
|
|||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
|
||||
int my_IORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
||||
{
|
||||
|
@ -134,9 +138,6 @@ int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||
}
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -210,7 +211,8 @@ int main(int argc, char** argv)
|
|||
|
||||
|
||||
/* Connect to the server */
|
||||
if (connect(sockfd, (struct sockaddr*) &servAddr, sizeof(servAddr)) < 0) {
|
||||
if (connect(sockfd, (struct sockaddr*) &servAddr, sizeof(servAddr))
|
||||
== -1) {
|
||||
fprintf(stderr, "ERROR: failed to connect\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-ecc.pem"
|
||||
|
@ -42,6 +41,8 @@
|
|||
#define KEY_FILE "../certs/ecc-client-key.pem"
|
||||
#define CIPHER_LIST "ECDHE-ECDSA-CHACHA20-POLY1305"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
@ -136,9 +136,7 @@ int main(int argc, char** argv)
|
|||
if (wolfSSL_want_read(ssl)) {
|
||||
/* no error, just non-blocking. Carry on. */
|
||||
printf("Waiting for connection...\n");
|
||||
|
||||
sleep(1); /* cut down on spam */
|
||||
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
@ -199,7 +199,8 @@ int main(int argc, char** argv)
|
|||
|
||||
|
||||
/* Reconnect to the server */
|
||||
if (connect(sockfd, (struct sockaddr*) &servAddr, sizeof(servAddr)) < 0) {
|
||||
if (connect(sockfd, (struct sockaddr*) &servAddr, sizeof(servAddr))
|
||||
== -1) {
|
||||
fprintf(stderr, "ERROR: failed to connect\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -246,6 +247,9 @@ int main(int argc, char** argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Print to stdout any data the server sends */
|
||||
printf("Server: %s\n", buff);
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* NOTE: ----------------------------------------------------------------------
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* NOTE:
|
||||
* wolfSSL needs to be built with --enable-writedup, or else we'll see errors.
|
||||
*/
|
||||
|
||||
|
@ -40,6 +40,10 @@
|
|||
/* threads */
|
||||
#include <pthread.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
|
||||
|
||||
void* ReadHandler(void* args)
|
||||
|
@ -85,10 +89,6 @@ void* WriteHandler(void* args)
|
|||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/ca-cert.pem"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int sockfd;
|
||||
|
|
|
@ -30,9 +30,10 @@
|
|||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int sockfd;
|
||||
|
@ -55,6 +56,7 @@ int main()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
memset(&servAddr, 0, sizeof(servAddr));
|
||||
|
||||
|
@ -129,6 +131,9 @@ int main()
|
|||
close(connd); /* Close the connection to the server */
|
||||
}
|
||||
|
||||
printf("Shutdown complete\n");
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
close(sockfd); /* Close the socket listening for clients */
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
|
||||
|
||||
|
||||
int my_IORecv(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
||||
|
@ -135,12 +140,6 @@ int my_IOSend(WOLFSSL* ssl, char* buff, int sz, void* ctx)
|
|||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
#define DH_FILE "../certs/dh2048.pem"
|
||||
|
||||
int main()
|
||||
{
|
||||
int sockfd;
|
||||
|
@ -195,18 +194,14 @@ int main()
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Set DH params for WOLFSSL_CTX */
|
||||
if (wolfSSL_CTX_SetTmpDH_file(ctx, DH_FILE, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to set DH parameters.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Register callbacks */
|
||||
wolfSSL_SetIORecv(ctx, my_IORecv);
|
||||
wolfSSL_SetIOSend(ctx, my_IOSend);
|
||||
|
||||
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
memset(&servAddr, 0, sizeof(servAddr));
|
||||
|
||||
|
@ -291,6 +286,9 @@ int main()
|
|||
close(connd); /* Close the connection to the server */
|
||||
}
|
||||
|
||||
printf("Shutdown complete\n");
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-ecc.pem"
|
||||
#define KEY_FILE "../certs/ecc-key.pem"
|
||||
#define CIPHER_LIST "ECDHE-ECDSA-CHACHA20-POLY1305"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -187,6 +186,9 @@ int main()
|
|||
close(connd); /* Close the connection to the server */
|
||||
}
|
||||
|
||||
printf("Shutdown complete\n");
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
|
|
|
@ -34,13 +34,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
#define DH_FILE "../certs/dh2048.pem"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -102,13 +101,6 @@ int main()
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Set DH params for WOLFSSL_CTX */
|
||||
if (wolfSSL_CTX_SetTmpDH_file(ctx, DH_FILE, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to set DH parameters.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
|
@ -207,6 +199,9 @@ int main()
|
|||
close(connd); /* Close the connection to the server */
|
||||
}
|
||||
|
||||
printf("Shutdown complete\n");
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
|
|
|
@ -33,9 +33,16 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
/* Threads */
|
||||
/* threads */
|
||||
#include <pthread.h>
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define MAX_CONCURRENT_THREADS 10
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
|
||||
|
||||
|
||||
/* Thread argument package */
|
||||
|
@ -115,14 +122,6 @@ void* ClientHandler(void* args)
|
|||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define MAX_CONCURRENT_THREADS 10
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
#define DH_FILE "../certs/dh2048.pem"
|
||||
|
||||
int main()
|
||||
{
|
||||
int sockfd;
|
||||
|
@ -184,13 +183,6 @@ int main()
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Set DH params for WOLFSSL_CTX */
|
||||
if (wolfSSL_CTX_SetTmpDH_file(ctx, DH_FILE, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to set DH parameters.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
/* wolfSSL */
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_PORT 11111
|
||||
|
||||
#define CERT_FILE "../certs/server-cert.pem"
|
||||
#define KEY_FILE "../certs/server-key.pem"
|
||||
#define DH_FILE "../certs/dh2048.pem"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -95,13 +94,6 @@ int main()
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Set DH params for WOLFSSL_CTX */
|
||||
if (wolfSSL_CTX_SetTmpDH_file(ctx, DH_FILE, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: failed to set DH parameters.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the server address struct with zeros */
|
||||
|
@ -188,6 +180,9 @@ int main()
|
|||
close(connd); /* Close the connection to the server */
|
||||
}
|
||||
|
||||
printf("Shutdown complete\n");
|
||||
|
||||
|
||||
|
||||
/* Cleanup and return */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
|
|
Loading…
Reference in New Issue