- Track open SFTP file handles per session in a fileList, returning opaque session-scoped handle IDs instead of raw file descriptors. - Resolve and validate client-supplied handle IDs via FindFileHandle. - Free the handle list and close handles on error paths, including the Windows code paths. - Drop the old raw-fd SFTP_ValidateFileHandle/STOREHANDLE handle table and its tests, superseded by the per-session ID lookup. |
||
|---|---|---|
| .. | ||
| README.md | ||
| default_conf.ftl | ||
| include.am | ||
| main.c | ||
| myFilesystem.h | ||
| userio_template.h | ||
| wolfssh_test.c | ||
| wolfssh_test.h | ||
README.md
wolfSSH for STM32 Cube IDE
The wolfSSH Cube Pack can be found here and is dependent on the wolfCrypt library.
Dependencies
wolfCrypt
The wolfCrypt crypto library is required to build/run the wolfSSH pack.
RTOS
The wolfSSH pack core functionality can be built without an RTOS but to build/run the tests, FreeRTOS will have to be added as a middlware.
Input/Output
By default, the wolfSSH pack uses a dummy custom IO implementation. The user is expected to be provide their own implementation in ide/STM32CUBE/userio_template.h. Alternatively, they can enable LwIP and configure wolfSSH to use it.
Building and Running Tests
-
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. To run the wolfSSH unit tests, name the entry function
wolfSSHTestinstead ofwolfCryptDemo. -
Then install the wolfSSH Cube Pack in the same manner as the wolfSSL pack with CUBEMX.
-
Open the project
.iocfile and click theSoftware Packsdrop down menu and thenSelect Components. Expand thewolfSSHpack and check all the components. -
In the
Software Packsconfiguration category of the.iocfile, click on the wolfSSH pack and enable the library by checking the box. -
The Pack defaults to using custom IO provided by the user. Modify
ide/STM32CUBE/userio_template.hto supply the custom IO. If you'd like to use LwIP instead, configure the wolfSSH IO settings in the.iocto enable LwIP compatibilty. You'll also have to enable LwIP in theMiddlewareconfiguration category of the project. Enable theLWIP_DNSoption in the LwIP configuration settings. -
Save your changes and select yes to the prompt asking about generating code.
-
Build the project and run the unit tests.
Notes
-
Make sure to make these changes to redirect the printf's to the UART.
-
If looking to enable filesystem support (required for SFTP), the pack assumes the user has defined their own filesystem in
wolfssh/myFilesystem.h. That file will originally contain a dummy filesystem. If going the FATFS route, make sure to replace#define WOLFSSH_USER_FILESYSTEMwith#define WOLFSSH_FATFSin thewolfSSL.I-CUBE-wolfSSH_conf.hheader file. The wolfSSL Cube Pack also defaults to disabling filesystem support so make sure to remove#define NO_FILESYSTEMfromwolfSSL.I-CUBE-wolfSSL_conf.h. -
If building with LwIP and you encounter the error
multiple definition of 'errno'inMiddlewares/Third_Party/LwIP/system/OS/sys_arch.c, modify the file as shown below.
#if defined(LWIP_SOCKET_SET_ERRNO) && defined(LWIP_PROVIDE_ERRNO)
- int errno;
+ extern int errno;
#endif