mirror of https://github.com/wolfSSL/wolfssh.git
Address feedback & add more relevant files
parent
d0f45f4a2a
commit
f5b551c644
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
The wolfSSH Cube Pack can be found [here](https://www.wolfssl.com/files/ide/I-CUBE-wolfSSH.pack)
|
The wolfSSH Cube Pack can be found [here](https://www.wolfssl.com/files/ide/I-CUBE-wolfSSH.pack)
|
||||||
|
|
||||||
1. The first step is to setup the wolfCrypt library in your ST project following the guide here [https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md). To run the wolfSSH unit tests, name the entry function `wolfSSHTest` instead of `wolfCryptDemo`.
|
1. The first step is to set up the wolfCrypt library in your ST project following the guide here [https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md). To run the wolfSSH unit tests, name the entry function `wolfSSHTest` instead of `wolfCryptDemo`.
|
||||||
|
|
||||||
2. Then install the wolfSSH Cube Pack in the same manner as the wolfSSL pack with CUBEMX.
|
2. Then install the wolfSSH Cube Pack in the same manner as the wolfSSL pack with CUBEMX.
|
||||||
|
|
||||||
3. Open the project `.ioc` file and click the `Softare Packs` drop down menu and then `Select Components`. Expand the `wolfSSH` pack and check all the components.
|
3. Open the project `.ioc` file and click the `Software Packs` drop down menu and then `Select Components`. Expand the `wolfSSH` pack and check all the components.
|
||||||
|
|
||||||
4. In the `Softare Packs` configuration category of the `.ioc` file, click on the wolfSSH pack and enable the library by checking the box.
|
4. In the `Software Packs` configuration category of the `.ioc` file, click on the wolfSSH pack and enable the library by checking the box.
|
||||||
|
|
||||||
5. Since LwIP is a dependency for the Cube Pack, enable LwIP in the `Middleware` configuration category of the project. Also enable the `LWIP_DNS` option in the LwIP configuration settings.
|
5. Since LwIP is a dependency for the Cube Pack, enable LwIP in the `Middleware` configuration category of the project. Also enable the `LWIP_DNS` option in the LwIP configuration settings.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
[#ftl]
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : ${name}
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the ${name} instances.
|
||||||
|
******************************************************************************
|
||||||
|
[@common.optinclude name=mxTmpFolder+"/license.tmp"/][#--include License text --]
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
[#assign s = name]
|
||||||
|
[#assign toto = s?replace(".","_")]
|
||||||
|
[#assign toto = toto?replace("/","")]
|
||||||
|
[#assign toto = toto?replace("-","_")]
|
||||||
|
[#assign inclusion_protection = toto?upper_case]
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __${inclusion_protection}__
|
||||||
|
#define __${inclusion_protection}__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
[#if includes??]
|
||||||
|
[#list includes as include]
|
||||||
|
#include "${include}"
|
||||||
|
[/#list]
|
||||||
|
[/#if]
|
||||||
|
|
||||||
|
[#-- SWIPdatas is a list of SWIPconfigModel --]
|
||||||
|
[#list SWIPdatas as SWIP]
|
||||||
|
[#-- Global variables --]
|
||||||
|
[#if SWIP.variables??]
|
||||||
|
[#list SWIP.variables as variable]
|
||||||
|
extern ${variable.value} ${variable.name};
|
||||||
|
[/#list]
|
||||||
|
[/#if]
|
||||||
|
|
||||||
|
[#-- Global variables --]
|
||||||
|
|
||||||
|
[#assign instName = SWIP.ipName]
|
||||||
|
[#assign fileName = SWIP.fileName]
|
||||||
|
[#assign version = SWIP.version]
|
||||||
|
|
||||||
|
/**
|
||||||
|
MiddleWare name : ${instName}
|
||||||
|
MiddleWare fileName : ${fileName}
|
||||||
|
MiddleWare version : ${version}
|
||||||
|
*/
|
||||||
|
[#if SWIP.defines??]
|
||||||
|
[#list SWIP.defines as definition]
|
||||||
|
/*---------- [#if definition.comments??]${definition.comments}[/#if] -----------*/
|
||||||
|
#define ${definition.name} #t#t ${definition.value}
|
||||||
|
[#if definition.description??]${definition.description} [/#if]
|
||||||
|
[/#list]
|
||||||
|
[/#if]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[/#list]
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Platform */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#define WOLFSSH_STM32_CUBEMX
|
||||||
|
/* #define WOLFSSL_CMSIS_RTOS */
|
||||||
|
/* #define NO_FILESYSTEM */
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Enable Features */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* SCP */
|
||||||
|
#undef WOLFSSH_SCP
|
||||||
|
#if defined(WOLFSSH_CONF_SCP) && WOLFSSH_CONF_SCP == 1
|
||||||
|
#define WOLFSSH_SCP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SFTP */
|
||||||
|
#undef WOLFSSH_SFTP
|
||||||
|
#if !defined(NO_FILESYSTEM) && defined(WOLFSSH_CONF_SFTP) && WOLFSSH_CONF_SFTP == 1
|
||||||
|
#define WOLFSSH_SFTP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Debugging */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#if defined(WOLFSSH_CONF_DEBUG) && WOLFSSH_CONF_DEBUG == 1
|
||||||
|
#define DEBUG_WOLFSSH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* wolfSSH IO */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#define WOLFSSH_LWIP
|
||||||
|
#define WOLFSSH_USER_IO
|
||||||
|
#define WOLFSSL_USER_IO
|
||||||
|
|
||||||
|
/* To be defined for the target Socket API */
|
||||||
|
#define WSTARTTCP()
|
||||||
|
|
||||||
|
#define WOLFSSH_LOG_PRINTF
|
||||||
|
#define WOLFSSL_LOG_PRINTF
|
||||||
|
#define fprintf(err, ... ) printf(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define BENCH_EMBEDDED
|
||||||
|
#define NO_WRITEV
|
||||||
|
#define NO_DEV_RANDOM
|
||||||
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
#define WOLFSSL_USER_CURRTIME
|
||||||
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
#define NO_WOLFSSL_DIR
|
||||||
|
#define WOLFSSL_NO_CURRDIR
|
||||||
|
#define NO_WOLF_C99
|
||||||
|
#define NO_MULTIBYTE_PRINT
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(NO_FILESYSTEM)
|
||||||
|
#define WOLFSSH_USER_FILESYSTEM
|
||||||
|
#endif
|
||||||
|
#define NO_WOLFSSH_DIR
|
||||||
|
|
||||||
|
|
||||||
|
#define XVALIDATEDATE(d, f,t) (0)
|
||||||
|
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||||
|
|
||||||
|
#define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */
|
||||||
|
|
||||||
|
#define TFM_TIMING_RESISTANT
|
||||||
|
#define ECC_TIMING_RESISTANT
|
||||||
|
#define WC_RSA_BLINDING
|
||||||
|
|
||||||
|
/* #define NO_DH */
|
||||||
|
#define HAVE_AESGCM
|
||||||
|
#define WOLFSSL_SHA512
|
||||||
|
#define HAVE_ECC
|
||||||
|
#define HAVE_CURVE25519
|
||||||
|
#define CURVE25519_SMALL
|
||||||
|
#define HAVE_ED25519
|
||||||
|
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
|
||||||
|
/* defines for unit tests */
|
||||||
|
#define NO_UNITTEST_MAIN_DRIVER
|
||||||
|
#define NO_TESTSUITE_MAIN_DRIVER
|
||||||
|
#define NO_APITEST_MAIN_DRIVER
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* ${inclusion_protection}_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*****END OF FILE****/
|
|
@ -0,0 +1,10 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# included from Top Level Makefile.am
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/main.c
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/wolfssh_test.c
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/wolfssh_test.h
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/myFilesystem.h
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/README.md
|
||||||
|
EXTRA_DIST+= ide/STM32CUBE/default_conf.ftl
|
|
@ -0,0 +1,227 @@
|
||||||
|
/* main.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2023 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Example for main.c with STM32Cube/wolfssh_test.c */
|
||||||
|
|
||||||
|
#if 0 /* EXAMPLE main.c */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
#include "lwip.h"
|
||||||
|
|
||||||
|
RNG_HandleTypeDef hrng;
|
||||||
|
|
||||||
|
UART_HandleTypeDef huart2;
|
||||||
|
|
||||||
|
/* Definitions for defaultTask */
|
||||||
|
osThreadId_t defaultTaskHandle;
|
||||||
|
const osThreadAttr_t defaultTask_attributes = {
|
||||||
|
.name = "defaultTask",
|
||||||
|
.stack_size = 128 * 4,
|
||||||
|
.priority = (osPriority_t) osPriorityNormal,
|
||||||
|
};
|
||||||
|
/* Definitions for myTask02 */
|
||||||
|
osThreadId_t myTask02Handle;
|
||||||
|
const osThreadAttr_t myTask02_attributes = {
|
||||||
|
.name = "myTask02",
|
||||||
|
.stack_size = 3000 * 4,
|
||||||
|
.priority = (osPriority_t) osPriorityLow,
|
||||||
|
};
|
||||||
|
|
||||||
|
void SystemClock_Config(void);
|
||||||
|
static void MX_GPIO_Init(void);
|
||||||
|
static void MX_RNG_Init(void);
|
||||||
|
static void MX_USART2_UART_Init(void);
|
||||||
|
void StartDefaultTask(void *argument);
|
||||||
|
extern void wolfSSHTest(void *argument);
|
||||||
|
|
||||||
|
/* Retargets the C library printf function to the USART. */
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifdef __GNUC__
|
||||||
|
int __io_putchar(int ch)
|
||||||
|
#else
|
||||||
|
int fputc(int ch, FILE *f)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
#ifdef __GNUC__
|
||||||
|
int _write(int file,char *ptr, int len)
|
||||||
|
{
|
||||||
|
int DataIdx;
|
||||||
|
for (DataIdx= 0; DataIdx< len; DataIdx++) {
|
||||||
|
__io_putchar(*ptr++);
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
|
HAL_Init();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Init */
|
||||||
|
setvbuf(stdin, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0);
|
||||||
|
/* USER CODE END Init */
|
||||||
|
|
||||||
|
/* Configure the system clock */
|
||||||
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* Initialize all configured peripherals */
|
||||||
|
MX_GPIO_Init();
|
||||||
|
MX_RNG_Init();
|
||||||
|
MX_USART2_UART_Init();
|
||||||
|
|
||||||
|
/* Init scheduler */
|
||||||
|
osKernelInitialize();
|
||||||
|
|
||||||
|
/* creation of defaultTask */
|
||||||
|
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
|
||||||
|
|
||||||
|
/* creation of myTask02 */
|
||||||
|
myTask02Handle = osThreadNew(wolfSSHTest, NULL, &myTask02_attributes);
|
||||||
|
|
||||||
|
/* Start scheduler */
|
||||||
|
osKernelStart();
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
|
while (1) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the RCC Oscillators according to the specified parameters
|
||||||
|
* in the RCC_OscInitTypeDef structure.
|
||||||
|
*/
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||||
|
RCC_OscInitStruct.PLL.PLLM = 13;
|
||||||
|
RCC_OscInitStruct.PLL.PLLN = 195;
|
||||||
|
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 5;
|
||||||
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the CPU, AHB and APB buses clocks
|
||||||
|
*/
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||||
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||||
|
|
||||||
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MX_RNG_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
hrng.Instance = RNG;
|
||||||
|
if (HAL_RNG_Init(&hrng) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MX_USART2_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
huart2.Instance = USART2;
|
||||||
|
huart2.Init.BaudRate = 115200;
|
||||||
|
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
|
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||||
|
huart2.Init.Parity = UART_PARITY_NONE;
|
||||||
|
huart2.Init.Mode = UART_MODE_TX_RX;
|
||||||
|
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
|
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||||
|
if (HAL_UART_Init(&huart2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MX_GPIO_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* GPIO Ports Clock Enable */
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void StartDefaultTask(void *argument)
|
||||||
|
{
|
||||||
|
/* init code for LWIP */
|
||||||
|
MX_LWIP_Init();
|
||||||
|
/* Infinite loop */
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
osDelay(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||||
|
{
|
||||||
|
if (htim->Instance == TIM1) {
|
||||||
|
HAL_IncTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Error_Handler(void)
|
||||||
|
{
|
||||||
|
__disable_irq();
|
||||||
|
while (1) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
void assert_failed(uint8_t *file, uint32_t line)
|
||||||
|
{
|
||||||
|
/* User can add his own implementation to report the file name and line number,
|
||||||
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||||
|
}
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* EXAMPLE main.c */
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/* myFilesystem.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2023 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MY_FILESYSTEM_H
|
||||||
|
#define MY_FILESYSTEM_H
|
||||||
|
|
||||||
|
#ifdef WOLFSSH_USER_FILESYSTEM
|
||||||
|
|
||||||
|
#define WFILE int
|
||||||
|
|
||||||
|
#define WSEEK_END SEEK_END
|
||||||
|
#define WBADFILE NULL
|
||||||
|
#define WS_DELIM '/'
|
||||||
|
enum {
|
||||||
|
WOLFSSH_O_RDWR, WOLFSSH_O_RDONLY, WOLFSSH_O_WRONLY,
|
||||||
|
WOLFSSH_O_APPEND, WOLFSSH_O_CREAT, WOLFSSH_O_TRUNC, WOLFSSH_O_EXCL
|
||||||
|
} ;
|
||||||
|
|
||||||
|
#define WSTAT_T stat_t
|
||||||
|
typedef struct { int i; } stat_t;
|
||||||
|
|
||||||
|
#define WFD int
|
||||||
|
enum { O_RDWR, O_RDONLY, O_WRONLY, O_APPEND, O_CREAT, O_TRUNC, O_EXCL } ;
|
||||||
|
|
||||||
|
static int WFOPEN(FILE **f, const char *n, const char *m){
|
||||||
|
(void) n; (void) m; (void)f;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WFCLOSE(FILE *f) {
|
||||||
|
(void) f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t WFREAD(void *b, size_t s, size_t n, FILE *f) {
|
||||||
|
(void) b; (void) s; (void) n; (void) f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t WFWRITE(const void *b, size_t s, size_t n, FILE *f) {
|
||||||
|
(void) b; (void) s; (void) n; (void) f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WFSEEK(FILE *f, long int p, int m) {
|
||||||
|
(void) f; (void) p; (void) m;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long int WFTELL(FILE *f) {
|
||||||
|
(void) f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static void WREWIND(FILE *f) {
|
||||||
|
(void) f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WOPEN (const char* n, int f, int m) {
|
||||||
|
(void) f; (void) n; (void) m;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WCLOSE(int f) {
|
||||||
|
(void) f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t WPREAD(int f, void* b, size_t c, off_t *o) {
|
||||||
|
(void) f; (void) b; (void) c; (void)o;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t WPWRITE(int f, void* b, size_t c, off_t *o) {
|
||||||
|
(void) f; (void) b; (void) c; (void)o;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *WGETCWD(void *fs, char *f, size_t l){
|
||||||
|
(void) fs; (void) f; (void) l;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WRMDIR(void *fs, const char *p){
|
||||||
|
(void) p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WMKDIR(void *fs, const char *p, mode_t m) {
|
||||||
|
(void) p; (void) m;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WREMOVE(void *fs, const char *p){
|
||||||
|
(void) fs; (void) p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WRENAME(void *fs, const char *p, const char *np){
|
||||||
|
(void) fs; (void) p; (void)np;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WSTAT(const char *p, stat_t *b) {
|
||||||
|
(void) p; (void)b;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WLSTAT(const char *p, stat_t *b) {
|
||||||
|
(void) p; (void)b;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WCHMOD(void *fs, const char *p, mode_t m) {
|
||||||
|
(void) fs; (void) p; (void)m;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SFTP_GetAttributes(void* fs, const char* fileName,
|
||||||
|
void* atr, byte link, void* heap) {
|
||||||
|
(void)fs; (void)fileName; (void)atr; (void)link; (void)heap;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SFTP_GetAttributes_Handle(void* ssh, byte* handle, int handleSz,
|
||||||
|
void* atr) {
|
||||||
|
(void)ssh; (void)handle; (void)handleSz;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WOLFSSH_USER_FILESYSTEM */
|
||||||
|
|
||||||
|
#endif
|
|
@ -6,5 +6,6 @@ include ide/winvs/include.am
|
||||||
include ide/CSBENCH/include.am
|
include ide/CSBENCH/include.am
|
||||||
include ide/MQX/include.am
|
include ide/MQX/include.am
|
||||||
include ide/IAR-EWARM/include.am
|
include ide/IAR-EWARM/include.am
|
||||||
|
include ide/STM32CUBE/include.am
|
||||||
|
|
||||||
EXTRA_DIST += ide/Renesas
|
EXTRA_DIST += ide/Renesas
|
||||||
|
|
|
@ -1182,13 +1182,9 @@ extern "C" {
|
||||||
|
|
||||||
#elif defined(WOLFSSH_USER_FILESYSTEM)
|
#elif defined(WOLFSSH_USER_FILESYSTEM)
|
||||||
/* User-defined I/O support */
|
/* User-defined I/O support */
|
||||||
#ifdef WOLFSSH_STM32_CUBEMX
|
#include "myFilesystem.h"
|
||||||
#include <wolfssh/myFilesystem.h>
|
|
||||||
#else
|
|
||||||
#include "myFilesystem.h"
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <unistd.h> /* used for rmdir */
|
#include <unistd.h> /* used for rmdir */
|
||||||
#include <sys/stat.h> /* used for mkdir, stat, and lstat */
|
#include <sys/stat.h> /* used for mkdir, stat, and lstat */
|
||||||
#include <stdio.h> /* used for remove and rename */
|
#include <stdio.h> /* used for remove and rename */
|
||||||
|
|
|
@ -113,23 +113,29 @@
|
||||||
#include <signal.h> /* ignore SIGPIPE */
|
#include <signal.h> /* ignore SIGPIPE */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NUM_SOCKETS 5
|
||||||
|
#elif defined(WOLFSSH_LWIP)
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <lwip/tcp.h>
|
||||||
|
#include <lwip/inet.h>
|
||||||
|
#include <lwip/netdb.h>
|
||||||
|
#ifndef SO_NOSIGPIPE
|
||||||
|
#include <signal.h> /* ignore SIGPIPE */
|
||||||
|
#endif
|
||||||
|
#define SOCKET_T int
|
||||||
#define NUM_SOCKETS 5
|
#define NUM_SOCKETS 5
|
||||||
#else /* USE_WINDOWS_API */
|
#else /* USE_WINDOWS_API */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifdef WOLFSSH_LWIP
|
#include <netdb.h>
|
||||||
#include <lwip/tcp.h>
|
#include <netinet/in.h>
|
||||||
#include <lwip/inet.h>
|
#include <netinet/tcp.h>
|
||||||
#include <lwip/netdb.h>
|
#include <arpa/inet.h>
|
||||||
#else
|
#include <sys/ioctl.h>
|
||||||
#include <netdb.h>
|
#include <fcntl.h>
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
|
||||||
#ifndef SO_NOSIGPIPE
|
#ifndef SO_NOSIGPIPE
|
||||||
#include <signal.h> /* ignore SIGPIPE */
|
#include <signal.h> /* ignore SIGPIPE */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue