From 88036db22312dca215763a00aad2ae04093a7b5c Mon Sep 17 00:00:00 2001 From: Aaron Jense Date: Mon, 9 Sep 2019 10:41:57 -0600 Subject: [PATCH] Visual Studio Solution for Azure Sphere Devices --- IDE/VS-AZURE-SPHERE/README.md | 139 +++++++++++++ IDE/VS-AZURE-SPHERE/client/app_manifest.json | 17 ++ IDE/VS-AZURE-SPHERE/client/client.c | 146 +++++++++++++ IDE/VS-AZURE-SPHERE/client/client.h | 119 +++++++++++ IDE/VS-AZURE-SPHERE/client/client.vcxproj | 84 ++++++++ IDE/VS-AZURE-SPHERE/include.am | 18 ++ IDE/VS-AZURE-SPHERE/server/app_manifest.json | 11 + IDE/VS-AZURE-SPHERE/server/server.c | 194 ++++++++++++++++++ IDE/VS-AZURE-SPHERE/server/server.h | 27 +++ IDE/VS-AZURE-SPHERE/server/server.vcxproj | 86 ++++++++ IDE/VS-AZURE-SPHERE/user_settings.h | 66 ++++++ .../wolfcrypt_test/app_manifest.json | 10 + .../wolfcrypt_test/wolfcrypt_test.vcxproj | 91 ++++++++ IDE/VS-AZURE-SPHERE/wolfssl.sln | 52 +++++ IDE/VS-AZURE-SPHERE/wolfssl.vcxproj | 135 ++++++++++++ IDE/include.am | 1 + wolfcrypt/src/random.c | 2 +- 17 files changed, 1197 insertions(+), 1 deletion(-) create mode 100644 IDE/VS-AZURE-SPHERE/README.md create mode 100644 IDE/VS-AZURE-SPHERE/client/app_manifest.json create mode 100644 IDE/VS-AZURE-SPHERE/client/client.c create mode 100644 IDE/VS-AZURE-SPHERE/client/client.h create mode 100644 IDE/VS-AZURE-SPHERE/client/client.vcxproj create mode 100644 IDE/VS-AZURE-SPHERE/include.am create mode 100644 IDE/VS-AZURE-SPHERE/server/app_manifest.json create mode 100644 IDE/VS-AZURE-SPHERE/server/server.c create mode 100644 IDE/VS-AZURE-SPHERE/server/server.h create mode 100644 IDE/VS-AZURE-SPHERE/server/server.vcxproj create mode 100644 IDE/VS-AZURE-SPHERE/user_settings.h create mode 100644 IDE/VS-AZURE-SPHERE/wolfcrypt_test/app_manifest.json create mode 100644 IDE/VS-AZURE-SPHERE/wolfcrypt_test/wolfcrypt_test.vcxproj create mode 100644 IDE/VS-AZURE-SPHERE/wolfssl.sln create mode 100644 IDE/VS-AZURE-SPHERE/wolfssl.vcxproj diff --git a/IDE/VS-AZURE-SPHERE/README.md b/IDE/VS-AZURE-SPHERE/README.md new file mode 100644 index 000000000..abfcb6be0 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/README.md @@ -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 Certificate file, default ./certs/server-cert.pem` +` -d Disable client cert check` +` -k Key file, default ./certs/server-key.pem` +` -p Port to listen on, not 0, default 11111` +` -? 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 Certificate Authority file, default ./certs/ca-cert.pem` +` -h Host to connect to, default 127.0.0.1` +` -p Port to listen on, not 0, default 11111` +` -? 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/) diff --git a/IDE/VS-AZURE-SPHERE/client/app_manifest.json b/IDE/VS-AZURE-SPHERE/client/app_manifest.json new file mode 100644 index 000000000..ce81b35ac --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/client/app_manifest.json @@ -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" +} diff --git a/IDE/VS-AZURE-SPHERE/client/client.c b/IDE/VS-AZURE-SPHERE/client/client.c new file mode 100644 index 000000000..2b33a7a57 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/client/client.c @@ -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 +#include +#include + +/* socket includes */ +#include +#include +#include +#include + +/* wolfSSL */ +#include +#include +#include + +/* Azure Sphere */ +#include +#include + +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 */ +} diff --git a/IDE/VS-AZURE-SPHERE/client/client.h b/IDE/VS-AZURE-SPHERE/client/client.h new file mode 100644 index 000000000..1a649da9f --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/client/client.h @@ -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 */ diff --git a/IDE/VS-AZURE-SPHERE/client/client.vcxproj b/IDE/VS-AZURE-SPHERE/client/client.vcxproj new file mode 100644 index 000000000..ada0fb898 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/client/client.vcxproj @@ -0,0 +1,84 @@ + + + + + Debug + ARM + + + Release + ARM + + + + {fbf6f097-b2bf-49ac-a70b-dba6036a395d} + AzureSphere + client + 15.0 + Linux + 1.0 + Generic + {D51BCBC9-82E9-4017-911E-C93873C4EA2B} + Device + GCC_AzureSphere_1_0 + $(MSBuildProjectDirectory)\Inc\Public + $(MSBuildProjectDirectory)\Inc\Public + + + + true + 2 + Application + + + false + 2 + Application + + + + + + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(ProjectName) + .out + + + .out + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + -Werror=implicit-function-declaration %(AdditionalOptions) + ..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories); + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + ..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories); + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + + + applibs;pthread;gcc_s;c;wolfssl + true + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + + + 192.168.35.1 + + + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + applibs;pthread;gcc_s;c;wolfssl + + + + + + + + + + + + \ No newline at end of file diff --git a/IDE/VS-AZURE-SPHERE/include.am b/IDE/VS-AZURE-SPHERE/include.am new file mode 100644 index 000000000..3a32f1f7c --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/include.am @@ -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 diff --git a/IDE/VS-AZURE-SPHERE/server/app_manifest.json b/IDE/VS-AZURE-SPHERE/server/app_manifest.json new file mode 100644 index 000000000..40915795e --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/server/app_manifest.json @@ -0,0 +1,11 @@ +{ + "SchemaVersion": 1, + "Name": "wolfSSL_Server", + "ComponentId": "00000000-0000-0000-0000-000000000001", + "EntryPoint": "/bin/app", + "CmdArgs": [], + "Capabilities": { + "AllowedTcpServerPorts": [ 11111 ] + }, + "ApplicationType": "Default" +} diff --git a/IDE/VS-AZURE-SPHERE/server/server.c b/IDE/VS-AZURE-SPHERE/server/server.c new file mode 100644 index 000000000..c689ace72 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/server/server.c @@ -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 +#include +#include + +/* socket includes */ +#include +#include +#include +#include + +/* wolfSSL */ +#include +#include + +/* Azure Sphere */ +#include +#include + +#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 */ +} diff --git a/IDE/VS-AZURE-SPHERE/server/server.h b/IDE/VS-AZURE-SPHERE/server/server.h new file mode 100644 index 000000000..23c18f865 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/server/server.h @@ -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 */ + diff --git a/IDE/VS-AZURE-SPHERE/server/server.vcxproj b/IDE/VS-AZURE-SPHERE/server/server.vcxproj new file mode 100644 index 000000000..0b3b763b4 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/server/server.vcxproj @@ -0,0 +1,86 @@ + + + + + Debug + ARM + + + Release + ARM + + + + {F005DF72-46F4-4989-BCB4-3ACDA323D569} + AzureSphere + client + 15.0 + Linux + 1.0 + Generic + {D51BCBC9-82E9-4017-911E-C93873C4EA2B} + Device + GCC_AzureSphere_1_0 + $(MSBuildProjectDirectory)\Inc\Public + $(MSBuildProjectDirectory)\Inc\Public + + + + true + 2 + Application + + + false + 2 + Application + + + + + + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(ProjectName) + .out + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .out + + + + -Werror=implicit-function-declaration %(AdditionalOptions) + ..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories); + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + ..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories); + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + + + applibs;pthread;gcc_s;c;wolfssl + true + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + + + 192.168.35.1 + + + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + applibs;pthread;gcc_s;c;wolfssl + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IDE/VS-AZURE-SPHERE/user_settings.h b/IDE/VS-AZURE-SPHERE/user_settings.h new file mode 100644 index 000000000..0178ead1c --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/user_settings.h @@ -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_ */ diff --git a/IDE/VS-AZURE-SPHERE/wolfcrypt_test/app_manifest.json b/IDE/VS-AZURE-SPHERE/wolfcrypt_test/app_manifest.json new file mode 100644 index 000000000..e20bc3cf2 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/wolfcrypt_test/app_manifest.json @@ -0,0 +1,10 @@ +{ + "SchemaVersion": 1, + "Name": "wolfCrypt_Test", + "ComponentId": "00000000-0000-0000-0000-000000000003", + "EntryPoint": "/bin/app", + "CmdArgs": [], + "Capabilities": { + }, + "ApplicationType": "Default" +} diff --git a/IDE/VS-AZURE-SPHERE/wolfcrypt_test/wolfcrypt_test.vcxproj b/IDE/VS-AZURE-SPHERE/wolfcrypt_test/wolfcrypt_test.vcxproj new file mode 100644 index 000000000..7f3e4e0ae --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/wolfcrypt_test/wolfcrypt_test.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + ARM + + + Release + ARM + + + + {CD96C02B-1FC9-424E-88BE-816BE143A1C3} + AzureSphere + echoclient + 15.0 + Linux + 1.0 + Generic + {D51BCBC9-82E9-4017-911E-C93873C4EA2B} + Device + GCC_AzureSphere_1_0 + $(MSBuildProjectDirectory)\Inc\Public + $(MSBuildProjectDirectory)\Inc\Public + wolfcrypt_test + + + + true + 2 + Application + + + false + 2 + Application + + + + + + + + $(ProjectName) + .out + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SysRootIncludePath);$(IncludePath); + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .out + + + + -Werror=implicit-function-declaration %(AdditionalOptions) + ..\..\..;../;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories) + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + strict-prototypes;%(CAdditionalWarning);deprecated-declarations + TurnOffAllWarnings + true + ..\..\..;$(ProjectDir);$(SysRootIncludePath);%(AdditionalIncludeDirectories) + WOLFSSL_USER_SETTINGS;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + TurnOffAllWarnings + + + applibs;pthread;gcc_s;c;wolfssl + %(SharedLibrarySearchPath) + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + true + + + $(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + applibs;pthread;gcc_s;c;wolfssl + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IDE/VS-AZURE-SPHERE/wolfssl.sln b/IDE/VS-AZURE-SPHERE/wolfssl.sln new file mode 100644 index 000000000..2971306ac --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/wolfssl.sln @@ -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 diff --git a/IDE/VS-AZURE-SPHERE/wolfssl.vcxproj b/IDE/VS-AZURE-SPHERE/wolfssl.vcxproj new file mode 100644 index 000000000..fbd3dbb30 --- /dev/null +++ b/IDE/VS-AZURE-SPHERE/wolfssl.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + ARM + + + Release + ARM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {eaed6d0c-d9c8-4901-b7d8-f8610afceae6} + AzureSphere + wolfssl + 15.0 + Linux + 1.0 + Generic + {D51BCBC9-82E9-4017-911E-C93873C4EA2B} + Device + GCC_AzureSphere_1_0 + $(MSBuildProjectDirectory)\Inc\Public + $(MSBuildProjectDirectory)\Inc\Public + + + + true + 2 + StaticLibrary + + + false + 2 + StaticLibrary + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .a + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + -Werror=implicit-function-declaration %(AdditionalOptions) + NO_MAIN_DRIVER;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + ..\..;$(ProjectDir);%(AdditionalIncludeDirectories) + strict-prototypes;%(CAdditionalWarning);deprecated-declarations + WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_POSIX_C_SOURCE;%(PreprocessorDefinitions) + ..\..;$(ProjectDir);%(AdditionalIncludeDirectories) + TurnOffAllWarnings + TurnOffAllWarnings + + + applibs;pthread;gcc_s;c + + + true + + + + + \ No newline at end of file diff --git a/IDE/include.am b/IDE/include.am index a70a88fef..32715b807 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -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 diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 6b0d5dafc..1b821b2af 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -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