Skip to content

Commit

Permalink
manual branch sync during commit sign test
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed May 31, 2024
2 parents 63c5b9a + 7a3830e commit 0a82157
Show file tree
Hide file tree
Showing 24 changed files with 536 additions and 168 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ scripts/memtest.txt
/IDE/ARDUINO/library.properties.tmp.backup
/IDE/ARDUINO/PREPENDED_README.md
# ? /IDE/ARDUINO/Arduino_README_prepend.md.tmp
# ? /IDE/ARDUINO/sketches/**/.theia/launch.json
/IDE/ARDUINO/sketches/**/.theia/launch.json


# Doxygen generated files
Expand Down
189 changes: 121 additions & 68 deletions IDE/ARDUINO/PREPENDED_README.md

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions IDE/ARDUINO/wolfssl-arduino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ if [ $# -gt 0 ]; then
else
echo "Installing to $THIS_INSTALL_DIR"
if [ -d "$THIS_INSTALL_DIR/.git" ];then
echo "Target is a GitHub repository."
echo "Target is a GitHub root repository."
THIS_INSTALL_IS_GITHUB="true"
else
echo "Target is NOT a GitHub repository."
echo "Target is NOT a GitHub root directory repository. (e.g. not wolfssl/Arduino-wolfssl)"
fi
fi
else
Expand Down Expand Up @@ -314,10 +314,16 @@ if [ "$THIS_OPERATION" = "INSTALL" ]; then
cp -r ."$ROOT_DIR"/* "$THIS_INSTALL_DIR" || exit 1
else
echo "Install:"
echo "mv .$ROOT_DIR $ARDUINO_ROOT"
mv ."$ROOT_DIR" "$ARDUINO_ROOT" || exit 1
if [ "$THIS_INSTALL_DIR" = "" ]; then
echo "mv .$ROOT_DIR $ARDUINO_ROOT"
mv ."$ROOT_DIR" "$ARDUINO_ROOT" || exit 1

echo "Arduino wolfSSL Version: $WOLFSSL_VERSION$WOLFSSL_VERSION_ARUINO_SUFFIX"
echo "Arduino wolfSSL Version: $WOLFSSL_VERSION$WOLFSSL_VERSION_ARUINO_SUFFIX"
else
echo "cp -r .\"$ROOT_DIR\"/* \"$THIS_INSTALL_DIR\""
mkdir -p "$THIS_INSTALL_DIR" || exit 1
cp -r ."$ROOT_DIR"/* "$THIS_INSTALL_DIR" || exit 1
fi
fi
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34601.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfssl_ESP32_ESPIDF_v5.2", "wolfssl_ESP32_ESPIDF_v5.2.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2392BC91-C84E-4B40-9103-3F763FF00E83}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@
<Subdirectory>esp-idf/v5.2</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM71</COMPort>
<COMPort>COM79</COMPort>
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
<UseCCache>false</UseCCache>
<DeviceID>ESP32C2</DeviceID>
</ESPIDFExtension>
<DetectMissingSolutionConfigurations>false</DetectMissingSolutionConfigurations>
</ProjectModeSettings>
<LoadCMakePresets>false</LoadCMakePresets>
</Build>
<CustomBuild>
<PreSyncActions />
Expand Down Expand Up @@ -216,6 +218,7 @@
<MaxBreakpointLimit>0</MaxBreakpointLimit>
<EnableVerboseMode>true</EnableVerboseMode>
<EnablePrettyPrinters>false</EnablePrettyPrinters>
<EnableAbsolutePathReporting>true</EnableAbsolutePathReporting>
</AdditionalGDBSettings>
<DebugMethod>
<ID>openocd</ID>
Expand Down
3 changes: 3 additions & 0 deletions IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/

// edit test for Vigilant mode 12

/* ESP-IDF */
#include <esp_log.h>
#include "sdkconfig.h"
Expand Down Expand Up @@ -204,6 +206,7 @@ void app_main(void)
#ifdef TASK_EXTRA_STACK_SIZE
ESP_LOGI(TAG, "TASK_EXTRA_STACK_SIZE: %d", TASK_EXTRA_STACK_SIZE);
#endif

#ifdef INCLUDE_uxTaskGetStackHighWaterMark
ESP_LOGI(TAG, "CONFIG_ESP_MAIN_TASK_STACK_SIZE = %d bytes (%d words)",
CONFIG_ESP_MAIN_TASK_STACK_SIZE,
Expand Down
23 changes: 22 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8070,6 +8070,27 @@ AC_ARG_ENABLE([staticmemory],
[ ENABLED_STATICMEMORY=no ]
)
for v in `echo $ENABLED_STATICMEMORY | tr "," " "`
do
case $v in
yes)
;;
no)
;;
small|lean)
ENABLED_STATICMEMORY=yes
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_LEAN"
;;
debug)
ENABLED_STATICMEMORY=yes
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK"
;;
*)
AC_MSG_ERROR([Invalid choice for staticmemory.])
break;;
esac
done
if test "x$ENABLED_STATICMEMORY" = "xyes"
then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
Expand Down Expand Up @@ -9633,7 +9654,7 @@ echo "" >> $OPTION_FILE
# note: cut requires an argument to exit with success.
if colrm >/dev/null 2>&1 </dev/null; then
TRIM="colrm 3"
elif cut --version >/dev/null 2>&1 </dev/null; then
elif echo "" | cut -c1 >/dev/null 2>&1 </dev/null; then
TRIM="cut -c1-2"
else
AC_MSG_ERROR([Could not find colrm or cut to make options file])
Expand Down
57 changes: 49 additions & 8 deletions examples/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,39 @@ static int client_srtp_test(WOLFSSL *ssl, func_args *args)
}
#endif /* WOLFSSL_SRTP */

#if defined(WOLFSSL_STATIC_MEMORY) && \
defined(WOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK)
static void ExampleDebugMemoryCb(size_t sz, int bucketSz, byte st, int type) {
switch (st) {
case WOLFSSL_DEBUG_MEMORY_ALLOC:
if (type == DYNAMIC_TYPE_IN_BUFFER) {
printf("IN BUFFER: ");
}

if (type == DYNAMIC_TYPE_OUT_BUFFER) {
printf("OUT BUFFER: ");
}

printf("Alloc'd %d bytes using bucket size %d\n", (int)sz,
bucketSz);
break;

case WOLFSSL_DEBUG_MEMORY_FAIL:
printf("Failed when trying to allocate %d bytes\n", (int)sz);
break;

case WOLFSSL_DEBUG_MEMORY_FREE:
printf("Free'ing : %d\n", (int)sz);
break;

case WOLFSSL_DEBUG_MEMORY_INIT:
printf("Creating memory bucket of size : %d\n", bucketSz);
break;
}
}
#endif



THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
{
Expand Down Expand Up @@ -2096,10 +2129,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
byte memory[80000];
#endif
byte memoryIO[34500]; /* max for IO buffer (TLS packet can be 16k) */
#if !defined(WOLFSSL_STATIC_MEMORY_LEAN)
WOLFSSL_MEM_CONN_STATS ssl_stats;
#ifdef DEBUG_WOLFSSL
#if defined(DEBUG_WOLFSSL)
WOLFSSL_MEM_STATS mem_stats;
#endif
#endif
WOLFSSL_HEAP_HINT *heap = NULL;
#endif

Expand Down Expand Up @@ -3036,7 +3071,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)


#ifdef WOLFSSL_STATIC_MEMORY
#ifdef DEBUG_WOLFSSL
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_STATIC_MEMORY_LEAN)
/* print off helper buffer sizes for use with static memory
* printing to stderr in case of debug mode turned on */
LOG_ERROR("static memory management size = %d\n",
Expand All @@ -3053,6 +3088,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
err_sys("unable to load static memory");
}

#if defined(WOLFSSL_STATIC_MEMORY) && \
defined(WOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK)
wolfSSL_SetDebugMemoryCb(ExampleDebugMemoryCb);
#endif
ctx = wolfSSL_CTX_new_ex(method(heap), heap);
if (ctx == NULL)
err_sys("unable to get ctx");
Expand Down Expand Up @@ -3326,7 +3365,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if (wolfSSL_CTX_use_certificate_chain_buffer_format(ctx,
client_cert_der_2048, sizeof_client_cert_der_2048,
WOLFSSL_FILETYPE_ASN1) != WOLFSSL_SUCCESS)

// if (wolfSSL_CTX_use_certificate_chain_buffer_format(ctx,
// // client_cert_der_2048, sizeof_client_cert_der_2048,
// client_sm2, sizeof_client_sm2,
Expand Down Expand Up @@ -3403,7 +3442,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_CTX_free(ctx); ctx = NULL;
err_sys("can't load ca buffer, Please run from wolfSSL home dir");
}

// if (wolfSSL_CTX_load_verify_buffer(ctx,
// root_sm2, sizeof_root_sm2,
// SSL_FILETYPE_PEM) != WOLFSSL_SUCCESS) {
Expand Down Expand Up @@ -3612,7 +3651,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}
#endif

#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL) && \
!defined(WOLFSSL_STATIC_MEMORY_LEAN)
LOG_ERROR("Before creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys("ctx not using static memory");
Expand Down Expand Up @@ -3710,7 +3750,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
}
#endif

#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL) && \
!defined(WOLFSSL_STATIC_MEMORY_LEAN)
LOG_ERROR("After creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys("ctx not using static memory");
Expand Down Expand Up @@ -4418,7 +4459,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif

/* display collected statistics */
#ifdef WOLFSSL_STATIC_MEMORY
#if defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY_LEAN)
if (wolfSSL_is_static_memory(ssl, &ssl_stats) != 1)
err_sys("static memory was not used with ssl");

Expand Down Expand Up @@ -4645,7 +4686,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
wolfSSL_shutdown(sslResume); /* bidirectional shutdown */

/* display collected statistics */
#ifdef WOLFSSL_STATIC_MEMORY
#if defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY_LEAN)
if (wolfSSL_is_static_memory(sslResume, &ssl_stats) != 1)
err_sys("static memory was not used with ssl");

Expand Down
2 changes: 1 addition & 1 deletion examples/configs/user_settings_wolfboot_keytools.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
#define NO_RABBIT
#define NO_MD5
#define NO_SIG_WRAPPER
#define NO_CERT
#define NO_CERTS
#define NO_SESSION_CACHE
#define NO_HC128
#define NO_DES3
Expand Down
14 changes: 9 additions & 5 deletions examples/server/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,10 +1601,12 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
byte memory[80000];
#endif
byte memoryIO[34500]; /* max for IO buffer (TLS packet can be 16k) */
#if !defined(WOLFSSL_STATIC_MEMORY_LEAN)
WOLFSSL_MEM_CONN_STATS ssl_stats;
#ifdef DEBUG_WOLFSSL
#if defined(DEBUG_WOLFSSL)
WOLFSSL_MEM_STATS mem_stats;
#endif
#endif
#endif
#if defined(WOLFSSL_TLS13) && defined(HAVE_SUPPORTED_CURVES)
int onlyKeyShare = 0;
Expand Down Expand Up @@ -2503,7 +2505,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
err_sys_ex(runWithErrors, "unable to get method");

#ifdef WOLFSSL_STATIC_MEMORY
#ifdef DEBUG_WOLFSSL
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_STATIC_MEMORY_LEAN)
/* print off helper buffer sizes for use with static memory
* printing to stderr in case of debug mode turned on */
LOG_ERROR("static memory management size = %d\n",
Expand Down Expand Up @@ -2967,7 +2969,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
err_sys_ex(runWithErrors, "tcp accept failed");
}
}
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL) && \
!defined(WOLFSSL_STATIC_MEMORY_LEAN)
LOG_ERROR("Before creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys_ex(runWithErrors, "ctx not using static memory");
Expand Down Expand Up @@ -3056,7 +3059,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
}
#endif

#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL) && \
!defined(WOLFSSL_STATIC_MEMORY_LEAN)
LOG_ERROR("After creating SSL\n");
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
err_sys_ex(runWithErrors, "ctx not using static memory");
Expand Down Expand Up @@ -3802,7 +3806,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
}

/* display collected statistics */
#ifdef WOLFSSL_STATIC_MEMORY
#if defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY_LEAN)
if (wolfSSL_is_static_memory(ssl, &ssl_stats) != 1)
err_sys_ex(runWithErrors, "static memory was not used with ssl");

Expand Down
6 changes: 3 additions & 3 deletions linuxkm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ ifneq "$(quiet)" "silent_"
@echo ' wolfCrypt .{text,data,rodata} sections containerized to .{text,data,rodata}.wolfcrypt'
endif

$(src)/linuxkm/module_exports.c: rename-pie-text-and-data-sections
$(obj)/linuxkm/module_exports.c: rename-pie-text-and-data-sections

endif


# auto-generate the exported symbol list, leveraging the WOLFSSL_API visibility tags.
# exclude symbols that don't match wc_* or wolf*.
$(src)/linuxkm/module_exports.c: $(src)/linuxkm/module_exports.c.template $(WOLFSSL_OBJ_TARGETS)
$(obj)/linuxkm/module_exports.c: $(src)/module_exports.c.template $(WOLFSSL_OBJ_TARGETS)
@cp $< $@
@readelf --symbols --wide $(WOLFSSL_OBJ_TARGETS) | \
awk '/^ *[0-9]+: / { \
Expand All @@ -190,4 +190,4 @@ $(src)/linuxkm/module_exports.c: $(src)/linuxkm/module_exports.c.template $(WOLF
}' >> $@
@echo -e '#ifndef NO_CRYPT_TEST\nEXPORT_SYMBOL_NS_GPL(wolfcrypt_test, WOLFSSL);\n#endif' >> $@

clean-files := module_exports.c linuxkm src wolfcrypt/src wolfcrypt/test wolfcrypt
clean-files := linuxkm src wolfcrypt
9 changes: 7 additions & 2 deletions linuxkm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ libwolfssl.ko:
@if test -z "$(src_libwolfssl_la_OBJECTS)"; then echo '$$src_libwolfssl_la_OBJECTS is unset.' >&2; exit 1; fi
@mkdir -p linuxkm src wolfcrypt/src wolfcrypt/test
@if test ! -h $(SRC_TOP)/Kbuild; then ln -s $(MODULE_TOP)/Kbuild $(SRC_TOP)/Kbuild; fi
# after commit 9a0ebe5011 (6.10), sources must be in $(obj). work around this by making links to all needed sources:
@cp --no-dereference --symbolic-link --update=none '$(MODULE_TOP)'/*.[ch] '$(MODULE_TOP)'/linuxkm/
@cp --no-dereference --symbolic-link --update=none --recursive '$(SRC_TOP)'/wolfcrypt/src '$(MODULE_TOP)'/wolfcrypt/
@cp --no-dereference --symbolic-link --update=none --recursive '$(SRC_TOP)'/wolfcrypt/test '$(MODULE_TOP)'/wolfcrypt/
@cp --no-dereference --symbolic-link --update=none --recursive '$(SRC_TOP)'/src '$(MODULE_TOP)'/
ifeq "$(ENABLED_LINUXKM_PIE)" "yes"
+$(MAKE) -C $(KERNEL_ROOT) M=$(MODULE_TOP) src=$(SRC_TOP) $(KBUILD_EXTRA_FLAGS) CC_FLAGS_FTRACE=
+$(MAKE) -C $(KERNEL_ROOT) M=$(MODULE_TOP) $(KBUILD_EXTRA_FLAGS) CC_FLAGS_FTRACE=
else
+$(MAKE) -C $(KERNEL_ROOT) M=$(MODULE_TOP) src=$(SRC_TOP) $(KBUILD_EXTRA_FLAGS)
+$(MAKE) -C $(KERNEL_ROOT) M=$(MODULE_TOP) $(KBUILD_EXTRA_FLAGS)
endif

libwolfssl.ko.signed: libwolfssl.ko
Expand Down
Loading

0 comments on commit 0a82157

Please sign in to comment.