[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
6
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/App.config
vendored
Normal file
6
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/App.config
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("wolfSSL-TLS-Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("wolfSSL")]
|
||||
[assembly: AssemblyProduct("wolfSSL-TLS-Client")]
|
||||
[assembly: AssemblyCopyright("Copyright wolfSSL 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("05aad2b4-445e-4f0e-8e16-8f8512696505")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
26
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/Properties/Settings.Designer.cs
generated
vendored
Normal file
26
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/Properties/Settings.Designer.cs
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace wolfSSL_TLS_CSharp.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
</SettingsFile>
|
||||
210
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs
vendored
Normal file
210
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
/* wolfSSL-TLS-Client.cs
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using wolfSSL.CSharp;
|
||||
|
||||
public class wolfSSL_TLS_Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Example of a logging function
|
||||
/// </summary>
|
||||
/// <param name="lvl">level of log</param>
|
||||
/// <param name="msg">message to log</param>
|
||||
public static void standard_log(int lvl, StringBuilder msg)
|
||||
{
|
||||
Console.WriteLine(msg);
|
||||
}
|
||||
|
||||
|
||||
private static void clean(IntPtr ssl, IntPtr ctx)
|
||||
{
|
||||
wolfssl.free(ssl);
|
||||
wolfssl.CTX_free(ctx);
|
||||
wolfssl.Cleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verification callback
|
||||
/// </summary>
|
||||
/// <param name="preverify">1=Verify Okay, 0=Failure</param>
|
||||
/// <param name="x509_ctx">Certificate in WOLFSSL_X509_STORE_CTX format</param>
|
||||
private static int myVerify(int preverify, IntPtr x509_ctx)
|
||||
{
|
||||
/* Use the provided verification */
|
||||
/* Can optionally override failures by returning non-zero value */
|
||||
return preverify;
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
IntPtr ctx;
|
||||
IntPtr ssl;
|
||||
Socket tcp;
|
||||
|
||||
/* These paths should be changed for use */
|
||||
string caCert = @"ca-cert.pem";
|
||||
StringBuilder dhparam = new StringBuilder("dh2048.pem");
|
||||
|
||||
StringBuilder buff = new StringBuilder(1024);
|
||||
StringBuilder reply = new StringBuilder("Hello, this is the wolfSSL C# wrapper");
|
||||
|
||||
//example of function used for setting logging
|
||||
wolfssl.SetLogging(standard_log);
|
||||
|
||||
wolfssl.Init();
|
||||
|
||||
|
||||
Console.WriteLine("Calling ctx Init from wolfSSL");
|
||||
ctx = wolfssl.CTX_new(wolfssl.usev23_client());
|
||||
if (ctx == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Error in creating ctx structure");
|
||||
return;
|
||||
}
|
||||
Console.WriteLine("Finished init of ctx .... now load in CA");
|
||||
|
||||
|
||||
if (!File.Exists(caCert))
|
||||
{
|
||||
Console.WriteLine("Could not find CA cert file");
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (wolfssl.CTX_load_verify_locations(ctx, caCert, null)
|
||||
!= wolfssl.SUCCESS)
|
||||
{
|
||||
Console.WriteLine("Error loading CA cert");
|
||||
}
|
||||
|
||||
StringBuilder ciphers = new StringBuilder(new String(' ', 4096));
|
||||
wolfssl.get_ciphers(ciphers, 4096);
|
||||
Console.WriteLine("Ciphers : " + ciphers.ToString());
|
||||
|
||||
/* Uncomment Section to enable specific cipher suite */
|
||||
#if false
|
||||
ciphers = new StringBuilder("ECDHE-ECDSA-AES128-GCM-SHA256");
|
||||
if (wolfssl.CTX_set_cipher_list(ctx, ciphers) != wolfssl.SUCCESS)
|
||||
{
|
||||
Console.WriteLine("ERROR CTX_set_cipher_list()");
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
short minDhKey = 128;
|
||||
wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey);
|
||||
|
||||
/* Setup Verify Callback */
|
||||
if (wolfssl.CTX_set_verify(ctx, wolfssl.SSL_VERIFY_PEER, myVerify)
|
||||
!= wolfssl.SUCCESS)
|
||||
{
|
||||
Console.WriteLine("Error setting verify callback!");
|
||||
}
|
||||
|
||||
|
||||
/* set up TCP socket */
|
||||
tcp = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
|
||||
ProtocolType.Tcp);
|
||||
try
|
||||
{
|
||||
tcp.Connect("localhost", 11111);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("tcp.Connect() error " + e.ToString());
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
if (!tcp.Connected)
|
||||
{
|
||||
Console.WriteLine("tcp.Connect() failed!");
|
||||
tcp.Close();
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Connected TCP");
|
||||
ssl = wolfssl.new_ssl(ctx);
|
||||
if (ssl == IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("Error in creating ssl object");
|
||||
wolfssl.CTX_free(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Connection made wolfSSL_connect ");
|
||||
if (wolfssl.set_fd(ssl, tcp) != wolfssl.SUCCESS)
|
||||
{
|
||||
/* get and print out the error */
|
||||
Console.WriteLine(wolfssl.get_error(ssl));
|
||||
tcp.Close();
|
||||
clean(ssl, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
wolfssl.SetTmpDH_file(ssl, dhparam, wolfssl.SSL_FILETYPE_PEM);
|
||||
|
||||
if (wolfssl.connect(ssl) != wolfssl.SUCCESS)
|
||||
{
|
||||
/* get and print out the error */
|
||||
Console.WriteLine(wolfssl.get_error(ssl));
|
||||
tcp.Close();
|
||||
clean(ssl, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* print out results of TLS/SSL accept */
|
||||
Console.WriteLine("SSL version is " + wolfssl.get_version(ssl));
|
||||
Console.WriteLine("SSL cipher suite is " + wolfssl.get_current_cipher(ssl));
|
||||
|
||||
|
||||
if (wolfssl.write(ssl, reply, reply.Length) != reply.Length)
|
||||
{
|
||||
Console.WriteLine("Error in write");
|
||||
tcp.Close();
|
||||
clean(ssl, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* read and print out the message then reply */
|
||||
if (wolfssl.read(ssl, buff, 1023) < 0)
|
||||
{
|
||||
Console.WriteLine("Error in read");
|
||||
tcp.Close();
|
||||
clean(ssl, ctx);
|
||||
return;
|
||||
}
|
||||
Console.WriteLine(buff);
|
||||
|
||||
wolfssl.shutdown(ssl);
|
||||
tcp.Close();
|
||||
clean(ssl, ctx);
|
||||
}
|
||||
}
|
||||
132
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.csproj
vendored
Normal file
132
kernel/FreeRTOS-Plus/ThirdParty/wolfSSL/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.csproj
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B9DF2972-38F6-4B42-B228-E3C1A47DF8E8}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>wolfSSL_TLS_Client</RootNamespace>
|
||||
<AssemblyName>wolfSSL-TLS-Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\DLL Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\DLL Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\x64\DLL Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>..\x64\DLL Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="wolfSSL-TLS-Client.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\wolfSSL_CSharp\wolfSSL_CSharp.csproj">
|
||||
<Project>{52609808-0418-46d3-8e17-141927a1a39a}</Project>
|
||||
<Name>wolfSSL_CSharp</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user