zephyr no malloc

- cert gen
- csr gen
- pkcs12
- Compiles for Zephyr 3.4.0 and 2.7.4
- Add support for CONFIG_POSIX_API
pull/7438/head
Juliusz Sosinowicz 2024-04-16 16:25:17 +02:00
parent 4e6a34504d
commit 7ed5e0b3ba
18 changed files with 401 additions and 51 deletions

View File

@ -991,11 +991,18 @@ void* wolfSSL_Malloc(size_t size, void* heap, int type)
break;
}
#ifdef WOLFSSL_DEBUG_STATIC_MEMORY
#ifdef WOLFSSL_ZEPHYR
else {
fprintf(stderr, "Size: %zu, Empty: %d\n", size,
mem->sizeList[i]);
}
#else
else {
fprintf(stderr, "Size: %ld, Empty: %d\n", size,
mem->sizeList[i]);
}
#endif
#endif
}
}
}
@ -1029,7 +1036,13 @@ void* wolfSSL_Malloc(size_t size, void* heap, int type)
else {
WOLFSSL_MSG("ERROR ran out of static memory");
#ifdef WOLFSSL_DEBUG_MEMORY
fprintf(stderr, "Looking for %lu bytes at %s:%d\n", size, func, line);
#ifdef WOLFSSL_ZEPHYR
fprintf(stderr, "Looking for %zu bytes at %s:%d\n", size, func,
line);
#else
fprintf(stderr, "Looking for %lu bytes at %s:%d\n", size, func,
line);
#endif
#endif
}

View File

@ -130,15 +130,22 @@ typedef struct WC_PKCS12_ATTRIBUTE {
WC_PKCS12* wc_PKCS12_new(void)
{
return wc_PKCS12_new_ex(NULL);
}
WC_PKCS12* wc_PKCS12_new_ex(void* heap)
{
WC_PKCS12* pkcs12 = (WC_PKCS12*)XMALLOC(sizeof(WC_PKCS12),
NULL, DYNAMIC_TYPE_PKCS);
heap, DYNAMIC_TYPE_PKCS);
if (pkcs12 == NULL) {
WOLFSSL_MSG("Memory issue when creating WC_PKCS12 struct");
return NULL;
}
XMEMSET(pkcs12, 0, sizeof(WC_PKCS12));
pkcs12->heap = heap;
return pkcs12;
}
@ -202,7 +209,7 @@ void wc_PKCS12_free(WC_PKCS12* pkcs12)
}
#endif
XFREE(pkcs12, NULL, DYNAMIC_TYPE_PKCS);
XFREE(pkcs12, heap, DYNAMIC_TYPE_PKCS);
}
@ -2604,20 +2611,12 @@ WC_PKCS12* wc_PKCS12_create(char* pass, word32 passSz, char* name,
return NULL;
}
if ((pkcs12 = wc_PKCS12_new()) == NULL) {
if ((pkcs12 = wc_PKCS12_new_ex(heap)) == NULL) {
wc_FreeRng(&rng);
WOLFSSL_LEAVE("wc_PKCS12_create", MEMORY_E);
return NULL;
}
if ((ret = wc_PKCS12_SetHeap(pkcs12, heap)) != 0) {
wc_PKCS12_free(pkcs12);
wc_FreeRng(&rng);
WOLFSSL_LEAVE("wc_PKCS12_create", ret);
(void)ret;
return NULL;
}
if (iter <= 0) {
iter = WC_PKCS12_ITT_DEFAULT;
}

View File

@ -3736,11 +3736,19 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
#if KERNEL_VERSION_NUMBER >= 0x30500
#include <zephyr/random/random.h>
#else
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/random/rand32.h>
#else
#include <random/rand32.h>
#endif
#endif
#ifndef _POSIX_C_SOURCE
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/posix/time.h>
#else
#include <posix/time.h>
#endif
#else
#include <time.h>
#endif

View File

@ -3668,11 +3668,13 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
#elif defined(WOLFSSL_ZEPHYR)
void* wolfsslThreadHeapHint = NULL;
int wolfSSL_NewThread(THREAD_TYPE* thread,
THREAD_CB cb, void* arg)
{
#ifndef WOLFSSL_ZEPHYR_STACK_SZ
#define WOLFSSL_ZEPHYR_STACK_SZ (24*1024)
#define WOLFSSL_ZEPHYR_STACK_SZ (48*1024)
#endif
if (thread == NULL || cb == NULL)
@ -3685,11 +3687,14 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
* thread->threadStack = k_thread_stack_alloc(WOLFSSL_ZEPHYR_STACK_SZ,
* 0);
*/
printf("thread stack size is %ld\n", Z_KERNEL_STACK_SIZE_ADJUST(WOLFSSL_ZEPHYR_STACK_SZ));
thread->threadStack = (void*)XMALLOC(
Z_KERNEL_STACK_SIZE_ADJUST(WOLFSSL_ZEPHYR_STACK_SZ), 0,
DYNAMIC_TYPE_TMP_BUFFER);
if (thread->threadStack == NULL)
Z_KERNEL_STACK_SIZE_ADJUST(WOLFSSL_ZEPHYR_STACK_SZ),
wolfsslThreadHeapHint, DYNAMIC_TYPE_TMP_BUFFER);
if (thread->threadStack == NULL) {
WOLFSSL_MSG("error: XMALLOC failed");
return MEMORY_E;
}
/* k_thread_create does not return any error codes */
/* Casting to k_thread_entry_t should be fine since we just ignore the
@ -3716,7 +3721,8 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
* if (err != 0)
* ret = MEMORY_E;
*/
XFREE(thread.threadStack, NULL, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(thread.threadStack, wolfsslThreadHeapHint,
DYNAMIC_TYPE_TMP_BUFFER);
thread.threadStack = NULL;
/* No thread resources to free. Everything is stored in thread.tid */

View File

@ -354,6 +354,9 @@ const byte const_byte_array[] = "A+Gd\0\0\0";
#ifdef HAVE_PKCS7
#include <wolfssl/wolfcrypt/pkcs7.h>
#endif
#ifdef HAVE_PKCS12
#include <wolfssl/wolfcrypt/pkcs12.h>
#endif
#ifdef HAVE_FIPS
#include <wolfssl/wolfcrypt/fips_test.h>
#endif
@ -584,6 +587,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srp_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t random_test(void);
#endif /* WC_NO_RNG */
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ripemd_test(void);
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_test(void); /* test mini api */
@ -595,7 +599,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t openssl_evpSig_test(void);
#endif
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf1_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_pbkdf_test(void);
#if defined(HAVE_PBKDF2) && !defined(NO_SHA256) && !defined(NO_HMAC)
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pbkdf2_test(void);
#endif
@ -1672,6 +1676,13 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
PRIVATE_KEY_LOCK();
#endif
#if defined(HAVE_PKCS12) && defined(USE_CERT_BUFFERS_2048)
if ( (ret = pkcs12_test()) != 0)
TEST_FAIL("PKCS12 test failed!\n", ret);
else
TEST_PASS("PKCS12 test passed!\n");
#endif
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
if ( (ret = openssl_test()) != 0)
TEST_FAIL("OPENSSL test failed!\n", ret);
@ -24707,7 +24718,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t scrypt_test(void)
#endif
#ifdef HAVE_PKCS12
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_pbkdf_test(void)
{
WOLFSSL_SMALL_STACK_STATIC const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67,
0x00, 0x00 };
@ -24734,7 +24745,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
int kLen = 24;
int iterations = 1;
wc_test_ret_t ret;
WOLFSSL_ENTER("pkcs12_test");
WOLFSSL_ENTER("pkcs12_pbkdf_test");
ret = wc_PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8,
iterations, kLen, WC_SHA256, id);
@ -24839,7 +24850,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void)
return ret;
#endif
#ifdef HAVE_PKCS12
ret = pkcs12_test();
ret = pkcs12_pbkdf_test();
if (ret != 0)
return ret;
#endif
@ -24853,6 +24864,76 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pwdbased_test(void)
#endif /* NO_PWDBASED */
#if defined(HAVE_PKCS12) && defined(USE_CERT_BUFFERS_2048)
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t pkcs12_test(void)
{
wc_test_ret_t ret = 0;
WC_PKCS12* pkcs12 = NULL;
/* Gen vars */
byte* pkcs12der = NULL;
int pkcs12derSz = 0;
WC_DerCertList derCaList = {
(byte*)ca_cert_der_2048, sizeof_ca_cert_der_2048, NULL
};
char* pass = (char*)"wolfSSL test";
/* Parsing vars */
WC_DerCertList* derCaListOut = NULL;
byte* keyDer = NULL;
byte* certDer = NULL;
word32 keySz;
word32 certSz;
WOLFSSL_ENTER("pkcs12_test");
pkcs12 = wc_PKCS12_create(pass, XSTRLEN(pass),
(char*)"friendlyName" /* not used currently */,
(byte*)server_key_der_2048, sizeof_server_key_der_2048,
(byte*)server_cert_der_2048, sizeof_server_cert_der_2048,
&derCaList, PBE_SHA1_DES3, PBE_SHA1_DES3, 100, 100,
0 /* not used currently */, HEAP_HINT);
if (pkcs12 == NULL)
return MEMORY_E;
ret = wc_i2d_PKCS12(pkcs12, NULL, &pkcs12derSz);
if (ret != LENGTH_ONLY_E)
return ret == 0 ? -1 : ret;
pkcs12der = (byte*)XMALLOC(pkcs12derSz, HEAP_HINT, DYNAMIC_TYPE_PKCS);
if (pkcs12der == NULL)
return MEMORY_E;
{
/* Use tmp pointer to avoid advancing pkcs12der */
byte* tmp = pkcs12der;
ret = wc_i2d_PKCS12(pkcs12, &tmp, &pkcs12derSz);
if (ret <= 0)
return ret == 0 ? -1 : ret;
}
wc_PKCS12_free(pkcs12);
pkcs12 = wc_PKCS12_new_ex(HEAP_HINT);
if (pkcs12 == NULL)
return MEMORY_E;
/* convert the DER file into an internal structure */
ret = wc_d2i_PKCS12(pkcs12der, pkcs12derSz, pkcs12);
if (ret != 0)
return ret;
/* parse the internal structure into its parts */
ret = wc_PKCS12_parse(pkcs12, "wolfSSL test", &keyDer, &keySz,
&certDer, &certSz, &derCaListOut);
if (ret != 0 || keyDer == NULL || certDer == NULL || derCaListOut == NULL)
return ret == 0 ? -1 : ret;
wc_FreeCertList(derCaListOut, HEAP_HINT);
XFREE(keyDer, HEAP_HINT, DYNAMIC_TYPE_PKCS);
XFREE(certDer, HEAP_HINT, DYNAMIC_TYPE_PKCS);
wc_PKCS12_free(pkcs12);
return ret;
}
#endif
#if defined(HAVE_HKDF) && !defined(NO_HMAC)
#if defined(WOLFSSL_AFALG_XILINX) || defined(WOLFSSL_AFALG_XILINX_AES) || \
@ -50257,7 +50338,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
return BAD_FUNC_ARG;
#ifdef DEBUG_WOLFSSL
printf("CryptoDevCb: Algo Type %d\n", info->algo_type);
WOLFSSL_MSG_EX("CryptoDevCb: Algo Type %d\n", info->algo_type);
#endif
if (info->algo_type == WC_ALGO_TYPE_RNG) {
@ -50299,7 +50380,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
}
else if (info->algo_type == WC_ALGO_TYPE_PK) {
#ifdef DEBUG_WOLFSSL
printf("CryptoDevCb: Pk Type %d\n", info->pk.type);
WOLFSSL_MSG_EX("CryptoDevCb: Pk Type %d\n", info->pk.type);
#endif
#ifndef NO_RSA

View File

@ -206,7 +206,12 @@
#endif
#elif defined(WOLFSSL_ZEPHYR)
#ifndef SINGLE_THREADED
#include <version.h>
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/kernel.h>
#else
#include <kernel.h>
#endif
#endif
#elif defined(WOLFSSL_TELIT_M2MB)
/* do nothing */

View File

@ -143,9 +143,26 @@
#include <pthread.h>
#define SOCKET_T int
#elif defined(WOLFSSL_ZEPHYR)
#include <version.h>
#include <string.h>
#include <sys/types.h>
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/net/socket.h>
#ifdef CONFIG_POSIX_API
#include <zephyr/posix/poll.h>
#include <zephyr/posix/netdb.h>
#include <zephyr/posix/sys/socket.h>
#include <zephyr/posix/sys/select.h>
#endif
#else
#include <net/socket.h>
#ifdef CONFIG_POSIX_API
#include <posix/poll.h>
#include <posix/netdb.h>
#include <posix/sys/socket.h>
#include <posix/sys/select.h>
#endif
#endif
#define SOCKET_T int
#define SOL_SOCKET 1
#define WOLFSSL_USE_GETADDRINFO

View File

@ -47,6 +47,7 @@ enum {
};
WOLFSSL_API WC_PKCS12* wc_PKCS12_new(void);
WOLFSSL_API WC_PKCS12* wc_PKCS12_new_ex(void* heap);
WOLFSSL_API void wc_PKCS12_free(WC_PKCS12* pkcs12);
WOLFSSL_API int wc_d2i_PKCS12(const byte* der, word32 derSz, WC_PKCS12* pkcs12);
#ifndef NO_FILESYSTEM
@ -67,7 +68,7 @@ WOLFSSL_API WC_PKCS12* wc_PKCS12_create(char* pass, word32 passSz,
WOLFSSL_LOCAL int wc_PKCS12_SetHeap(WC_PKCS12* pkcs12, void* heap);
WOLFSSL_LOCAL void* wc_PKCS12_GetHeap(WC_PKCS12* pkcs12);
WOLFSSL_LOCAL void wc_FreeCertList(WC_DerCertList* list, void* heap);
WOLFSSL_API void wc_FreeCertList(WC_DerCertList* list, void* heap);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -2082,9 +2082,16 @@ extern void uITRON4_free(void *p) ;
#endif /*(WOLFSSL_APACHE_MYNEWT)*/
#ifdef WOLFSSL_ZEPHYR
#include <version.h>
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/util.h>
#else
#include <kernel.h>
#include <sys/printk.h>
#include <sys/util.h>
#endif
#include <stdlib.h>
#define WOLFSSL_DH_CONST

View File

@ -1422,6 +1422,7 @@ typedef struct w64wrapper {
k_thread_stack_t* threadStack;
} THREAD_TYPE;
#define WOLFSSL_THREAD
extern void* wolfsslThreadHeapHint;
#elif defined(NETOS)
typedef UINT THREAD_RETURN;
typedef struct {

View File

@ -145,13 +145,20 @@
#elif defined(WOLFSSL_APACHE_MYNEWT)
/* do nothing */
#elif defined(WOLFSSL_ZEPHYR)
#include <version.h>
#ifndef SINGLE_THREADED
#ifndef CONFIG_PTHREAD_IPC
#error "Need CONFIG_PTHREAD_IPC for threading"
#endif
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/kernel.h>
#include <zephyr/posix/posix_types.h>
#include <zephyr/posix/pthread.h>
#else
#include <kernel.h>
#include <posix/posix_types.h>
#include <posix/pthread.h>
#endif
#endif
#elif defined(WOLFSSL_TELIT_M2MB)
@ -999,8 +1006,13 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#define USE_WOLF_TIME_T
#elif defined(WOLFSSL_ZEPHYR)
#include <version.h>
#ifndef _POSIX_C_SOURCE
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/posix/time.h>
#else
#include <posix/time.h>
#endif
#else
#include <time.h>
#endif

View File

@ -129,7 +129,18 @@
#include <lwip-socket.h>
#include <errno.h>
#elif defined(WOLFSSL_ZEPHYR)
#include <version.h>
#if KERNEL_VERSION_NUMBER >= 0x30100
#include <zephyr/net/socket.h>
#ifdef CONFIG_POSIX_API
#include <zephyr/posix/sys/socket.h>
#endif
#else
#include <net/socket.h>
#ifdef CONFIG_POSIX_API
#include <posix/sys/socket.h>
#endif
#endif
#elif defined(MICROCHIP_PIC32)
#include <sys/errno.h>
#elif defined(HAVE_NETX)

View File

@ -165,6 +165,7 @@ if(CONFIG_WOLFSSL)
target_compile_definitions(wolfSSL INTERFACE WOLFSSL_USER_SETTINGS)
if(CONFIG_WOLFSSL_DEBUG)
target_compile_definitions(wolfSSL INTERFACE DEBUG_WOLFSSL)
zephyr_library_compile_options(-g3 -O0)
endif()
else()
assert(CONFIG_WOLFSSL_LIBRARY "wolfSSL was enabled, but neither BUILTIN or LIBRARY was selected.")

View File

@ -23,6 +23,7 @@ CONFIG_CONSOLE=y
CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_BUFFER_SIZE=15360
CONFIG_LOG_MODE_IMMEDIATE=y
#CONFIG_WOLFSSL_DEBUG=y
# Entropy

View File

@ -1,7 +1,7 @@
# Configure stack and heap sizes
CONFIG_MAIN_STACK_SIZE=32768
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
CONFIG_MAIN_STACK_SIZE=655360
#CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=65536
# Pthreads
CONFIG_PTHREAD_IPC=y
@ -21,6 +21,7 @@ CONFIG_CONSOLE=y
CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_BUFFER_SIZE=15360
CONFIG_LOG_MODE_IMMEDIATE=y
#CONFIG_WOLFSSL_DEBUG=y
# Entropy

View File

@ -1,8 +1,8 @@
# Kernel options
CONFIG_MAIN_STACK_SIZE=16384
CONFIG_MAIN_STACK_SIZE=655360
CONFIG_ENTROPY_GENERATOR=y
CONFIG_INIT_STACKS=y
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
#CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
# General config
CONFIG_NEWLIB_LIBC=y
@ -43,8 +43,8 @@ CONFIG_NET_PKT_TX_COUNT=10
# Logging
CONFIG_PRINTK=y
#CONFIG_WOLFSSL_DEBUG=y
#CONFIG_LOG=y
#CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
# TLS configuration
CONFIG_WOLFSSL=y

View File

@ -32,7 +32,7 @@
#endif
#define BUFFER_SIZE 2048
#define STATIC_MEM_SIZE (192*1024)
#define STATIC_MEM_SIZE (256*1024)
#define MAX_SEND_SIZE 256
#ifdef WOLFSSL_STATIC_MEMORY
@ -94,7 +94,7 @@ static int wolfssl_client_new(WOLFSSL_CTX** ctx, WOLFSSL** ssl)
WOLFSSL* client_ssl = NULL;
/* Create and initialize WOLFSSL_CTX */
if ((client_ctx = wolfSSL_CTX_new_ex(wolfTLSv1_2_client_method(),
if ((client_ctx = wolfSSL_CTX_new_ex(wolfTLSv1_3_client_method_ex(HEAP_HINT_CLIENT),
HEAP_HINT_CLIENT)) == NULL) {
printf("ERROR: failed to create WOLFSSL_CTX\n");
ret = -1;
@ -165,7 +165,7 @@ static int wolfssl_server_new(WOLFSSL_CTX** ctx, WOLFSSL** ssl)
WOLFSSL* server_ssl = NULL;
/* Create and initialize WOLFSSL_CTX */
if ((server_ctx = wolfSSL_CTX_new_ex(wolfTLSv1_2_server_method(),
if ((server_ctx = wolfSSL_CTX_new_ex(wolfTLSv1_3_server_method_ex(HEAP_HINT_SERVER),
HEAP_HINT_SERVER)) == NULL) {
printf("ERROR: failed to create WOLFSSL_CTX\n");
ret = -1;
@ -446,12 +446,12 @@ void client_thread()
SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID;
#ifdef WOLFSSL_STATIC_MEMORY
if (wc_LoadStaticMemory(&HEAP_HINT_CLIENT, gMemoryClient,
sizeof(gMemoryClient),
WOLFMEM_GENERAL | WOLFMEM_TRACK_STATS, 1) != 0) {
printf("unable to load static memory");
ret = -1;
}
//if (wc_LoadStaticMemory(&HEAP_HINT_CLIENT, gMemoryClient,
// sizeof(gMemoryClient),
// WOLFMEM_GENERAL | WOLFMEM_TRACK_STATS, 1) != 0) {
// printf("unable to load static memory");
// ret = -1;
//}
if (ret == 0)
#endif
@ -507,6 +507,17 @@ int main()
wolfSSL_Debugging_ON();
#endif
#ifdef WOLFSSL_STATIC_MEMORY
if (wc_LoadStaticMemory(&HEAP_HINT_CLIENT, gMemoryClient,
sizeof(gMemoryClient),
WOLFMEM_GENERAL | WOLFMEM_TRACK_STATS, 1) != 0) {
printf("unable to load static memory");
return -1;
}
wolfsslThreadHeapHint = HEAP_HINT_CLIENT;
#endif
/* Start server */
if (wolfSSL_NewThread(&serverThread, server_thread, NULL) != 0) {
printf("Failed to start server thread\n");

View File

@ -0,0 +1,175 @@
/* user_settings-tls-generic.h
* generated from configure options
*
* 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 WOLFSSL_OPTIONS_H
#define WOLFSSL_OPTIONS_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
#undef SINGLE_THREADED
#define SINGLE_THREADED
#endif
#undef TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT
#undef ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#undef WC_RSA_BLINDING
#define WC_RSA_BLINDING
#undef HAVE_AESGCM
#define HAVE_AESGCM
#undef WOLFSSL_SHA512
#define WOLFSSL_SHA512
#undef WOLFSSL_SHA384
#define WOLFSSL_SHA384
#undef NO_DSA
#define NO_DSA
#undef HAVE_ECC
#define HAVE_ECC
#undef TFM_ECC256
#define TFM_ECC256
#undef WOLFSSL_BASE64_ENCODE
#define WOLFSSL_BASE64_ENCODE
#undef NO_RC4
#define NO_RC4
#undef WOLFSSL_SHA224
#define WOLFSSL_SHA224
#undef WOLFSSL_SHA3
#define WOLFSSL_SHA3
#undef HAVE_POLY1305
#define HAVE_POLY1305
#undef HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH
#undef HAVE_CHACHA
#define HAVE_CHACHA
#undef HAVE_HASHDRBG
#define HAVE_HASHDRBG
#undef NO_FILESYSTEM
#define NO_FILESYSTEM
#undef HAVE_TLS_EXTENSIONS
#define HAVE_TLS_EXTENSIONS
#undef HAVE_SUPPORTED_CURVES
#define HAVE_SUPPORTED_CURVES
#undef HAVE_EXTENDED_MASTER
#define HAVE_EXTENDED_MASTER
#undef NO_PSK
#define NO_PSK
#undef NO_MD4
#define NO_MD4
//#undef NO_PWDBASED
//#define NO_PWDBASED
#undef USE_FAST_MATH
#define USE_FAST_MATH
#undef WOLFSSL_NO_ASM
#define WOLFSSL_NO_ASM
#undef WOLFSSL_X86_BUILD
#define WOLFSSL_X86_BUILD
#undef WC_NO_ASYNC_THREADING
#define WC_NO_ASYNC_THREADING
//#undef NO_DES3
//#define NO_DES3
#undef WOLFSSL_STATIC_MEMORY
#define WOLFSSL_STATIC_MEMORY
#undef WOLFSSL_TLS13
#define WOLFSSL_TLS13
#undef HAVE_HKDF
#define HAVE_HKDF
#undef WC_RSA_PSS
#define WC_RSA_PSS
#undef HAVE_FFDHE_2048
#define HAVE_FFDHE_2048
#define WOLFSSL_NO_MALLOC
//#define WOLFSSL_DEBUG_STATIC_MEMORY
//#define WOLFSSL_DEBUG_MEMORY_PRINT
//#define WOLFSSL_DEBUG_MEMORY
//#define WOLFSSL_TRACK_MEMORY
#define LARGEST_MEM_BUCKET 65536
#undef WOLFSSL_DYN_CERT
#define WOLFSSL_DYN_CERT
#undef WOLFSSL_CERT_GEN
#define WOLFSSL_CERT_GEN
#undef WOLFSSL_CERT_REQ
#define WOLFSSL_CERT_REQ
#undef HAVE_PKCS12
#define HAVE_PKCS12
#undef WOLFSSL_TLS13
#define WOLFSSL_TLS13
#if 0
#undef WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_RSA
#undef WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_DH
#undef WOLFSSL_HAVE_SP_ECC
#define WOLFSSL_HAVE_SP_ECC
#endif
#ifdef __cplusplus
}
#endif
#endif /* WOLFSSL_OPTIONS_H */