Update code to v1.0.14 (10)

This commit is contained in:
Caten
2024-02-29 19:35:00 +08:00
parent c2ee3b694c
commit a956d26f6d
3188 changed files with 2317293 additions and 146 deletions

View File

@@ -0,0 +1,9 @@
wolfSSL sample application project for Renesas RSK+RX65N-2MB evaluation board
======
<br>
A sample program for evaluating wolfSSL targeting the Renesas RSK+RX65N-2MB evaluation board is provided. For details on the program, refer to the following documents included in the package.
+ InstructionManualForExample_RSK+RX65N-2MB_JP.pdf (Japanese)
+ InstructionManualForExample_RSK+RX65N-2MB_EN.pdf (English

View File

@@ -0,0 +1,12 @@
Renesas RSK+RX65N-2MB 評価ボード用 wolfSSLサンプルプロジェクト
======
<br>
Renesas社製 RSK+RX65N-2MB 評価ボードをターゲットとしてwolfSSLを評価するためのサンプルプログラムを提供します。サンプルプログラムに関するマニュアルは同梱の
+ InstructionManualForExample_RSK+RX65N-2MB_JP.pdf (日本語版)
+ InstructionManualForExample_RSK+RX65N-2MB_EN.pdf (英語版)
を参照ください。

View File

@@ -0,0 +1,17 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/README_EN.md
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/README_JP.md
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/InstructionManualForExample_RSK+RX65N-2MB_EN.pdf
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/InstructionManualForExample_RSK+RX65N-2MB_JP.pdf
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/resource/section.esi
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl/.cproject
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl/.project
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl/wolfssl.rcpc
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.c
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/key_data.h
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/wolfssl_demo.c
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/wolfssl_demo.h
EXTRA_DIST+= IDE/Renesas/e2studio/RX65N/RSK/wolfssl_demo/user_settings.h

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ASCII"?>
<com.renesas.linkersection.model:SectionContainer xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.renesas.linkersection.model="http:///LinkerSection.ecore">
<sections name="SU">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="4"/>
</sections>
<sections name="SI"/>
<sections name="R_1"/>
<sections name="R_2"/>
<sections name="R"/>
<sections name="RPFRAM2"/>
<sections name="C_PKCS11_STORAGE*">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="1050624"/>
</sections>
<sections name="C_SYSTEM_CONFIG*">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="1067008"/>
</sections>
<sections name="B_ETHERNET_BUFFERS_1">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="8388608"/>
</sections>
<sections name="B_RX_DESC_1"/>
<sections name="B_TX_DESC_1"/>
<sections name="B"/>
<sections name="B_1"/>
<sections name="B_2"/>
<sections name="C_1">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="4292870144"/>
</sections>
<sections name="C_2"/>
<sections name="C"/>
<sections name="C$*"/>
<sections name="D*"/>
<sections name="W*"/>
<sections name="L"/>
<sections name="P*"/>
<sections name="EXCEPTVECT">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="4294967168"/>
</sections>
<sections name="RESETVECT">
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="4294967292"/>
</sections>
</com.renesas.linkersection.model:SectionContainer>

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MicomToolCommonProjectFile Version="1.00">
<CreatorType Name="e2studio" Version=""/>
<Placeholders>
<PlaceholderPrefix>${</PlaceholderPrefix>
<PlaceholderPostfix>}</PlaceholderPostfix>
</Placeholders>
<Project Name="wolfssl" Type="Library">
<Files>
<Category Name="src">
<Path>..\..\..\..\..\..\src\crl.c</Path>
<Path>..\..\..\..\..\..\src\internal.c</Path>
<Path>..\..\..\..\..\..\src\keys.c</Path>
<Path>..\..\..\..\..\..\src\ocsp.c</Path>
<Path>..\..\..\..\..\..\src\sniffer.c</Path>
<Path>..\..\..\..\..\..\src\ssl.c</Path>
<Path>..\..\..\..\..\..\src\tls.c</Path>
<Path>..\..\..\..\..\..\src\tls13.c</Path>
<Path>..\..\..\..\..\..\src\wolfio.c</Path>
</Category>
<Category Name="wolfcrypt">
<Category Name="port">
<Path>..\..\..\..\..\..\wolfcrypt\src\port\Renesas\renesas_common.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\port\Renesas\renesas_tsip_aes.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\port\Renesas\renesas_tsip_sha.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\port\Renesas\renesas_tsip_util.c</Path>
</Category>
<Category Name="src">
<Path>..\..\..\..\..\..\wolfcrypt\src\aes.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\arc4.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\asm.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\asn.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\blake2b.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\camellia.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\chacha.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\chacha20_poly1305.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\cmac.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\coding.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\compress.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\cpuid.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\cryptocb.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\curve25519.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\des3.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\dh.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\dsa.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ecc.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ecc_fp.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ed25519.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\error.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\fe_low_mem.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\fe_operations.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ge_low_mem.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ge_operations.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\hash.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\hmac.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\integer.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\kdf.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\logging.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\md2.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\md4.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\md5.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\memory.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\pkcs12.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\pkcs7.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\poly1305.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\pwdbased.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\random.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\ripemd.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\rsa.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sha.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sha256.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sha3.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sha512.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\signature.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_arm32.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_arm64.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_c32.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_c64.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_int.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\sp_x86_64.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\srp.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\tfm.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\wc_encrypt.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\wc_port.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\wolfevent.c</Path>
<Path>..\..\..\..\..\..\wolfcrypt\src\wolfmath.c</Path>
</Category>
</Category>
</Files>
<Device Category="com.renesas.cdt.managedbuild.renesas.ccrx.common.option.cpu.rx600" Series="RX">R5F565NEDxFC</Device>
<BuildOptions Name="CC-RX" Version="v3.04.00">
<BuildMode Active="True" Name="Debug">
<GeneralOptions/>
<CompileOptions>
<Option>-isa=rxv2</Option>
<Option>-fpu</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\"</Option>
<Option>-include="${ProjDirPath}\..\wolfssl_demo"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\demos"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\freertos_kernel\include"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\freertos_kernel\portable\Renesas\RX600v2"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\libraries\freertos_plus\standard\freertos_plus_tcp\include"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\amazon_freertos_common"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\config_files"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_config"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_bsp"</Option>
<Option>-include="${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_tsip_rx"</Option>
<Option>-define=WOLFSSL_USER_SETTINGS</Option>
<Option>-utf8</Option>
<Option>-nomessage</Option>
<Option>-debug</Option>
<Option>-outcode=utf8</Option>
<Option>-nologo</Option>
<Option>-lang=c99</Option>
<Option>-lang=cpp</Option>
<Option>-output=obj=${CONFIGDIR}\${FILELEAF}.obj</Option>
<Option>-obj_path=${CONFIGDIR}</Option>
</CompileOptions>
<AssembleOptions>
<Option>-isa=rxv2</Option>
<Option>-fpu</Option>
<Option>-utf8</Option>
<Option>-debug</Option>
<Option>-nologo</Option>
<Option>-output=${CONFIGDIR}</Option>
</AssembleOptions>
<LinkOptions>
<Option>-output="${ProjName}.lib"</Option>
<Option>-form=library=u</Option>
<Option>-nomessage</Option>
<Option>-list=${ProjName}.lbp</Option>
<Option>-nologo</Option>
<PreLinker>Auto</PreLinker>
</LinkOptions>
<LibraryGenerateOptions>
<GenerateMode>None</GenerateMode>
</LibraryGenerateOptions>
<LinkOrder>
<Path>Debug\crl.obj</Path>
<Path>Debug\internal.obj</Path>
<Path>Debug\keys.obj</Path>
<Path>Debug\ocsp.obj</Path>
<Path>Debug\sniffer.obj</Path>
<Path>Debug\ssl.obj</Path>
<Path>Debug\tls.obj</Path>
<Path>Debug\tls13.obj</Path>
<Path>Debug\wolfio.obj</Path>
<Path>Debug\renesas_common.obj</Path>
<Path>Debug\renesas_tsip_aes.obj</Path>
<Path>Debug\renesas_tsip_sha.obj</Path>
<Path>Debug\renesas_tsip_util.obj</Path>
<Path>Debug\aes.obj</Path>
<Path>Debug\arc4.obj</Path>
<Path>Debug\asm.obj</Path>
<Path>Debug\asn.obj</Path>
<Path>Debug\blake2b.obj</Path>
<Path>Debug\camellia.obj</Path>
<Path>Debug\chacha.obj</Path>
<Path>Debug\chacha20_poly1305.obj</Path>
<Path>Debug\cmac.obj</Path>
<Path>Debug\coding.obj</Path>
<Path>Debug\compress.obj</Path>
<Path>Debug\cpuid.obj</Path>
<Path>Debug\cryptocb.obj</Path>
<Path>Debug\curve25519.obj</Path>
<Path>Debug\des3.obj</Path>
<Path>Debug\dh.obj</Path>
<Path>Debug\dsa.obj</Path>
<Path>Debug\ecc.obj</Path>
<Path>Debug\ecc_fp.obj</Path>
<Path>Debug\ed25519.obj</Path>
<Path>Debug\error.obj</Path>
<Path>Debug\fe_low_mem.obj</Path>
<Path>Debug\fe_operations.obj</Path>
<Path>Debug\ge_low_mem.obj</Path>
<Path>Debug\ge_operations.obj</Path>
<Path>Debug\hash.obj</Path>
<Path>Debug\hmac.obj</Path>
<Path>Debug\integer.obj</Path>
<Path>Debug\kdf.obj</Path>
<Path>Debug\logging.obj</Path>
<Path>Debug\md2.obj</Path>
<Path>Debug\md4.obj</Path>
<Path>Debug\md5.obj</Path>
<Path>Debug\memory.obj</Path>
<Path>Debug\pkcs12.obj</Path>
<Path>Debug\pkcs7.obj</Path>
<Path>Debug\poly1305.obj</Path>
<Path>Debug\pwdbased.obj</Path>
<Path>Debug\random.obj</Path>
<Path>Debug\ripemd.obj</Path>
<Path>Debug\rsa.obj</Path>
<Path>Debug\sha.obj</Path>
<Path>Debug\sha256.obj</Path>
<Path>Debug\sha3.obj</Path>
<Path>Debug\sha512.obj</Path>
<Path>Debug\signature.obj</Path>
<Path>Debug\sp_arm32.obj</Path>
<Path>Debug\sp_arm64.obj</Path>
<Path>Debug\sp_c32.obj</Path>
<Path>Debug\sp_c64.obj</Path>
<Path>Debug\sp_int.obj</Path>
<Path>Debug\sp_x86_64.obj</Path>
<Path>Debug\srp.obj</Path>
<Path>Debug\tfm.obj</Path>
<Path>Debug\wc_encrypt.obj</Path>
<Path>Debug\wc_port.obj</Path>
<Path>Debug\wolfevent.obj</Path>
<Path>Debug\wolfmath.obj</Path>
</LinkOrder>
<CommonOptions>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\wolfssl_demo"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\demos"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\freertos_kernel\include"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\freertos_kernel\portable\Renesas\RX600v2"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\libraries\freertos_plus\standard\freertos_plus_tcp\include"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\amazon_freertos_common"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\config_files"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_config"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_bsp"</IncludePathForC>
<IncludePathForC>"${ProjDirPath}\..\..\..\..\..\..\..\vendors\renesas\boards\rx65n-rsk\aws_demos\src\smc_gen\r_tsip_rx"</IncludePathForC>
<MacroForC>WOLFSSL_USER_SETTINGS</MacroForC>
</CommonOptions>
</BuildMode>
</BuildOptions>
</Project>
</MicomToolCommonProjectFile>

View File

@@ -0,0 +1,231 @@
/* key_data.c
*
* Copyright (C) 2006-2022 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
*/
#include "key_data.h"
/*-------------------------------------------------------------------------
TSIP v1.09 or later
--------------------------------------------------------------------------*/
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && (WOLFSSL_RENESAS_TSIP_VER >=109)
const st_key_block_data_t g_key_block_data =
{
/* uint8_t encrypted_provisioning_key[R_TSIP_AES_CBC_IV_BYTE_SIZE * 2]; */
{
0x94, 0x4D, 0x99, 0x53, 0xE9, 0x15, 0xD1, 0xD9, 0x0A, 0x2C, 0x17, 0x48,
0x87, 0x2F, 0x22, 0xA8, 0x90, 0xB3, 0xDE, 0x25, 0x17, 0xEA, 0xE6, 0x31,
0x28, 0x3F, 0xB9, 0x8F, 0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0x16, 0x9C,
0xFB, 0xF6, 0xE9, 0x73, 0x96, 0x78, 0x94, 0x59, 0x12, 0x28, 0x03, 0x37,
0x75, 0x56, 0x00, 0x2F, 0xCE, 0x54, 0x7C, 0x34, 0xFD, 0x0B, 0x10, 0x5B,
0x4A, 0xEE, 0x11, 0x1B, 0x39, 0xE9, 0x80, 0x8B, 0x27, 0x2D, 0x29, 0x12,
0x68, 0x87, 0xD2, 0xC9, 0x78, 0xED, 0xED, 0xF2, 0xA6, 0x4D, 0x6B, 0x10,
0x98, 0x9D, 0x52, 0x1C, 0xCE, 0x69, 0x0D, 0x5C, 0x46, 0xEB, 0x5D, 0x9B,
0xC8, 0x6A, 0x8E, 0x1F, 0x56, 0x05, 0xBA, 0xD2, 0x50, 0x9F, 0x92, 0xB7,
0xD4, 0x4D, 0xCD, 0x58, 0x5B, 0xA7, 0x87, 0x10, 0x6D, 0xF3, 0xDB, 0xA8,
0x1D, 0x23, 0x00, 0xE4, 0x81, 0x69, 0x3E, 0x7D, 0xEA, 0x5B, 0x33, 0xF4,
0x73, 0xD8, 0x7C, 0xDD, 0x64, 0x74, 0x40, 0x30, 0x93, 0x8D, 0x2C, 0xA5,
0x2C, 0x24, 0x11, 0xB2, 0x26, 0x56, 0xE3, 0x41, 0x72, 0xAE, 0x41, 0x56,
0x9C, 0x75, 0x11, 0x8E, 0x53, 0x59, 0x77, 0xBF, 0x48, 0x71, 0x86, 0x7C,
0x7C, 0xCE, 0x04, 0xB9, 0x73, 0x62, 0xE6, 0x1D, 0xF8, 0xED, 0x93, 0x87
},
/* uint8_t encrypted_user_update_key[R_TSIP_AES256_KEY_BYTE_SIZE + 16]; */
{
0
},
/* uint8_t
* encrypted_user_rsa2048_private_key[R_TSIP_RSA2048_ND_KEY_BYTE_SIZE + 16]
*/
{
0x22, 0xEC, 0xE3, 0x79, 0xD1, 0x0C, 0xB4, 0xED, 0xE0, 0xA9, 0x0F, 0xBD,
0xC7, 0x0B, 0xB4, 0x1E, 0x82, 0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A, 0xEA, 0x8C, 0x2D, 0x68, 0xF4, 0xD5, 0xD7, 0xA9, 0x6F,
0x2C, 0x8C, 0x13, 0x93, 0xA3, 0x80, 0x11, 0xF9, 0x0F, 0x36, 0x14, 0xA8
},
};
/* Public key type of CA root cert: 0: RSA-2048 2: ECDSA-P256*/
#if defined(USE_ECC_CERT)
const uint32_t encrypted_user_key_type =
R_TSIP_TLS_PUBLIC_KEY_TYPE_ECDSA_P256;
#else
const uint32_t encrypted_user_key_type =
R_TSIP_TLS_PUBLIC_KEY_TYPE_RSA2048;
#endif
const unsigned char ca_ecc_cert_der_sig[] =
{
0x6e, 0x7d, 0x2b, 0xd3, 0x6d, 0x6a, 0x70, 0x31, 0xbf, 0xcd, 0x6f, 0x32,
0x74, 0x8b, 0x4d, 0xdf, 0x7c, 0x72, 0xc6, 0x78, 0x61, 0x2b, 0x0f, 0xcc,
0xbc, 0xa3, 0x25, 0x54, 0x04, 0xfa, 0x9e, 0xf7, 0x1c, 0xa2, 0xe1, 0x33,
0x90, 0x08, 0xcd, 0x3c, 0xc1, 0x03, 0x66, 0xb6, 0x3f, 0xf1, 0xbf, 0xaf,
0x0d, 0xb0, 0xeb, 0xe4, 0xc7, 0x54, 0x60, 0x34, 0x3b, 0x62, 0xcf, 0x28,
0x95, 0xa2, 0x08, 0x79, 0xc5, 0x51, 0xf3, 0xe1, 0x88, 0x3b, 0xa0, 0x1d,
0x1d, 0x42, 0x5a, 0xba, 0x09, 0xe4, 0x64, 0xa1, 0x83, 0xf4, 0x60, 0x44,
0x89, 0xd3, 0xdd, 0x6c, 0x71, 0x7b, 0xd1, 0xb0, 0x28, 0x7b, 0x98, 0xe2,
0x4b, 0x99, 0x9a, 0x22, 0xd0, 0xeb, 0x1c, 0x5c, 0xbe, 0x49, 0x1a, 0xcf,
0xd7, 0x4b, 0x19, 0xe9, 0xdf, 0x82, 0x21, 0xe3, 0x87, 0x7a, 0x25, 0x58,
0x8f, 0x29, 0x0e, 0xce, 0xf4, 0x09, 0x0f, 0x2f, 0x04, 0xe9, 0xd2, 0xf9,
0xcc, 0xb7, 0x7a, 0x46, 0x5d, 0x98, 0x05, 0x54, 0x89, 0x8e, 0x09, 0x79,
0xa8, 0x6f, 0xf6, 0x12, 0xdd, 0x93, 0x38, 0x83, 0x14, 0x3f, 0x42, 0xcf,
0x03, 0x9d, 0x84, 0x9d, 0xe9, 0x6e, 0x9f, 0x87, 0x0f, 0xb8, 0x15, 0x9b,
0x9b, 0x4c, 0x32, 0x3b, 0x82, 0x7b, 0x3d, 0xd4, 0x85, 0x1e, 0x71, 0x99,
0x67, 0x40, 0x59, 0xad, 0x8c, 0x31, 0xd7, 0xa2, 0x81, 0xfd, 0x46, 0x21,
0xd7, 0xc8, 0x89, 0x3d, 0x17, 0x3f, 0x5e, 0x82, 0x5e, 0xfa, 0x7b, 0x34,
0x7a, 0x1b, 0x85, 0x86, 0xf8, 0x02, 0xf2, 0xf3, 0x01, 0x2c, 0xbd, 0x4a,
0x98, 0x0f, 0xe9, 0x4b, 0x1a, 0xa3, 0xee, 0xfc, 0x77, 0xda, 0xcf, 0xee,
0x9c, 0xca, 0xf9, 0xbf, 0xaa, 0x5b, 0xbc, 0x01, 0x4b, 0xd4, 0x74, 0x7c,
0xee, 0xfb, 0x7c, 0xc4, 0x31, 0xb7, 0x46, 0x9e, 0x94, 0x84, 0xa3, 0x82,
0x0c, 0x7b, 0x61, 0x4e
};
const int sizeof_ca_ecc_cert_sig = sizeof(ca_ecc_cert_der_sig);
/* ./ca-cert.der.sign, */
const unsigned char ca_cert_der_sig[] =
{
0x0a, 0xc8, 0xbb, 0x7e, 0x5a, 0x72, 0x6a, 0x5b, 0xf0, 0xc6, 0xbf, 0x36,
0x8e, 0xe1, 0xcd, 0xbc, 0x08, 0xfd, 0x22, 0x5a, 0x3b, 0x48, 0x33, 0xb9,
0x12, 0x55, 0x80, 0x6c, 0x36, 0x14, 0x05, 0x24, 0x63, 0x20, 0x8b, 0x26,
0x69, 0xa9, 0xe3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x91, 0x5b, 0x11, 0x3a,
0xe3, 0xf5, 0x69, 0x70, 0xa7, 0xfe, 0xf2, 0xf0, 0xbd, 0x11, 0xaf, 0xa7,
0x37, 0xda, 0x24, 0x75, 0x3e, 0x1a, 0x39, 0x49, 0xb4, 0x1e, 0x0e, 0xaf,
0x5d, 0x1e, 0x94, 0xdf
};
const int sizeof_ca_cert_sig = sizeof(ca_cert_der_sig);
/* ./client-cert.der.sign, */
const unsigned char client_cert_der_sign[] =
{
0x5D, 0x1F, 0x89, 0x41, 0xEC, 0x47, 0xC8, 0x90, 0x61, 0x79, 0x8A, 0x16,
0x1F, 0x31, 0x96, 0x67, 0xD9, 0x3C, 0xEC, 0x6B, 0x58, 0xC6, 0x5A, 0xED,
0x99, 0xB3, 0xEF, 0x27, 0x6F, 0x04, 0x8C, 0xD9, 0x68, 0xB1, 0xD6, 0x23,
0x15, 0x84, 0x00, 0xE1, 0x27, 0xD1, 0x1F, 0x68, 0xB7, 0x3F, 0x13, 0x53,
0x8A, 0x95, 0x5A, 0x20, 0x7C, 0xB2, 0x76, 0x5B, 0xDC, 0xE0, 0xA6, 0x21,
0x7C, 0x49, 0xCF, 0x93, 0xBA, 0xD5, 0x12, 0x9F, 0xEE, 0x90, 0x5B, 0x3F,
0xA3, 0x9D, 0x13, 0x72, 0xAC, 0x72, 0x16, 0xFE, 0x1D, 0xBE, 0xEB, 0x8E,
0xC7, 0xDC, 0xC4, 0xF8, 0x1A, 0xD8, 0xA0, 0xA4, 0xF6, 0x04, 0x30, 0xF6,
0x7E, 0xB6, 0xC8, 0xE1, 0xAB, 0x88, 0x37, 0x08, 0x63, 0x72, 0xAA, 0x46,
0xCC, 0xCA, 0xF0, 0x9E, 0x02, 0x1E, 0x65, 0x67, 0xFF, 0x2C, 0x9D, 0x81,
0x6C, 0x1E, 0xF1, 0x54, 0x05, 0x68, 0x68, 0x18, 0x72, 0x26, 0x55, 0xB6,
0x2C, 0x95, 0xC0, 0xC9, 0xB2, 0xA7, 0x0B, 0x60, 0xD7, 0xEB, 0x1D, 0x08,
0x1A, 0xA2, 0x54, 0x15, 0x89, 0xCB, 0x83, 0x21, 0x5D, 0x15, 0x9B, 0x38,
0xAC, 0x89, 0x63, 0xD5, 0x4B, 0xF4, 0x8B, 0x47, 0x93, 0x78, 0x43, 0xCB,
0x9B, 0x71, 0xBF, 0x94, 0x76, 0xB5, 0xCE, 0x35, 0xA9, 0x1A, 0xD5, 0xA5,
0xD8, 0x19, 0xA6, 0x04, 0x39, 0xB1, 0x09, 0x8C, 0x65, 0x02, 0x58, 0x3A,
0x95, 0xEF, 0xA2, 0xC3, 0x85, 0x18, 0x61, 0x23, 0x2D, 0xC5, 0xCD, 0x62,
0xC1, 0x19, 0x31, 0xE5, 0x36, 0x95, 0x22, 0xDB, 0x3E, 0x1A, 0x3C, 0xE8,
0xC6, 0x2E, 0xDF, 0xD9, 0x2F, 0x84, 0xC1, 0xF0, 0x38, 0x2B, 0xE5, 0x73,
0x35, 0x4F, 0x05, 0xE2, 0xA5, 0x60, 0x79, 0xB0, 0x23, 0xDC, 0x56, 0x4C,
0xE7, 0xD9, 0x1F, 0xCF, 0x6A, 0xFC, 0x55, 0xEB, 0xAA, 0x48, 0x3E, 0x95,
0x2A, 0x10, 0x01, 0x05
};
const int sizeof_client_cert_der_sign = sizeof(client_cert_der_sign);
uint32_t s_inst1[R_TSIP_SINST_WORD_SIZE] = { 0 };
uint32_t s_inst2[R_TSIP_SINST2_WORD_SIZE]= { 0 };
#endif

View File

@@ -0,0 +1,58 @@
/* key_data.h
*
* Copyright (C) 2006-2022 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 KEY_DATA_H_
#define KEY_DATA_H_
#include <wolfssl/wolfcrypt/settings.h>
#if defined(WOLFSSL_RENESAS_TSIP)
#include "r_tsip_rx_if.h"
typedef struct st_key_block_data
{
uint8_t encrypted_provisioning_key[R_TSIP_AES_CBC_IV_BYTE_SIZE * 2];
uint8_t iv[R_TSIP_AES_CBC_IV_BYTE_SIZE];
uint8_t encrypted_user_rsa2048_ne_key[R_TSIP_RSA2048_NE_KEY_BYTE_SIZE + 16];
uint8_t encrypted_user_update_key[R_TSIP_AES256_KEY_BYTE_SIZE + 16];
uint8_t encrypted_user_rsa2048_private_key[R_TSIP_RSA2048_ND_KEY_BYTE_SIZE + 16];
uint8_t encrypted_user_ecc256_private_key[R_TSIP_ECC_PRIVATE_KEY_BYTE_SIZE + 16];
} st_key_block_data_t;
extern const uint32_t encrypted_user_key_type;
extern const st_key_block_data_t g_key_block_data;
extern const unsigned char ca_cert_der_sig[];
extern const unsigned char ca_ecc_cert_der_sig[];
extern const unsigned char client_cert_der_sign[];
extern const int sizeof_ca_cert_der;
#endif /* WOLFSSL_RENESAS_TSIP */
#endif /* KEY_DATA_H_ */

View File

@@ -0,0 +1,228 @@
/* user_settings.h
*
* Copyright (C) 2006-2022 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
*/
/*-- Renesas MCU type ---------------------------------------------------------
*
*
*----------------------------------------------------------------------------*/
#define WOLFSSL_RENESAS_RX65N
/*-- Renesas TSIP usage and its version ---------------------------------------
*
* "WOLFSSL_RENESAS_TSIP" definition makes wolfSSL to use H/W acceleration
* for cipher operations.
* TSIP definition asks to have its version number.
* "WOLFSSL_RENESAS_TSIP_VER" takes following value:
* 106: TSIPv1.06
* 109: TSIPv1.09
* 113: TSIPv1.13
* 114: TSIPv1.14
* 115: TSIPv1.15
*----------------------------------------------------------------------------*/
#define WOLFSSL_RENESAS_TSIP
#define WOLFSSL_RENESAS_TSIP_VER 115
/*-- TLS version definitions --------------------------------------------------
*
* wolfSSL supports TLSv1.2 by default. In case you want your system to support
* TLSv1.3, uncomment line below.
*
*----------------------------------------------------------------------------*/
#define WOLFSSL_TLS13
/*-- Operating System related definitions --------------------------------------
*
* In case any real-time OS is used, define its name(e.g. FREERTOS).
* Otherwise, define "SINGLE_THREADED". They are exclusive each other.
*
*----------------------------------------------------------------------------*/
#define FREERTOS
#define FREERTOS_TCP
/*-- Cipher related definitions -----------------------------------------------
*
*
*----------------------------------------------------------------------------*/
#define NO_DEV_RANDOM
#define NO_MD4
#define WOLFSSL_DH_CONST
#define HAVE_TLS_EXTENSIONS
#define HAVE_AESGCM
#define HAVE_AESCCM
#define HAVE_AES_CBC
#define WOLFSSL_SHA512
#define HAVE_SUPPORTED_CURVES
#define HAVE_ECC
#define HAVE_CURVE25519
#define CURVE25519_SMALL
#define WOLFSSL_STATIC_RSA
/* USE_ECC_CERT
* This macro is for selecting root CA certificate to load, it is valid only
* in example applications. wolfSSL does not refer this macro.
* If you want to use cipher suites including ECDSA authentication in
* the example applications with TSIP, enable this macro.
* In TSIP 1.13 or later version, following cipher suites are
* available:
* - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
* - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SAH256
*
* Note that, this macro disables cipher suites including RSA
* authentication such as:
* - TLS_RSA_WITH_AES_128_CBC_SHA
* - TLS_RSA_WITH_AES_256_CBC_SHA
* - TLS_RSA_WITH_AES_128_CBC_SHA256
* - TLS_RSA_WITH_AES_256_CBC_SHA256
* - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
* - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA256
*
*/
#define USE_ECC_CERT
/* In this example application, Root CA cert buffer named
* "ca_ecc_cert_der_256" is used under the following macro definition
* for ECDSA.
*/
#define USE_CERT_BUFFERS_256
/* In this example application, Root CA cert buffer named
* "ca_cert_der_2048" is used under the following macro definition
* for RSA authentication.
*/
#define USE_CERT_BUFFERS_2048
/*-- Misc definitions ---------------------------------------------------------
*
*
*----------------------------------------------------------------------------*/
#define SIZEOF_LONG_LONG 8
/*
* -- "NO_ASN_TIME" macro is to avoid certificate expiration validation --
*
* Note. In your actual products, do not forget to comment-out
* "NO_ASN_TIME" macro. And prepare time function to get calender time,
* otherwise, certificate expiration validation will not work.
*/
/*#define NO_ASN_TIME*/
#define NO_MAIN_DRIVER
#define BENCH_EMBEDDED
#define NO_WOLFSSL_DIR
#define WOLFSSL_NO_CURRDIR
#define NO_FILESYSTEM
#define WOLFSSL_LOG_PRINTF
#define WOLFSSL_HAVE_MIN
#define WOLFSSL_HAVE_MAX
#define WOLFSSL_SMALL_STACK
#define NO_WRITEV
#define WOLFSSL_USER_CURRTIME /* for benchmark */
#define TIME_OVERRIDES
#define XTIME time
#define WOLFSSL_GMTIME
#define XGMTIME(c,t) gmtime(c)
#define USE_WOLF_SUSECONDS_T
#define USE_WOLF_TIMEVAL_T
#define XSTRNCASECMP(s1,s2,n) strncmp(s1,s2,n)
#define WC_RSA_BLINDING
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#define USE_FAST_MATH
/*-- Debugging options ------------------------------------------------------
*
* "DEBUG_WOLFSSL" definition enables log to output into stdout.
* Note: wolfSSL_Debugging_ON() must be called just after wolfSSL_Init().
*----------------------------------------------------------------------------*/
/*#define DEBUG_WOLFSSL*/
/*-- Definitions for functionality negation -----------------------------------
*
*
*----------------------------------------------------------------------------*/
/*#define NO_RENESAS_TSIP_CRYPT*/
/*#define NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION*/
#if defined(WOLFCRYPT_ONLY)
#undef WOLFSSL_RENESAS_TSIP
#endif
/*-- Consistency checking between definitions ---------------------------------
*
*
*----------------------------------------------------------------------------*/
/*-- TSIP TLS specific definitions --*/
#if defined(WOLFSSL_RENESAS_TSIP)
#if !defined(WOLFSSL_RENESAS_TSIP_VER)
#error "WOLFSSL_RENESAS_TSIP_VER is required to be defined and have value"
#endif
#endif
/*-- Complementary definitions ------------------------------------------------
*
*
*----------------------------------------------------------------------------*/
#if defined(WOLFSSL_RENESAS_TSIP)
#if !defined(NO_RENESAS_TSIP_CRYPT)
#define WOLFSSL_RENESAS_TSIP_CRYPT
#define WOLFSSL_RENESAS_TSIP_TLS
#define WOLFSSL_RENESAS_TSIP_TLS_AES_CRYPT
#define HAVE_PK_CALLBACKS
#define WOLF_CRYPTO_CB
#endif
#else
#define OPENSSL_EXTRA
#define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */
#endif
/*-- TLS version and required definitions --*/
#if defined(WOLFSSL_TLS13)
#define HAVE_FFDHE_2048
#define HAVE_HKDF
#define WC_RSA_PSS
#endif
/*-- strcasecmp */
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))

View File

@@ -0,0 +1,504 @@
/* wolfssl_demo.c
*
* Copyright (C) 2006-2022 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
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "FreeRTOS.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "platform/iot_network.h"
#include "platform.h"
#include <wolfssl/wolfcrypt/settings.h>
#include "wolfssl/ssl.h"
#include <wolfssl/wolfio.h>
#include "wolfssl/certs_test.h"
#include "wolfssl/wolfcrypt/types.h"
#include "wolfssl_demo.h"
#include <wolfcrypt/test/test.h>
#include <wolfcrypt/benchmark/benchmark.h>
#if defined(BENCHMARK)
#include "r_cmt_rx_if.h"
#endif
#if defined(TLS_CLIENT)
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
#include "key_data.h"
#include <wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h>
extern const st_key_block_data_t g_key_block_data;
user_PKCbInfo guser_PKCbInfo;
uint32_t g_encrypted_root_public_key[140];
static TsipUserCtx userContext;
#endif /* WOLFSSL_RENESAS_TSIP_TLS */
static WOLFSSL_CTX* client_ctx;
#endif /* TLS_CLIENT */
#define TLSSERVER_IP "192.168.1.14"
#define TLSSERVER_PORT 11111
#define YEAR 2022
#define MON 3
#define FREQ 10000 /* Hz */
static long tick;
static int tmTick;
/* time
* returns seconds from EPOCH
*/
time_t time(time_t *t)
{
(void)t;
return ((YEAR-1970)*365+30*MON)*24*60*60 + tmTick++;
}
/* timeTick
* called periodically by H/W timer to increase tmTick.
*/
#if defined(BENCHMARK)
static void timeTick(void* pdata)
{
(void)pdata;
tick++;
}
#endif
double current_time(int reset)
{
if(reset) tick = 0 ;
return ((double)tick/FREQ) ;
}
/* --------------------------------------------------------*/
/* Benchmark_demo */
/* --------------------------------------------------------*/
#if defined(BENCHMARK)
static void Benchmark_demo(void)
{
uint32_t channel;
R_CMT_CreatePeriodic(FREQ, &timeTick, &channel);
printf("Start wolfCrypt Benchmark\n");
benchmark_test(NULL);
printf("End wolfCrypt Benchmark\n");
}
#endif /* BENCHMARK */
/* --------------------------------------------------------*/
/* CryptTest_demo */
/* --------------------------------------------------------*/
#if defined(CRYPT_TEST)
static void CryptTest_demo(void)
{
int ret;
if ((ret = wolfCrypt_Init()) != 0) {
printf("wolfCrypt_Init failed %d\n", ret);
}
printf("Start wolfCrypt Test\n");
wolfcrypt_test(NULL);
printf("End wolfCrypt Test\n");
if ((ret = wolfCrypt_Cleanup()) != 0) {
printf("wolfCrypt_Cleanup failed %d\n", ret);
}
}
#endif /* CRYPT_TEST */
/* --------------------------------------------------------*/
/* Tls_client_demo */
/* --------------------------------------------------------*/
#if defined(TLS_CLIENT)
static void Tls_client_init(const char* cipherlist)
{
#ifndef NO_FILESYSTEM
#ifdef USE_ECC_CERT
char *cert = "./certs/ca-ecc-cert.pem";
#else
char *cert = "./certs/ca-cert.pem";
#endif
#else
#if defined(USE_ECC_CERT) && defined(USE_CERT_BUFFERS_256)
const unsigned char *cert = ca_ecc_cert_der_256;
#define SIZEOF_CERT sizeof_ca_ecc_cert_der_256
#else
const unsigned char *cert = ca_cert_der_2048;
#define SIZEOF_CERT sizeof_ca_cert_der_2048
#endif
#endif
client_ctx = NULL;
wolfSSL_Init();
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif
/* Create and initialize WOLFSSL_CTX */
if ((client_ctx =
wolfSSL_CTX_new(wolfSSLv23_client_method_ex((void *)NULL))) == NULL) {
printf("ERROR: failed to create WOLFSSL_CTX\n");
return;
}
#ifdef WOLFSSL_RENESAS_TSIP_TLS
tsip_set_callbacks(client_ctx);
#endif
/* load Root CA certificate */
#if defined(NO_FILESYSTEM)
if (wolfSSL_CTX_load_verify_buffer(client_ctx, cert,
SIZEOF_CERT, SSL_FILETYPE_ASN1) != SSL_SUCCESS) {
printf("ERROR: can't load certificate data\n");
return;
}
#else
if (wolfSSL_CTX_load_verify_locations(client_ctx, cert, 0) != SSL_SUCCESS) {
printf("ERROR: can't load \"%s\"\n", cert);
return NULL;
}
#endif
/* load client certificate */
#ifdef USE_ECC_CERT
if (wolfSSL_CTX_use_certificate_chain_buffer_format(client_ctx,
cliecc_cert_der_256,
sizeof_cliecc_cert_der_256,
WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
printf("ERROR: can't load client-certificate\n");
return;
}
#else
if (wolfSSL_CTX_use_certificate_chain_buffer_format(client_ctx,
client_cert_der_2048,
sizeof_client_cert_der_2048,
WOLFSSL_FILETYPE_ASN1) != SSL_SUCCESS) {
printf("ERROR: can't load client-certificate\n");
return;
}
#endif /* USE_ECC_CERT */
/* load client private key */
#ifdef USE_ECC_CERT
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_RENESAS_TSIP_TLS) && \
(WOLFSSL_RENESAS_TSIP_VER >= 115 )
if (tsip_set_clientPrivateKeyEnc(
g_key_block_data.encrypted_user_ecc256_private_key,
TSIP_ECCP256) != 0) {
printf("ERROR: can't load client-private key\n");
return;
}
#endif
if (wolfSSL_CTX_use_PrivateKey_buffer(client_ctx,
ecc_clikey_der_256,
sizeof_ecc_clikey_der_256,
SSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS) {
printf("ERROR: can't load private-key data.\n");
return;
}
#else
if (wolfSSL_CTX_use_PrivateKey_buffer(client_ctx,
client_key_der_2048,
sizeof_client_key_der_2048,
SSL_FILETYPE_ASN1)
!= WOLFSSL_SUCCESS) {
printf("ERROR: can't load private-key data.\n");
return;
}
#endif /* USE_ECC_CERT */
/* use specific cipher */
if (cipherlist != NULL &&
wolfSSL_CTX_set_cipher_list(client_ctx, cipherlist) !=
WOLFSSL_SUCCESS) {
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
printf("client can't set cipher list");
}
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_RENESAS_TSIP_TLS) && \
(WOLFSSL_RENESAS_TSIP_VER >= 115)
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
!= WOLFSSL_SUCCESS) {
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
printf("client can't set use supported curves\n");
return;
}
#endif
}
static void Tls_client()
{
#define BUFF_SIZE 256
#define ADDR_SIZE 16
int ret;
WOLFSSL_CTX* ctx = (WOLFSSL_CTX *)client_ctx;
WOLFSSL* ssl;
Socket_t socket;
socklen_t socksize = sizeof(struct freertos_sockaddr);
struct freertos_sockaddr PeerAddr;
char addrBuff[ADDR_SIZE] = {0};
static const char sendBuff[]= "Hello Server\n" ;
char rcvBuff[BUFF_SIZE] = {0};
/* create TCP socket */
socket = FreeRTOS_socket(FREERTOS_AF_INET,
FREERTOS_SOCK_STREAM,
FREERTOS_IPPROTO_TCP);
configASSERT(socket != FREERTOS_INVALID_SOCKET);
FreeRTOS_bind(socket, NULL, socksize);
/* attempt to connect TLS server */
PeerAddr.sin_addr = FreeRTOS_inet_addr(TLSSERVER_IP);
PeerAddr.sin_port = FreeRTOS_htons(TLSSERVER_PORT);
ret = FreeRTOS_connect(socket, &PeerAddr, sizeof(PeerAddr));
if (ret != 0) {
printf("ERROR FreeRTOS_connect: %d\n",ret);
}
/* create WOLFSSL object */
if (ret == 0) {
ssl = wolfSSL_new(ctx);
if (ssl == NULL) {
printf("ERROR wolfSSL_new: %d\n", wolfSSL_get_error(ssl, 0));
ret = -1;
}
}
if (ret == 0) {
#ifdef WOLFSSL_RENESAS_TSIP_TLS
tsip_set_callback_ctx(ssl, &userContext);
#endif
}
if (ret == 0) {
/* associate socket with ssl object */
if (wolfSSL_set_fd(ssl, (int)socket) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_set_fd: %d\n", wolfSSL_get_error(ssl, 0));
ret = -1;
}
}
if (ret == 0) {
if (wolfSSL_connect(ssl) != WOLFSSL_SUCCESS) {
printf("ERROR wolfSSL_connect: %d\n", wolfSSL_get_error(ssl, 0));
ret = -1;
}
}
if (ret == 0) {
if (wolfSSL_write(ssl, sendBuff, strlen(sendBuff)) !=
strlen(sendBuff)) {
printf("ERROR wolfSSL_write: %d\n", wolfSSL_get_error(ssl, 0));
ret = -1;
}
}
if (ret == 0) {
if ((ret=wolfSSL_read(ssl, rcvBuff, BUFF_SIZE -1)) < 0) {
printf("ERROR wolfSSL_read: %d\n", wolfSSL_get_error(ssl, 0));
ret = -1;
}
else {
rcvBuff[ret] = '\0';
printf("Received: %s\n\n", rcvBuff);
ret = 0;
}
}
wolfSSL_shutdown(ssl);
FreeRTOS_shutdown(socket, FREERTOS_SHUT_RDWR);
while(FreeRTOS_recv(socket, rcvBuff, BUFF_SIZE -1, 0) >=0) {
vTaskDelay(250);
}
FreeRTOS_closesocket(socket);
wolfSSL_free(ssl);
wolfSSL_CTX_free(ctx);
wolfSSL_Cleanup();
return;
}
static void Tls_client_demo(void)
{
/* setup ciphersuite list to use for TLS handshake */
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
#ifdef USE_ECC_CERT
const char* cipherlist[] = {
#if defined(WOLFSSL_TLS13)
"TLS13-AES128-GCM-SHA256",
"TLS13-AES128-CCM-SHA256",
#endif
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES128-SHA256"
};
int cipherlist_sz;
#if defined(WOLFSSL_TLS13)
cipherlist_sz = 2;
#else
cipherlist_sz = 2;
#endif
#else
const char* cipherlist[] = {
#if defined(WOLFSSL_TLS13)
"TLS13-AES128-GCM-SHA256",
"TLS13-AES128-CCM-SHA256",
#endif
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-SHA256",
"AES128-SHA",
"AES128-SHA256",
"AES256-SHA",
"AES256-SHA256"
};
int cipherlist_sz;
#if defined(WOLFSSL_TLS13)
cipherlist_sz = 2;
#else
cipherlist_sz = 6;
#endif
#endif
#else
const char* cipherlist[] = { NULL };
const int cipherlist_sz = 0;
#endif
int i = 0;
printf("/*------------------------------------------------*/\n");
printf(" TLS_Client demo\n");
printf(" - TLS server address:" TLSSERVER_IP " port: %d\n",
TLSSERVER_PORT);
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && (WOLFSSL_RENESAS_TSIP_VER >=109)
printf(" - with TSIP\n");
#endif
printf("/*------------------------------------------------*/\n");
/* setup credentials for TLS handshake */
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && (WOLFSSL_RENESAS_TSIP_VER >=109)
#if defined(USE_ECC_CERT)
/* Root CA cert has ECC-P256 public key */
tsip_inform_cert_sign((const byte*)ca_ecc_cert_der_sig);
#else
/* Root CA cert has RSA public key */
tsip_inform_cert_sign((const byte*)ca_cert_der_sig);
#endif
wc_tsip_inform_user_keys_ex(
(byte*)&g_key_block_data.encrypted_provisioning_key,
(byte*)&g_key_block_data.iv,
(byte*)&g_key_block_data.encrypted_user_rsa2048_ne_key,
encrypted_user_key_type);
#endif /* WOLFSSL_RENESAS_TSIP_TLS && (WOLFSSL_RENESAS_TSIP_VER >=109) */
do {
if(cipherlist_sz > 0 ) printf("cipher : %s\n", cipherlist[i]);
Tls_client_init(cipherlist[i]);
Tls_client();
i++;
} while (i < cipherlist_sz);
printf("End of TLS_Client demo.\n");
}
#endif /* TLS_CLIENT */
/* Demo entry function called by iot_demo_runner
* To run this entry function as an aws_iot_demo, define this as
* DEMO_entryFUNCTION in aws_demo_config.h.
*/
void wolfSSL_demo_task(bool awsIotMqttMode,
const char* pIdentifier,
void* pNetworkServerInfo,
void* pNetworkCredentialInfo,
const IotNetworkInterface_t* pNetworkInterface)
{
(void)awsIotMqttMode;
(void)pIdentifier;
(void)pNetworkServerInfo;
(void)pNetworkCredentialInfo;
(void)pNetworkInterface;
#if defined(CRYPT_TEST)
CryptTest_demo();
#elif defined(BENCHMARK)
Benchmark_demo();
#elif defined(TLS_CLIENT)
Tls_client_demo();
#endif
while (1) {
vTaskDelay(10000);
}
}

View File

@@ -0,0 +1,63 @@
/* wolfssl_demo.h
*
* Copyright (C) 2006-2022 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_DEMO_H_
#define WOLFSSL_DEMO_H_
/**************************************************/
/******* DO NOT CHANGE the following order ********/
/**************************************************/
/* Include logging header files and define logging macros in the following order:
* 1. Include the header file "logging_levels.h".
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
* the logging configuration for DEMO.
* 3. Include the header file "logging_stack.h", if logging is enabled for DEMO.
*/
#include "logging_levels.h"
/* Logging configuration for the Demo. */
#ifndef LIBRARY_LOG_NAME
#define LIBRARY_LOG_NAME "WOLFSSL_Demo"
#endif
#ifndef LIBRARY_LOG_LEVEL
#define LIBRARY_LOG_LEVEL LOG_INFO
#endif
#include "logging_stack.h"
/* Enable wolfcrypt test demo */
/*#define CRYPT_TEST*/
/* Enable benchmark demo */
/*#define BENCHMARK*/
/* Enable TLS client demo */
/* cannot enable with other definition */
#define TLS_CLIENT
#endif /* WOLFSSL_DEMO_H_ */