Skip to content

Commit 21b7c8e

Browse files
author
Andras Fekete
committed
Addressing PR comment
1 parent 077ac68 commit 21b7c8e

13 files changed

Lines changed: 39 additions & 26 deletions

tls/client-tls-bio.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ int main(int argc, char** argv)
8080

8181
/* Create and initialize WOLFSSL_CTX */
8282
#ifdef USE_TLSV13
83-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
83+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
8484
#else
85-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
85+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
8686
#endif
87+
if (ctx == NULL) {
8788
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
8889
ret = -1;
8990
goto exit;

tls/client-tls-cacb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ int Security(int sock)
133133

134134
/* create and initialize WOLFSSL_CTX structure */
135135
#ifdef USE_TLSV13
136-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
136+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
137137
#else
138-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
138+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
139139
#endif
140+
if (ctx == NULL) {
140141
printf("SSL_CTX_new error.\n");
141142
ret = EXIT_FAILURE;
142143
goto exit;

tls/client-tls-callback.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,11 @@ int main(int argc, char** argv)
180180

181181
/* Create and initialize WOLFSSL_CTX */
182182
#ifdef USE_TLSV13
183-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
183+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
184184
#else
185-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
185+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
186186
#endif
187+
if (ctx == NULL) {
187188
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
188189
ret = -1;
189190
goto exit;

tls/client-tls-cryptocb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ int main(int argc, char** argv)
138138

139139
/* Create and initialize WOLFSSL_CTX */
140140
#ifdef USE_TLSV13
141-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
141+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
142142
#else
143-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
143+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
144144
#endif
145+
if (ctx == NULL) {
145146
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
146147
ret = -1;
147148
goto exit;

tls/client-tls-ecdhe.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ int main(int argc, char** argv)
8484

8585
/* Create and initialize WOLFSSL_CTX */
8686
#ifdef USE_TLSV13
87-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
87+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
8888
#else
89-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
89+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
9090
#endif
91+
if (ctx == NULL) {
9192
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
9293
ret = -1;
9394
goto exit;

tls/client-tls-nonblocking.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ int main(int argc, char** argv)
132132

133133
/* Create and initialize WOLFSSL_CTX */
134134
#ifdef USE_TLSV13
135-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
135+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
136136
#else
137-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
137+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
138138
#endif
139+
if (ctx == NULL) {
139140
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
140141
ret = -1;
141142
goto exit;

tls/client-tls-pkcs12.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ int main(int argc, char** argv)
134134

135135
/* Create and initialize WOLFSSL_CTX */
136136
#ifdef USE_TLSV13
137-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
137+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
138138
#else
139-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
139+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
140140
#endif
141+
if (ctx == NULL) {
141142
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
142143
return -1;
143144
}

tls/client-tls.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ int main(int argc, char** argv)
101101

102102
/* Create and initialize WOLFSSL_CTX */
103103
#ifdef USE_TLSV13
104-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method())) == NULL) {
104+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
105105
#else
106-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
106+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
107107
#endif
108+
if (ctx == NULL) {
108109
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
109110
ret = -1;
110111
goto socket_cleanup;

tls/server-tls-callback.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ int main()
178178

179179
/* Create and initialize WOLFSSL_CTX */
180180
#ifdef USE_TLSV13
181-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_server_method())) == NULL) {
181+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_server_method());
182182
#else
183-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method())) == NULL) {
183+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method());
184184
#endif
185+
if (ctx == NULL) {
185186
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
186187
ret = -1;
187188
goto exit;

tls/server-tls-ecdhe.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ int main()
8080

8181
/* Create and initialize WOLFSSL_CTX */
8282
#ifdef USE_TLSV13
83-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_3_server_method())) == NULL) {
83+
ctx = wolfSSL_CTX_new(wolfTLSv1_3_server_method());
8484
#else
85-
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method())) == NULL) {
85+
ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method());
8686
#endif
87+
if (ctx == NULL) {
8788
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
8889
ret = -1;
8990
goto exit;

0 commit comments

Comments
 (0)