Skip to content

Commit fefad7d

Browse files
committed
Apply copilot suggestions
1 parent adef0a2 commit fefad7d

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

tls/client-tls13-certauth-c2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int Tls13SecretCallback(WOLFSSL* ssl, int id, const unsigned char* secret
121121
int main(int argc, char** argv)
122122
{
123123
int ret = 0;
124-
#ifdef WOLFSSL_TLS13
124+
#if defined(WOLFSSL_TLS13)
125125
int sockfd = SOCKET_INVALID;
126126
struct sockaddr_in servAddr;
127127
char buff[256];

tls/server-tls13-certauth-c2s.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ static int cert_setup_callback(WOLFSSL *ssl, void *_arg) {
196196
if (wolfSSL_use_certificate_file(ssl, certFileName, SSL_FILETYPE_PEM) !=
197197
WOLFSSL_SUCCESS) {
198198
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
199-
CERT_FILE);
199+
certFileName);
200200
return 0;
201201
}
202202
if (wolfSSL_use_PrivateKey_file(ssl, keyFileName, SSL_FILETYPE_PEM) !=
203203
WOLFSSL_SUCCESS) {
204204
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
205-
KEY_FILE);
205+
keyFileName);
206206
return 0;
207207
}
208208
return 1;
@@ -296,22 +296,6 @@ int main(int argc, char** argv)
296296
*/
297297
wolfSSL_CTX_set_cert_cb(ctx, cert_setup_callback, NULL);
298298

299-
/* Load server certificates into WOLFSSL_CTX */
300-
if ((ret = wolfSSL_CTX_use_certificate_file(ctx, CERT_FILE,
301-
WOLFSSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
302-
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
303-
CERT_FILE);
304-
goto exit;
305-
}
306-
307-
/* Load server key into WOLFSSL_CTX */
308-
if ((ret = wolfSSL_CTX_use_PrivateKey_file(ctx, KEY_FILE,
309-
WOLFSSL_FILETYPE_PEM)) != WOLFSSL_SUCCESS) {
310-
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
311-
KEY_FILE);
312-
goto exit;
313-
}
314-
315299
/* Load client certificate as "trusted" into WOLFSSL_CTX */
316300
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, CA_FILE, NULL))
317301
!= WOLFSSL_SUCCESS) {

0 commit comments

Comments
 (0)