From c402947e3e5eff8368ab1e458014b831fd39c779 Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Tue, 23 Apr 2019 16:30:24 +0900 Subject: [PATCH 1/2] Add Renesas CS+ support and example server Fixed CC-RX compiler warning Fixed README --- ide/Renesas/cs+/README.md | 68 + ide/Renesas/cs+/README_jp.md | 80 + ide/Renesas/cs+/common/strings.h | 22 + ide/Renesas/cs+/common/unistd.h | 22 + ide/Renesas/cs+/common/user_settings.h | 62 + .../cs+/common/wolfssh_csplus_usersettings.h | 28 + ide/Renesas/cs+/demo_server/demo_server.mtpj | 1156 +++++++++ ide/Renesas/cs+/demo_server/wolfssh_demo.c | 651 +++++ ide/Renesas/cs+/demo_server/wolfssh_demo.h | 26 + ide/Renesas/cs+/demo_server/wolfssh_dummy.c | 55 + ide/Renesas/cs+/wolfssh_lib/wolfssh_lib.mtpj | 1250 ++++++++++ ide/Renesas/cs+/wolfssl_lib/wolfssl_lib.mtpj | 2172 +++++++++++++++++ ide/include.am | 2 + src/internal.c | 206 +- src/ssh.c | 2 +- wolfssh/port.h | 8 +- 16 files changed, 5705 insertions(+), 105 deletions(-) create mode 100644 ide/Renesas/cs+/README.md create mode 100644 ide/Renesas/cs+/README_jp.md create mode 100644 ide/Renesas/cs+/common/strings.h create mode 100644 ide/Renesas/cs+/common/unistd.h create mode 100644 ide/Renesas/cs+/common/user_settings.h create mode 100644 ide/Renesas/cs+/common/wolfssh_csplus_usersettings.h create mode 100644 ide/Renesas/cs+/demo_server/demo_server.mtpj create mode 100644 ide/Renesas/cs+/demo_server/wolfssh_demo.c create mode 100644 ide/Renesas/cs+/demo_server/wolfssh_demo.h create mode 100644 ide/Renesas/cs+/demo_server/wolfssh_dummy.c create mode 100644 ide/Renesas/cs+/wolfssh_lib/wolfssh_lib.mtpj create mode 100644 ide/Renesas/cs+/wolfssl_lib/wolfssl_lib.mtpj diff --git a/ide/Renesas/cs+/README.md b/ide/Renesas/cs+/README.md new file mode 100644 index 0000000..acac93a --- /dev/null +++ b/ide/Renesas/cs+/README.md @@ -0,0 +1,68 @@ +# wolfSSH/AlphaProject Boad Simple Ssh Example Server Setup Guide +This demo is tested with the following condition. + +* Renesas : CS+ v8.01 +* Board : Alpha Project AP-RX71M-0A w/ Sample program v2.0 +* wolfSSL : 4.0.0 +* wolfSSH : 1.3.1 + +## Setup process: +### 1. Download software + + - Unzip AlphaProject firmware + - Unzip wolfssl under the same directory + - Unzip wolfssh under the same directory + +### 2. Set up wolfSSL and wolfSSH + - Open wolfssh\ide\Renesas\cs+\wolfssl_lib\wolfssl_lib.mtpj with CS+ and build + - Open wolfssh\ide\Renesas\cs+\wolfssh_lib\wolfssh_lib.mtpj with CS+ and build + - Open demo_server.mtpj and build. This create demo program library. + +### 3. Set up AlphaProject + - The demo uses ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\ap_rx71m_0a_ether_sample_cs.mtpj + - Open and edit ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\AP_RX71M_0A.c + insert wolfSSL_init() in UsbfInit(). +``` + CanInit(); + SciInit(); + EthernetAppInit(); + UsbfInit(); + wolfSSL_init(); <- insert this line +``` + + - Modify stack and heap size in ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_config\r_bsp_config.h +``` + Line 154 #pragma stacksize su=0x2000 + Line 175 #define BSP_CFG_HEAP_BYTES (0xa000) +``` + - Modify IP address Sample\ap_rx71m_0a_usbfunc_sample_cs\src\tcp_sample\config_tcpudp.c as needed + +``` + #define MY_IP_ADDR0 192,168,1,200 /* Local IP address */ + #define GATEWAY_ADDR0 192,168,1,254 /* Gateway address (invalid if all 0s) */ + #define SUBNET_MASK0 255,255,255,0 +``` + - Add project properties of linking library in ap_rx71m_0a_usbfunc_sample_cs.mtpj + wolfssh\ide\Renesas\cs+\Projects\wolfssl_lib\DefaultBuild\wolfssl_lib.lib + wolfssh\ide\Renesas\cs+\Projects\wolfssh_lib\DefaultBuild\wolfssh_lib.lib +  wolfssh\ide\Renesas\cs+\Projects\demo_server\DefaultBuild\demo_sever.lib + + - Set CC-RX(Build Tool)->Library Geberation->Library Configuration to"C99" and enable ctype.h. + + - Build the project and start execut. You see message on the console prompting command. +``` + Start server_test +``` + - wolfSSH simple server will be open on port 50000 which can be connected to by using the example client bundled with wolfSSH +``` + $ ./examples/client/client -h 192.168.1.200 -p 50000 -u jill + Sample public key check callback + public key = 0x55a0890864ea + public key size = 279 + ctx = You've been sampled! + Password: <---- input "upthehill" + Server said: Hello, wolfSSH! +``` +## Support + +Email us at [support@wolfssl.com](mailto:support@wolfssl.com). diff --git a/ide/Renesas/cs+/README_jp.md b/ide/Renesas/cs+/README_jp.md new file mode 100644 index 0000000..1fa09e0 --- /dev/null +++ b/ide/Renesas/cs+/README_jp.md @@ -0,0 +1,80 @@ +# wolfSSH ƒVƒ“ƒvƒ‹ SSH ƒT[ƒo ƒZƒbƒgƒAƒbƒvƒKƒCƒh + +‚±‚̃fƒ‚‚͈ȉº‚̊‹«‚ŃeƒXƒg‚µ‚Ä‚¢‚Ü‚·B + +* Renesas : CS+ v8.01 +* Board : Alpha Project AP-RX71M-0A w/ Sample program v2.0 +* wolfSSL : 4.0.0 +* wolfSSH : 1.3.1 + +##ƒZƒbƒgƒAƒbƒvŽè‡F +### ‚P ƒ\ƒtƒgƒEƒFƒA‚Ì“üŽè + +- APƒ{[ƒh•t‘®‚̃\ƒtƒgƒEƒFƒAˆêŽ®‚ð“K“–‚ȃtƒHƒ‹ƒ_[‰º‚ɉ𓀂µ‚Ü‚·B +- “¯‚¶ƒtƒHƒ‹ƒ_[‰º‚ÉwolfsslˆêŽ®‚ð‰ð“€‚µ‚Ü‚·B +- “¯‚¶ƒtƒHƒ‹ƒ_[‰º‚ÉwolfsshˆêŽ®‚ð‰ð“š‚µ‚Ü‚·B +### ‚Q wolfSSL‹y‚ÑwolfSSH‚̃ZƒbƒgƒAƒbƒv + +- CS+‚É‚Äwolfssh\ide\Renesas\cs+\‰º‚Ìwolfssl_lib\wolfssl_lib.mtpj‚ðŠJ‚« + wolfSSLƒ‰ƒCƒuƒ‰ƒŠ[‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B +- CS+‚É‚Äwolfssh\ide\Renesas\cs+\‰º‚Ìwolfssh_lib\wolfssj_lib.mtpj‚ðŠJ‚« + wolfSShƒ‰ƒCƒuƒ‰ƒŠ[‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B +- “¯‚¶ƒtƒHƒ‹ƒ_‚̉º‚Ìdemo_server.mtpj‚ðŠJ‚«Aƒfƒ‚ƒvƒƒOƒ‰ƒ€‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B + ‚±‚̃vƒƒOƒ‰ƒ€‚àƒ‰ƒCƒuƒ‰ƒŠ[Œ`Ž®‚Ńrƒ‹ƒh‚³‚ê‚Ü‚·B + +### ‚R AlphaProject‘¤‚̃ZƒbƒgƒAƒbƒv +ƒfƒ‚‚Íap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_csƒtƒHƒ‹ƒ_‰º‚Ì +ap_rx71m_0a_usbfunc_sample_cs.mtpjƒvƒƒWƒFƒNƒg‚ð—˜—p‚µ‚Ü‚·B + +- ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_ether_sample_cs\srcƒtƒHƒ‹ƒ_‰º‚ÌAP_RX71M_0A.cƒtƒ@ƒCƒ‹‚ðŠJ‚«A + UsbfInit()‚̉º‚ÉwolfSSL_init()‚ð‘}“ü‚µ‚Ü‚·B + +``` + CanInit(); + SciInit(); + EthernetAppInit(); + UsbfInit(); + wolfSSL_init(); <- ‚±‚Ìs‚ð‘}“ü +``` +- ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_config\r_bsp_config.h + ‚ðŠJ‚«AƒXƒ^ƒbƒNƒTƒCƒY‚ƃq[ƒvƒTƒCƒY‚ðˆÈ‰º‚̂悤‚Éݒ肵‚Ü‚·B +@154s–Ú #pragma stacksize su=0x2000 +@175s–Ú #define BSP_CFG_HEAP_BYTES (0xa000) + +- IPƒAƒhƒŒƒX‚̃fƒtƒHƒ‹ƒg’l‚͈ȉº‚̂悤‚É‚È‚Á‚Ä‚¢‚Ü‚·B +@•K—v‚ª‚ ‚ê‚ÎASample\ap_rx71m_0a_ether_sample_cs\src\tcp_sample\config_tcpudp.c +@“à‚Ì139s–Ú‚©‚ç‚Ì’è‹`‚ð•ÏX‚µ‚Ü‚·B + +``` + #define MY_IP_ADDR0 192,168,1,200 /* Local IP address */ + #define GATEWAY_ADDR0 192,168,1,254 /* Gateway address (invalid if all 0s) */ + #define SUBNET_MASK0 255,255,255,0 /* Subnet mask */ +``` +- CS+‚Åap_rx71m_0a_usbfunc_sample_cs.mtpjƒvƒƒWƒFƒNƒg‚ðŠJ‚«AwolfSSLAwolfSSH‹y‚уfƒ‚ƒ‰ƒCƒuƒ‰ƒŠ‚ð +@“o˜^‚µ‚Ü‚·BCC-RX(ƒrƒ‹ƒhƒc[ƒ‹)->ƒŠƒ“ƒNEƒIƒvƒVƒ‡ƒ“ƒ^ƒu->Žg—p‚·‚郉ƒCƒuƒ‰ƒŠ‚É +@ˆÈ‰º‚Ì“ñ‚‚̃tƒ@ƒCƒ‹‚ð“o˜^‚µ‚Ü‚·B + + - CC-RX(ƒrƒ‹ƒhƒc[ƒ‹)->ƒ‰ƒCƒuƒ‰ƒŠ[ƒWƒFƒlƒŒ[ƒVƒ‡ƒ“ƒ^ƒu->ƒ‰ƒCƒuƒ‰ƒŠ[\¬‚ðuC99v‚ÉA + ctype.h‚ð—LŒø‚É‚·‚é‚ðu‚Í‚¢v‚Éݒ肵‚Ü‚·B + +- ƒvƒƒWƒFƒNƒg‚̃rƒ‹ƒhAƒ^[ƒQƒbƒg‚ւ̃_ƒEƒ“ƒ[ƒh‚ð‚µ‚½‚Ì‚¿A•\Ž¦->ƒfƒoƒbƒOEƒRƒ“ƒ\[ƒ‹ +@‚©‚çƒRƒ“ƒ\[ƒ‹‚ð•\Ž¦‚³‚¹‚Ü‚·BŽÀs‚ðŠJŽn‚·‚é‚ƃRƒ“ƒ\[ƒ‹‚Ɉȉº‚Ì•\Ž¦‚ªo—Í‚³‚ê‚Ü‚·B +``` + Start server_test +``` +- ƒVƒ“ƒvƒ‹ wolfSSH ƒT[ƒo‚ÍA50000”Ԃ̃|[ƒg‚ðŠJ‚¢‚Ä‘Ò‚¿‚Ü‚·BƒT[ƒo‚Ö‚ÍAwolfSSH‚É•tƒTƒ“ƒvƒ‹ƒNƒ‰ƒCƒAƒ“ƒg‚ð +Žg‚Á‚Ĉȉº‚̂悤‚ÉÚ‘±‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B +``` + $ ./examples/client/client -h 192.168.1.200 -p 50000 -u jill + Sample public key check callback + public key = 0x55a0890864ea + public key size = 279 + ctx = You've been sampled! + Password: <---- input "upthehill" + Server said: Hello, wolfSSH! +``` + +##@ƒTƒ|[ƒg +ƒTƒ|[ƒg‚ª•K—v‚ÈꇂÍA[support@wolfssl.com](mailto:support@wolfssl.com)‚Ö‚²˜A—‚­‚¾‚³‚¢B + +ˆÈã diff --git a/ide/Renesas/cs+/common/strings.h b/ide/Renesas/cs+/common/strings.h new file mode 100644 index 0000000..ca82580 --- /dev/null +++ b/ide/Renesas/cs+/common/strings.h @@ -0,0 +1,22 @@ +/* strings.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 + */ + +int strncasecmp(const char *s1, const char * s2, unsigned int sz); diff --git a/ide/Renesas/cs+/common/unistd.h b/ide/Renesas/cs+/common/unistd.h new file mode 100644 index 0000000..fe40e25 --- /dev/null +++ b/ide/Renesas/cs+/common/unistd.h @@ -0,0 +1,22 @@ +/* unistd.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 + */ + +/* DUMMY Header */ diff --git a/ide/Renesas/cs+/common/user_settings.h b/ide/Renesas/cs+/common/user_settings.h new file mode 100644 index 0000000..c933048 --- /dev/null +++ b/ide/Renesas/cs+/common/user_settings.h @@ -0,0 +1,62 @@ +/* user_settings.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 + */ +#define WOLFCRYPT_ONLY +#define NO_ERROR_STRINGS + +#define NO_MAIN_DRIVER +#define NO_WRITEV +#define NO_DEV_RANDOM +#define NO_WOLFSSL_DIR +#define NO_WOLFSSL_STUB +#define NO_DYNAMIC_ARRAY /* for compilers not allowed dynamic size array */ +#define NO_RC4 +#define NO_OLD_SHA256 +#define NO_FILESYSTEM + +#define WOLFSSL_NO_CURRDIR +#define WOLFSSL_LOG_PRINTF +#define WOLFSSL_SMALL_STACK +#define WOLFSSL_DH_CONST +#define WOLFSSL_USER_IO + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define HAVE_AESGCM +#define WOLFSSL_SHA512 +#define WOLFSSL_SHA384 +#define HAVE_ECC + +#define BENCH_EMBEDDED +#define USE_CERT_BUFFERS_2048 +#define SIZEOF_LONG_LONG 8 +#define USER_TIME +#define XTIME time +#define USE_WOLF_SUSECONDS_T +#define USE_WOLF_TIMEVAL_T +#define WOLFSSL_GENSEED_FORTEST /* Wardning: define your own seed gen */ + +#define SINGLE_THREADED /* or define RTOS option */ + +#include "wolfssh_csplus_usersettings.h" \ No newline at end of file diff --git a/ide/Renesas/cs+/common/wolfssh_csplus_usersettings.h b/ide/Renesas/cs+/common/wolfssh_csplus_usersettings.h new file mode 100644 index 0000000..3a8fb59 --- /dev/null +++ b/ide/Renesas/cs+/common/wolfssh_csplus_usersettings.h @@ -0,0 +1,28 @@ +/* wolfssh_csplus_usersettings..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 + */ + +#define RENESAS_CSPLUS +#define WIOCTL ws_Ioctl +//#define DEBUG_WOLFSSH +#define WOLFSSH_NO_TIMESTAMP +#define WOLFSSH_USER_IO +#define FIONREAD 1 +#define WOLFSSH_THREAD diff --git a/ide/Renesas/cs+/demo_server/demo_server.mtpj b/ide/Renesas/cs+/demo_server/demo_server.mtpj new file mode 100644 index 0000000..e79d831 --- /dev/null +++ b/ide/Renesas/cs+/demo_server/demo_server.mtpj @@ -0,0 +1,1156 @@ + + 9.01.00.00 + + + 2.0 + 9.1 + f77fb16a-3c3e-4baf-90a8-23fe338f86d7 + 3872a816-2ce9-4de2-8ecc-ac3804043601 + 4b78c3ec-0db8-4e34-a820-0758492b5587 + fb98844b-2c27-4275-9804-f6e63e204da0 + f77fb16a-3c3e-4baf-90a8-23fe338f86d7 + + + wolfssh_dummy.c + File + wolfssh_dummy.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 4b78c3ec-0db8-4e34-a820-0758492b5587 + + + wolfssh_demo.c + File + wolfssh_demo.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 4b78c3ec-0db8-4e34-a820-0758492b5587 + + + + + True + 0 + + + + + 7020d445-1358-4043-a8ea-3b101e73ceaa + f96683fa-8de4-4c6d-a1ab-925d7f232c09 + + + + + 0e793ff3-2e3f-43c0-bdc9-926269595403 + + + + + 1.0 + + + R5F571MLDxFC + 0 + + + + + 0 + R5F571MLDxFC + + + + + 3a79707d-5977-45f7-ac11-19c35e333132 + + + + + 1.4 + 1 + RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA + False + DefaultBuild + 533b1e24-2b33-4fa6-aed3-7a5b06457216 + CSource + debf22a5-334f-4123-866e-15becc0708ed + CSource + 2 + 0 + + + + DefaultBuild + + RXv2 + LibraryFile + False + True + True + Debug + src/smc_gen/r_t4_rx/lib/T4_Library_rxv1_ether_little.lib + + + %TargetFiles% + + + + +0 + %TargetFiles% : %Program% %Options% + RX600 + False + %BuildModeName% + None + Stype + Debug + False + + + Rebuild + Fpu + True + %BuildModeName% + None + True + True + False + Nodpfpu + %ProjectName%.mot + False + + False + Level2 + Little + + False + + False + False + Nearest + 1E + False + Size + Off + False + False + False + SinglePrecision + False + False + False + False + + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + False + -8586456914319795373 + DefaultBuild + + %TargetFiles% + %TargetFiles% : %Program% %Options% + False + + + RXv2 + LibraryFile + False + False + + +0 + RX600 + False + %BuildModeName% + None + Rebuild + Fpu + True + %BuildModeName% + False + Nodpfpu + %ProjectName%.mot + False + Little + + False + False + Nearest + False + Off + False + False + SinglePrecision + False + False + False + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + V3.01.00 + + + C + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\common +-include=..\..\..\.. +-include=..\..\..\..\..\wolfssl +-include=..\..\..\..\..\ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_t4_rx\lib +-define=WOLFSSL_USER_SETTINGS +-output=obj=%BuildModeName%\%FileLeaf%.obj +-debug +-optimize=max +-nologo + + + Auto + + D + 100 + + B + + + False + None + L + Auto + False + + W + + + False + False + Auto + + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + + False + Auto + No + False + True + Auto + + False + NoMap + + + None + False + No + Sjis + + False + + False + + Fpu + False + False + Auto + No + False + Sjis + False + -8586456106508325689 + C99 + False + False + Misra2012 + LevelMax + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + ..\common +..\..\..\.. +..\..\..\..\..\wolfssl +..\..\..\..\..\ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_t4_rx\lib + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\common +-include=..\..\..\.. +-include=..\..\..\..\..\wolfssl +-include=..\..\..\..\..\..\Users\darkb\work\05.Projects\06.Renesas_HandsOn\ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_t4_rx\lib +-define=WOLFSSL_USER_SETTINGS +-output=obj=%BuildModeName%\%FileLeaf%.obj +-debug +-optimize=max +-nologo + + WOLFSSL_USER_SETTINGS + + Auto + + D + 100 + + B + + + False + None + L + Auto + + W + + + False + False + Auto + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + False + Auto + No + False + True + Auto + + False + NoMap + + None + False + No + Sjis + + False + False + + Fpu + False + False + Auto + No + False + Sjis + + + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=%BuildModeName%\%FileLeaf%.obj +-debug +-nologo + + False + -8586456915272942418 + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=%BuildModeName%\%FileLeaf%.obj +-debug +-nologo + + + + False + Absolute + Stype + + None + None + False + + False + + Debug + + src/smc_gen/r_t4_rx/lib/T4_Library_rxv1_ether_little.lib + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + False + -8586456107149702059 + False + Absolute + Stype + + None + None + False + SU,SI,B_1,R_1,B_2,R_2,B,R/4,C_1,C_2,C,C$*,D*,W*,L,P*/FFC00000,EXCEPTVECT/FFFFFF80,RESETVECT/FFFFFFFC + False + + Debug + + src/smc_gen/r_t4_rx/lib/T4_Library_rxv1_ether_little.lib + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + _undefined_interrupt_source_isr + None + False + False + 0 + + + False + + + + + False + + + + False + + + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + False + -8586456915272932476 + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + + + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + False + -8586456107149702059 + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + + + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + True + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + False + -8586456914319795373 + C99 + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + + + 636915445705652944 + 0 + + + 636915445911824194 + 0 + + + -8586456057680144009 + False + True + False + -8586456914942951614 + False + True + False + + + + + True + 00000000-0000-0000-0000-000000000000 + + + + + + + + + + R5F571MLDxFC + + + + + 7d577131-4ec1-4e88-968d-89381f6c178a + + + + + 1.1 + + + False + False + False + True + Yes + Nanosecond + False + False + False + False + False + True + FilesNotToAnalyze + 0 + All + 0 + False + %ProjectName%.mtfl + %ProjectName%.mtvl + 10 + + + RealtimeSampling + + Synchronized + AtProgramStop + 20 + 1000000 + LineChart + False + PaleGreen + PaleTurquoise + 40ff0a4f + 405be416 + 40056def + 40ff541c + False + Auto + Channel01 + 0 + Rising + 0 + Orange + 10 + None + + + + + + + + + + + + + + + + + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + c0ff0a4f + c05be416 + c0056dff + c0ff541c + c04fc1ff + c0a932ff + c0ffd91c + c0ff30a5 + c0bee02f + c05510ff + c0ff97e4 + c0913a37 + c0c68e15 + c0317f0c + c060493e + c072808e + + + + + 90536345-15c8-40cb-957c-e59974e4bf78 + + + + + C:\workspace\wolfssh\ide\Renesas\cs+\demo_serv + C:\Program Files (x86)\Renesas Electronics\SmartConfigurator\RX\eclipse\SmartConfigurator.exe + 9d12be9d-513b-47e6-ad99-0da0012959a6 + demo_server.scfg + + + + + 9.01.00.00 + + + diff --git a/ide/Renesas/cs+/demo_server/wolfssh_demo.c b/ide/Renesas/cs+/demo_server/wolfssh_demo.c new file mode 100644 index 0000000..2b6d952 --- /dev/null +++ b/ide/Renesas/cs+/demo_server/wolfssh_demo.c @@ -0,0 +1,651 @@ +/* wolfssh_demo.c + * + * Copyright (C) 2014-2019 wolfSSL Inc. + * + * This file is part of wolfSSH. + * + * wolfSSH 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 3 of the License, or + * (at your option) any later version. + * + * wolfSSH 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 wolfSSH. If not, see . + */ +#include +#include +#include "r_t4_itcpip.h" + +#define WOLFSSH_TEST_SERVER +#define WOLFSSH_TEST_THREADING + +#ifdef WOLFSSL_USER_SETTINGS + #include +#else + #include +#endif + +#include +#include +#include +#include +#include +#include "wolfssh_demo.h" + +#ifdef NO_FILESYSTEM + #include +#endif + +#define FREQ 10000 /* Hz */ + +#ifdef __cplusplus +//#include // Remove the comment when you use ios +//_SINT ios_base::Init::init_cnt; // Remove the comment when you use ios +#endif + + +static long tick; +static void timeTick(void *pdata) +{ + tick++; +} + +#ifndef NO_WOLFSSH_SERVER + +static const char serverBanner[] = "wolfSSH Example Server\n"; + +typedef struct { + WOLFSSH* ssh; + ID fd; +} thread_ctx_t; + + +#ifndef EXAMPLE_HIGHWATER_MARK + #define EXAMPLE_HIGHWATER_MARK 0x3FFF8000 /* 1GB - 32kB */ +#endif +#ifndef EXAMPLE_BUFFER_SZ + #define EXAMPLE_BUFFER_SZ 4096 +#endif +#define SCRATCH_BUFFER_SZ 1200 + +static int my_IORecv(WOLFSSH* ssh, void* buff, word32 sz, void* ctx) +{ + int ret; + ID cepid; + if(ctx != NULL)cepid = *(ID *)ctx; + else return WS_CBIO_ERR_GENERAL; + + ret = tcp_rcv_dat(cepid, buff, sz, TMO_FEVR); + + return ret; +} + +static int my_IOSend(WOLFSSH* ssh, void* buff, word32 sz, void* ctx) +{ + int ret; + ID cepid; + + if(ctx != NULL)cepid = *(ID *)ctx; + else return WS_CBIO_ERR_GENERAL; + + ret = tcp_snd_dat(cepid, buff, sz, TMO_FEVR); + + return ret; +} + +static byte find_char(const byte* str, const byte* buf, word32 bufSz) +{ + const byte* cur; + + while (bufSz) { + cur = str; + while (*cur != '\0') { + if (*cur == *buf) + return *cur; + cur++; + } + buf++; + bufSz--; + } + + return 0; +} + + +static int dump_stats(thread_ctx_t* ctx) +{ + char stats[1024]; + word32 statsSz; + word32 txCount, rxCount, seq, peerSeq; + + wolfSSH_GetStats(ctx->ssh, &txCount, &rxCount, &seq, &peerSeq); + + printf(stats, + "Statistics for Thread #%u:\r\n" + " txCount = %u\r\n rxCount = %u\r\n" + " seq = %u\r\n peerSeq = %u\r\n", + 0, txCount, rxCount, seq, peerSeq); + statsSz = (word32)strlen(stats); + + fprintf(stderr, "%s", stats); + return wolfSSH_stream_send(ctx->ssh, (byte*)stats, statsSz); +} + + + +static int server_worker(void* vArgs) +{ + int ret; + thread_ctx_t* threadCtx = (thread_ctx_t*)vArgs; + + ret = wolfSSH_accept(threadCtx->ssh); + + if (ret == WS_SUCCESS) { + byte* buf = NULL; + byte* tmpBuf; + int bufSz, backlogSz = 0, rxSz, txSz, stop = 0, txSum; + + do { + bufSz = EXAMPLE_BUFFER_SZ + backlogSz; + + tmpBuf = (byte*)realloc(buf, bufSz); + + if (tmpBuf == NULL) + stop = 1; + else + buf = tmpBuf; + + XMEMSET(buf, 0, bufSz); + + if (!stop) { + do { + rxSz = wolfSSH_stream_read(threadCtx->ssh, + buf + backlogSz, + EXAMPLE_BUFFER_SZ); + if (rxSz <= 0) + rxSz = wolfSSH_get_error(threadCtx->ssh); + } while (rxSz == WS_WANT_READ || rxSz == WS_WANT_WRITE); + + if (rxSz > 0) { + backlogSz += rxSz; + txSum = 0; + txSz = 0; + printf("Client said = %s \n", buf); + while (backlogSz != txSum && txSz >= 0 && !stop) { + txSz = wolfSSH_stream_send(threadCtx->ssh, + buf + txSum, + backlogSz - txSum); + + if (txSz > 0) { + byte c; + const byte matches[] = { 0x03, 0x05, 0x06, 0x00 }; + + c = find_char(matches, buf + txSum, txSz); + switch (c) { + case 0x03: + stop = 1; + break; + case 0x06: + if (wolfSSH_TriggerKeyExchange(threadCtx->ssh) + != WS_SUCCESS) + stop = 1; + break; + case 0x05: + if (dump_stats(threadCtx) <= 0) + stop = 1; + break; + } + txSum += txSz; + } + else if (txSz != WS_REKEYING) + stop = 1; + } + + if (txSum < backlogSz) + memmove(buf, buf + txSum, backlogSz - txSum); + backlogSz -= txSum; + } + else + stop = 1; + } + } while (!stop); + + free(buf); + } + + wolfSSH_stream_exit(threadCtx->ssh, 0); + tcp_sht_cep(threadCtx->fd); + wolfSSH_free(threadCtx->ssh); + free(threadCtx); + + return 0; +} + +/* returns buffer size on success */ +static int load_key(byte isEcc, byte* buf, word32 bufSz) +{ + word32 sz = 0; + +#ifndef NO_FILESYSTEM + const char* bufName; + bufName = isEcc ? "./keys/server-key-ecc.der" : + "./keys/server-key-rsa.der" ; + sz = load_file(bufName, buf, bufSz); +#else + /* using buffers instead */ + if (isEcc) { + if (sizeof_ecc_key_der_256 > bufSz) { + return 0; + } + WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256); + sz = sizeof_ecc_key_der_256; + } + else { + if (sizeof_rsa_key_der_2048 > bufSz) { + return 0; + } + WMEMCPY(buf, rsa_key_der_2048, sizeof_rsa_key_der_2048); + sz = sizeof_rsa_key_der_2048; + } +#endif + + return sz; +} + + +static INLINE void c32toa(word32 u32, byte* c) +{ + c[0] = (u32 >> 24) & 0xff; + c[1] = (u32 >> 16) & 0xff; + c[2] = (u32 >> 8) & 0xff; + c[3] = u32 & 0xff; +} + + +/* Map user names to passwords */ +/* Use arrays for username and p. The password or public key can + * be hashed and the hash stored here. Then I won't need the type. */ +typedef struct PwMap { + byte type; + byte username[32]; + word32 usernameSz; + byte p[SHA256_DIGEST_SIZE]; + struct PwMap* next; +} PwMap; + + +typedef struct PwMapList { + PwMap* head; +} PwMapList; + + +static PwMap* PwMapNew(PwMapList* list, byte type, const byte* username, + word32 usernameSz, const byte* p, word32 pSz) +{ + PwMap* map; + + map = (PwMap*)malloc(sizeof(PwMap)); + if (map != NULL) { + Sha256 sha; + byte flatSz[4]; + + map->type = type; + if (usernameSz >= sizeof(map->username)) + usernameSz = sizeof(map->username) - 1; + memcpy(map->username, username, usernameSz + 1); + map->username[usernameSz] = 0; + map->usernameSz = usernameSz; + + wc_InitSha256(&sha); + c32toa(pSz, flatSz); + wc_Sha256Update(&sha, flatSz, sizeof(flatSz)); + wc_Sha256Update(&sha, p, pSz); + wc_Sha256Final(&sha, map->p); + + map->next = list->head; + list->head = map; + } + + return map; +} + + +static void PwMapListDelete(PwMapList* list) +{ + if (list != NULL) { + PwMap* head = list->head; + + while (head != NULL) { + PwMap* cur = head; + head = head->next; + memset(cur, 0, sizeof(PwMap)); + free(cur); + } + } +} + + +static const char samplePasswordBuffer[] = + "jill:upthehill\n" + "jack:fetchapail\n"; + + +static const char samplePublicKeyEccBuffer[] = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAA" + "BBBNkI5JTP6D0lF42tbxX19cE87hztUS6FSDoGvPfiU0CgeNSbI+aFdKIzTP5CQEJSvm25" + "qUzgDtH7oyaQROUnNvk= hansel\n" + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAA" + "BBBKAtH8cqaDbtJFjtviLobHBmjCtG56DMkP6A4M2H9zX2/YCg1h9bYS7WHd9UQDwXO1Hh" + "IZzRYecXh7SG9P4GhRY= gretel\n"; + + +static const char samplePublicKeyRsaBuffer[] = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9P3ZFowOsONXHD5MwWiCciXytBRZGho" + "MNiisWSgUs5HdHcACuHYPi2W6Z1PBFmBWT9odOrGRjoZXJfDDoPi+j8SSfDGsc/hsCmc3G" + "p2yEhUZUEkDhtOXyqjns1ickC9Gh4u80aSVtwHRnJZh9xPhSq5tLOhId4eP61s+a5pwjTj" + "nEhBaIPUJO2C/M0pFnnbZxKgJlX7t1Doy7h5eXxviymOIvaCZKU+x5OopfzM/wFkey0EPW" + "NmzI5y/+pzU5afsdeEWdiQDIQc80H6Pz8fsoFPvYSG+s4/wz0duu7yeeV1Ypoho65Zr+pE" + "nIf7dO0B8EblgWt+ud+JI8wrAhfE4x hansel\n" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqDwRVTRVk/wjPhoo66+Mztrc31KsxDZ" + "+kAV0139PHQ+wsueNpba6jNn5o6mUTEOrxrz0LMsDJOBM7CmG0983kF4gRIihECpQ0rcjO" + "P6BSfbVTE9mfIK5IsUiZGd8SoE9kSV2pJ2FvZeBQENoAxEFk0zZL9tchPS+OCUGbK4SDjz" + "uNZl/30Mczs73N3MBzi6J1oPo7sFlqzB6ecBjK2Kpjus4Y1rYFphJnUxtKvB0s+hoaadru" + "biE57dK6BrH5iZwVLTQKux31uCJLPhiktI3iLbdlGZEctJkTasfVSsUizwVIyRjhVKmbdI" + "RGwkU38D043AR1h0mUoGCPIKuqcFMf gretel\n"; + + +static int LoadPasswordBuffer(byte* buf, word32 bufSz, PwMapList* list) +{ + char* str = (char*)buf; + char* delimiter; + char* username; + char* password; + + /* Each line of passwd.txt is in the format + * username:password\n + * This function modifies the passed-in buffer. */ + + if (list == NULL) + return -1; + + if (buf == NULL || bufSz == 0) + return 0; + + while (*str != 0) { + delimiter = strchr(str, ':'); + username = str; + *delimiter = 0; + password = delimiter + 1; + str = strchr(password, '\n'); + *str = 0; + str++; + if (PwMapNew(list, WOLFSSH_USERAUTH_PASSWORD, + (byte*)username, (word32)strlen(username), + (byte*)password, (word32)strlen(password)) == NULL ) { + + return -1; + } + } + + return 0; +} + + +static int LoadPublicKeyBuffer(byte* buf, word32 bufSz, PwMapList* list) +{ + char* str = (char*)buf; + char* delimiter; + byte* publicKey64; + word32 publicKey64Sz; + byte* username; + word32 usernameSz; + byte publicKey[300]; + word32 publicKeySz; + + /* Each line of passwd.txt is in the format + * ssh-rsa AAAB3BASE64ENCODEDPUBLICKEYBLOB username\n + * This function modifies the passed-in buffer. */ + if (list == NULL) + return -1; + + if (buf == NULL || bufSz == 0) + return 0; + + while (*str != 0) { + /* Skip the public key type. This example will always be ssh-rsa. */ + delimiter = strchr(str, ' '); + str = delimiter + 1; + delimiter = strchr(str, ' '); + publicKey64 = (byte*)str; + *delimiter = 0; + publicKey64Sz = (word32)(delimiter - str); + str = delimiter + 1; + delimiter = strchr(str, '\n'); + username = (byte*)str; + *delimiter = 0; + usernameSz = (word32)(delimiter - str); + str = delimiter + 1; + publicKeySz = sizeof(publicKey); + + if (Base64_Decode(publicKey64, publicKey64Sz, + publicKey, &publicKeySz) != 0) { + + return -1; + } + + if (PwMapNew(list, WOLFSSH_USERAUTH_PUBLICKEY, + username, usernameSz, + publicKey, publicKeySz) == NULL ) { + + return -1; + } + } + + return 0; +} + + +static int wsUserAuth(byte authType, + WS_UserAuthData* authData, + void* ctx) +{ + PwMapList* list; + PwMap* map; + byte authHash[SHA256_DIGEST_SIZE]; + + if (ctx == NULL) { + fprintf(stderr, "wsUserAuth: ctx not set"); + return WOLFSSH_USERAUTH_FAILURE; + } + + if (authType != WOLFSSH_USERAUTH_PASSWORD && + authType != WOLFSSH_USERAUTH_PUBLICKEY) { + + return WOLFSSH_USERAUTH_FAILURE; + } + + /* Hash the password or public key with its length. */ + { + Sha256 sha; + byte flatSz[4]; + wc_InitSha256(&sha); + if (authType == WOLFSSH_USERAUTH_PASSWORD) { + c32toa(authData->sf.password.passwordSz, flatSz); + wc_Sha256Update(&sha, flatSz, sizeof(flatSz)); + wc_Sha256Update(&sha, + authData->sf.password.password, + authData->sf.password.passwordSz); + } + else if (authType == WOLFSSH_USERAUTH_PUBLICKEY) { + c32toa(authData->sf.publicKey.publicKeySz, flatSz); + wc_Sha256Update(&sha, flatSz, sizeof(flatSz)); + wc_Sha256Update(&sha, + authData->sf.publicKey.publicKey, + authData->sf.publicKey.publicKeySz); + } + wc_Sha256Final(&sha, authHash); + } + + list = (PwMapList*)ctx; + map = list->head; + + while (map != NULL) { + if (authData->usernameSz == map->usernameSz && + memcmp(authData->username, map->username, map->usernameSz) == 0) { + + if (authData->type == map->type) { + if (memcmp(map->p, authHash, SHA256_DIGEST_SIZE) == 0) { + return WOLFSSH_USERAUTH_SUCCESS; + } + else { + return (authType == WOLFSSH_USERAUTH_PASSWORD ? + WOLFSSH_USERAUTH_INVALID_PASSWORD : + WOLFSSH_USERAUTH_INVALID_PUBLICKEY); + } + } + else { + return WOLFSSH_USERAUTH_INVALID_AUTHTYPE; + } + } + map = map->next; + } + + return WOLFSSH_USERAUTH_INVALID_USER; +} + + +int server_test(void) +{ + WOLFSSH_CTX* ctx = NULL; + PwMapList pwMapList; + word32 defaultHighwater = EXAMPLE_HIGHWATER_MARK; + int useEcc = 0; + int multipleConnections = 0; + ID cepid = 1; + ID repid = 1; + ER ercd; + T_IPV4EP dst_addr = {0, 0}; + + printf("Start server_test\n"); + if (wolfSSH_Init() != WS_SUCCESS) { + fprintf(stderr, "Couldn't initialize wolfSSH.\n"); + return(EXIT_FAILURE); + } + + ctx = wolfSSH_CTX_new(WOLFSSH_ENDPOINT_SERVER, NULL); + if (ctx == NULL) { + fprintf(stderr, "Couldn't allocate SSH CTX data.\n"); + return(EXIT_FAILURE); + } + + memset(&pwMapList, 0, sizeof(pwMapList)); + wolfSSH_SetUserAuth(ctx, wsUserAuth); + wolfSSH_CTX_SetBanner(ctx, serverBanner); + + { + const char* bufName; + byte buf[SCRATCH_BUFFER_SZ]; + word32 bufSz; + + bufSz = load_key(useEcc, buf, SCRATCH_BUFFER_SZ); + if (bufSz == 0) { + fprintf(stderr, "Couldn't load key.\n"); + return(EXIT_FAILURE); + } + if (wolfSSH_CTX_UsePrivateKey_buffer(ctx, buf, bufSz, + WOLFSSH_FORMAT_ASN1) < 0) { + fprintf(stderr, "Couldn't use key buffer.\n"); + return(EXIT_FAILURE); + } + + bufSz = (word32)strlen(samplePasswordBuffer); + memcpy(buf, samplePasswordBuffer, bufSz); + buf[bufSz] = 0; + LoadPasswordBuffer(buf, bufSz, &pwMapList); + + bufName = useEcc ? samplePublicKeyEccBuffer : + samplePublicKeyRsaBuffer; + bufSz = (word32)strlen(bufName); + memcpy(buf, bufName, bufSz); + buf[bufSz] = 0; + LoadPublicKeyBuffer(buf, bufSz, &pwMapList); + } + + /* Register callbacks */ + wolfSSH_SetIORecv(ctx, my_IORecv); + wolfSSH_SetIOSend(ctx, my_IOSend); + + do { + + WOLFSSH* ssh; + thread_ctx_t* threadCtx; + + threadCtx = (thread_ctx_t*)malloc(sizeof(thread_ctx_t)); + if (threadCtx == NULL) { + fprintf(stderr, "Couldn't allocate thread context data.\n"); + return(EXIT_FAILURE); + } + + ssh = wolfSSH_new(ctx); + if (ssh == NULL) { + fprintf(stderr, "Couldn't allocate SSH data.\n"); + return(EXIT_FAILURE); + } + wolfSSH_SetUserAuthCtx(ssh, &pwMapList); + /* Use the session object for its own highwater callback ctx */ + if (defaultHighwater > 0) { + wolfSSH_SetHighwaterCtx(ssh, (void*)ssh); + wolfSSH_SetHighwater(ssh, defaultHighwater); + } + printf("Waiting connection from client\n"); + if((ercd = tcp_acp_cep(cepid, repid, &dst_addr, TMO_FEVR)) != E_OK) { + printf("ERROR TCP Accept: %d\n", ercd); + return -1; + } + wolfSSH_SetIOReadCtx(ssh, (void *)&cepid); + wolfSSH_SetIOWriteCtx(ssh, (void *)&cepid); + + threadCtx->ssh = ssh; + threadCtx->fd = cepid; + server_worker(threadCtx); + + } while (multipleConnections); + + PwMapListDelete(&pwMapList); + wolfSSH_CTX_free(ctx); + if (wolfSSH_Cleanup() != WS_SUCCESS) { + fprintf(stderr, "Couldn't clean up wolfSSH.\n"); + return(EXIT_FAILURE); + } +#if defined(HAVE_ECC) && defined(FP_ECC) && defined(HAVE_THREAD_LS) + wc_ecc_fp_free(); /* free per thread cache */ +#endif + printf("End server_test\n"); + return 0; +} + +#endif /* NO_WOLFSSH_SERVER */ + +void wolfSSH_init(void) +{ + uint32_t channel; + R_CMT_CreatePeriodic(FREQ, &timeTick, &channel); +#if defined(DEBUG_WOLFSSH) + wolfSSH_Debugging_ON(); +#endif + + server_test(); + +} + +#ifdef __cplusplus +void abort(void) +{ + +} +#endif \ No newline at end of file diff --git a/ide/Renesas/cs+/demo_server/wolfssh_demo.h b/ide/Renesas/cs+/demo_server/wolfssh_demo.h new file mode 100644 index 0000000..c7be24e --- /dev/null +++ b/ide/Renesas/cs+/demo_server/wolfssh_demo.h @@ -0,0 +1,26 @@ +/* wolfssh_demo.h + * + * Copyright (C) 2014-2019 wolfSSL Inc. + * + * This file is part of wolfSSH. + * + * wolfSSH 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 3 of the License, or + * (at your option) any later version. + * + * wolfSSH 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 wolfSSH. If not, see . + */ + +#ifndef __WOLFSSH_DEMO_H_ +#define __WOLFSSH_DEMO_H_ + +int server_test(void); + +#endif diff --git a/ide/Renesas/cs+/demo_server/wolfssh_dummy.c b/ide/Renesas/cs+/demo_server/wolfssh_dummy.c new file mode 100644 index 0000000..5f4c927 --- /dev/null +++ b/ide/Renesas/cs+/demo_server/wolfssh_dummy.c @@ -0,0 +1,55 @@ +/* wolfssh_dummy.c + * + * Copyright (C) 2014-2019 wolfSSL Inc. + * + * This file is part of wolfSSH. + * + * wolfSSH 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 3 of the License, or + * (at your option) any later version. + * + * wolfSSH 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 wolfSSH. If not, see . + */ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include +#include + +/* used for checking bytes on wire for window adjust packet read */ +void ws_Ioctl(int fd, int flag, int *ret) +{ + /* This needs to implement when using scp or sftp */ +} + +#define YEAR 2019 +#define APR 4 + +static int tick = 0; + +time_t time(time_t *t) +{ + return ((YEAR-1970)*365+30*APR)*24*60*60 + tick++; +} + +#include +int strncasecmp(const char *s1, const char * s2, unsigned int sz) +{ + for( ; sz>0; sz--, s1++, s2++){ + if(toupper(*s1) < toupper(*s2)){ + return -1; + } + if(toupper(*s1) > toupper(*s2)){ + return 1; + } + } + return 0; +} \ No newline at end of file diff --git a/ide/Renesas/cs+/wolfssh_lib/wolfssh_lib.mtpj b/ide/Renesas/cs+/wolfssh_lib/wolfssh_lib.mtpj new file mode 100644 index 0000000..81820f1 --- /dev/null +++ b/ide/Renesas/cs+/wolfssh_lib/wolfssh_lib.mtpj @@ -0,0 +1,1250 @@ + + 9.01.00.00 + + + 2.0 + 9.1 + dda66d22-5686-4f64-90e1-6365d4ffcb31 + 51dacb6f-88ee-4585-ba95-e4683f5c8985 + 0d709bd8-9ab9-4912-b072-3a698c221055 + fb98844b-2c27-4275-9804-f6e63e204da0 + dda66d22-5686-4f64-90e1-6365d4ffcb31 + + + internal.c + File + ..\..\..\..\src\internal.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + io.c + File + ..\..\..\..\src\io.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + keygen.c + File + ..\..\..\..\src\keygen.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + port.c + File + ..\..\..\..\src\port.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + ssh.c + File + ..\..\..\..\src\ssh.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + wolfterm.c + File + ..\..\..\..\src\wolfterm.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + log.c + File + ..\..\..\..\src\log.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + user_settings.h + File + ..\common\user_settings.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + 0d709bd8-9ab9-4912-b072-3a698c221055 + + + + + True + 0 + + + + + 7020d445-1358-4043-a8ea-3b101e73ceaa + f96683fa-8de4-4c6d-a1ab-925d7f232c09 + + + + + 0e793ff3-2e3f-43c0-bdc9-926269595403 + + + + + 1.0 + + + R5F571MLDxFC + 0 + + + + + 0 + R5F571MLDxFC + + + + + 3a79707d-5977-45f7-ac11-19c35e333132 + + + + + 1.4 + 1 + RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA + False + DefaultBuild + e71ad213-c6af-45fd-9b9e-8ad37cc5deee + CSource + 92b1c416-68a2-4d18-9afd-c53094b2a4a9 + CSource + fd3d6f5e-0064-45a9-ad70-d477bb564631 + CSource + a15b5264-f511-46c0-b4fc-44b9389d073c + CSource + 7988a48b-48d2-4735-b649-5fc77de02ac0 + CSource + 3083b97a-3ccf-416c-be9c-185a372db095 + CSource + 9a21a466-206a-4490-af31-6e7a3c8a995e + CSource + 7 + 0 + + + + DefaultBuild + + RXv2 + LibraryFile + False + True + True + Debug + + + %TargetFiles% + + + + +0 + %TargetFiles% : %Program% %Options% + RX600 + False + %BuildModeName% + None + Stype + Debug + False + + + Rebuild + Fpu + True + %BuildModeName% + None + True + True + False + Nodpfpu + %ProjectName%.mot + False + + False + Level2 + Little + + False + + False + False + Nearest + 1E + False + Size + Off + False + False + False + SinglePrecision + False + False + False + False + + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + False + -8586456935802950468 + DefaultBuild + + %TargetFiles% + %TargetFiles% : %Program% %Options% + False + + + RXv2 + LibraryFile + False + True + + +0 + RX600 + False + %BuildModeName% + None + Rebuild + Fpu + True + %BuildModeName% + False + Nodpfpu + %ProjectName%.mot + False + Little + + False + False + Nearest + False + Off + False + False + SinglePrecision + False + False + False + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + V3.01.00 + + + C + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\common +-include=..\..\..\.. +-include=..\..\..\..\..\wolfssl +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-optimize=max +-nologo + + + Auto + + D + 100 + + B + + + False + None + L + Auto + False + + W + + + False + False + Auto + + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + + False + Auto + No + False + True + Auto + + False + NoMap + + + None + False + No + Sjis + + False + + False + + Fpu + False + False + Auto + No + False + Sjis + False + -8586456304495195618 + C99 + False + False + Misra2012 + LevelMax + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + ..\common +..\..\..\.. +..\..\..\..\..\wolfssl + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\common +-include=..\..\..\.. +-include=..\..\..\..\..\wolfssl +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-optimize=max +-nologo + + WOLFSSL_USER_SETTINGS + + Auto + + D + 100 + + B + + + False + None + L + Auto + + W + + + False + False + Auto + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + False + Auto + No + False + True + Auto + + False + NoMap + + None + False + No + Sjis + + False + False + + Fpu + False + False + Auto + No + False + Sjis + + + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo + + False + -8586456935802940500 + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo + + + + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + False + -8586456932763740568 + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + + + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + False + -8586456935802930533 + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + + + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + False + -8586456932763740568 + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + + + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + True + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + False + -8586456935802930533 + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + + + 636915425405541373 + 0 + + + 636915425405541373 + 1 + + + 636915425405541373 + 2 + + + 636915429315325289 + 0 + + + 636915425405541373 + 4 + + + 636915425405541373 + 5 + + + 636915425405541373 + 6 + + + 636915560699380968 + 0 + + + -8586456935449234435 + False + True + False + -8586456935449234435 + False + True + False + -8586456935449234435 + False + True + False + -8586456935449234435 + False + True + False + -8586456935449234435 + False + True + False + -8586456935449234435 + False + True + False + -8586456931539440551 + False + True + False + + + + + True + 00000000-0000-0000-0000-000000000000 + + + + + + + + + + R5F571MLDxFC + + + + + 7d577131-4ec1-4e88-968d-89381f6c178a + + + + + 1.1 + + + False + False + False + True + Yes + Nanosecond + False + False + False + False + False + True + FilesNotToAnalyze + 0 + All + 0 + False + %ProjectName%.mtfl + %ProjectName%.mtvl + 10 + + + RealtimeSampling + + Synchronized + AtProgramStop + 20 + 1000000 + LineChart + False + PaleGreen + PaleTurquoise + 40ff0a4f + 405be416 + 40056def + 40ff541c + False + Auto + Channel01 + 0 + Rising + 0 + Orange + 10 + None + + + + + + + + + + + + + + + + + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + c0ff0a4f + c05be416 + c0056dff + c0ff541c + c04fc1ff + c0a932ff + c0ffd91c + c0ff30a5 + c0bee02f + c05510ff + c0ff97e4 + c0913a37 + c0c68e15 + c0317f0c + c060493e + c072808e + + + + + 90536345-15c8-40cb-957c-e59974e4bf78 + + + + + C:\workspace\wolfssh\ide\Renesas\cs+\wolfssh + C:\Program Files (x86)\Renesas Electronics\SmartConfigurator\RX\eclipse\SmartConfigurator.exe + 0df41a5b-518c-43bd-928a-e75d4c6415c5 + wolfssh_lib.scfg + + + + + 9.01.00.00 + + + \ No newline at end of file diff --git a/ide/Renesas/cs+/wolfssl_lib/wolfssl_lib.mtpj b/ide/Renesas/cs+/wolfssl_lib/wolfssl_lib.mtpj new file mode 100644 index 0000000..b3b9bad --- /dev/null +++ b/ide/Renesas/cs+/wolfssl_lib/wolfssl_lib.mtpj @@ -0,0 +1,2172 @@ + + 9.01.00.00 + + + 2.0 + 9.1 + 805a7df9-f7cc-472f-9206-7f15b6ccd6ac + d0def283-fa90-4332-b42c-8fccd3585a64 + e38de3e6-e537-43bc-9f7d-3958453b991f + fb98844b-2c27-4275-9804-f6e63e204da0 + 805a7df9-f7cc-472f-9206-7f15b6ccd6ac + + + src + Category + e38de3e6-e537-43bc-9f7d-3958453b991f + 1329e557-253c-4918-9334-b7a7bb78bcc3 + + + wolfcrypt + Category + e38de3e6-e537-43bc-9f7d-3958453b991f + b113ecd1-816e-459a-afa4-fbc8975bfcb1 + + + user_settings.h + File + ..\common\user_settings.h + 03cad1e8-2eb3-4cde-a8a3-982423631122 + e38de3e6-e537-43bc-9f7d-3958453b991f + + + src + Category + 78a99f10-6945-4b7b-ab83-895a78962b99 + b3a0ee4c-7893-43ab-aa14-cc84267a24b4 + + + aes.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\aes.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + arc4.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\arc4.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + asm.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\asm.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + asn.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\asn.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + blake2b.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\blake2b.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + camellia.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\camellia.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + chacha.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\chacha.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + chacha20_poly1305.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\chacha20_poly1305.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + cmac.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\cmac.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + coding.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\coding.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + compress.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\compress.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + cpuid.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\cpuid.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + curve25519.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\curve25519.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + des3.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\des3.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + dh.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\dh.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + dsa.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\dsa.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ecc.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ecc.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ecc_fp.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ecc_fp.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ed25519.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ed25519.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + error.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\error.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + fe_low_mem.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\fe_low_mem.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + fe_operations.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\fe_operations.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ge_low_mem.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ge_low_mem.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ge_operations.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ge_operations.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + hash.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\hash.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + hc128.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\hc128.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + hmac.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\hmac.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + idea.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\idea.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + integer.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\integer.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + logging.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\logging.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md2.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\md2.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md4.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\md4.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + md5.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\md5.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + memory.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\memory.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pkcs7.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\pkcs7.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pkcs12.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\pkcs12.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + poly1305.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\poly1305.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + pwdbased.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\pwdbased.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + rabbit.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\rabbit.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + random.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\random.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + ripemd.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\ripemd.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + rsa.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\rsa.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sha.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha3.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sha3.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha256.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sha256.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sha512.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sha512.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + signature.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\signature.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_int.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_int.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + srp.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\srp.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + tfm.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\tfm.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wc_encrypt.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\wc_encrypt.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wc_port.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\wc_port.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wolfevent.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\wolfevent.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + wolfmath.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\wolfmath.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_arm32.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_arm32.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_arm64.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_arm64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_c32.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_c32.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_c64.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_c64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + sp_x86_64.c + File + ..\..\..\..\..\wolfssl\wolfcrypt\src\sp_x86_64.c + 941832c1-fc3b-4e1b-94e8-01ea17128b42 + 2170607d-803e-45b0-80af-6507d495a8de + + + + + True + 0 + + + + + 0 + + + 0 + + + 0 + + + + + 7020d445-1358-4043-a8ea-3b101e73ceaa + f96683fa-8de4-4c6d-a1ab-925d7f232c09 + + + + + 0e793ff3-2e3f-43c0-bdc9-926269595403 + + + + + 1.0 + + + R5F571MLDxFC + 0 + + + + + 1 + R5F565N7BxFB + + + + + 3a79707d-5977-45f7-ac11-19c35e333132 + + + + + 1.4 + 1 + RABlAGYAYQB1AGwAdABCAHUAaQBsAGQA + False + DefaultBuild + cfc4ddef-2ff8-440d-9135-5e36e230a9d0 + CSource + 5e231ff0-c118-4dc7-a48b-4a49019341fd + CSource + 833048b3-3a29-4897-9e42-6442e3651b16 + CSource + 3fc95b85-bb90-43d5-aa79-b3fb598696f9 + CSource + 8dfd13ae-48b6-4617-823d-c9d47886b2f1 + CSource + ad6d521e-8d24-4e7f-b731-6c09014373d6 + CSource + 2ae5859b-d47d-4473-8868-5f8d4ccc13fd + CSource + 7a86f97b-01cd-4d3f-8266-1a51e412c9eb + CSource + 8a45bb03-e6c7-480d-bbf6-fa49d6a18fb8 + CSource + 77038a87-cf7c-49fa-804c-e0aa205e3577 + CSource + 32c7b2d9-0fbe-4b95-ae23-a72399676db7 + CSource + b70e920e-a6ab-45d9-8712-cb894c7be8ec + CSource + 5abad234-5533-4425-8868-ca5dd16c7b0a + CSource + e0ef155e-a525-41f6-a2a6-b2b932dd79da + CSource + cd628038-e785-4445-93d6-9767879ff444 + CSource + ab743436-e914-44a6-bb32-6e9f5970a157 + CSource + ff3b1bee-5d5f-4822-8450-8a4d7288893a + CSource + 2cab52f3-45f5-4a6b-bed5-c49c1fcb3154 + CSource + be5dce22-07e7-4fcd-bbc7-9fbca0808ee3 + CSource + 2de1ac30-78dd-4a8a-a4c1-b03e0a72f7c8 + CSource + 58a3c174-a180-48e2-8ecd-2a55bdc950f1 + CSource + e1d8a94d-79fe-411c-8af9-5deddb3f6e58 + CSource + 0e3a6c2a-0fd5-4d86-83d9-f0256ae9e1d2 + CSource + 19b17c0d-d6fe-4aa2-b534-d02d59b392cb + CSource + 1529a7d4-0b6c-4ea8-900a-ec81b5eac904 + CSource + 980e2f67-afb3-4b48-bc51-8de94240ee4f + CSource + 85c26e25-fbfe-4ece-afca-4d142c6ea135 + CSource + 74663551-9e8b-4269-9c36-d538d56a3414 + CSource + d2806186-287c-47e3-bf79-8daa033201cb + CSource + 83d865e6-46a2-49da-8549-b021d2114a0e + CSource + d2f5a477-e313-47c6-acd6-094c38f1ab1a + CSource + f45859b1-b772-490f-a33a-b5b4a5a3c588 + CSource + b471977c-7300-4655-bd30-3796dc3d258e + CSource + 3fdef9c1-79c2-4de3-b252-9e999235ac35 + CSource + 209f29fe-f9fe-4822-ab88-9feaad450052 + CSource + 9d5b45a5-4bed-444b-915c-b002bc2a2fa6 + CSource + 3ede6353-7678-4ee8-9a02-eab7215dc75a + CSource + 9bf244df-506e-4b4c-ad2f-e5dc9ee7dd98 + CSource + 97304576-9ee3-46bd-933a-d30ce60633b0 + CSource + 91aab859-8af5-44f1-a8c9-e80cce8db8ac + CSource + 344691e8-47e1-4656-8d67-554b79beeb09 + CSource + c70b46e7-e59d-4f63-b374-25c07445cbd9 + CSource + 84abe674-65a0-4a83-9950-b3b2de5541e8 + CSource + 97a9f706-2d1d-423b-ae9d-67f1953b4646 + CSource + 43097e29-0472-439a-94e3-12705379cb30 + CSource + 953be9ae-7876-4d95-bccf-4d9872e5893e + CSource + 811d4212-787b-4006-a87f-eb5c82ff497b + CSource + eb209abd-c2f3-40fc-b36d-3489af8c2789 + CSource + 27b7c24f-ed90-4cdf-9e0f-8b8c97d1ef3d + CSource + 9a47b4ee-7f6b-4b54-914a-d52b6c697869 + CSource + b1390d66-373b-4f43-9ec5-024078ccd77e + CSource + 815a4f81-17bf-43d9-8891-bbe2d22555a9 + CSource + 51299014-db14-4e23-a579-ae04ec1ff314 + CSource + 17e90222-3ae5-41b9-a3be-70013eae67f2 + CSource + 75311d1a-e849-465b-bb0b-77546709e1ec + CSource + 52c93bf0-a1fe-4691-afab-4b9811aade10 + CSource + 317a55ec-33e2-45da-be24-8bc5730885fe + CSource + 221078b7-a232-4160-8909-cbc48b3f6a2a + CSource + d1a109cd-a5af-4f79-8bef-7acd6d46c8db + CSource + 59 + 1 + + + + DefaultBuild + + RXv2 + LibraryFile + False + True + True + Debug + + + %TargetFiles% + + + + +0 + %TargetFiles% : %Program% %Options% + RX600 + False + %BuildModeName% + None + Stype + Debug + False + + + Rebuild + Fpu + True + %BuildModeName% + None + True + True + False + Nodpfpu + %ProjectName%.mot + False + + False + Level2 + Little + + False + + False + False + Nearest + 1E + False + Size + Off + False + False + False + SinglePrecision + False + False + False + False + + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + False + -8586456114514688139 + DefaultBuild + + %TargetFiles% + %TargetFiles% : %Program% %Options% + False + + + RXv2 + LibraryFile + False + True + + +0 + RX600 + False + %BuildModeName% + None + Rebuild + Fpu + True + %BuildModeName% + False + Nodpfpu + %ProjectName%.mot + False + Little + + False + False + Nearest + False + Off + False + False + SinglePrecision + False + False + False + False + + Unsigned + False + Unsigned + False + False + Right + False + False + False + None + Branch24 + None + None + 00000000 + None + None + False + V3.01.00 + + + C + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\..\..\..\..\wolfssl\openssl +-include=..\..\..\..\.. +-include=. +-include=..\common +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + + Auto + + D + 100 + + B + + + False + None + L + Auto + False + + W + + + False + False + Auto + + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + + False + Auto + No + False + True + Auto + + False + NoMap + + + None + False + No + Sjis + + False + + False + + Fpu + False + False + Auto + No + False + Sjis + False + -8586456110862248571 + C99 + False + False + Misra2012 + Level2 + Object + False + -output=obj + None + False + Cpp + None + %BuildModeName% + None + False + False + None + True + ..\..\..\..\..\wolfssl\wolfssl\openssl +..\..\..\..\..\wolfssl +. +..\common + + + + False + Size + Auto + + + P + False + + 2 + + + + C + False + -isa=rxv2 +-fpu +-include=..\..\..\..\..\wolfssl\openssl +-include=..\..\..\..\.. +-include=. +-include=..\common +-define=WOLFSSL_USER_SETTINGS +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + WOLFSSL_USER_SETTINGS + + Auto + + D + 100 + + B + + + False + None + L + Auto + + W + + + False + False + Auto + + False + Auto + + + False + No + Intrinsic + + False + + + Noinstalign + Intrinsic + False + False + Auto + No + False + True + Auto + + False + NoMap + + None + False + No + Sjis + + False + False + + Fpu + False + False + Auto + No + False + Sjis + + + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + False + -8586796872818976776 + False + False + + False + -output + %BuildModeName% + False + True + False + + False + False + + False + False + SJIS + False + False + + + + -isa=rxv2 +-fpu +-output=obj +-obj_path=%BuildModeName% +-debug +-nologo +-exec_time + + + + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + False + -8586456112146240378 + False + Absolute + Stype + + None + None + False + + False + + Debug + + + False + None + False + + False + False + False + %BuildModeName% + None + False + + + None + + False + %ProjectName%.abs + + 1E + False + + %BuildModeName% + + False + False + False + None + %ProjectName%.mot + False + NoMessage + False + False + + + False + + False + + None + + Auto + + False + None + + False + + FF + + False + False + + FF + False + + None + False + False + 0 + + + False + + + + + False + + + + False + + + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + False + -8586796872818966962 + Stype + True + True + NoMessage + %BuildModeName% + None + + %ProjectName%.mot + None + None + + None + + + FF + None + False + + 1 + None + False + + FF + None + + + False + 0 + + Ccitt + + None + None + False + False + + + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + False + -8586456112146240378 + LibraryU + + List + False + None + Debug + + False + + %BuildModeName% + False + + + None + %ProjectName%.lib + False + + NoMessage + Auto + False + None + + False + + False + False + False + + + + -noprelink +-form=library=u +-output=%BuildModeName%\%ProjectName%.lib +-list=%BuildModeName%\%ProjectName%.lbp +-nologo +-exit + + + + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + True + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + False + -8586456114514658210 + C + None + False + %BuildModeName% + False + Custom + Level2 + %ProjectName%.lib + + None + False + + False + + False + Size + + False + Auto + False + False + 2 + False + False + Auto + P + True + 100 + C + + True + D + Auto + True + B + False + L + False + Auto + True + W + Auto + False + False + False + Intrinsic + False + False + False + Auto + False + False + Auto + False + False + Noinstalign + False + False + False + False + True + False + Fpu + False + + + 636575488940589048 + 0 + + + 636575488940589048 + 1 + + + 636575488940589048 + 2 + + + 636575488940589048 + 3 + + + 636575496067311621 + 0 + + + 636575488940589048 + 5 + + + 636575488940589048 + 6 + + + 636575488940589048 + 7 + + + 636575488940589048 + 8 + + + 636575488940589048 + 9 + + + 636575488940589048 + 10 + + + 636575488940589048 + 11 + + + 636575488940589048 + 12 + + + 636575488940589048 + 13 + + + 636575488940589048 + 14 + + + 636575488940589048 + 15 + + + 636575488940589048 + 16 + + + 636575488940589048 + 17 + + + 636575488940589048 + 18 + + + 636575488940589048 + 19 + + + 636575488940589048 + 20 + + + 636575488940589048 + 22 + + + 636575488940589048 + 23 + + + 636575488940589048 + 25 + + + 636575488940589048 + 26 + + + 636575488940589048 + 27 + + + 636575488940589048 + 28 + + + 636575488940589048 + 29 + + + 636575488940589048 + 30 + + + 636575488940589048 + 31 + + + 636575488940589048 + 32 + + + 636575488940589048 + 33 + + + 636575488940589048 + 34 + + + 636575488940589048 + 35 + + + 636575488940589048 + 36 + + + 636575488940589048 + 37 + + + 636575488940589048 + 38 + + + 636575488940589048 + 39 + + + 636575488940589048 + 40 + + + 636575488940589048 + 41 + + + 636575488940589048 + 42 + + + 636575488940589048 + 43 + + + 636575488940589048 + 44 + + + 636575488940589048 + 46 + + + 636575488940589048 + 47 + + + 636575488940589048 + 48 + + + 636575488940589048 + 49 + + + 636575488940589048 + 50 + + + 636575488940589048 + 52 + + + 636575488940589048 + 53 + + + 636575488940589048 + 54 + + + 636575488940589048 + 55 + + + 636575488940589048 + 56 + + + 636575488940589048 + 57 + + + 636575488940589048 + 58 + + + 636575494875104790 + 1 + + + 636575494875104790 + 2 + + + 636575494875104790 + 3 + + + 636575494875104790 + 4 + + + 636575494875104790 + 5 + + + 636916246330446624 + 0 + + + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914181681 + False + True + False + -8586796871914176690 + False + True + False + -8586796871914176690 + False + True + False + -8586796871914171698 + False + True + False + -8586796871914171698 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914166695 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914156829 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914151735 + False + True + False + -8586796871914146702 + False + True + False + -8586796871914146702 + False + True + False + -8586796871914146702 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914141673 + False + True + False + -8586796871914136311 + False + True + False + -8586796871914136311 + False + True + False + -8586796871914136311 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + -8586796865979661205 + False + True + False + + + + + True + 00000000-0000-0000-0000-000000000000 + + + + + + + + + + R5F565N7BxFB + + + + + 7d577131-4ec1-4e88-968d-89381f6c178a + + + + + 1.1 + + + False + False + False + True + Yes + Nanosecond + False + False + False + False + False + True + FilesNotToAnalyze + 0 + All + 0 + False + %ProjectName%.mtfl + %ProjectName%.mtvl + 10 + + + RealtimeSampling + + Synchronized + AtProgramStop + 20 + 1000000 + LineChart + False + PaleGreen + PaleTurquoise + 40ff0a4f + 405be416 + 40056def + 40ff541c + False + Auto + Channel01 + 0 + Rising + 0 + Orange + 10 + None + + + + + + + + + + + + + + + + + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + Auto + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 25.5 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + c0ff0a4f + c05be416 + c0056dff + c0ff541c + c04fc1ff + c0a932ff + c0ffd91c + c0ff30a5 + c0bee02f + c05510ff + c0ff97e4 + c0913a37 + c0c68e15 + c0317f0c + c060493e + c072808e + + + + + 90536345-15c8-40cb-957c-e59974e4bf78 + + + + + E:\Renesas\wolfssl-3.14.0\wolfssl-3.14.0\IDE\Renesas\cs+\Projects\wolfssl_lib + E:\ProgramFiles\Renesas\SmartConfigurator\RX\eclipse\SmartConfigurator.exe + ab969cad-a48e-4926-b0d6-6ea8ba0de305 + wolfssl_lib.scfg + + + + + 8.01.00.00 + + + \ No newline at end of file diff --git a/ide/include.am b/ide/include.am index 4c020b9..890bd48 100644 --- a/ide/include.am +++ b/ide/include.am @@ -4,3 +4,5 @@ include ide/winvs/include.am include ide/CSBENCH/include.am + +EXTRA_DIST += ide/Renesas diff --git a/src/internal.c b/src/internal.c index 8adee55..f56e699 100644 --- a/src/internal.c +++ b/src/internal.c @@ -692,7 +692,7 @@ int GenerateKey(byte hashId, byte keyId, return WS_BAD_ARGUMENT; } - digestSz = wc_HashGetDigestSize(hashId); + digestSz = wc_HashGetDigestSize((enum wc_HashType)hashId); if (digestSz == 0) { WLOG(WS_LOG_DEBUG, "GK: bad hash ID"); return WS_BAD_ARGUMENT; @@ -704,25 +704,25 @@ int GenerateKey(byte hashId, byte keyId, blocks = keySz / digestSz; remainder = keySz % digestSz; - ret = wc_HashInit(&hash, hashId); + ret = wc_HashInit(&hash, (enum wc_HashType)hashId); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); if (ret == WS_SUCCESS && kPad) - ret = wc_HashUpdate(&hash, hashId, &pad, 1); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, k, kSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, h, hSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, &keyId, sizeof(keyId)); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &keyId, sizeof(keyId)); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, sessionId, sessionIdSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, sessionId, sessionIdSz); if (ret == WS_SUCCESS) { if (blocks == 0) { if (remainder > 0) { byte lastBlock[WC_MAX_DIGEST_SIZE]; - ret = wc_HashFinal(&hash, hashId, lastBlock); + ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, lastBlock); if (ret == WS_SUCCESS) WMEMCPY(key, lastBlock, remainder); } @@ -731,23 +731,23 @@ int GenerateKey(byte hashId, byte keyId, word32 runningKeySz, curBlock; runningKeySz = digestSz; - ret = wc_HashFinal(&hash, hashId, key); + ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, key); for (curBlock = 1; curBlock < blocks; curBlock++) { - ret = wc_HashInit(&hash, hashId); + ret = wc_HashInit(&hash, (enum wc_HashType)hashId); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); if (ret != WS_SUCCESS) break; if (kPad) - ret = wc_HashUpdate(&hash, hashId, &pad, 1); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, hashId, k, kSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, hashId, h, hSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, hashId, key, runningKeySz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, key, runningKeySz); if (ret != WS_SUCCESS) break; - ret = wc_HashFinal(&hash, hashId, key + runningKeySz); + ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, key + runningKeySz); if (ret != WS_SUCCESS) break; runningKeySz += digestSz; } @@ -755,19 +755,19 @@ int GenerateKey(byte hashId, byte keyId, if (remainder > 0) { byte lastBlock[WC_MAX_DIGEST_SIZE]; if (ret == WS_SUCCESS) - ret = wc_HashInit(&hash, hashId); + ret = wc_HashInit(&hash, (enum wc_HashType)hashId); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); if (ret == WS_SUCCESS && kPad) - ret = wc_HashUpdate(&hash, hashId, &pad, 1); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, k, kSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, h, hSz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, hashId, key, runningKeySz); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, key, runningKeySz); if (ret == WS_SUCCESS) - ret = wc_HashFinal(&hash, hashId, lastBlock); + ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, lastBlock); if (ret == WS_SUCCESS) WMEMCPY(key + runningKeySz, lastBlock, remainder); } @@ -1872,7 +1872,7 @@ static INLINE byte KeySzForId(byte id) } -static INLINE byte HashForId(byte id) +static INLINE enum wc_HashType HashForId(byte id) { switch (id) { case ID_DH_GROUP1_SHA1: @@ -2191,34 +2191,34 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) } if (ret == WS_SUCCESS) - ret = wc_HashInit(&ssh->handshake->hash, ssh->handshake->hashId); + ret = wc_HashInit(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_SERVER) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->peerProtoId, ssh->peerProtoIdSz); } if (ret == WS_SUCCESS) { strSz = (word32)WSTRLEN(sshProtoIdStr) - SSH_PROTO_EOL_SZ; c32toa(strSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, (const byte*)sshProtoIdStr, strSz); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_CLIENT) { ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->peerProtoId, ssh->peerProtoIdSz); if (ret == WS_SUCCESS) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->kexInit, ssh->handshake->kexInitSz); } @@ -2226,24 +2226,24 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == WS_SUCCESS) { c32toa(len + 1, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } if (ret == WS_SUCCESS) { scratchLen[0] = MSGID_KEXINIT; - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, MSG_ID_SZ); } if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, buf, len); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_SERVER) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->kexInit, ssh->handshake->kexInitSz); } @@ -2437,7 +2437,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the raw public key blob from the server including its * length which is at LENGTH_SZ offset ahead of pubKey. */ ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, pubKey - LENGTH_SZ, pubKeySz + LENGTH_SZ); if (ret == WS_SUCCESS) @@ -2451,21 +2451,21 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == 0) { c32toa(ssh->handshake->dhGexMinSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested preferred key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexPreferredSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested maximum key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexMaxSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Add a pad byte if the mpint has the MSB set. */ @@ -2478,7 +2478,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) c32toa(ssh->handshake->primeGroupSz + primeGroupPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX prime group. */ @@ -2486,14 +2486,14 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (primeGroupPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the GEX prime group. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->primeGroup, ssh->handshake->primeGroupSz); /* Add a pad byte if the mpint has the MSB set. */ @@ -2504,7 +2504,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the length of the GEX generator. */ c32toa(ssh->handshake->generatorSz + generatorPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX generator. */ @@ -2512,14 +2512,14 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (generatorPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the GEX generator. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->generator, ssh->handshake->generatorSz); } @@ -2527,12 +2527,12 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the size of the client's DH e-value (ECDH Q-value). */ if (ret == 0) { c32toa(ssh->handshake->eSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's DH e-value (ECDH Q-value). */ if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->e, ssh->handshake->eSz); /* Get and hash in the server's DH f-value (ECDH Q-value) */ @@ -2550,7 +2550,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == WS_SUCCESS) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, f, fSz + LENGTH_SZ); if (ret == WS_SUCCESS) { @@ -2650,26 +2650,26 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the shared secret K. */ if (ret == 0) { c32toa(ssh->kSz + kPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (kPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, scratchLen, 1); + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, ssh->k, ssh->kSz); /* Save the exchange hash value H, and session ID. */ if (ret == 0) ret = wc_HashFinal(&ssh->handshake->hash, - ssh->handshake->hashId, ssh->h); + (enum wc_HashType)ssh->handshake->hashId, ssh->h); if (ret == 0) { - ssh->hSz = wc_HashGetDigestSize(ssh->handshake->hashId); + ssh->hSz = wc_HashGetDigestSize((enum wc_HashType)ssh->handshake->hashId); if (ssh->sessionIdSz == 0) { WMEMCPY(ssh->sessionId, ssh->h, ssh->hSz); ssh->sessionIdSz = ssh->hSz; @@ -3312,8 +3312,8 @@ static int DoUserAuthRequestRsa(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, volatile int sizeCompare; encDigestSz = wc_EncodeSignature(encDigest, digest, - wc_HashGetDigestSize(hashId), - wc_HashGetOID(hashId)); + wc_HashGetDigestSize((enum wc_HashType)hashId), + wc_HashGetOID((enum wc_HashType)hashId)); compare = ConstantCompare(encDigest, checkDigest, encDigestSz); @@ -3561,35 +3561,35 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData, if (ret == WS_SUCCESS) { hashId = HashForId(pkTypeId); WMEMSET(digest, 0, sizeof(digest)); - digestSz = wc_HashGetDigestSize(hashId); - ret = wc_HashInit(&hash, hashId); + digestSz = wc_HashGetDigestSize((enum wc_HashType)hashId); + ret = wc_HashInit(&hash, (enum wc_HashType)hashId); } if (ret == 0) { c32toa(ssh->sessionIdSz, digest); - ret = wc_HashUpdate(&hash, hashId, digest, UINT32_SZ); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, digest, UINT32_SZ); } if (ret == 0) - ret = wc_HashUpdate(&hash, hashId, + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, ssh->sessionId, ssh->sessionIdSz); if (ret == 0) { digest[0] = MSGID_USERAUTH_REQUEST; - ret = wc_HashUpdate(&hash, hashId, digest, MSG_ID_SZ); + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, digest, MSG_ID_SZ); } /* The rest of the fields in the signature are already * in the buffer. Just need to account for the sizes. */ if (ret == 0) - ret = wc_HashUpdate(&hash, hashId, pk->dataToSign, + ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, pk->dataToSign, authData->usernameSz + authData->serviceNameSz + authData->authNameSz + BOOLEAN_SZ + pk->publicKeyTypeSz + pk->publicKeySz + (UINT32_SZ * 5)); if (ret == 0) { - ret = wc_HashFinal(&hash, hashId, digest); + ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, digest); if (ret != 0) ret = WS_CRYPTO_FAILED; @@ -5624,20 +5624,20 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sz, scratchLen); /* Hash in the length of the public key block. */ ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the length of the key type string. */ if (ret == 0) { c32toa(sigKeyBlock.nameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the key type string. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, (byte*)sigKeyBlock.name, sigKeyBlock.nameSz); /* Hash in the length of the RSA public key E value. */ @@ -5645,7 +5645,7 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sk.rsa.eSz + sigKeyBlock.sk.rsa.ePad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the RSA public key E value. */ @@ -5653,13 +5653,13 @@ int SendKexDhReply(WOLFSSH* ssh) if (sigKeyBlock.sk.rsa.ePad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, scratchLen, 1); + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the RSA public key E value. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, sigKeyBlock.sk.rsa.e, sigKeyBlock.sk.rsa.eSz); /* Hash in the length of the RSA public key N value. */ @@ -5667,7 +5667,7 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sk.rsa.nSz + sigKeyBlock.sk.rsa.nPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the RSA public key N value. */ @@ -5675,13 +5675,13 @@ int SendKexDhReply(WOLFSSH* ssh) if (sigKeyBlock.sk.rsa.nPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, scratchLen, 1); + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the RSA public key N value. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, sigKeyBlock.sk.rsa.n, sigKeyBlock.sk.rsa.nSz); } @@ -5713,46 +5713,46 @@ int SendKexDhReply(WOLFSSH* ssh) sigKeyBlock.sk.ecc.qSz; c32toa(sigKeyBlock.sz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the length of the key type string. */ if (ret == 0) { c32toa(sigKeyBlock.nameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the key type string. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, (byte*)sigKeyBlock.name, sigKeyBlock.nameSz); /* Hash in the length of the name of the prime. */ if (ret == 0) { c32toa(sigKeyBlock.sk.ecc.primeNameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the name of the prime. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, (const byte*)sigKeyBlock.sk.ecc.primeName, sigKeyBlock.sk.ecc.primeNameSz); /* Hash in the length of the public key. */ if (ret == 0) { c32toa(sigKeyBlock.sk.ecc.qSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the public key. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, sigKeyBlock.sk.ecc.q, sigKeyBlock.sk.ecc.qSz); } @@ -5765,21 +5765,21 @@ int SendKexDhReply(WOLFSSH* ssh) if (ret == 0) { c32toa(ssh->handshake->dhGexMinSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested preferred key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexPreferredSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested maximum key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexMaxSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Add a pad byte if the mpint has the MSB set. */ @@ -5789,7 +5789,7 @@ int SendKexDhReply(WOLFSSH* ssh) /* Hash in the length of the GEX prime group. */ c32toa(primeGroupSz + primeGroupPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX prime group. */ @@ -5797,14 +5797,14 @@ int SendKexDhReply(WOLFSSH* ssh) if (primeGroupPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the GEX prime group. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, primeGroup, primeGroupSz); /* Add a pad byte if the mpint has the MSB set. */ if (ret == 0) { @@ -5813,7 +5813,7 @@ int SendKexDhReply(WOLFSSH* ssh) /* Hash in the length of the GEX generator. */ c32toa(generatorSz + generatorPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX generator. */ @@ -5821,26 +5821,26 @@ int SendKexDhReply(WOLFSSH* ssh) if (generatorPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } /* Hash in the GEX generator. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, + (enum wc_HashType)ssh->handshake->hashId, generator, generatorSz); } /* Hash in the size of the client's DH e-value (ECDH Q-value). */ if (ret == 0) { c32toa(ssh->handshake->eSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } /* Hash in the client's DH e-value (ECDH Q-value). */ if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, ssh->handshake->e, ssh->handshake->eSz); /* Make the server's DH f-value and the shared secret K. */ @@ -5902,44 +5902,44 @@ int SendKexDhReply(WOLFSSH* ssh) if (ret == 0) { CreateMpint(f, &fSz, &fPad); c32toa(fSz + fPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (fPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, scratchLen, 1); + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, f, fSz); + (enum wc_HashType)ssh->handshake->hashId, f, fSz); /* Hash in the shared secret K. */ if (ret == 0) { CreateMpint(ssh->k, &ssh->kSz, &kPad); c32toa(ssh->kSz + kPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (kPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - ssh->handshake->hashId, scratchLen, 1); + (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); } } if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, ssh->k, ssh->kSz); /* Save the exchange hash value H, and session ID. */ if (ret == 0) ret = wc_HashFinal(&ssh->handshake->hash, - ssh->handshake->hashId, ssh->h); + (enum wc_HashType)ssh->handshake->hashId, ssh->h); if (ret == 0) { - ssh->hSz = wc_HashGetDigestSize(ssh->handshake->hashId); + ssh->hSz = wc_HashGetDigestSize((enum wc_HashType)ssh->handshake->hashId); if (ssh->sessionIdSz == 0) { WMEMCPY(ssh->sessionId, ssh->h, ssh->hSz); ssh->sessionIdSz = ssh->hSz; @@ -5958,11 +5958,11 @@ int SendKexDhReply(WOLFSSH* ssh) sigHashId = HashForId(ssh->handshake->pubKeyId); - ret = wc_HashInit(&digestHash, sigHashId); + ret = wc_HashInit(&digestHash, (enum wc_HashType)sigHashId); if (ret == 0) - ret = wc_HashUpdate(&digestHash, sigHashId, ssh->h, ssh->hSz); + ret = wc_HashUpdate(&digestHash, (enum wc_HashType)sigHashId, ssh->h, ssh->hSz); if (ret == 0) - ret = wc_HashFinal(&digestHash, sigHashId, digest); + ret = wc_HashFinal(&digestHash, (enum wc_HashType)sigHashId, digest); if (ret != 0) ret = WS_CRYPTO_FAILED; @@ -5972,8 +5972,8 @@ int SendKexDhReply(WOLFSSH* ssh) word32 encSigSz; encSigSz = wc_EncodeSignature(encSig, digest, - wc_HashGetDigestSize(sigHashId), - wc_HashGetOID(sigHashId)); + wc_HashGetDigestSize((enum wc_HashType)sigHashId), + wc_HashGetOID((enum wc_HashType)sigHashId)); if (encSigSz <= 0) { WLOG(WS_LOG_DEBUG, "SendKexDhReply: Bad Encode Sig"); ret = WS_CRYPTO_FAILED; @@ -5991,7 +5991,7 @@ int SendKexDhReply(WOLFSSH* ssh) else { WLOG(WS_LOG_INFO, "Signing hash with ECDSA."); sigSz = sizeof(sig); - ret = wc_ecc_sign_hash(digest, wc_HashGetDigestSize(sigHashId), + ret = wc_ecc_sign_hash(digest, wc_HashGetDigestSize((enum wc_HashType)sigHashId), sig, &sigSz, ssh->rng, &sigKeyBlock.sk.ecc.key); if (ret != MP_OKAY) { diff --git a/src/ssh.c b/src/ssh.c index d76d9a8..b3e9fcf 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -1200,7 +1200,7 @@ WS_SessionType wolfSSH_GetSessionType(const WOLFSSH* ssh) WLOG(WS_LOG_DEBUG, "Entering wolfSSH_GetSessionType()"); if (ssh && ssh->channelList) - return ssh->channelList->sessionType; + return (WS_SessionType)ssh->channelList->sessionType; return WOLFSSH_SESSION_UNKNOWN; } diff --git a/wolfssh/port.h b/wolfssh/port.h index 593a666..628d0e6 100644 --- a/wolfssh/port.h +++ b/wolfssh/port.h @@ -223,7 +223,13 @@ extern "C" { #define WSTRNCASECMP(s1, s2, n) strncmp((s1), (s2), (n)) #define WSNPRINTF(s,n,f,...) snprintf((s),(n),(f),##__VA_ARGS__) #define WVSNPRINTF(s,n,f,...) vsnprintf((s),(n),(f),##__VA_ARGS__) - #else + #elif defined(RENESAS_CSPLUS) + #include + #define WSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) + #define WSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) + #define WSNPRINTF(s,n,f,...) snprintf((s),(n),(f),__VA_ARGS__) + #define WVSNPRINTF(s,n,f,...) vsnprintf((s),(n),(f),__VA_ARGS__) + #else #include #define WSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) #define WSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) From d98acb8d3503156722d82766307e1df08cfea245 Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Tue, 7 May 2019 09:18:01 +0900 Subject: [PATCH 2/2] addressed review comments --- ide/Renesas/cs+/README_jp.md | 76 ++++++------ src/internal.c | 219 ++++++++++++++++++----------------- 2 files changed, 152 insertions(+), 143 deletions(-) diff --git a/ide/Renesas/cs+/README_jp.md b/ide/Renesas/cs+/README_jp.md index 1fa09e0..31aff34 100644 --- a/ide/Renesas/cs+/README_jp.md +++ b/ide/Renesas/cs+/README_jp.md @@ -1,69 +1,69 @@ -# wolfSSH ƒVƒ“ƒvƒ‹ SSH ƒT[ƒo ƒZƒbƒgƒAƒbƒvƒKƒCƒh +# wolfSSH シンプル SSH サームセットアップガイド -‚±‚̃fƒ‚‚͈ȉº‚̊‹«‚ŃeƒXƒg‚µ‚Ä‚¢‚Ü‚·B +ã“ã®ãƒ‡ãƒ¢ã¯ä»¥ä¸‹ã®ç’°å¢ƒã§ãƒ†ã‚¹ãƒˆã—ã¦ã„ã¾ã™ã€‚ * Renesas : CS+ v8.01 * Board : Alpha Project AP-RX71M-0A w/ Sample program v2.0 * wolfSSL : 4.0.0 * wolfSSH : 1.3.1 -##ƒZƒbƒgƒAƒbƒvŽè‡F -### ‚P ƒ\ƒtƒgƒEƒFƒA‚Ì“üŽè +## セットアップ手順: +### 1 ソフトウェアã®å…¥æ‰‹ -- APƒ{[ƒh•t‘®‚̃\ƒtƒgƒEƒFƒAˆêŽ®‚ð“K“–‚ȃtƒHƒ‹ƒ_[‰º‚ɉ𓀂µ‚Ü‚·B -- “¯‚¶ƒtƒHƒ‹ƒ_[‰º‚ÉwolfsslˆêŽ®‚ð‰ð“€‚µ‚Ü‚·B -- “¯‚¶ƒtƒHƒ‹ƒ_[‰º‚ÉwolfsshˆêŽ®‚ð‰ð“š‚µ‚Ü‚·B -### ‚Q wolfSSL‹y‚ÑwolfSSH‚̃ZƒbƒgƒAƒbƒv +- APボード付属ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ä¸€å¼ã‚’é©å½“ãªãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ä¸‹ã«è§£å‡ã—ã¾ã™ã€‚ +- åŒã˜ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ä¸‹ã«wolfssl一å¼ã‚’解å‡ã—ã¾ã™ã€‚ +- åŒã˜ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ä¸‹ã«wolfssh一å¼ã‚’解答ã—ã¾ã™ã€‚ +### ï¼’ wolfSSLåŠã³wolfSSHã®ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ— -- CS+‚É‚Äwolfssh\ide\Renesas\cs+\‰º‚Ìwolfssl_lib\wolfssl_lib.mtpj‚ðŠJ‚« - wolfSSLƒ‰ƒCƒuƒ‰ƒŠ[‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B -- CS+‚É‚Äwolfssh\ide\Renesas\cs+\‰º‚Ìwolfssh_lib\wolfssj_lib.mtpj‚ðŠJ‚« - wolfSShƒ‰ƒCƒuƒ‰ƒŠ[‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B -- “¯‚¶ƒtƒHƒ‹ƒ_‚̉º‚Ìdemo_server.mtpj‚ðŠJ‚«Aƒfƒ‚ƒvƒƒOƒ‰ƒ€‚̃rƒ‹ƒh‚ð‚µ‚Ü‚·B - ‚±‚̃vƒƒOƒ‰ƒ€‚àƒ‰ƒCƒuƒ‰ƒŠ[Œ`Ž®‚Ńrƒ‹ƒh‚³‚ê‚Ü‚·B +- CS+ã«ã¦wolfssh\ide\Renesas\cs+\下ã®wolfssl_lib\wolfssl_lib.mtpjã‚’é–‹ã + wolfSSLライブラリーã®ãƒ“ルドをã—ã¾ã™ã€‚ +- CS+ã«ã¦wolfssh\ide\Renesas\cs+\下ã®wolfssh_lib\wolfssj_lib.mtpjã‚’é–‹ã + wolfSShライブラリーã®ãƒ“ルドをã—ã¾ã™ã€‚ +- åŒã˜ãƒ•ã‚©ãƒ«ãƒ€ã®ä¸‹ã®demo_server.mtpjã‚’é–‹ãã€ãƒ‡ãƒ¢ãƒ—ログラムã®ãƒ“ルドをã—ã¾ã™ã€‚ + ã“ã®ãƒ—ログラムもライブラリー形å¼ã§ãƒ“ルドã•ã‚Œã¾ã™ã€‚ -### ‚R AlphaProject‘¤‚̃ZƒbƒgƒAƒbƒv -ƒfƒ‚‚Íap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_csƒtƒHƒ‹ƒ_‰º‚Ì -ap_rx71m_0a_usbfunc_sample_cs.mtpjƒvƒƒWƒFƒNƒg‚ð—˜—p‚µ‚Ü‚·B +### 3 AlphaProjectå´ã®ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ— +デモã¯ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_csフォルダ下㮠+ap_rx71m_0a_usbfunc_sample_cs.mtpjプロジェクトを利用ã—ã¾ã™ã€‚ -- ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_ether_sample_cs\srcƒtƒHƒ‹ƒ_‰º‚ÌAP_RX71M_0A.cƒtƒ@ƒCƒ‹‚ðŠJ‚«A - UsbfInit()‚̉º‚ÉwolfSSL_init()‚ð‘}“ü‚µ‚Ü‚·B +- ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_ether_sample_cs\srcフォルダ下ã®AP_RX71M_0A.cファイルを開ã〠+ UsbfInit()ã®ä¸‹ã«wolfSSL_init()を挿入ã—ã¾ã™ã€‚ ``` CanInit(); SciInit(); EthernetAppInit(); UsbfInit(); - wolfSSL_init(); <- ‚±‚Ìs‚ð‘}“ü + wolfSSL_init(); <- ã“ã®è¡Œã‚’挿入 ``` - ap_rx71m_0a_sample_cs\Sample\ap_rx71m_0a_usbfunc_sample_cs\src\smc_gen\r_config\r_bsp_config.h - ‚ðŠJ‚«AƒXƒ^ƒbƒNƒTƒCƒY‚ƃq[ƒvƒTƒCƒY‚ðˆÈ‰º‚̂悤‚Éݒ肵‚Ü‚·B -@154s–Ú #pragma stacksize su=0x2000 -@175s–Ú #define BSP_CFG_HEAP_BYTES (0xa000) + ã‚’é–‹ãã€ã‚¹ã‚¿ãƒƒã‚¯ã‚µã‚¤ã‚ºã¨ãƒ’ープサイズを以下ã®ã‚ˆã†ã«è¨­å®šã—ã¾ã™ã€‚ + 154行目 #pragma stacksize su=0x2000 + 175行目 #define BSP_CFG_HEAP_BYTES (0xa000) -- IPƒAƒhƒŒƒX‚̃fƒtƒHƒ‹ƒg’l‚͈ȉº‚̂悤‚É‚È‚Á‚Ä‚¢‚Ü‚·B -@•K—v‚ª‚ ‚ê‚ÎASample\ap_rx71m_0a_ether_sample_cs\src\tcp_sample\config_tcpudp.c -@“à‚Ì139s–Ú‚©‚ç‚Ì’è‹`‚ð•ÏX‚µ‚Ü‚·B +- IPアドレスã®ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆå€¤ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã£ã¦ã„ã¾ã™ã€‚ + 必è¦ãŒã‚ã‚Œã°ã€Sample\ap_rx71m_0a_ether_sample_cs\src\tcp_sample\config_tcpudp.c + 内ã®139行目ã‹ã‚‰ã®å®šç¾©ã‚’変更ã—ã¾ã™ã€‚ ``` #define MY_IP_ADDR0 192,168,1,200 /* Local IP address */ #define GATEWAY_ADDR0 192,168,1,254 /* Gateway address (invalid if all 0s) */ #define SUBNET_MASK0 255,255,255,0 /* Subnet mask */ ``` -- CS+‚Åap_rx71m_0a_usbfunc_sample_cs.mtpjƒvƒƒWƒFƒNƒg‚ðŠJ‚«AwolfSSLAwolfSSH‹y‚уfƒ‚ƒ‰ƒCƒuƒ‰ƒŠ‚ð -@“o˜^‚µ‚Ü‚·BCC-RX(ƒrƒ‹ƒhƒc[ƒ‹)->ƒŠƒ“ƒNEƒIƒvƒVƒ‡ƒ“ƒ^ƒu->Žg—p‚·‚郉ƒCƒuƒ‰ƒŠ‚É -@ˆÈ‰º‚Ì“ñ‚‚̃tƒ@ƒCƒ‹‚ð“o˜^‚µ‚Ü‚·B +- CS+ã§ap_rx71m_0a_usbfunc_sample_cs.mtpjプロジェクトを開ãã€wolfSSLã€wolfSSHåŠã³ãƒ‡ãƒ¢ãƒ©ã‚¤ãƒ–ラリを + 登録ã—ã¾ã™ã€‚CC-RX(ビルドツール)->リンク・オプションタブ->使用ã™ã‚‹ãƒ©ã‚¤ãƒ–ラリ㫠+ 以下ã®äºŒã¤ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’登録ã—ã¾ã™ã€‚ - - CC-RX(ƒrƒ‹ƒhƒc[ƒ‹)->ƒ‰ƒCƒuƒ‰ƒŠ[ƒWƒFƒlƒŒ[ƒVƒ‡ƒ“ƒ^ƒu->ƒ‰ƒCƒuƒ‰ƒŠ[\¬‚ðuC99v‚ÉA - ctype.h‚ð—LŒø‚É‚·‚é‚ðu‚Í‚¢v‚Éݒ肵‚Ü‚·B + - CC-RX(ビルドツール)->ライブラリージェãƒãƒ¬ãƒ¼ã‚·ãƒ§ãƒ³ã‚¿ãƒ–->ライブラリー構æˆã‚’「C99ã€ã«ã€ + ctype.hを有効ã«ã™ã‚‹ã‚’「ã¯ã„ã€ã«è¨­å®šã—ã¾ã™ã€‚ -- ƒvƒƒWƒFƒNƒg‚̃rƒ‹ƒhAƒ^[ƒQƒbƒg‚ւ̃_ƒEƒ“ƒ[ƒh‚ð‚µ‚½‚Ì‚¿A•\Ž¦->ƒfƒoƒbƒOEƒRƒ“ƒ\[ƒ‹ -@‚©‚çƒRƒ“ƒ\[ƒ‹‚ð•\Ž¦‚³‚¹‚Ü‚·BŽÀs‚ðŠJŽn‚·‚é‚ƃRƒ“ƒ\[ƒ‹‚Ɉȉº‚Ì•\Ž¦‚ªo—Í‚³‚ê‚Ü‚·B +- プロジェクトã®ãƒ“ルドã€ã‚¿ãƒ¼ã‚²ãƒƒãƒˆã¸ã®ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã‚’ã—ãŸã®ã¡ã€è¡¨ç¤º->デãƒãƒƒã‚°ãƒ»ã‚³ãƒ³ã‚½ãƒ¼ãƒ« + ã‹ã‚‰ã‚³ãƒ³ã‚½ãƒ¼ãƒ«ã‚’表示ã•ã›ã¾ã™ã€‚実行を開始ã™ã‚‹ã¨ã‚³ãƒ³ã‚½ãƒ¼ãƒ«ã«ä»¥ä¸‹ã®è¡¨ç¤ºãŒå‡ºåŠ›ã•ã‚Œã¾ã™ã€‚ ``` Start server_test ``` -- ƒVƒ“ƒvƒ‹ wolfSSH ƒT[ƒo‚ÍA50000”Ԃ̃|[ƒg‚ðŠJ‚¢‚Ä‘Ò‚¿‚Ü‚·BƒT[ƒo‚Ö‚ÍAwolfSSH‚É•tƒTƒ“ƒvƒ‹ƒNƒ‰ƒCƒAƒ“ƒg‚ð -Žg‚Á‚Ĉȉº‚̂悤‚ÉÚ‘±‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B +- シンプル wolfSSH サーãƒã¯ã€50000番ã®ãƒãƒ¼ãƒˆã‚’é–‹ã„ã¦å¾…ã¡ã¾ã™ã€‚サーãƒã¸ã¯ã€wolfSSHã«ä»˜ã‚µãƒ³ãƒ—ルクライアントを +使ã£ã¦ä»¥ä¸‹ã®ã‚ˆã†ã«æŽ¥ç¶šã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ ``` $ ./examples/client/client -h 192.168.1.200 -p 50000 -u jill Sample public key check callback @@ -74,7 +74,7 @@ ap_rx71m_0a_usbfunc_sample_cs.mtpj Server said: Hello, wolfSSH! ``` -##@ƒTƒ|[ƒg -ƒTƒ|[ƒg‚ª•K—v‚ÈꇂÍA[support@wolfssl.com](mailto:support@wolfssl.com)‚Ö‚²˜A—‚­‚¾‚³‚¢B +## サãƒãƒ¼ãƒˆ +サãƒãƒ¼ãƒˆãŒå¿…è¦ãªå ´åˆã¯ã€[support@wolfssl.com](mailto:support@wolfssl.com)ã¸ã”連絡ãã ã•ã„。 -ˆÈã +以上 diff --git a/src/internal.c b/src/internal.c index f56e699..9885b7e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -677,6 +677,7 @@ int GenerateKey(byte hashId, byte keyId, { word32 blocks, remainder; wc_HashAlg hash; + enum wc_HashType enmhashId = (enum wc_HashType)hashId; byte kPad = 0; byte pad = 0; byte kSzFlat[LENGTH_SZ]; @@ -692,7 +693,7 @@ int GenerateKey(byte hashId, byte keyId, return WS_BAD_ARGUMENT; } - digestSz = wc_HashGetDigestSize((enum wc_HashType)hashId); + digestSz = wc_HashGetDigestSize(enmhashId); if (digestSz == 0) { WLOG(WS_LOG_DEBUG, "GK: bad hash ID"); return WS_BAD_ARGUMENT; @@ -704,25 +705,25 @@ int GenerateKey(byte hashId, byte keyId, blocks = keySz / digestSz; remainder = keySz % digestSz; - ret = wc_HashInit(&hash, (enum wc_HashType)hashId); + ret = wc_HashInit(&hash, enmhashId); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, enmhashId, kSzFlat, LENGTH_SZ); if (ret == WS_SUCCESS && kPad) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); + ret = wc_HashUpdate(&hash, enmhashId, &pad, 1); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); + ret = wc_HashUpdate(&hash, enmhashId, k, kSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); + ret = wc_HashUpdate(&hash, enmhashId, h, hSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &keyId, sizeof(keyId)); + ret = wc_HashUpdate(&hash, enmhashId, &keyId, sizeof(keyId)); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, sessionId, sessionIdSz); + ret = wc_HashUpdate(&hash, enmhashId, sessionId, sessionIdSz); if (ret == WS_SUCCESS) { if (blocks == 0) { if (remainder > 0) { byte lastBlock[WC_MAX_DIGEST_SIZE]; - ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, lastBlock); + ret = wc_HashFinal(&hash, enmhashId, lastBlock); if (ret == WS_SUCCESS) WMEMCPY(key, lastBlock, remainder); } @@ -731,23 +732,23 @@ int GenerateKey(byte hashId, byte keyId, word32 runningKeySz, curBlock; runningKeySz = digestSz; - ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, key); + ret = wc_HashFinal(&hash, enmhashId, key); for (curBlock = 1; curBlock < blocks; curBlock++) { - ret = wc_HashInit(&hash, (enum wc_HashType)hashId); + ret = wc_HashInit(&hash, enmhashId); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, enmhashId, kSzFlat, LENGTH_SZ); if (ret != WS_SUCCESS) break; if (kPad) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); + ret = wc_HashUpdate(&hash, enmhashId, &pad, 1); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); + ret = wc_HashUpdate(&hash, enmhashId, k, kSz); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); + ret = wc_HashUpdate(&hash, enmhashId, h, hSz); if (ret != WS_SUCCESS) break; - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, key, runningKeySz); + ret = wc_HashUpdate(&hash, enmhashId, key, runningKeySz); if (ret != WS_SUCCESS) break; - ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, key + runningKeySz); + ret = wc_HashFinal(&hash, enmhashId, key + runningKeySz); if (ret != WS_SUCCESS) break; runningKeySz += digestSz; } @@ -755,19 +756,19 @@ int GenerateKey(byte hashId, byte keyId, if (remainder > 0) { byte lastBlock[WC_MAX_DIGEST_SIZE]; if (ret == WS_SUCCESS) - ret = wc_HashInit(&hash, (enum wc_HashType)hashId); + ret = wc_HashInit(&hash, enmhashId); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, kSzFlat, LENGTH_SZ); + ret = wc_HashUpdate(&hash, enmhashId, kSzFlat, LENGTH_SZ); if (ret == WS_SUCCESS && kPad) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, &pad, 1); + ret = wc_HashUpdate(&hash, enmhashId, &pad, 1); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, k, kSz); + ret = wc_HashUpdate(&hash, enmhashId, k, kSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, h, hSz); + ret = wc_HashUpdate(&hash, enmhashId, h, hSz); if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, key, runningKeySz); + ret = wc_HashUpdate(&hash, enmhashId, key, runningKeySz); if (ret == WS_SUCCESS) - ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, lastBlock); + ret = wc_HashFinal(&hash, enmhashId, lastBlock); if (ret == WS_SUCCESS) WMEMCPY(key + runningKeySz, lastBlock, remainder); } @@ -2182,6 +2183,7 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) } if (ret == WS_SUCCESS) { + enum wc_HashType enmhashId = (enum wc_HashType)ssh->handshake->hashId; byte scratchLen[LENGTH_SZ]; word32 strSz; @@ -2191,34 +2193,34 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) } if (ret == WS_SUCCESS) - ret = wc_HashInit(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId); + ret = wc_HashInit(&ssh->handshake->hash, enmhashId); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_SERVER) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->peerProtoId, ssh->peerProtoIdSz); } if (ret == WS_SUCCESS) { strSz = (word32)WSTRLEN(sshProtoIdStr) - SSH_PROTO_EOL_SZ; c32toa(strSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, (const byte*)sshProtoIdStr, strSz); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_CLIENT) { ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->peerProtoId, ssh->peerProtoIdSz); if (ret == WS_SUCCESS) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->handshake->kexInit, ssh->handshake->kexInitSz); } @@ -2226,24 +2228,24 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == WS_SUCCESS) { c32toa(len + 1, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } if (ret == WS_SUCCESS) { scratchLen[0] = MSGID_KEXINIT; - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, MSG_ID_SZ); } if (ret == WS_SUCCESS) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, buf, len); if (ret == WS_SUCCESS) { if (ssh->ctx->side == WOLFSSH_ENDPOINT_SERVER) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->handshake->kexInit, ssh->handshake->kexInitSz); } @@ -2369,6 +2371,7 @@ static int DoKexDhInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) { + enum wc_HashType enmhashId; byte* pubKey = NULL; word32 pubKeySz; byte* f = NULL; @@ -2432,12 +2435,14 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) ret = WS_SUCCESS; } } + + enmhashId = (enum wc_HashType)ssh->handshake->hashId; if (ret == WS_SUCCESS) /* Hash in the raw public key blob from the server including its * length which is at LENGTH_SZ offset ahead of pubKey. */ ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, pubKey - LENGTH_SZ, pubKeySz + LENGTH_SZ); if (ret == WS_SUCCESS) @@ -2451,21 +2456,21 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == 0) { c32toa(ssh->handshake->dhGexMinSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested preferred key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexPreferredSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested maximum key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexMaxSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Add a pad byte if the mpint has the MSB set. */ @@ -2478,7 +2483,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) c32toa(ssh->handshake->primeGroupSz + primeGroupPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX prime group. */ @@ -2486,14 +2491,14 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (primeGroupPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, 1); } } /* Hash in the GEX prime group. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->handshake->primeGroup, ssh->handshake->primeGroupSz); /* Add a pad byte if the mpint has the MSB set. */ @@ -2504,7 +2509,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the length of the GEX generator. */ c32toa(ssh->handshake->generatorSz + generatorPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX generator. */ @@ -2512,14 +2517,14 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (generatorPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, 1); } } /* Hash in the GEX generator. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, ssh->handshake->generator, ssh->handshake->generatorSz); } @@ -2527,12 +2532,12 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the size of the client's DH e-value (ECDH Q-value). */ if (ret == 0) { c32toa(ssh->handshake->eSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's DH e-value (ECDH Q-value). */ if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, ssh->handshake->e, ssh->handshake->eSz); /* Get and hash in the server's DH f-value (ECDH Q-value) */ @@ -2550,7 +2555,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) if (ret == WS_SUCCESS) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, f, fSz + LENGTH_SZ); if (ret == WS_SUCCESS) { @@ -2650,26 +2655,26 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx) /* Hash in the shared secret K. */ if (ret == 0) { c32toa(ssh->kSz + kPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (kPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); + enmhashId, scratchLen, 1); } } if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, ssh->k, ssh->kSz); /* Save the exchange hash value H, and session ID. */ if (ret == 0) ret = wc_HashFinal(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, ssh->h); + enmhashId, ssh->h); if (ret == 0) { - ssh->hSz = wc_HashGetDigestSize((enum wc_HashType)ssh->handshake->hashId); + ssh->hSz = wc_HashGetDigestSize(enmhashId); if (ssh->sessionIdSz == 0) { WMEMCPY(ssh->sessionId, ssh->h, ssh->hSz); ssh->sessionIdSz = ssh->hSz; @@ -3218,6 +3223,7 @@ static int DoUserAuthRequestRsa(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, byte hashId, byte* digest, word32 digestSz) { RsaKey key; + enum wc_HashType enmhashId = (enum wc_HashType)hashId; byte checkDigest[MAX_ENCODED_SIG_SZ]; int checkDigestSz; byte* publicKeyType; @@ -3312,8 +3318,8 @@ static int DoUserAuthRequestRsa(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk, volatile int sizeCompare; encDigestSz = wc_EncodeSignature(encDigest, digest, - wc_HashGetDigestSize((enum wc_HashType)hashId), - wc_HashGetOID((enum wc_HashType)hashId)); + wc_HashGetDigestSize(enmhashId), + wc_HashGetOID(enmhashId)); compare = ConstantCompare(encDigest, checkDigest, encDigestSz); @@ -3550,7 +3556,7 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData, wc_HashAlg hash; byte digest[WC_MAX_DIGEST_SIZE]; word32 digestSz; - byte hashId = WC_HASH_TYPE_SHA; + enum wc_HashType hashId = WC_HASH_TYPE_SHA; byte pkTypeId; pkTypeId = NameToId((char*)pk->publicKeyType, @@ -3561,35 +3567,35 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData, if (ret == WS_SUCCESS) { hashId = HashForId(pkTypeId); WMEMSET(digest, 0, sizeof(digest)); - digestSz = wc_HashGetDigestSize((enum wc_HashType)hashId); - ret = wc_HashInit(&hash, (enum wc_HashType)hashId); + digestSz = wc_HashGetDigestSize(hashId); + ret = wc_HashInit(&hash, hashId); } if (ret == 0) { c32toa(ssh->sessionIdSz, digest); - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, digest, UINT32_SZ); + ret = wc_HashUpdate(&hash, hashId, digest, UINT32_SZ); } if (ret == 0) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, + ret = wc_HashUpdate(&hash, hashId, ssh->sessionId, ssh->sessionIdSz); if (ret == 0) { digest[0] = MSGID_USERAUTH_REQUEST; - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, digest, MSG_ID_SZ); + ret = wc_HashUpdate(&hash, hashId, digest, MSG_ID_SZ); } /* The rest of the fields in the signature are already * in the buffer. Just need to account for the sizes. */ if (ret == 0) - ret = wc_HashUpdate(&hash, (enum wc_HashType)hashId, pk->dataToSign, + ret = wc_HashUpdate(&hash, hashId, pk->dataToSign, authData->usernameSz + authData->serviceNameSz + authData->authNameSz + BOOLEAN_SZ + pk->publicKeyTypeSz + pk->publicKeySz + (UINT32_SZ * 5)); if (ret == 0) { - ret = wc_HashFinal(&hash, (enum wc_HashType)hashId, digest); + ret = wc_HashFinal(&hash, hashId, digest); if (ret != 0) ret = WS_CRYPTO_FAILED; @@ -4655,7 +4661,7 @@ static INLINE int Encrypt(WOLFSSH* ssh, byte* cipher, const byte* input, #ifdef WOLFSSL_AES_COUNTER case ID_AES128_CTR: if (sz % AES_BLOCK_SIZE || wc_AesCtrEncrypt(&ssh->encryptCipher.aes, - cipher, input, sz) < 0) { + cipher, input, sz) < 0) { ret = WS_ENCRYPT_E; } @@ -5554,6 +5560,7 @@ int SendKexDhReply(WOLFSSH* ssh) word32 idx; int ret = WS_SUCCESS; byte msgId = MSGID_KEXDH_REPLY; + enum wc_HashType enmhashId; WLOG(WS_LOG_DEBUG, "Entering SendKexDhReply()"); @@ -5590,6 +5597,8 @@ int SendKexDhReply(WOLFSSH* ssh) ret = WS_INVALID_ALGO_ID; } + enmhashId = (enum wc_HashType)ssh->handshake->hashId; + /* At this point, the exchange hash, H, includes items V_C, V_S, I_C, * and I_S. Next add K_S, the server's public host key. K_S will * either be RSA or ECDSA public key blob. */ @@ -5624,20 +5633,20 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sz, scratchLen); /* Hash in the length of the public key block. */ ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the length of the key type string. */ if (ret == 0) { c32toa(sigKeyBlock.nameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the key type string. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, (byte*)sigKeyBlock.name, sigKeyBlock.nameSz); /* Hash in the length of the RSA public key E value. */ @@ -5645,7 +5654,7 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sk.rsa.eSz + sigKeyBlock.sk.rsa.ePad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the RSA public key E value. */ @@ -5653,13 +5662,13 @@ int SendKexDhReply(WOLFSSH* ssh) if (sigKeyBlock.sk.rsa.ePad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); + enmhashId, scratchLen, 1); } } /* Hash in the RSA public key E value. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, sigKeyBlock.sk.rsa.e, sigKeyBlock.sk.rsa.eSz); /* Hash in the length of the RSA public key N value. */ @@ -5667,7 +5676,7 @@ int SendKexDhReply(WOLFSSH* ssh) c32toa(sigKeyBlock.sk.rsa.nSz + sigKeyBlock.sk.rsa.nPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the RSA public key N value. */ @@ -5675,13 +5684,13 @@ int SendKexDhReply(WOLFSSH* ssh) if (sigKeyBlock.sk.rsa.nPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); + enmhashId, scratchLen, 1); } } /* Hash in the RSA public key N value. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, sigKeyBlock.sk.rsa.n, sigKeyBlock.sk.rsa.nSz); } @@ -5713,46 +5722,46 @@ int SendKexDhReply(WOLFSSH* ssh) sigKeyBlock.sk.ecc.qSz; c32toa(sigKeyBlock.sz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the length of the key type string. */ if (ret == 0) { c32toa(sigKeyBlock.nameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the key type string. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, (byte*)sigKeyBlock.name, sigKeyBlock.nameSz); /* Hash in the length of the name of the prime. */ if (ret == 0) { c32toa(sigKeyBlock.sk.ecc.primeNameSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the name of the prime. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, (const byte*)sigKeyBlock.sk.ecc.primeName, sigKeyBlock.sk.ecc.primeNameSz); /* Hash in the length of the public key. */ if (ret == 0) { c32toa(sigKeyBlock.sk.ecc.qSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the public key. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, sigKeyBlock.sk.ecc.q, sigKeyBlock.sk.ecc.qSz); } @@ -5765,21 +5774,21 @@ int SendKexDhReply(WOLFSSH* ssh) if (ret == 0) { c32toa(ssh->handshake->dhGexMinSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested preferred key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexPreferredSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's requested maximum key size. */ if (ret == 0) { c32toa(ssh->handshake->dhGexMaxSz, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Add a pad byte if the mpint has the MSB set. */ @@ -5789,7 +5798,7 @@ int SendKexDhReply(WOLFSSH* ssh) /* Hash in the length of the GEX prime group. */ c32toa(primeGroupSz + primeGroupPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX prime group. */ @@ -5797,14 +5806,14 @@ int SendKexDhReply(WOLFSSH* ssh) if (primeGroupPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, 1); } } /* Hash in the GEX prime group. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, primeGroup, primeGroupSz); /* Add a pad byte if the mpint has the MSB set. */ if (ret == 0) { @@ -5813,7 +5822,7 @@ int SendKexDhReply(WOLFSSH* ssh) /* Hash in the length of the GEX generator. */ c32toa(generatorSz + generatorPad, scratchLen); ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the pad byte for the GEX generator. */ @@ -5821,26 +5830,26 @@ int SendKexDhReply(WOLFSSH* ssh) if (generatorPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, scratchLen, 1); } } /* Hash in the GEX generator. */ if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, + enmhashId, generator, generatorSz); } /* Hash in the size of the client's DH e-value (ECDH Q-value). */ if (ret == 0) { c32toa(ssh->handshake->eSz, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } /* Hash in the client's DH e-value (ECDH Q-value). */ if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, ssh->handshake->e, ssh->handshake->eSz); /* Make the server's DH f-value and the shared secret K. */ @@ -5902,44 +5911,44 @@ int SendKexDhReply(WOLFSSH* ssh) if (ret == 0) { CreateMpint(f, &fSz, &fPad); c32toa(fSz + fPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (fPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); + enmhashId, scratchLen, 1); } } if (ret == 0) ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, f, fSz); + enmhashId, f, fSz); /* Hash in the shared secret K. */ if (ret == 0) { CreateMpint(ssh->k, &ssh->kSz, &kPad); c32toa(ssh->kSz + kPad, scratchLen); - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, scratchLen, LENGTH_SZ); } if (ret == 0) { if (kPad) { scratchLen[0] = 0; ret = wc_HashUpdate(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, scratchLen, 1); + enmhashId, scratchLen, 1); } } if (ret == 0) - ret = wc_HashUpdate(&ssh->handshake->hash, (enum wc_HashType)ssh->handshake->hashId, + ret = wc_HashUpdate(&ssh->handshake->hash, enmhashId, ssh->k, ssh->kSz); /* Save the exchange hash value H, and session ID. */ if (ret == 0) ret = wc_HashFinal(&ssh->handshake->hash, - (enum wc_HashType)ssh->handshake->hashId, ssh->h); + enmhashId, ssh->h); if (ret == 0) { - ssh->hSz = wc_HashGetDigestSize((enum wc_HashType)ssh->handshake->hashId); + ssh->hSz = wc_HashGetDigestSize(enmhashId); if (ssh->sessionIdSz == 0) { WMEMCPY(ssh->sessionId, ssh->h, ssh->hSz); ssh->sessionIdSz = ssh->hSz; @@ -5954,15 +5963,15 @@ int SendKexDhReply(WOLFSSH* ssh) if (ret == WS_SUCCESS) { wc_HashAlg digestHash; byte digest[WC_MAX_DIGEST_SIZE]; - byte sigHashId; + enum wc_HashType sigHashId; sigHashId = HashForId(ssh->handshake->pubKeyId); - ret = wc_HashInit(&digestHash, (enum wc_HashType)sigHashId); + ret = wc_HashInit(&digestHash, sigHashId); if (ret == 0) - ret = wc_HashUpdate(&digestHash, (enum wc_HashType)sigHashId, ssh->h, ssh->hSz); + ret = wc_HashUpdate(&digestHash, sigHashId, ssh->h, ssh->hSz); if (ret == 0) - ret = wc_HashFinal(&digestHash, (enum wc_HashType)sigHashId, digest); + ret = wc_HashFinal(&digestHash, sigHashId, digest); if (ret != 0) ret = WS_CRYPTO_FAILED; @@ -5972,8 +5981,8 @@ int SendKexDhReply(WOLFSSH* ssh) word32 encSigSz; encSigSz = wc_EncodeSignature(encSig, digest, - wc_HashGetDigestSize((enum wc_HashType)sigHashId), - wc_HashGetOID((enum wc_HashType)sigHashId)); + wc_HashGetDigestSize(sigHashId), + wc_HashGetOID(sigHashId)); if (encSigSz <= 0) { WLOG(WS_LOG_DEBUG, "SendKexDhReply: Bad Encode Sig"); ret = WS_CRYPTO_FAILED; @@ -5991,7 +6000,7 @@ int SendKexDhReply(WOLFSSH* ssh) else { WLOG(WS_LOG_INFO, "Signing hash with ECDSA."); sigSz = sizeof(sig); - ret = wc_ecc_sign_hash(digest, wc_HashGetDigestSize((enum wc_HashType)sigHashId), + ret = wc_ecc_sign_hash(digest, wc_HashGetDigestSize(sigHashId), sig, &sigSz, ssh->rng, &sigKeyBlock.sk.ecc.key); if (ret != MP_OKAY) {