Skip to content

Commit 9379a8a

Browse files
committed
added standard license headers, switched to C-style comments
1 parent c820906 commit 9379a8a

8 files changed

Lines changed: 188 additions & 48 deletions

File tree

IDE/apple-universal/build-wolfssl-framework.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
#!/bin/bash
2+
3+
# build-wolfssl-framework.sh
4+
#
5+
# Copyright (C) 2006-2023 wolfSSL Inc.
6+
#
7+
# This file is part of wolfSSL.
8+
#
9+
# wolfSSL is free software; you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation; either version 2 of the License, or
12+
# (at your option) any later version.
13+
#
14+
# wolfSSL is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with this program; if not, write to the Free Software
21+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
22+
23+
224
set -euxo pipefail
325

426
WOLFSSL_DIR=$(pwd)/../../

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/ContentView.swift

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
//
2-
// ContentView.swift
3-
// wolfssl-multiplatform
4-
//
5-
// Created by Brett Nicholas on 7/11/23.
6-
//
1+
/* ContentView.swift
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
721

822
import SwiftUI
923

1024
struct ContentView: View {
1125

12-
// Call our test function in the initialization of the view
26+
/* Call our test function in the initialization of the view */
1327
init() {
1428
wolfssl_test();
1529
}

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.c

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1+
/* simple_client_example.c
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
122
#include "simple_client_example.h"
223

324
#include <stdio.h>
425
#include <stdlib.h>
526
#include <string.h>
627
#include <sys/socket.h>
728
#include <netdb.h>
29+
30+
#ifndef WOLFSSL_USER_SETTINGS
831
#include <wolfssl/options.h>
32+
#endif
933
#include <wolfssl/ssl.h>
1034

1135
#define SERVER_HOST "www.wolfssl.com"
@@ -17,7 +41,7 @@ int simple_client_example(void)
1741
WOLFSSL* ssl;
1842
int sockfd, ret;
1943

20-
// Resolve the server address
44+
/* Resolve the server address */
2145
struct addrinfo hints, *server_addr;
2246
memset(&hints, 0, sizeof(hints));
2347
hints.ai_family = AF_UNSPEC;
@@ -29,15 +53,15 @@ int simple_client_example(void)
2953
return 1;
3054
}
3155

32-
// Create a TCP socket
56+
/* Create a TCP socket */
3357
sockfd = socket(server_addr->ai_family, server_addr->ai_socktype, server_addr->ai_protocol);
3458
if (sockfd == -1) {
3559
perror("Failed to create socket");
3660
freeaddrinfo(server_addr);
3761
return 1;
3862
}
3963

40-
// Connect to the server
64+
/* Connect to the server */
4165
ret = connect(sockfd, server_addr->ai_addr, server_addr->ai_addrlen);
4266
if (ret == -1) {
4367
perror("Failed to connect to server");
@@ -48,29 +72,29 @@ int simple_client_example(void)
4872

4973
freeaddrinfo(server_addr);
5074

51-
// Initialize wolfSSL library
75+
/* Initialize wolfSSL library */
5276
wolfSSL_Init();
5377

54-
// Create a new SSL context
78+
/* Create a new SSL context */
5579
ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
5680
if (ctx == NULL) {
5781
printf("Unable to create SSL context.\n");
5882
close(sockfd);
5983
return 1;
6084
}
6185

62-
// Load CA certificate into WOLFSSL_CTX
63-
// NOTE: CERT_PATH macro is set relative to Xcode $(PROJECT_DIR) environment variable
64-
// in the preprocessor macros section of the project build settings to avoid hardcoding
65-
// a path in the source code. The CA cert is located at wolfssl/certs/wolfssl-website-ca.pem.
86+
/* Load CA certificate into WOLFSSL_CTX
87+
* NOTE: CERT_PATH macro is set relative to Xcode $(PROJECT_DIR) environment variable
88+
* in the preprocessor macros section of the project build settings to avoid hardcoding
89+
* a path in the source code. The CA cert is located at wolfssl/certs/wolfssl-website-ca.pem. */
6690
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, CERT_PATH, NULL)) != WOLFSSL_SUCCESS) {
6791
printf("ERROR: failed to load %s, please check the file.\n", CERT_PATH);
6892
wolfSSL_CTX_free(ctx);
6993
close(sockfd);
7094
return 1;
7195
}
7296

73-
// Create a new SSL object
97+
/* Create a new SSL object */
7498
ssl = wolfSSL_new(ctx);
7599
if (ssl == NULL) {
76100
printf("Unable to create SSL object.\n");
@@ -79,10 +103,10 @@ int simple_client_example(void)
79103
return 1;
80104
}
81105

82-
// Attach the SSL object to the socket file descriptor
106+
/* Attach the SSL object to the socket file descriptor */
83107
wolfSSL_set_fd(ssl, sockfd);
84108

85-
// Perform the SSL handshake
109+
/* Perform the SSL handshake */
86110
ret = wolfSSL_connect(ssl);
87111
if (ret != SSL_SUCCESS) {
88112
printf("SSL connection failed: %d\n", wolfSSL_get_error(ssl, ret));
@@ -92,14 +116,14 @@ int simple_client_example(void)
92116
return 1;
93117
}
94118

95-
// Send an HTTP request
119+
/* Send an HTTP request */
96120
const char* request = "GET / HTTP/1.1\r\nHost: www.wolfssl.com\r\n\r\n";
97121
ret = wolfSSL_write(ssl, request, (int)strlen(request));
98122
if (ret < 0) {
99123
printf("Failed to send HTTP request.\n");
100124
}
101125

102-
// Receive and print the server's response
126+
/* Receive and print the server's response */
103127
char buffer[1024];
104128
ret = wolfSSL_read(ssl, buffer, sizeof(buffer) - 1);
105129
if (ret > 0) {
@@ -109,7 +133,7 @@ int simple_client_example(void)
109133
printf("Failed to receive server response.\n");
110134
}
111135

112-
// Clean up and close the connection
136+
/* Clean up and close the connection */
113137
wolfSSL_shutdown(ssl);
114138
wolfSSL_free(ssl);
115139
wolfSSL_CTX_free(ctx);

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
//
2-
// simple_client_example.h
3-
// wolfssl-multiplatform
4-
//
5-
//
1+
/* simple_client_example.h
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
621

722
#ifndef simple_client_example_h
823
#define simple_client_example_h
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
//
2-
// Use this file to import your target's public headers that you would like to expose to Swift.
3-
//
1+
/* wolfssl-multiplatform-Bridging-Header.h
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
22+
/*
23+
* Use this file to import your target's public headers that you would like to expose to Swift.
24+
*/
425
#import "wolfssl_test_driver.h"

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_multiplatformApp.swift

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
//
2-
// wolfssl_multiplatformApp.swift
3-
// wolfssl-multiplatform
4-
//
5-
// Created by Brett Nicholas on 7/11/23.
6-
//
1+
/* wolfssl_multiplatformApp.swift
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
721

822
import SwiftUI
923

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
//
2-
// wolfssl_test.c
3-
// wolfssl-multiplatform
4-
//
5-
// Created by Brett Nicholas on 7/11/23.
6-
//
1+
/* wolfssl_test_driver.c
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
721

822
#include "wolfssl_test_driver.h"
923

24+
#ifndef WOLFSSL_USER_SETTINGS
1025
#include <wolfssl/options.h>
26+
#endif
1127
#include <wolfssl/ssl.h>
1228

1329
#include "test.h"

IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.h

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
//
2-
// wolfssl_test.h
3-
// wolfssl-multiplatform
4-
//
5-
// Created by Brett Nicholas on 7/11/23.
6-
//
1+
/* wolfssl_test_driver.h
2+
*
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
721

822
#ifndef wolfssl_test_driver_h
923
#define wolfssl_test_driver_h

0 commit comments

Comments
 (0)