mirror of https://github.com/wolfSSL/wolfssh.git
Initial support for STM32Cube
parent
f8651c952b
commit
d0f45f4a2a
|
@ -0,0 +1,22 @@
|
|||
# wolfSSH for STM32 Cube IDE
|
||||
|
||||
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`.
|
||||
|
||||
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.
|
||||
|
||||
4. In the `Softare 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.
|
||||
|
||||
6. Save your changes and select yes to the prompt asking about generating code.
|
||||
|
||||
7. Build the project and run the unit tests.
|
||||
|
||||
## Notes
|
||||
- Make sure to make [these changes](https://github.com/wolfSSL/wolfssl/tree/master/IDE/STM32Cube#stm32-printf) to redirect the printf's to the UART.
|
||||
|
||||
- If looking to enable filesystem support, 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_FILESYSTEM` with `#define WOLFSSH_FATFS` in the `wolfSSL.I-CUBE-wolfSSH_conf.h` header file. The wolfSSL Cube Pack also defaults to disabling filesystem support so make sure to remove `#define NO_FILESYSTEM` from `wolfSSL.I-CUBE-wolfSSL_conf.h`.
|
|
@ -0,0 +1,60 @@
|
|||
/* wolfssh_test.c
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#include "wolfssh_test.h"
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include <cmsis_os.h>
|
||||
|
||||
#ifdef WOLFSSL_DEBUG_MEMORY
|
||||
/* for memory debugging */
|
||||
#include <task.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef CMSIS_OS2_H_
|
||||
void wolfSSHTest(void* argument)
|
||||
#else
|
||||
void wolfSSHTest(const void* argument)
|
||||
#endif
|
||||
{
|
||||
int ret = 0;
|
||||
#if 0
|
||||
wolfSSL_Debugging_ON();
|
||||
wolfSSH_Debugging_ON();
|
||||
#endif
|
||||
|
||||
printf("Running wolfSSH Tests...\n");
|
||||
|
||||
if (wolfSSH_TestsuiteTest(0, NULL))
|
||||
ret = -1;
|
||||
if (wolfSSH_UnitTest(0, NULL))
|
||||
ret = -1;
|
||||
if (wolfSSH_ApiTest(0, NULL))
|
||||
ret = -1;
|
||||
|
||||
printf("wolfSSH Test: Return code %d\n", ret);
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* wolfssh_test.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#ifndef WOLFSSH_TEST_H_
|
||||
#define WOLFSSH_TEST_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "../../tests/unit.h"
|
||||
#include "../../tests/api.h"
|
||||
#include "../../tests/testsuite.h"
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include <cmsis_os.h>
|
||||
#endif
|
||||
|
||||
#ifdef CMSIS_OS2_H_
|
||||
void wolfSSHTest(void* argument);
|
||||
#else
|
||||
void wolfSSHTest(void const * argument);
|
||||
#endif
|
||||
|
||||
#endif /* WOLFSSH_TEST_H_ */
|
|
@ -1182,7 +1182,11 @@ extern "C" {
|
|||
|
||||
#elif defined(WOLFSSH_USER_FILESYSTEM)
|
||||
/* User-defined I/O support */
|
||||
#include "myFilesystem.h"
|
||||
#ifdef WOLFSSH_STM32_CUBEMX
|
||||
#include <wolfssh/myFilesystem.h>
|
||||
#else
|
||||
#include "myFilesystem.h"
|
||||
#endif
|
||||
#else
|
||||
|
||||
#include <unistd.h> /* used for rmdir */
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
|
||||
#ifdef WOLFSSL_USER_SETTINGS
|
||||
#include "user_settings.h"
|
||||
#elif defined(USE_HAL_DRIVER) && !defined(HAVE_CONFIG_H)
|
||||
/* STM Configuration File (generated by CubeMX) */
|
||||
#include "wolfSSL.I-CUBE-wolfSSH_conf.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -116,14 +116,20 @@
|
|||
#define NUM_SOCKETS 5
|
||||
#else /* USE_WINDOWS_API */
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <pthread.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef WOLFSSH_LWIP
|
||||
#include <lwip/tcp.h>
|
||||
#include <lwip/inet.h>
|
||||
#include <lwip/netdb.h>
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifndef SO_NOSIGPIPE
|
||||
#include <signal.h> /* ignore SIGPIPE */
|
||||
#endif
|
||||
|
@ -529,7 +535,8 @@ static INLINE void tcp_socket(WS_SOCKET_T* sockFd)
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(WOLFSSH_TEST_SERVER) && !defined(FREESCALE_MQX)
|
||||
#if defined(WOLFSSH_TEST_SERVER) && !defined(FREESCALE_MQX)\
|
||||
&& !defined(WOLFSSH_LWIP)
|
||||
|
||||
static INLINE void tcp_listen(WS_SOCKET_T* sockfd, word16* port, int useAnyAddr)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue