Peer review cleanups 2.

pull/413/head
David Garske 2024-01-10 17:26:55 -08:00
parent f808600853
commit ab0d633d5b
2 changed files with 12 additions and 13 deletions

View File

@ -178,7 +178,9 @@ int main(int argc, char** argv)
wolfSSL_CTX_SetDevId(ctx, devId); wolfSSL_CTX_SetDevId(ctx, devId);
#if 0 #if 0
/* Example: "TLS13-AES256-GCM-SHA384", "TLS13-AES128-GCM-SHA256" or "TLS13-CHACHA20-POLY1305-SHA256" */ /* Examples: "TLS13-AES256-GCM-SHA384",
* "TLS13-AES128-GCM-SHA256" or
* "TLS13-CHACHA20-POLY1305-SHA256" */
wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384"); wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384");
#endif #endif
@ -243,11 +245,9 @@ int main(int argc, char** argv)
exit: exit:
/* Cleanup and return */ /* Cleanup and return */
wolfSSL_free(ssl); /* Free the wolfSSL object */
if (sockfd != SOCKET_INVALID) if (sockfd != SOCKET_INVALID)
close(sockfd); /* Close the connection to the server */ close(sockfd); /* Close the connection to the server */
if (ssl != NULL)
wolfSSL_free(ssl); /* Free the wolfSSL object */
if (ctx != NULL)
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */ wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */ wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */

View File

@ -142,7 +142,9 @@ int main(int argc, char** argv)
WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
#if 0 #if 0
/* Example: "TLS13-AES256-GCM-SHA384", "TLS13-AES128-GCM-SHA256" or "TLS13-CHACHA20-POLY1305-SHA256" */ /* Examples: "TLS13-AES256-GCM-SHA384",
* "TLS13-AES128-GCM-SHA256" or
* "TLS13-CHACHA20-POLY1305-SHA256" */
wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384"); wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384");
#endif #endif
@ -238,7 +240,6 @@ int main(int argc, char** argv)
} }
/* Write our reply into buff */ /* Write our reply into buff */
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
memcpy(buff, reply, strlen(reply)); memcpy(buff, reply, strlen(reply));
@ -264,13 +265,11 @@ int main(int argc, char** argv)
exit: exit:
/* Cleanup and return */ /* Cleanup and return */
if (ssl)
wolfSSL_free(ssl); /* Free the wolfSSL object */ wolfSSL_free(ssl); /* Free the wolfSSL object */
if (connd != SOCKET_INVALID) if (connd != SOCKET_INVALID)
close(connd); /* Close the connection to the client */ close(connd); /* Close the connection to the client */
if (sockfd != SOCKET_INVALID) if (sockfd != SOCKET_INVALID)
close(sockfd); /* Close the socket listening for clients */ close(sockfd); /* Close the socket listening for clients */
if (ctx)
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */ wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */ wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
#else #else