Visual Studio Solution for Azure Sphere Devices

This commit is contained in:
Aaron Jense 2019-09-09 10:41:57 -06:00
parent c52801754c
commit 88036db223
17 changed files with 1197 additions and 1 deletions

View File

@ -0,0 +1,139 @@
wolfSSL for Microsoft Azure Sphere Devices
==========================================
## Description
This directory contains the Visual Studio projects targeted for Azure Sphere.
The example projects include a client, server and wolfCrypt Library Test.
Each of these projects relies on the wolfSSL static library project.
Each project uses `user_settings.h` for to enable and disable features.
### Set Up Steps
0. Open the wolfssl Microsoft Visual Studio Solution
1. Build All the Projects
+ Right Click: `Solution 'wolfssl' (4 of 4 projects)`
+ Click: `Build Solution`
2. Connect your Azure Sphere MT3620 Development Board using USB.
3. Run the wolfCrypt Library Test
+ Right Click: `wolfcrypt_test (Azure Sphere)`
+ Click: `Debug->'Start new instance'.`
4. Wait for the wolfCrypt Library Test to finish.
5. Test the client.
+ Run client(Azure Sphere) using: `Debug->'Start new instance'`
It's OK if the HTTP GET request returns an error.
The TLS connection was successful.
6. Test the server.
+ Run server(Azure Sphere) using: `Debug->'Start new instance'`
+ Run the following wolfSSL example client command inside wolfssl directory.
```
./examples/client/client -h "Server IP Address" -p 11111 -A ./certs/ca-cert.pem
```
### Client
The client project has defines in `user_settings.h` for:
`SERVER_IP`, `CERT`, `SIZEOF_CERT`, `DEFAULT_PORT` and `msg`.
These are set by default to connect to `www.wolfssl.com`.
If `CUSTOM_SERVER_CONNECTION` is defined then the client would be ready to connect
to a example server at an IP address of `192.168.1.200`.
The example server could be started with the following command:
```
./examples/server/server -b -d -p 11111 -c ./certs/server-cert.pem -k ./certs/server-key.pem
```
Server Options Explanation:
` -b Bind to any interface instead of localhost only`
` -c <file> Certificate file, default ./certs/server-cert.pem`
` -d Disable client cert check`
` -k <file> Key file, default ./certs/server-key.pem`
` -p <num> Port to listen on, not 0, default 11111`
` -? <num> Help, print this usage`
This command assumes that you're in the base directory of 'wolfssl' and it has
been configured and compiled on a computer with an IP address of `192.168.1.200`.
Change `SERVER_IP` under `CUSTOM_SERVER_CONNECTION` in `user_settings.h`
accordingly.
If you would like to connect to a website on the internet other then
`www.wolfssl.com` then you would need to put it's corresponding CA certificate
in `client.h` similarly to `wolfssl_website_root_ca`.
The `CERT` and `SIZEOF_CERT` array could be created using the `dertoc.pl`
script under `wolfssl/scripts/dertoc.pl`.
Usage Example:
```
./scripts/dertoc.pl ./certs/server-cert.der server_cert_der_2048 dertoc.c
```
You would then copy the generated output from `dertoc.c` into `client.h` and set
CERT and `SIZEOF_CERT` accordingly inside `user_settings.h`.
The IP address of the server to connect to also needs to be added to the client's
`app_manifest.json` under 'AllowedConnections'. There are IP addresses in the
default `app_manifest.json` for testing purposes and can be removed if not needed.
### Server
The Server application will wait for any incoming client connections once built
and uploaded to the MT3620 Development board.
The following wolfSSL example client can connect to a server on the MT3620 board:
```
./examples/client/client -h "Server IP Address" -p 11111 -A ./certs/ca-cert.pem
```
Client Options Explanation:
` -A <file> Certificate Authority file, default ./certs/ca-cert.pem`
` -h <host> Host to connect to, default 127.0.0.1`
` -p <num> Port to listen on, not 0, default 11111`
` -? <num> Help, print this usage`
### wolfCrypt Test
This tests the wolfCrypt Library.
This is a good test to run if you change the options in `user_settings.h`.
### Troubleshooting
* Ensure your Azure Sphere MT3620 Development Board was set up using the
instructions using the Azure Sphere Documentation (See Link Below).
This includes claiming your device, updating device, setting up networking,
and prepping for debug.
* The commands for the example client/server assumes it is being run from the
base directory of wolfssl.
[Azure Sphere Documentation](https://docs.microsoft.com/en-us/azure-sphere/)
[Support Forum](https://www.wolfssl.com/forums/)
[Support Email](support@wolfssl.com)
### Resources
[wolfSSL Website](https://www.wolfssl.com/)
[wolfSSL Wiki](https://github.com/wolfSSL/wolfssl/wiki)
[wolfSSL Manual](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-toc.html)
[wolfSSL API Reference]
(https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-wolfssl-api-reference.html)
[wolfCrypt API Reference]
(https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-18-wolfcrypt-api-reference.html)
[TLS 1.3](https://www.wolfssl.com/docs/tls13/)

View File

@ -0,0 +1,17 @@
{
"SchemaVersion": 1,
"Name": "wolfSSL_Client",
"ComponentId": "00000000-0000-0000-0000-000000000002",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
"AllowedConnections": [
"151.101.26.217",
"192.168.1.128",
"192.168.1.150",
"192.168.1.200",
"192.168.1.225"
]
},
"ApplicationType": "Default"
}

View File

@ -0,0 +1,146 @@
/* client.c
*
* Copyright (C) 2006-2019 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "client.h"
/* the usual suspects */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* socket includes */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* wolfSSL */
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfssl/certs_test.h>
/* Azure Sphere */
#include <applibs/log.h>
#include <applibs/networking.h>
int main(int argc, char** argv)
{
bool isNetworkingReady = false;
int sockfd;
struct sockaddr_in servAddr;
char buff[256];
size_t len;
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
WOLFSSL* ssl;
/* Check if the Azure Sphere Dev Board has network connectivity. */
if ((Networking_IsNetworkingReady(&isNetworkingReady) < 0) || !isNetworkingReady) {
fprintf(stderr, "ERROR: network is not up.\n");
return -1;
}
/* Initialize wolfSSL */
wolfSSL_Init();
/* Create a socket that uses an internet IPv4 address,
* Sets the socket to be stream based (TCP),
* 0 means choose the default protocol. */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "ERROR: failed to create the socket\n");
return -1;
}
/* Create and initialize WOLFSSL_CTX */
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
return -1;
}
/* Load client certificates into WOLFSSL_CTX */
if (wolfSSL_CTX_load_verify_buffer(ctx, CERT, SIZEOF_CERT, WOLFSSL_FILETYPE_ASN1)
!= SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load %s, please check the buffer.\n");
return -1;
}
/* Initialize the server address struct with zeros */
memset(&servAddr, 0, sizeof(servAddr));
/* Fill in the server address */
servAddr.sin_family = AF_INET; /* using IPv4 */
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
/* Get the server IPv4 address from SERVER_IP in user_settings.h */
if (inet_pton(AF_INET, SERVER_IP, &servAddr.sin_addr) != 1) {
fprintf(stderr, "ERROR: invalid address\n");
return -1;
}
/* Connect to the server */
if (connect(sockfd, (struct sockaddr*) & servAddr, sizeof(servAddr))
== -1) {
fprintf(stderr, "ERROR: failed to connect\n");
return -1;
}
/* Create a WOLFSSL object */
if ((ssl = wolfSSL_new(ctx)) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL object\n");
return -1;
}
/* Attach wolfSSL to the socket */
wolfSSL_set_fd(ssl, sockfd);
/* Connect to wolfSSL on the server side */
if (wolfSSL_connect(ssl) != SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
return -1;
}
/* Get length of message for server. */
printf("\nMessage for server: %s\n",msg);
len = strnlen(msg, sizeof(msg));
/* Send the message to the server */
if (wolfSSL_write(ssl, msg, (int)len) != len) {
fprintf(stderr, "ERROR: failed to write\n");
return -1;
}
/* Read the server data into our buff array */
memset(buff, 0, sizeof(buff));
if (wolfSSL_read(ssl, buff, sizeof(buff) - 1) == -1) {
fprintf(stderr, "ERROR: failed to read\n");
return -1;
}
/* Print to stdout any data the server sends */
printf("Server Reply: %s\n", buff);
/* Cleanup and return */
wolfSSL_free(ssl); /* Free the wolfSSL object */
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
close(sockfd); /* Close the connection to the server */
return 0; /* Return reporting a success */
}

View File

@ -0,0 +1,119 @@
/* client.h
*
* Copyright (C) 2006-2019 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_CLIENT_H
#define WOLFSSL_CLIENT_H
static const unsigned char wolfssl_website_root_ca[] =
{
0x30, 0x82, 0x03, 0x75, 0x30, 0x82, 0x02, 0x5D, 0xA0, 0x03,
0x02, 0x01, 0x02, 0x02, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x15, 0x4B, 0x5A, 0xC3, 0x94, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05,
0x00, 0x30, 0x57, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55,
0x04, 0x06, 0x13, 0x02, 0x42, 0x45, 0x31, 0x19, 0x30, 0x17,
0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x10, 0x47, 0x6C, 0x6F,
0x62, 0x61, 0x6C, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x6E, 0x76,
0x2D, 0x73, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55,
0x04, 0x0B, 0x13, 0x07, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43,
0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x12, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x53, 0x69,
0x67, 0x6E, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x41,
0x30, 0x1E, 0x17, 0x0D, 0x39, 0x38, 0x30, 0x39, 0x30, 0x31,
0x31, 0x32, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32,
0x38, 0x30, 0x31, 0x32, 0x38, 0x31, 0x32, 0x30, 0x30, 0x30,
0x30, 0x5A, 0x30, 0x57, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
0x55, 0x04, 0x06, 0x13, 0x02, 0x42, 0x45, 0x31, 0x19, 0x30,
0x17, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x10, 0x47, 0x6C,
0x6F, 0x62, 0x61, 0x6C, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x6E,
0x76, 0x2D, 0x73, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
0x55, 0x04, 0x0B, 0x13, 0x07, 0x52, 0x6F, 0x6F, 0x74, 0x20,
0x43, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04,
0x03, 0x13, 0x12, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x53,
0x69, 0x67, 0x6E, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43,
0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02,
0x82, 0x01, 0x01, 0x00, 0xDA, 0x0E, 0xE6, 0x99, 0x8D, 0xCE,
0xA3, 0xE3, 0x4F, 0x8A, 0x7E, 0xFB, 0xF1, 0x8B, 0x83, 0x25,
0x6B, 0xEA, 0x48, 0x1F, 0xF1, 0x2A, 0xB0, 0xB9, 0x95, 0x11,
0x04, 0xBD, 0xF0, 0x63, 0xD1, 0xE2, 0x67, 0x66, 0xCF, 0x1C,
0xDD, 0xCF, 0x1B, 0x48, 0x2B, 0xEE, 0x8D, 0x89, 0x8E, 0x9A,
0xAF, 0x29, 0x80, 0x65, 0xAB, 0xE9, 0xC7, 0x2D, 0x12, 0xCB,
0xAB, 0x1C, 0x4C, 0x70, 0x07, 0xA1, 0x3D, 0x0A, 0x30, 0xCD,
0x15, 0x8D, 0x4F, 0xF8, 0xDD, 0xD4, 0x8C, 0x50, 0x15, 0x1C,
0xEF, 0x50, 0xEE, 0xC4, 0x2E, 0xF7, 0xFC, 0xE9, 0x52, 0xF2,
0x91, 0x7D, 0xE0, 0x6D, 0xD5, 0x35, 0x30, 0x8E, 0x5E, 0x43,
0x73, 0xF2, 0x41, 0xE9, 0xD5, 0x6A, 0xE3, 0xB2, 0x89, 0x3A,
0x56, 0x39, 0x38, 0x6F, 0x06, 0x3C, 0x88, 0x69, 0x5B, 0x2A,
0x4D, 0xC5, 0xA7, 0x54, 0xB8, 0x6C, 0x89, 0xCC, 0x9B, 0xF9,
0x3C, 0xCA, 0xE5, 0xFD, 0x89, 0xF5, 0x12, 0x3C, 0x92, 0x78,
0x96, 0xD6, 0xDC, 0x74, 0x6E, 0x93, 0x44, 0x61, 0xD1, 0x8D,
0xC7, 0x46, 0xB2, 0x75, 0x0E, 0x86, 0xE8, 0x19, 0x8A, 0xD5,
0x6D, 0x6C, 0xD5, 0x78, 0x16, 0x95, 0xA2, 0xE9, 0xC8, 0x0A,
0x38, 0xEB, 0xF2, 0x24, 0x13, 0x4F, 0x73, 0x54, 0x93, 0x13,
0x85, 0x3A, 0x1B, 0xBC, 0x1E, 0x34, 0xB5, 0x8B, 0x05, 0x8C,
0xB9, 0x77, 0x8B, 0xB1, 0xDB, 0x1F, 0x20, 0x91, 0xAB, 0x09,
0x53, 0x6E, 0x90, 0xCE, 0x7B, 0x37, 0x74, 0xB9, 0x70, 0x47,
0x91, 0x22, 0x51, 0x63, 0x16, 0x79, 0xAE, 0xB1, 0xAE, 0x41,
0x26, 0x08, 0xC8, 0x19, 0x2B, 0xD1, 0x46, 0xAA, 0x48, 0xD6,
0x64, 0x2A, 0xD7, 0x83, 0x34, 0xFF, 0x2C, 0x2A, 0xC1, 0x6C,
0x19, 0x43, 0x4A, 0x07, 0x85, 0xE7, 0xD3, 0x7C, 0xF6, 0x21,
0x68, 0xEF, 0xEA, 0xF2, 0x52, 0x9F, 0x7F, 0x93, 0x90, 0xCF,
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x42, 0x30, 0x40, 0x30,
0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04,
0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0F, 0x06, 0x03, 0x55,
0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xFF, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04,
0x16, 0x04, 0x14, 0x60, 0x7B, 0x66, 0x1A, 0x45, 0x0D, 0x97,
0xCA, 0x89, 0x50, 0x2F, 0x7D, 0x04, 0xCD, 0x34, 0xA8, 0xFF,
0xFC, 0xFD, 0x4B, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82,
0x01, 0x01, 0x00, 0xD6, 0x73, 0xE7, 0x7C, 0x4F, 0x76, 0xD0,
0x8D, 0xBF, 0xEC, 0xBA, 0xA2, 0xBE, 0x34, 0xC5, 0x28, 0x32,
0xB5, 0x7C, 0xFC, 0x6C, 0x9C, 0x2C, 0x2B, 0xBD, 0x09, 0x9E,
0x53, 0xBF, 0x6B, 0x5E, 0xAA, 0x11, 0x48, 0xB6, 0xE5, 0x08,
0xA3, 0xB3, 0xCA, 0x3D, 0x61, 0x4D, 0xD3, 0x46, 0x09, 0xB3,
0x3E, 0xC3, 0xA0, 0xE3, 0x63, 0x55, 0x1B, 0xF2, 0xBA, 0xEF,
0xAD, 0x39, 0xE1, 0x43, 0xB9, 0x38, 0xA3, 0xE6, 0x2F, 0x8A,
0x26, 0x3B, 0xEF, 0xA0, 0x50, 0x56, 0xF9, 0xC6, 0x0A, 0xFD,
0x38, 0xCD, 0xC4, 0x0B, 0x70, 0x51, 0x94, 0x97, 0x98, 0x04,
0xDF, 0xC3, 0x5F, 0x94, 0xD5, 0x15, 0xC9, 0x14, 0x41, 0x9C,
0xC4, 0x5D, 0x75, 0x64, 0x15, 0x0D, 0xFF, 0x55, 0x30, 0xEC,
0x86, 0x8F, 0xFF, 0x0D, 0xEF, 0x2C, 0xB9, 0x63, 0x46, 0xF6,
0xAA, 0xFC, 0xDF, 0xBC, 0x69, 0xFD, 0x2E, 0x12, 0x48, 0x64,
0x9A, 0xE0, 0x95, 0xF0, 0xA6, 0xEF, 0x29, 0x8F, 0x01, 0xB1,
0x15, 0xB5, 0x0C, 0x1D, 0xA5, 0xFE, 0x69, 0x2C, 0x69, 0x24,
0x78, 0x1E, 0xB3, 0xA7, 0x1C, 0x71, 0x62, 0xEE, 0xCA, 0xC8,
0x97, 0xAC, 0x17, 0x5D, 0x8A, 0xC2, 0xF8, 0x47, 0x86, 0x6E,
0x2A, 0xC4, 0x56, 0x31, 0x95, 0xD0, 0x67, 0x89, 0x85, 0x2B,
0xF9, 0x6C, 0xA6, 0x5D, 0x46, 0x9D, 0x0C, 0xAA, 0x82, 0xE4,
0x99, 0x51, 0xDD, 0x70, 0xB7, 0xDB, 0x56, 0x3D, 0x61, 0xE4,
0x6A, 0xE1, 0x5C, 0xD6, 0xF6, 0xFE, 0x3D, 0xDE, 0x41, 0xCC,
0x07, 0xAE, 0x63, 0x52, 0xBF, 0x53, 0x53, 0xF4, 0x2B, 0xE9,
0xC7, 0xFD, 0xB6, 0xF7, 0x82, 0x5F, 0x85, 0xD2, 0x41, 0x18,
0xDB, 0x81, 0xB3, 0x04, 0x1C, 0xC5, 0x1F, 0xA4, 0x80, 0x6F,
0x15, 0x20, 0xC9, 0xDE, 0x0C, 0x88, 0x0A, 0x1D, 0xD6, 0x66,
0x55, 0xE2, 0xFC, 0x48, 0xC9, 0x29, 0x26, 0x69, 0xE0
};
static const int sizeof_wolfssl_website_root_ca = sizeof(wolfssl_website_root_ca);
#endif /* WOLFSSL_CLIENT_H */

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{fbf6f097-b2bf-49ac-a70b-dba6036a395d}</ProjectGuid>
<Keyword>AzureSphere</Keyword>
<RootNamespace>client</RootNamespace>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<ApplicationType>Linux</ApplicationType>
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
<DebugMachineType>Device</DebugMachineType>
<PlatformToolset>GCC_AzureSphere_1_0</PlatformToolset>
<ProjectPublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</ProjectPublicIncludePath>
<PublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</PublicIncludePath>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<TargetExt>.out</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetExt>.out</TargetExt>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>-Werror=implicit-function-declaration %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
<ShowProgress Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ShowProgress>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">192.168.35.1</Command>
</CustomBuildStep>
<Link>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="client.c" />
<ClInclude Include="client.h" />
</ItemGroup>
<ItemGroup>
<None Include="app_manifest.json" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,18 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/README.md
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/user_settings.h
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/wolfssl.sln
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/wolfssl.vcxproj
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/client/app_manifest.json
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/client/client.c
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/client/client.h
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/client/client.vcxproj
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/server/app_manifest.json
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/server/server.c
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/server/server.h
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/server/server.vcxproj
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/wolfcrypt_test/app_manifest.json
EXTRA_DIST+= IDE/VS-AZURE-SPHERE/wolfcrypt_test/wolfcrypt_test.vcxproj

View File

@ -0,0 +1,11 @@
{
"SchemaVersion": 1,
"Name": "wolfSSL_Server",
"ComponentId": "00000000-0000-0000-0000-000000000001",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
"AllowedTcpServerPorts": [ 11111 ]
},
"ApplicationType": "Default"
}

View File

@ -0,0 +1,194 @@
/* server.c
*
* Copyright (C) 2006-2019 wolfSSL Inc.
*
* This file is part of wolfSSL. (formerly known as CyaSSL)
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "server.h"
/* the usual suspects */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* socket includes */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* wolfSSL */
#include <wolfssl/ssl.h>
#include <wolfssl/certs_test.h>
/* Azure Sphere */
#include <applibs/log.h>
#include <applibs/networking.h>
#define DEFAULT_PORT 11111
#define CERT_BUF server_cert_der_2048
#define SIZEOF_CERT_BUF sizeof_server_cert_der_2048
#define KEY_BUF server_key_der_2048
#define SIZEOF_KEY_BUF sizeof_server_key_der_2048
int main(void)
{
bool isNetworkingReady = false;
int sockfd;
int connd;
struct sockaddr_in servAddr;
struct sockaddr_in clientAddr;
socklen_t size = sizeof(clientAddr);
char buff[256];
size_t len;
int shutdown = 0;
int ret;
const char* reply = "I hear ya fa shizzle!\n";
/* declare wolfSSL objects */
WOLFSSL_CTX* ctx;
WOLFSSL* ssl;
/* Check if the Azure Sphere Dev Board has network connectivity. */
if ((Networking_IsNetworkingReady(&isNetworkingReady) < 0) || !isNetworkingReady) {
Log_Debug("\nNetwork is not up.\n");
return -1;
}
/* Initialize wolfSSL */
wolfSSL_Init();
/* Create a socket that uses an internet IPv4 address,
* Sets the socket to be stream based (TCP),
* 0 means choose the default protocol. */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "ERROR: failed to create the socket\n");
return -1;
}
/* Create and initialize WOLFSSL_CTX */
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method())) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL_CTX\n");
return -1;
}
/* Load server certificates into WOLFSSL_CTX */
if (wolfSSL_CTX_use_certificate_buffer(ctx, CERT_BUF, SIZEOF_CERT_BUF, SSL_FILETYPE_ASN1)
!= SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
CERT_BUF);
return -1;
}
/* Load server key into WOLFSSL_CTX */
if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, KEY_BUF, SIZEOF_KEY_BUF, SSL_FILETYPE_ASN1)
!= SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to load %s, please check the file.\n",
KEY_BUF);
return -1;
}
/* Initialize the server address struct with zeros */
memset(&servAddr, 0, sizeof(servAddr));
/* Fill in the server address */
servAddr.sin_family = AF_INET; /* using IPv4 */
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
servAddr.sin_addr.s_addr = INADDR_ANY; /* from anywhere */
/* Bind the server socket to our port */
if (bind(sockfd, (struct sockaddr*)&servAddr, sizeof(servAddr)) == -1) {
fprintf(stderr, "ERROR: failed to bind\n");
return -1;
}
/* Listen for a new connection, allow 5 pending connections */
if (listen(sockfd, 5) == -1) {
fprintf(stderr, "ERROR: failed to listen\n");
return -1;
}
/* Continue to accept clients until shutdown is issued */
while (!shutdown) {
printf("Waiting for a connection...\n");
/* Accept client connections */
if ((connd = accept(sockfd, (struct sockaddr*)&clientAddr, &size))
== -1) {
fprintf(stderr, "ERROR: failed to accept the connection\n\n");
return -1;
}
/* Create a WOLFSSL object */
if ((ssl = wolfSSL_new(ctx)) == NULL) {
fprintf(stderr, "ERROR: failed to create WOLFSSL object\n");
return -1;
}
/* Attach wolfSSL to the socket */
wolfSSL_set_fd(ssl, connd);
/* Establish TLS connection */
ret = wolfSSL_accept(ssl);
if (ret != SSL_SUCCESS) {
fprintf(stderr, "wolfSSL_accept error = %d\n",
wolfSSL_get_error(ssl, ret));
return -1;
}
printf("Client connected successfully\n");
/* Read the client data into our buff array */
memset(buff, 0, sizeof(buff));
if (wolfSSL_read(ssl, buff, sizeof(buff)-1) == -1) {
fprintf(stderr, "ERROR: failed to read\n");
return -1;
}
/* Print to stdout any data the client sends */
printf("Client: %s\n", buff);
/* Check for server shutdown command */
if (strncmp(buff, "shutdown", 8) == 0) {
printf("Shutdown command issued!\n");
shutdown = 1;
}
/* Write our reply into buff */
memset(buff, 0, sizeof(buff));
memcpy(buff, reply, strlen(reply));
len = strnlen(buff, sizeof(buff));
/* Reply back to the client */
if (wolfSSL_write(ssl, buff, (int)len) != len) {
fprintf(stderr, "ERROR: failed to write\n");
return -1;
}
/* Cleanup after this connection */
wolfSSL_free(ssl); /* Free the wolfSSL object */
close(connd); /* Close the connection to the client */
}
printf("Shutdown complete\n");
/* Cleanup and return */
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
close(sockfd); /* Close the socket listening for clients */
return 0; /* Return reporting a success */
}

View File

@ -0,0 +1,27 @@
/* server.h
*
* Copyright (C) 2006-2019 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_SERVER_H
#define WOLFSSL_SERVER_H
#endif /* WOLFSSL_SERVER_H */

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F005DF72-46F4-4989-BCB4-3ACDA323D569}</ProjectGuid>
<Keyword>AzureSphere</Keyword>
<RootNamespace>client</RootNamespace>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<ApplicationType>Linux</ApplicationType>
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
<DebugMachineType>Device</DebugMachineType>
<PlatformToolset>GCC_AzureSphere_1_0</PlatformToolset>
<ProjectPublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</ProjectPublicIncludePath>
<PublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</PublicIncludePath>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<TargetExt>.out</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.out</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>-Werror=implicit-function-declaration %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
<ShowProgress Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ShowProgress>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">192.168.35.1</Command>
</CustomBuildStep>
<Link>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="server.h" />
</ItemGroup>
<ItemGroup>
<None Include="app_manifest.json" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="server.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,66 @@
#ifndef _USER_SETTINGS_H_
#define _USER_SETTINGS_H_
#define WOLFSSL_AZSPHERE
/* Client connects to the server with these details. */
#ifdef CUSTOM_SERVER_CONNECTION
#ifndef SERVER_IP
#define SERVER_IP "192.168.1.200" /* Local Test Server IP */
#endif
#define CERT ca_cert_der_2048
#define SIZEOF_CERT sizeof_ca_cert_der_2048
#define DEFAULT_PORT 11111
static const char msg[] = "Are you listening wolfSSL Server?";
#else
#ifndef SERVER_IP
#define SERVER_IP "151.101.26.217" /* www.wolfssl.com */
#endif
#define CERT wolfssl_website_root_ca
#define SIZEOF_CERT sizeof_wolfssl_website_root_ca
#define DEFAULT_PORT 443
static const char msg[] = "GET /index.html HTTP/1.1\r\n\r\n";
#endif
/* Math: Normal (!USE_FAST_MATH) */
#define SIZEOF_LONG_LONG 8
#define WC_RSA_BLINDING
#define ECC_TIMING_RESISTANT
/* Enable options */
#define HAVE_CHACHA
#define HAVE_POLY1305
#define HAVE_ECC
#define HAVE_SUPPORTED_CURVES
#define HAVE_TLS_EXTENSIONS
#define HAVE_ONE_TIME_AUTH
#define HAVE_TRUNCATED_HMAC
#define HAVE_EXTENDED_MASTER
#define HAVE_ALPN
#define HAVE_SNI
#define HAVE_OCSP
#define HAVE_AESGCM
/* Disable options */
#define NO_PWDBASED
#define NO_DSA
#define NO_DES3
#define NO_RABBIT
#define NO_RC4
#define NO_MD4
/* Benchmark / Testing */
#define BENCH_EMBEDDED
#define USE_CERT_BUFFERS_2048
#define USE_CERT_BUFFERS_256
/* Redirect printf to Log_Debug */
#define printf Log_Debug
/* OS */
#define SINGLE_THREADED
/* Filesystem */
#define NO_FILESYSTEM
#endif /* _USER_SETTINGS_H_ */

View File

@ -0,0 +1,10 @@
{
"SchemaVersion": 1,
"Name": "wolfCrypt_Test",
"ComponentId": "00000000-0000-0000-0000-000000000003",
"EntryPoint": "/bin/app",
"CmdArgs": [],
"Capabilities": {
},
"ApplicationType": "Default"
}

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CD96C02B-1FC9-424E-88BE-816BE143A1C3}</ProjectGuid>
<Keyword>AzureSphere</Keyword>
<RootNamespace>echoclient</RootNamespace>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<ApplicationType>Linux</ApplicationType>
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
<DebugMachineType>Device</DebugMachineType>
<PlatformToolset>GCC_AzureSphere_1_0</PlatformToolset>
<ProjectPublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</ProjectPublicIncludePath>
<PublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</PublicIncludePath>
<ProjectName>wolfcrypt_test</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<TargetName>$(ProjectName)</TargetName>
<TargetExt>.out</TargetExt>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<IncludePath>$(SysRootIncludePath);$(IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.out</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>-Werror=implicit-function-declaration %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CAdditionalWarning Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">strict-prototypes;%(CAdditionalWarning);deprecated-declarations</CAdditionalWarning>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">TurnOffAllWarnings</WarningLevel>
<Verbose Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</Verbose>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">TurnOffAllWarnings</WarningLevel>
</ClCompile>
<Link>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
<SharedLibrarySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">%(SharedLibrarySearchPath)</SharedLibrarySearchPath>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ShowProgress Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ShowProgress>
</Link>
<Link>
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">applibs;pthread;gcc_s;c;wolfssl</LibraryDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\wolfcrypt\test\test.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\wolfcrypt\test\test.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\certs\ecc-key.der" />
<None Include="app_manifest.json" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -0,0 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29201.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssl", "wolfssl.vcxproj", "{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfcrypt_test", "wolfcrypt_test\wolfcrypt_test.vcxproj", "{CD96C02B-1FC9-424E-88BE-816BE143A1C3}"
ProjectSection(ProjectDependencies) = postProject
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6} = {EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "client\client.vcxproj", "{FBF6F097-B2BF-49AC-A70B-DBA6036A395D}"
ProjectSection(ProjectDependencies) = postProject
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6} = {EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server\server.vcxproj", "{F005DF72-46F4-4989-BCB4-3ACDA323D569}"
ProjectSection(ProjectDependencies) = postProject
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6} = {EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Release|ARM = Release|ARM
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}.Debug|ARM.ActiveCfg = Debug|ARM
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}.Debug|ARM.Build.0 = Debug|ARM
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}.Release|ARM.ActiveCfg = Release|ARM
{EAED6D0C-D9C8-4901-B7D8-F8610AFCEAE6}.Release|ARM.Build.0 = Release|ARM
{CD96C02B-1FC9-424E-88BE-816BE143A1C3}.Debug|ARM.ActiveCfg = Debug|ARM
{CD96C02B-1FC9-424E-88BE-816BE143A1C3}.Debug|ARM.Build.0 = Debug|ARM
{CD96C02B-1FC9-424E-88BE-816BE143A1C3}.Release|ARM.ActiveCfg = Release|ARM
{CD96C02B-1FC9-424E-88BE-816BE143A1C3}.Release|ARM.Build.0 = Release|ARM
{FBF6F097-B2BF-49AC-A70B-DBA6036A395D}.Debug|ARM.ActiveCfg = Debug|ARM
{FBF6F097-B2BF-49AC-A70B-DBA6036A395D}.Debug|ARM.Build.0 = Debug|ARM
{FBF6F097-B2BF-49AC-A70B-DBA6036A395D}.Release|ARM.ActiveCfg = Release|ARM
{FBF6F097-B2BF-49AC-A70B-DBA6036A395D}.Release|ARM.Build.0 = Release|ARM
{F005DF72-46F4-4989-BCB4-3ACDA323D569}.Debug|ARM.ActiveCfg = Debug|ARM
{F005DF72-46F4-4989-BCB4-3ACDA323D569}.Debug|ARM.Build.0 = Debug|ARM
{F005DF72-46F4-4989-BCB4-3ACDA323D569}.Release|ARM.ActiveCfg = Release|ARM
{F005DF72-46F4-4989-BCB4-3ACDA323D569}.Release|ARM.Build.0 = Release|ARM
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {13BC142A-0A4E-42D5-BB84-347B5D44153E}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\bio.c" />
<ClCompile Include="..\..\src\crl.c" />
<ClCompile Include="..\..\src\internal.c" />
<ClCompile Include="..\..\src\keys.c" />
<ClCompile Include="..\..\src\ocsp.c" />
<ClCompile Include="..\..\src\sniffer.c" />
<ClCompile Include="..\..\src\ssl.c" />
<ClCompile Include="..\..\src\tls.c" />
<ClCompile Include="..\..\src\tls13.c" />
<ClCompile Include="..\..\src\wolfio.c" />
<ClCompile Include="..\..\wolfcrypt\src\aes.c" />
<ClCompile Include="..\..\wolfcrypt\src\arc4.c" />
<ClCompile Include="..\..\wolfcrypt\src\asn.c" />
<ClCompile Include="..\..\wolfcrypt\src\blake2b.c" />
<ClCompile Include="..\..\wolfcrypt\src\camellia.c" />
<ClCompile Include="..\..\wolfcrypt\src\chacha.c" />
<ClCompile Include="..\..\wolfcrypt\src\chacha20_poly1305.c" />
<ClCompile Include="..\..\wolfcrypt\src\cmac.c" />
<ClCompile Include="..\..\wolfcrypt\src\coding.c" />
<ClCompile Include="..\..\wolfcrypt\src\curve25519.c" />
<ClCompile Include="..\..\wolfcrypt\src\des3.c" />
<ClCompile Include="..\..\wolfcrypt\src\dh.c" />
<ClCompile Include="..\..\wolfcrypt\src\dsa.c" />
<ClCompile Include="..\..\wolfcrypt\src\ecc.c" />
<ClCompile Include="..\..\wolfcrypt\src\ed25519.c" />
<ClCompile Include="..\..\wolfcrypt\src\error.c" />
<ClCompile Include="..\..\wolfcrypt\src\evp.c" />
<ClCompile Include="..\..\wolfcrypt\src\fe_low_mem.c" />
<ClCompile Include="..\..\wolfcrypt\src\fe_operations.c" />
<ClCompile Include="..\..\wolfcrypt\src\ge_low_mem.c" />
<ClCompile Include="..\..\wolfcrypt\src\ge_operations.c" />
<ClCompile Include="..\..\wolfcrypt\src\hash.c" />
<ClCompile Include="..\..\wolfcrypt\src\hc128.c" />
<ClCompile Include="..\..\wolfcrypt\src\hmac.c" />
<ClCompile Include="..\..\wolfcrypt\src\idea.c" />
<ClCompile Include="..\..\wolfcrypt\src\integer.c" />
<ClCompile Include="..\..\wolfcrypt\src\logging.c" />
<ClCompile Include="..\..\wolfcrypt\src\md2.c" />
<ClCompile Include="..\..\wolfcrypt\src\md4.c" />
<ClCompile Include="..\..\wolfcrypt\src\md5.c" />
<ClCompile Include="..\..\wolfcrypt\src\memory.c" />
<ClCompile Include="..\..\wolfcrypt\src\pkcs7.c" />
<ClCompile Include="..\..\wolfcrypt\src\poly1305.c" />
<ClCompile Include="..\..\wolfcrypt\src\random.c" />
<ClCompile Include="..\..\wolfcrypt\src\ripemd.c" />
<ClCompile Include="..\..\wolfcrypt\src\rsa.c" />
<ClCompile Include="..\..\wolfcrypt\src\sha.c" />
<ClCompile Include="..\..\wolfcrypt\src\sha256.c" />
<ClCompile Include="..\..\wolfcrypt\src\sha3.c" />
<ClCompile Include="..\..\wolfcrypt\src\sha512.c" />
<ClCompile Include="..\..\wolfcrypt\src\signature.c" />
<ClCompile Include="..\..\wolfcrypt\src\srp.c" />
<ClCompile Include="..\..\wolfcrypt\src\tfm.c" />
<ClCompile Include="..\..\wolfcrypt\src\wc_encrypt.c" />
<ClCompile Include="..\..\wolfcrypt\src\wc_pkcs11.c" />
<ClCompile Include="..\..\wolfcrypt\src\wc_port.c" />
<ClCompile Include="..\..\wolfcrypt\src\wolfevent.c" />
<ClCompile Include="..\..\wolfcrypt\src\wolfmath.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="user_settings.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{eaed6d0c-d9c8-4901-b7d8-f8610afceae6}</ProjectGuid>
<Keyword>AzureSphere</Keyword>
<RootNamespace>wolfssl</RootNamespace>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<ApplicationType>Linux</ApplicationType>
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
<DebugMachineType>Device</DebugMachineType>
<PlatformToolset>GCC_AzureSphere_1_0</PlatformToolset>
<ProjectPublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</ProjectPublicIncludePath>
<PublicIncludePath>$(MSBuildProjectDirectory)\Inc\Public</PublicIncludePath>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<TargetSysroot>2</TargetSysroot>
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.a</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>-Werror=implicit-function-declaration %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NO_MAIN_DRIVER;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">..\..;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CAdditionalWarning Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">strict-prototypes;%(CAdditionalWarning);deprecated-declarations</CAdditionalWarning>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_POSIX_C_SOURCE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">..\..;$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">TurnOffAllWarnings</WarningLevel>
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">TurnOffAllWarnings</WarningLevel>
</ClCompile>
<Link>
<LibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">applibs;pthread;gcc_s;c</LibraryDependencies>
</Link>
<Lib>
<Verbose Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</Verbose>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -14,6 +14,7 @@ include IDE/ARDUINO/include.am
include IDE/INTIME-RTOS/include.am
include IDE/OPENSTM32/include.am
include IDE/VS-ARM/include.am
include IDE/VS-AZURE-SPHERE/include.am
include IDE/GCC-ARM/include.am
include IDE/CSBENCH/include.am
include IDE/ECLIPSE/DEOS/include.am

View File

@ -2202,7 +2202,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
defined(WOLFSSL_LPC43xx) || defined(WOLFSSL_STM32F2xx) || \
defined(MBED) || defined(WOLFSSL_EMBOS) || \
defined(WOLFSSL_GENSEED_FORTEST) || defined(WOLFSSL_CHIBIOS) || \
defined(WOLFSSL_CONTIKI)
defined(WOLFSSL_CONTIKI) || defined(WOLFSSL_AZSPHERE)
/* these platforms do not have a default random seed and
you'll need to implement your own wc_GenerateSeed or define via