Skip to content

Commit ab0d633

Browse files
committed
Peer review cleanups 2.
1 parent f808600 commit ab0d633

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

tls/client-tls-cryptocb.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ int main(int argc, char** argv)
178178
wolfSSL_CTX_SetDevId(ctx, devId);
179179

180180
#if 0
181-
/* Example: "TLS13-AES256-GCM-SHA384", "TLS13-AES128-GCM-SHA256" or "TLS13-CHACHA20-POLY1305-SHA256" */
181+
/* Examples: "TLS13-AES256-GCM-SHA384",
182+
* "TLS13-AES128-GCM-SHA256" or
183+
* "TLS13-CHACHA20-POLY1305-SHA256" */
182184
wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384");
183185
#endif
184186

@@ -243,12 +245,10 @@ int main(int argc, char** argv)
243245

244246
exit:
245247
/* Cleanup and return */
248+
wolfSSL_free(ssl); /* Free the wolfSSL object */
246249
if (sockfd != SOCKET_INVALID)
247-
close(sockfd); /* Close the connection to the server */
248-
if (ssl != NULL)
249-
wolfSSL_free(ssl); /* Free the wolfSSL object */
250-
if (ctx != NULL)
251-
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
250+
close(sockfd); /* Close the connection to the server */
251+
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
252252
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
253253

254254
#else

tls/server-tls-cryptocb.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ int main(int argc, char** argv)
142142
WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
143143

144144
#if 0
145-
/* Example: "TLS13-AES256-GCM-SHA384", "TLS13-AES128-GCM-SHA256" or "TLS13-CHACHA20-POLY1305-SHA256" */
145+
/* Examples: "TLS13-AES256-GCM-SHA384",
146+
* "TLS13-AES128-GCM-SHA256" or
147+
* "TLS13-CHACHA20-POLY1305-SHA256" */
146148
wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384");
147149
#endif
148150

@@ -238,7 +240,6 @@ int main(int argc, char** argv)
238240
}
239241

240242

241-
242243
/* Write our reply into buff */
243244
memset(buff, 0, sizeof(buff));
244245
memcpy(buff, reply, strlen(reply));
@@ -264,14 +265,12 @@ int main(int argc, char** argv)
264265

265266
exit:
266267
/* Cleanup and return */
267-
if (ssl)
268-
wolfSSL_free(ssl); /* Free the wolfSSL object */
268+
wolfSSL_free(ssl); /* Free the wolfSSL object */
269269
if (connd != SOCKET_INVALID)
270-
close(connd); /* Close the connection to the client */
270+
close(connd); /* Close the connection to the client */
271271
if (sockfd != SOCKET_INVALID)
272272
close(sockfd); /* Close the socket listening for clients */
273-
if (ctx)
274-
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
273+
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
275274
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
276275
#else
277276
printf("Please configure wolfSSL with --enable-cryptocb and try again\n");

0 commit comments

Comments
 (0)