Getting files to run and pass nightly-CDT test
parent
d3c8997d7c
commit
c8d596269d
|
@ -158,6 +158,8 @@ int gen_csr(int type)
|
||||||
pemSz = ret;
|
pemSz = ret;
|
||||||
printf("%s (%d)", pem, pemSz);
|
printf("%s (%d)", pem, pemSz);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (type == EC_KEY_TYPE) {
|
if (type == EC_KEY_TYPE) {
|
||||||
wc_ecc_free(&ecKey);
|
wc_ecc_free(&ecKey);
|
||||||
|
|
Binary file not shown.
|
@ -348,7 +348,8 @@ int main(int argc, char** argv)
|
||||||
Des3Decrypt(&des3, key, size, inFile, outFile);
|
Des3Decrypt(&des3, key, size, inFile, outFile);
|
||||||
}
|
}
|
||||||
else if (choice == 'n') {
|
else if (choice == 'n') {
|
||||||
printf("Must select either -e or -d for encryption and decryption\n");
|
printf("Must select either -e[56,112,168] or -d[56,112,168] for \
|
||||||
|
encryption and decryption\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -347,7 +347,8 @@ int main(int argc, char** argv)
|
||||||
AesDecrypt(&aes, key, size, inFile, outFile);
|
AesDecrypt(&aes, key, size, inFile, outFile);
|
||||||
}
|
}
|
||||||
else if (choice == 'n') {
|
else if (choice == 'n') {
|
||||||
printf("Must select either -e or -d for encryption and decryption\n");
|
printf("Must select either -e[128, 192, 256] or -d[128, 192, 256] \
|
||||||
|
for encryption and decryption\n");
|
||||||
ret = -110;
|
ret = -110;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,8 @@ int main(int argc, char** argv)
|
||||||
AesDecrypt(&aes, key, size, inFile, outFile);
|
AesDecrypt(&aes, key, size, inFile, outFile);
|
||||||
}
|
}
|
||||||
else if (choice == 'n') {
|
else if (choice == 'n') {
|
||||||
printf("Must select either -e or -d for encryption and decryption\n");
|
printf("Must select either -e[128, 192, 256] or -d[128, 192, 256] \
|
||||||
|
for encryption and decryption\n");
|
||||||
ret = -110;
|
ret = -110;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,8 @@ int main(int argc, char** argv)
|
||||||
AesCtrDecrypt(&aes, key, size, inFile, outFile);
|
AesCtrDecrypt(&aes, key, size, inFile, outFile);
|
||||||
}
|
}
|
||||||
else if (choice == 'n') {
|
else if (choice == 'n') {
|
||||||
printf("Must select either -e or -d for encryption and decryption\n");
|
printf("Must select either -e[128, 192, 256] or -d[128, 192, 256] \
|
||||||
|
for encryption and decryption\n");
|
||||||
ret = -110;
|
ret = -110;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,8 @@ int main(int argc, char** argv)
|
||||||
CamelliaDecrypt(&cam, key, size, inFile, outFile);
|
CamelliaDecrypt(&cam, key, size, inFile, outFile);
|
||||||
}
|
}
|
||||||
else if (choice == 'n') {
|
else if (choice == 'n') {
|
||||||
printf("Must select either -e or -d for encryption and decryption\n");
|
printf("Must select either -e[128,192,256] or -d[128,192,256] for \
|
||||||
|
encryption and decryption\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -14,4 +14,4 @@ all: $(TARGETS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS)
|
rm -f $(TARGETS) encryptedAesKey
|
||||||
|
|
|
@ -32,15 +32,15 @@ sudo make install
|
||||||
Once the wolfSSL libraries are configured and installed the from this directory
|
Once the wolfSSL libraries are configured and installed the from this directory
|
||||||
run the build.sh script which will generate the two applications
|
run the build.sh script which will generate the two applications
|
||||||
|
|
||||||
rsa-priv-enc
|
rsa-private-encrypt-app
|
||||||
rsa-pub-dec
|
rsa-public-decrypt-app
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
USING:
|
USING:
|
||||||
|
|
||||||
```
|
```
|
||||||
./rsa-priv-enc
|
./rsa-private-encrypt-app
|
||||||
```
|
```
|
||||||
|
|
||||||
This will output the file "encryptedAesKey"
|
This will output the file "encryptedAesKey"
|
||||||
|
@ -54,7 +54,7 @@ specified on line 33 of the application "rsa-private-encrypt-app.c".
|
||||||
Now run
|
Now run
|
||||||
|
|
||||||
```
|
```
|
||||||
./rsa-pub-dec
|
./rsa-public-decrypt-app
|
||||||
```
|
```
|
||||||
|
|
||||||
This will open the file specified on line 32 of the application
|
This will open the file specified on line 32 of the application
|
||||||
|
|
|
@ -87,15 +87,23 @@ static int authEnvelopedData_encrypt(byte* cert, word32 certSz, byte* key,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
PKCS7* pkcs7;
|
PKCS7* pkcs7;
|
||||||
|
WC_RNG rng;
|
||||||
|
|
||||||
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
||||||
if (pkcs7 == NULL)
|
if (pkcs7 == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
if(ret != 0){
|
||||||
|
printf("wc_InitRng() failed, ret = %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pkcs7->content = (byte*)data;
|
pkcs7->content = (byte*)data;
|
||||||
pkcs7->contentSz = sizeof(data);
|
pkcs7->contentSz = sizeof(data);
|
||||||
pkcs7->contentOID = DATA;
|
pkcs7->contentOID = DATA;
|
||||||
pkcs7->encryptOID = AES256GCMb;
|
pkcs7->encryptOID = AES256GCMb;
|
||||||
|
pkcs7->rng = &rng;
|
||||||
|
|
||||||
/* add recipient using ECC certificate (KARI type) */
|
/* add recipient using ECC certificate (KARI type) */
|
||||||
ret = wc_PKCS7_AddRecipient_KARI(pkcs7, cert, certSz, AES256_WRAP,
|
ret = wc_PKCS7_AddRecipient_KARI(pkcs7, cert, certSz, AES256_WRAP,
|
||||||
|
@ -124,6 +132,7 @@ static int authEnvelopedData_encrypt(byte* cert, word32 certSz, byte* key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
wc_PKCS7_Free(pkcs7);
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -135,11 +144,18 @@ static int authEnvelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
PKCS7* pkcs7;
|
PKCS7* pkcs7;
|
||||||
|
WC_RNG rng;
|
||||||
|
|
||||||
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
||||||
if (pkcs7 == NULL)
|
if (pkcs7 == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
if(ret != 0){
|
||||||
|
printf("wc_InitRng() failed, ret = %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* init with recipient cert */
|
/* init with recipient cert */
|
||||||
ret = wc_PKCS7_InitWithCert(pkcs7, cert, certSz);
|
ret = wc_PKCS7_InitWithCert(pkcs7, cert, certSz);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
@ -156,6 +172,8 @@ static int authEnvelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkcs7->rng = &rng;
|
||||||
|
|
||||||
/* decode envelopedData, returns size */
|
/* decode envelopedData, returns size */
|
||||||
ret = wc_PKCS7_DecodeAuthEnvelopedData(pkcs7, in, inSz, out, outSz);
|
ret = wc_PKCS7_DecodeAuthEnvelopedData(pkcs7, in, inSz, out, outSz);
|
||||||
if (ret <= 0 || (ret != sizeof(data)) || (XMEMCMP(out, data, ret) != 0)) {
|
if (ret <= 0 || (ret != sizeof(data)) || (XMEMCMP(out, data, ret) != 0)) {
|
||||||
|
@ -168,6 +186,7 @@ static int authEnvelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
encodedFileKARI);
|
encodedFileKARI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
wc_PKCS7_Free(pkcs7);
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -87,15 +87,23 @@ static int envelopedData_encrypt(byte* cert, word32 certSz, byte* key,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
PKCS7* pkcs7;
|
PKCS7* pkcs7;
|
||||||
|
WC_RNG rng;
|
||||||
|
|
||||||
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
||||||
if (pkcs7 == NULL)
|
if (pkcs7 == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
if(ret != 0){
|
||||||
|
printf("wc_InitRng() failed, ret = %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pkcs7->content = (byte*)data;
|
pkcs7->content = (byte*)data;
|
||||||
pkcs7->contentSz = sizeof(data);
|
pkcs7->contentSz = sizeof(data);
|
||||||
pkcs7->contentOID = DATA;
|
pkcs7->contentOID = DATA;
|
||||||
pkcs7->encryptOID = AES256CBCb;
|
pkcs7->encryptOID = AES256CBCb;
|
||||||
|
pkcs7->rng = &rng;
|
||||||
|
|
||||||
/* add recipient using ECC certificate (KARI type) */
|
/* add recipient using ECC certificate (KARI type) */
|
||||||
ret = wc_PKCS7_AddRecipient_KARI(pkcs7, cert, certSz, AES256_WRAP,
|
ret = wc_PKCS7_AddRecipient_KARI(pkcs7, cert, certSz, AES256_WRAP,
|
||||||
|
@ -124,6 +132,7 @@ static int envelopedData_encrypt(byte* cert, word32 certSz, byte* key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
wc_PKCS7_Free(pkcs7);
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -135,6 +144,13 @@ static int envelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
PKCS7* pkcs7;
|
PKCS7* pkcs7;
|
||||||
|
WC_RNG rng;
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
if(ret != 0){
|
||||||
|
printf("wc_InitRng() failed, ret = %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
pkcs7 = wc_PKCS7_New(NULL, INVALID_DEVID);
|
||||||
if (pkcs7 == NULL)
|
if (pkcs7 == NULL)
|
||||||
|
@ -156,6 +172,8 @@ static int envelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkcs7->rng = &rng;
|
||||||
|
|
||||||
/* decode envelopedData, returns size */
|
/* decode envelopedData, returns size */
|
||||||
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, in, inSz, out, outSz);
|
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, in, inSz, out, outSz);
|
||||||
if (ret <= 0 || (ret != sizeof(data)) || (XMEMCMP(out, data, ret) != 0)) {
|
if (ret <= 0 || (ret != sizeof(data)) || (XMEMCMP(out, data, ret) != 0)) {
|
||||||
|
@ -167,6 +185,7 @@ static int envelopedData_decrypt(byte* in, word32 inSz, byte* cert,
|
||||||
encodedFileKARI);
|
encodedFileKARI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
wc_PKCS7_Free(pkcs7);
|
wc_PKCS7_Free(pkcs7);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -262,8 +262,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
byte cert[2048];
|
byte cert[2048];
|
||||||
byte key[2048];
|
byte key[2048];
|
||||||
byte encrypted[2048];
|
byte encrypted[5096];
|
||||||
byte decrypted[2048];
|
byte decrypted[5096];
|
||||||
|
|
||||||
#ifdef DEBUG_WOLFSSL
|
#ifdef DEBUG_WOLFSSL
|
||||||
wolfSSL_Debugging_ON();
|
wolfSSL_Debugging_ON();
|
||||||
|
|
|
@ -281,8 +281,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
byte cert[2048];
|
byte cert[2048];
|
||||||
byte key[2048];
|
byte key[2048];
|
||||||
byte encrypted[2048];
|
byte encrypted[5096];
|
||||||
byte decrypted[2048];
|
byte decrypted[5096];
|
||||||
|
|
||||||
#ifdef DEBUG_WOLFSSL
|
#ifdef DEBUG_WOLFSSL
|
||||||
wolfSSL_Debugging_ON();
|
wolfSSL_Debugging_ON();
|
||||||
|
|
|
@ -231,7 +231,7 @@ int main(int argc, char **argv)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
wolfSSL_set_bio(ssl, custom, custom);
|
wolfSSL_set_bio(ssl, custom, custom);
|
||||||
if (wolfSSL_BIO_set_ssl(bioSSL, ssl, BIO_CLOSE) != 0) {
|
if (wolfSSL_BIO_set_ssl(bioSSL, ssl, BIO_CLOSE) != WOLFSSL_SUCCESS) {
|
||||||
fprintf(stderr, "wolfSSL_BIO_set_ssl error.\n");
|
fprintf(stderr, "wolfSSL_BIO_set_ssl error.\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,22 +72,23 @@ static inline unsigned int My_Psk_Client_Cb(WOLFSSL* ssl, const char* hint,
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int sockfd, ret, error, currTimeout;
|
int sockfd = SOCKET_INVALID;
|
||||||
|
int ret, error, currTimeout;
|
||||||
int select_ret = TEST_SELECT_FAIL;
|
int select_ret = TEST_SELECT_FAIL;
|
||||||
int nfds;
|
int nfds;
|
||||||
int result;
|
int result;
|
||||||
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
||||||
char recvline[MAXLINE]; /* string received from the server */
|
char recvline[MAXLINE]; /* string received from the server */
|
||||||
fd_set recvfds, errfds;
|
fd_set recvfds, errfds;
|
||||||
WOLFSSL_CTX* ctx;
|
WOLFSSL_CTX* ctx = NULL;
|
||||||
WOLFSSL* ssl;
|
WOLFSSL* ssl = NULL;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
struct sockaddr_in servaddr;
|
struct sockaddr_in servaddr;
|
||||||
|
|
||||||
/* must include an ip address of this will flag */
|
/* must include an ip address of this will flag */
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: tcpClient <IPaddress>\n");
|
printf("Usage: tcpClient <IPaddress>\n");
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a stream socket using tcp,internet protocal IPv4,
|
/* create a stream socket using tcp,internet protocal IPv4,
|
||||||
|
@ -104,14 +105,14 @@ int main(int argc, char **argv)
|
||||||
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
printf("inet_pton error\n");
|
printf("inet_pton error\n");
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attempts to make a connection on a socket */
|
/* attempts to make a connection on a socket */
|
||||||
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("Connection Error\n");
|
printf("Connection Error\n");
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invokes the fcntl callable service to get the file status
|
/* invokes the fcntl callable service to get the file status
|
||||||
|
@ -120,7 +121,8 @@ int main(int argc, char **argv)
|
||||||
int flags = fcntl(sockfd, F_GETFL, 0);
|
int flags = fcntl(sockfd, F_GETFL, 0);
|
||||||
if (flags < 0) {
|
if (flags < 0) {
|
||||||
printf("fcntl get failed\n");
|
printf("fcntl get failed\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invokes the fcntl callable service to set file status flags.
|
/* invokes the fcntl callable service to set file status flags.
|
||||||
|
@ -130,7 +132,8 @@ int main(int argc, char **argv)
|
||||||
flags = fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
|
flags = fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
|
||||||
if (flags < 0) {
|
if (flags < 0) {
|
||||||
printf("fcntl set failed\n");
|
printf("fcntl set failed\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
wolfSSL_Init(); /* initialize wolfSSL */
|
wolfSSL_Init(); /* initialize wolfSSL */
|
||||||
|
@ -138,7 +141,8 @@ int main(int argc, char **argv)
|
||||||
/* create and initialize WOLFSSL_CTX structure */
|
/* create and initialize WOLFSSL_CTX structure */
|
||||||
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up pre shared keys */
|
/* set up pre shared keys */
|
||||||
|
@ -147,7 +151,8 @@ int main(int argc, char **argv)
|
||||||
/* create wolfSSL object after each tcp connect */
|
/* create wolfSSL object after each tcp connect */
|
||||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_new error.\n");
|
fprintf(stderr, "wolfSSL_new error.\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* associate the file descriptor with the session */
|
/* associate the file descriptor with the session */
|
||||||
|
@ -210,14 +215,15 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (ret != WOLFSSL_SUCCESS){
|
if (ret != WOLFSSL_SUCCESS){
|
||||||
printf("wolfSSL_connect failed");
|
printf("wolfSSL_connect failed");
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* takes inputting string and outputs it to the server */
|
/* takes inputting string and outputs it to the server */
|
||||||
/* write string to the server */
|
/* write string to the server */
|
||||||
if (wolfSSL_write(ssl, sendline, MAXLINE) != sizeof(sendline)) {
|
if (wolfSSL_write(ssl, sendline, MAXLINE) != sizeof(sendline)) {
|
||||||
printf("Write Error to Server\n");
|
printf("Write Error to Server\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flags if the Server stopped before the client could end */
|
/* flags if the Server stopped before the client could end */
|
||||||
|
@ -226,20 +232,25 @@ int main(int argc, char **argv)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("Client: Server Terminated Prematurely!\n");
|
printf("Client: Server Terminated Prematurely!\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show message from the server */
|
/* show message from the server */
|
||||||
printf("Server Message: %s\n", recvline);
|
printf("Server Message: %s\n", recvline);
|
||||||
|
|
||||||
/* cleanup */
|
ret = 0;
|
||||||
wolfSSL_free(ssl);
|
|
||||||
|
|
||||||
/* when completely done using SSL/TLS, free the
|
exit:
|
||||||
* wolfssl_ctx object */
|
/* Cleanup and return */
|
||||||
wolfSSL_CTX_free(ctx);
|
if (ssl)
|
||||||
wolfSSL_Cleanup();
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
if (sockfd != SOCKET_INVALID)
|
||||||
|
close(sockfd); /* Close the socket */
|
||||||
|
if (ctx)
|
||||||
|
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||||
|
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||||
|
|
||||||
return ret;
|
return ret; /* Return reporting a success */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,19 +63,21 @@ static inline unsigned int My_Psk_Client_Cb(WOLFSSL* ssl, const char* hint,
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
int sockfd, sock, ret;
|
int sockfd = SOCKET_INVALID;
|
||||||
|
int sock = SOCKET_INVALID;
|
||||||
|
int ret;
|
||||||
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
||||||
char recvline[MAXLINE]; /* string received from the server */
|
char recvline[MAXLINE]; /* string received from the server */
|
||||||
WOLFSSL* ssl;
|
WOLFSSL* ssl = NULL;
|
||||||
WOLFSSL* sslResume = 0;
|
WOLFSSL* sslResume = NULL;
|
||||||
WOLFSSL_SESSION* session = 0;
|
WOLFSSL_SESSION* session = NULL;
|
||||||
WOLFSSL_CTX* ctx;
|
WOLFSSL_CTX* ctx = NULL;
|
||||||
struct sockaddr_in servaddr;;
|
struct sockaddr_in servaddr;;
|
||||||
|
|
||||||
/* must include an ip address of this will flag */
|
/* must include an ip address of this will flag */
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: tcpClient <IPaddress>\n");
|
printf("Usage: tcpClient <IPaddress>\n");
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a stream socket using tcp,internet protocal IPv4,
|
/* create a stream socket using tcp,internet protocal IPv4,
|
||||||
|
@ -91,13 +93,13 @@ int main(int argc, char **argv){
|
||||||
/* converts IPv4 addresses from text to binary form */
|
/* converts IPv4 addresses from text to binary form */
|
||||||
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
||||||
if (ret != 1){
|
if (ret != 1){
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attempts to make a connection on a socket */
|
/* attempts to make a connection on a socket */
|
||||||
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||||
if (ret != 0 ){
|
if (ret != 0 ){
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
wolfSSL_Init(); /* initialize wolfSSL */
|
wolfSSL_Init(); /* initialize wolfSSL */
|
||||||
|
@ -105,7 +107,7 @@ int main(int argc, char **argv){
|
||||||
/* create and initialize WOLFSSL_CTX structure */
|
/* create and initialize WOLFSSL_CTX structure */
|
||||||
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up pre shared keys */
|
/* set up pre shared keys */
|
||||||
|
@ -114,7 +116,7 @@ int main(int argc, char **argv){
|
||||||
/* create wolfSSL object after each tcp connect */
|
/* create wolfSSL object after each tcp connect */
|
||||||
if ( (ssl = wolfSSL_new(ctx)) == NULL) {
|
if ( (ssl = wolfSSL_new(ctx)) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_new error.\n");
|
fprintf(stderr, "wolfSSL_new error.\n");
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* associate the file descriptor with the session */
|
/* associate the file descriptor with the session */
|
||||||
|
@ -123,13 +125,13 @@ int main(int argc, char **argv){
|
||||||
/* takes inputting string and outputs it to the server */
|
/* takes inputting string and outputs it to the server */
|
||||||
if (wolfSSL_write(ssl, sendline, sizeof(sendline)) != sizeof(sendline)) {
|
if (wolfSSL_write(ssl, sendline, sizeof(sendline)) != sizeof(sendline)) {
|
||||||
printf("Write Error to Server\n");
|
printf("Write Error to Server\n");
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flags if the Server stopped before the client could end */
|
/* flags if the Server stopped before the client could end */
|
||||||
if (wolfSSL_read(ssl, recvline, MAXLINE) < 0 ) {
|
if (wolfSSL_read(ssl, recvline, MAXLINE) < 0 ) {
|
||||||
printf("Client: Server Terminated Prematurely!\n");
|
printf("Client: Server Terminated Prematurely!\n");
|
||||||
return 1;
|
ret = -1; goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show message from the server */
|
/* show message from the server */
|
||||||
|
@ -159,7 +161,7 @@ int main(int argc, char **argv){
|
||||||
ret = connect(sock, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
ret = connect(sock, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||||
|
|
||||||
if (ret != 0){
|
if (ret != 0){
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the session ID to connect to the server */
|
/* set the session ID to connect to the server */
|
||||||
|
@ -169,18 +171,21 @@ int main(int argc, char **argv){
|
||||||
/* check has connect successfully */
|
/* check has connect successfully */
|
||||||
if (wolfSSL_connect(sslResume) != WOLFSSL_SUCCESS) {
|
if (wolfSSL_connect(sslResume) != WOLFSSL_SUCCESS) {
|
||||||
printf("SSL resume failed\n");
|
printf("SSL resume failed\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wolfSSL_write(sslResume, sendline, sizeof(sendline)) != sizeof(sendline)) {
|
if (wolfSSL_write(sslResume, sendline, sizeof(sendline)) != sizeof(sendline)) {
|
||||||
printf("Write Error to Server\n");
|
printf("Write Error to Server\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flags if the Server stopped before the client could end */
|
/* flags if the Server stopped before the client could end */
|
||||||
if (wolfSSL_read(sslResume, recvline, MAXLINE) < 0 ) {
|
if (wolfSSL_read(sslResume, recvline, MAXLINE) < 0 ) {
|
||||||
printf("Client: Server Terminated Prematurely!\n");
|
printf("Client: Server Terminated Prematurely!\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show message from the server */
|
/* show message from the server */
|
||||||
|
@ -194,12 +199,21 @@ int main(int argc, char **argv){
|
||||||
}
|
}
|
||||||
/* shut down wolfSSL */
|
/* shut down wolfSSL */
|
||||||
wolfSSL_shutdown(sslResume);
|
wolfSSL_shutdown(sslResume);
|
||||||
/* shut down socket */
|
|
||||||
close(sock);
|
|
||||||
/* clean up now with wolfSSL_Cleanup() */
|
|
||||||
wolfSSL_free(sslResume);
|
|
||||||
wolfSSL_CTX_free(ctx);
|
|
||||||
wolfSSL_Cleanup();
|
|
||||||
|
|
||||||
return ret;
|
exit:
|
||||||
|
/* Cleanup and return */
|
||||||
|
if (ssl)
|
||||||
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
if (sslResume)
|
||||||
|
wolfSSL_free(sslResume); /* Free the wolfSSL object */
|
||||||
|
if (sockfd != SOCKET_INVALID)
|
||||||
|
close(sockfd); /* Close the socket */
|
||||||
|
if (sock != SOCKET_INVALID)
|
||||||
|
close(sock); /* Close the socket */
|
||||||
|
if (ctx)
|
||||||
|
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||||
|
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||||
|
|
||||||
|
return ret; /* Return reporting a success */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,18 +61,19 @@ static inline unsigned int My_Psk_Client_Cb(WOLFSSL* ssl, const char* hint,
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret, sockfd;
|
int ret;
|
||||||
|
int sockfd = SOCKET_INVALID;
|
||||||
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
char sendline[MAXLINE]="Hello Server"; /* string to send to the server */
|
||||||
char recvline[MAXLINE]; /* string received from the server */
|
char recvline[MAXLINE]; /* string received from the server */
|
||||||
struct sockaddr_in servaddr;;
|
struct sockaddr_in servaddr;;
|
||||||
|
|
||||||
WOLFSSL* ssl;
|
WOLFSSL* ssl = NULL;
|
||||||
WOLFSSL_CTX* ctx;
|
WOLFSSL_CTX* ctx = NULL;
|
||||||
|
|
||||||
/* must include an ip address of this will flag */
|
/* must include an ip address of this will flag */
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: tcpClient <IPaddress>\n");
|
printf("Usage: tcpClient <IPaddress>\n");
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a stream socket using tcp,internet protocal IPv4,
|
/* create a stream socket using tcp,internet protocal IPv4,
|
||||||
|
@ -89,14 +90,16 @@ int main(int argc, char **argv)
|
||||||
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
ret = inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
printf("inet_pton error\n");
|
printf("inet_pton error\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attempts to make a connection on a socket */
|
/* attempts to make a connection on a socket */
|
||||||
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
ret = connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("Connection Error\n");
|
printf("Connection Error\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +108,8 @@ int main(int argc, char **argv)
|
||||||
/* create and initialize WOLFSSL_CTX structure */
|
/* create and initialize WOLFSSL_CTX structure */
|
||||||
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up pre shared keys */
|
/* set up pre shared keys */
|
||||||
|
@ -114,38 +118,44 @@ int main(int argc, char **argv)
|
||||||
/* creat wolfssl object after each tcp connect */
|
/* creat wolfssl object after each tcp connect */
|
||||||
if ( (ssl = wolfSSL_new(ctx)) == NULL) {
|
if ( (ssl = wolfSSL_new(ctx)) == NULL) {
|
||||||
fprintf(stderr, "wolfSSL_new error.\n");
|
fprintf(stderr, "wolfSSL_new error.\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* associate the file descriptor with the session */
|
/* associate the file descriptor with the session */
|
||||||
ret = wolfSSL_set_fd(ssl, sockfd);
|
ret = wolfSSL_set_fd(ssl, sockfd);
|
||||||
if (ret != WOLFSSL_SUCCESS) {
|
if (ret != WOLFSSL_SUCCESS) {
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write string to the server */
|
/* write string to the server */
|
||||||
if (wolfSSL_write(ssl, sendline, MAXLINE) != sizeof(sendline)) {
|
if (wolfSSL_write(ssl, sendline, MAXLINE) != sizeof(sendline)) {
|
||||||
printf("Write Error to Server\n");
|
printf("Write Error to Server\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if server ended before client could read a response */
|
/* check if server ended before client could read a response */
|
||||||
if (wolfSSL_read(ssl, recvline, MAXLINE) < 0 ) {
|
if (wolfSSL_read(ssl, recvline, MAXLINE) < 0 ) {
|
||||||
printf("Client: Server Terminated Prematurely!\n");
|
printf("Client: Server Terminated Prematurely!\n");
|
||||||
return 1;
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show message from the server */
|
/* show message from the server */
|
||||||
printf("Server Message: %s\n", recvline);
|
printf("Server Message: %s\n", recvline);
|
||||||
|
|
||||||
/* cleanup */
|
ret = 0;
|
||||||
wolfSSL_free(ssl);
|
|
||||||
|
|
||||||
/* when completely done using SSL/TLS, free the
|
exit:
|
||||||
* wolfssl_ctx object */
|
/* Cleanup and return */
|
||||||
wolfSSL_CTX_free(ctx);
|
if (ssl)
|
||||||
wolfSSL_Cleanup();
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
if (sockfd != SOCKET_INVALID)
|
||||||
|
close(sockfd); /* Close the socket */
|
||||||
|
if (ctx)
|
||||||
|
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||||
|
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||||
|
|
||||||
/* exit client */
|
return ret; /* Return reporting a success */
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,5 +94,7 @@ int main(int argc, char **argv)
|
||||||
/* close socket and connection */
|
/* close socket and connection */
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
Configure and install wolfSSL with these options:
|
Configure and install wolfSSL with these options:
|
||||||
|
|
||||||
./configure --disable-shared --disable-asn --disable-filesystem \
|
./configure --disable-asn --disable-filesystem \
|
||||||
--enable-cryptonly --enable-sp=smallrsa2048 --enable-sp-math \
|
--enable-cryptonly --enable-sp=smallrsa2048 --enable-sp-math \
|
||||||
--disable-dh --disable-ecc --disable-sha224 --enable-rsavfy
|
--disable-dh --disable-ecc --disable-sha224 --enable-rsavfy \
|
||||||
|
CFLAGS="-DWOLFSSL_PUBLIC_MP"
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wolfssl/options.h>
|
#include <wolfssl/options.h>
|
||||||
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <wolfssl/wolfcrypt/rsa.h>
|
#include <wolfssl/wolfcrypt/rsa.h>
|
||||||
#include <wolfssl/wolfcrypt/sha256.h>
|
#include <wolfssl/wolfcrypt/sha256.h>
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,8 @@ int main(int argc, char** argv)
|
||||||
/* Print to stdout any data the server sends */
|
/* Print to stdout any data the server sends */
|
||||||
printf("Server: %s\n", buff);
|
printf("Server: %s\n", buff);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (bio)
|
if (bio)
|
||||||
|
|
|
@ -214,6 +214,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
Security(sockfd);
|
Security(sockfd);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (sockfd != SOCKET_INVALID)
|
if (sockfd != SOCKET_INVALID)
|
||||||
|
|
|
@ -271,6 +271,7 @@ int main(int argc, char** argv)
|
||||||
/* Print to stdout any data the server sends */
|
/* Print to stdout any data the server sends */
|
||||||
printf("Server: %s\n", buff);
|
printf("Server: %s\n", buff);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -602,6 +602,8 @@ int main(int argc, char** argv)
|
||||||
/* Print to stdout any data the server sends */
|
/* Print to stdout any data the server sends */
|
||||||
printf("Server: %s\n", buff);
|
printf("Server: %s\n", buff);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
cleanup:
|
cleanup:
|
||||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
|
|
@ -194,6 +194,7 @@ int main(int argc, char** argv)
|
||||||
/* Print to stdout any data the server sends */
|
/* Print to stdout any data the server sends */
|
||||||
printf("Server: %s\n", buff);
|
printf("Server: %s\n", buff);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -250,6 +250,8 @@ int main(int argc, char** argv)
|
||||||
ret == WOLFSSL_ERROR_WANT_WRITE);
|
ret == WOLFSSL_ERROR_WANT_WRITE);
|
||||||
printf("Shutdown complete\n");
|
printf("Shutdown complete\n");
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (ssl)
|
if (ssl)
|
||||||
|
|
|
@ -234,7 +234,11 @@ int main(int argc, char** argv)
|
||||||
/* Get a message for the server from stdin */
|
/* Get a message for the server from stdin */
|
||||||
printf("Message for server: ");
|
printf("Message for server: ");
|
||||||
memset(buff, 0, sizeof(buff));
|
memset(buff, 0, sizeof(buff));
|
||||||
fgets(buff, sizeof(buff), stdin);
|
if (fgets(buff, sizeof(buff), stdin) == NULL) {
|
||||||
|
fprintf(stderr, "ERROR: failed to get message for server\n");
|
||||||
|
ret = -1;
|
||||||
|
goto client_example_end;
|
||||||
|
}
|
||||||
len = strnlen(buff, sizeof(buff));
|
len = strnlen(buff, sizeof(buff));
|
||||||
|
|
||||||
/* Send the message to the server */
|
/* Send the message to the server */
|
||||||
|
@ -254,6 +258,8 @@ int main(int argc, char** argv)
|
||||||
/* Print to stdout any data the server sends */
|
/* Print to stdout any data the server sends */
|
||||||
printf("Server: %s\n", buff);
|
printf("Server: %s\n", buff);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
client_example_end:
|
client_example_end:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
|
|
@ -275,8 +275,10 @@ exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (ssl)
|
if (ssl)
|
||||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||||
|
#ifdef OPENSSL_EXTRA
|
||||||
if (session)
|
if (session)
|
||||||
wolfSSL_SESSION_free(session);
|
wolfSSL_SESSION_free(session);
|
||||||
|
#endif
|
||||||
if (sockfd != SOCKET_INVALID)
|
if (sockfd != SOCKET_INVALID)
|
||||||
close(sockfd); /* Close the socket */
|
close(sockfd); /* Close the socket */
|
||||||
if (ctx)
|
if (ctx)
|
||||||
|
|
|
@ -212,6 +212,7 @@ int main(int argc, char** argv)
|
||||||
pthread_join(write_thread, NULL);
|
pthread_join(write_thread, NULL);
|
||||||
pthread_join(read_thread, NULL);
|
pthread_join(read_thread, NULL);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -167,6 +167,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
printf("Shutdown complete\n");
|
printf("Shutdown complete\n");
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
|
@ -306,6 +306,8 @@ int main()
|
||||||
close(connd); /* Close the connection to the client */
|
close(connd); /* Close the connection to the client */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (ssl)
|
if (ssl)
|
||||||
|
|
|
@ -206,6 +206,7 @@ int main()
|
||||||
close(connd); /* Close the connection to the client */
|
close(connd); /* Close the connection to the client */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -288,6 +288,8 @@ int main()
|
||||||
|
|
||||||
printf("Shutdown complete\n");
|
printf("Shutdown complete\n");
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (ssl)
|
if (ssl)
|
||||||
|
|
|
@ -300,6 +300,7 @@ int main()
|
||||||
|
|
||||||
printf("Shutdown complete\n");
|
printf("Shutdown complete\n");
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -313,6 +313,7 @@ int main()
|
||||||
|
|
||||||
printf("Shutdown complete\n");
|
printf("Shutdown complete\n");
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
|
|
|
@ -200,6 +200,8 @@ int main()
|
||||||
close(connd); /* Close the connection to the client */
|
close(connd); /* Close the connection to the client */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (ssl)
|
if (ssl)
|
||||||
|
|
Loading…
Reference in New Issue