Skip to content

Commit abb6f6f

Browse files
committed
WIP git tangle and sync with upstream
1 parent 4f50f3d commit abb6f6f

File tree

15 files changed

+315
-82
lines changed

15 files changed

+315
-82
lines changed

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,47 @@ wrapper/Ada/obj/
468468
# Autogenerated debug trace headers
469469
wolfssl/debug-trace-error-codes.h
470470
wolfssl/debug-untrace-error-codes.h
471+
/wrapper/CSharp/SmartDeviceProject1
472+
/commit_squash.sh
473+
/gpg_refresh.sh
474+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32.clog
475+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32c2.clog
476+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32c3.clog
477+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32c6.clog
478+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32h2.clog
479+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32s2.clog
480+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp32s3.clog
481+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/esp8266.clog
482+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh.wip
483+
/IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh.wip
484+
/server_loop.sh
485+
/UpgradeLog.XML
486+
/wolfcrypt/src/evp.c.wip
487+
/wolfssl/PR_text.md
488+
/wolfssl-VS2022.vcxproj.user
489+
/wolfssl-VS2022a-options_h.vcxproj
490+
/wolfssl-VS2022a.sln
491+
/wolfssl-VS2022a.vcxproj
492+
/wolfssl.sln
493+
/wolfssl.vcproj.not found
494+
/wolfssl_VS2008.sln
495+
/wolfssl_VS2008.vcproj
496+
/wolfssl_VS2008CE.sln
497+
/wolfssl_VS2008CE.vcproj
498+
/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-CE_2008_console.csproj
499+
/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client-VS2008.csproj
500+
/wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS_CE_2008.csproj
501+
/wrapper/CSharp/wolfSSL_CSharp/CSharp_CE_2008.csproj
502+
/wrapper/CSharp/wolfSSL_CSharp/CSharp_CE_2008.sln
503+
/wrapper/CSharp/wolfSSL_CSharp/wolfSSL_CSharp _VS2008.csproj
504+
/wrapper/CSharp/wolfSSL_CSharp-Clients-old.sln
505+
/wrapper/CSharp/wolfSSL_CSharp-Pull Request.sln
506+
/wrapper/CSharp/wolfssl_VS2008.sln
507+
/wrapper/CSharp/wolfssl_VS2008CE.sln
508+
/wrapper/CSharp/wolfssl_VS2012.sln
509+
/_UpgradeReport_Files
510+
/_UpgradeReport_Files/UpgradeReport.css
511+
/_UpgradeReport_Files/UpgradeReport.xslt
512+
/_UpgradeReport_Files/UpgradeReport_Minus.gif
513+
/_UpgradeReport_Files/UpgradeReport_Plus.gif
514+
/DLL Release (options.h)/x64

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ WOLFSSL_UNALIGNED_64BIT_ACCESS
874874
WOLFSSL_USER_FILESYSTEM
875875
WOLFSSL_USER_LOG
876876
WOLFSSL_USER_MUTEX
877+
WOLFSSL_USER_SETTINGS_TAG
877878
WOLFSSL_USER_THREADING
878879
WOLFSSL_USE_ESP32C3_CRYPT_HASH_HW
879880
WOLFSSL_USE_FLASHMEM

IDE/WIN/user_settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#error This user_settings.h header is only designed for Windows
77
#endif
88

9+
#define WOLFSSL_USER_SETTINGS_TAG "wolfssl v5.8.0 for IDE/WIN example config"
10+
911
#define USE_WOLFSSL_IO
1012
#define HAVE_AESGCM
1113
#define WOLFSSL_TLS13

src/ssl.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15375,6 +15375,20 @@ const char* wolfSSL_lib_version(void)
1537515375
return LIBWOLFSSL_VERSION_STRING;
1537615376
}
1537715377

15378+
/* current user_settings.h breadcrumb tag */
15379+
const char* wolfSSL_user_settings_tag(void)
15380+
{
15381+
#ifdef WOLFSSL_USER_SETTINGS
15382+
#ifdef WOLFSSL_USER_SETTINGS_TAG
15383+
return WOLFSSL_USER_SETTINGS_TAG;
15384+
#else
15385+
return "unknown or WOLFSSL_USER_SETTINGS_TAG not set"
15386+
#endif
15387+
#else
15388+
return "WOLFSSL_USER_SETTINGS not defined, assuming options.h build"
15389+
#endif
15390+
}
15391+
1537815392
#ifdef OPENSSL_EXTRA
1537915393
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
1538015394
const char* wolfSSL_OpenSSL_version(int a)

wolfssl/ssl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,6 +3288,8 @@ WOLFSSL_API void wolfSSL_set_security_level(WOLFSSL * ssl, int level);
32883288

32893289
/* which library version do we have */
32903290
WOLFSSL_API const char* wolfSSL_lib_version(void);
3291+
/* which user_settings.h file was used to build wolfssl */
3292+
WOLFSSL_API const char* wolfSSL_user_settings_tag(void);
32913293
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
32923294
WOLFSSL_API const char* wolfSSL_OpenSSL_version(int a);
32933295
#else

wolfssl/wolfcrypt/settings.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4504,6 +4504,17 @@ extern void uITRON4_free(void *p) ;
45044504
#undef WOLFSSL_DLL_TAG
45054505
#endif
45064506

4507+
/* Breadcrub to identify user_settings.h file */
4508+
#ifdef WOLFSSL_USER_SETTINGS
4509+
#ifdef WOLFSSL_USER_SETTINGS_TAG
4510+
/* found a value, probably in in user_settings.h or -D build option */
4511+
#else
4512+
#define WOLFSSL_USER_SETTINGS_TAG "WOLFSSL_USER_SETTINGS_TAG not set"
4513+
#endif
4514+
#else
4515+
#define WOLFSSL_USER_SETTINGS_TAG "WOLFSSL_USER_SETTINGS not defined"
4516+
#endif
4517+
45074518
/* Some final sanity checks. See esp32-crypt.h for Apple HomeKit config. */
45084519
#if defined(WOLFSSL_APPLE_HOMEKIT) || defined(CONFIG_WOLFSSL_APPLE_HOMEKIT)
45094520
#ifndef WOLFCRYPT_HAVE_SRP

wolfssl/wolfcrypt/wc_port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@
492492
#endif
493493
#elif defined(_MSC_VER) && !defined(WOLFSSL_NOT_WINDOWS_API)
494494
/* Use MSVC compiler intrinsics for atomic ops */
495-
#ifdef _WIN32_WCE
495+
#if defined(_WIN32_WCE) && defined(_M_ARM)
496496
#include <armintr.h>
497497
#else
498498
#include <intrin.h>

wrapper/CSharp/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ AdditionalIncludeDirectories="./;./wrapper/CSharp"
3232
```
3333

3434

35-
See also the sample Windows user_settings.h in `[WOLFSSL_ROOT]/IDE/WIN``
35+
See also the alternative sample Windows `user_settings.h` in `[WOLFSSL_ROOT]/IDE/WIN`:
3636

3737
```
3838
AdditionalIncludeDirectories="./;./IDE/WIN"
@@ -49,7 +49,7 @@ Check that the proper preprocessor definitions are included: `BUILDING_WOLFSSL;W
4949

5050
Syntax for project file:
5151
```
52-
PreprocessorDefinitions="WOLFSSL_LIB;WOLFSSL_USER_SETTINGS"
52+
PreprocessorDefinitions="BUILDING_WOLFSSL;WOLFSSL_DLL;WOLFSSL_USER_SETTINGS"
5353
```
5454
Some older versions of Visual Studio will require manually setting the Configure Type to create a DLL file:
5555

@@ -69,7 +69,7 @@ error LNK2019: unresolved external symbol __imp__recv@16 ...
6969

7070
Add `Ws2_32.lib` to Configuration Properties - Linker - ( Input || Additional Dependency)
7171

72-
Note the `AnyCPU` Platform not work with C libraries compiled to a specific architecture.
72+
Note the `AnyCPU` Platform may not work with C libraries compiled to a specific architecture.
7373
An error like this will likely be encountered:
7474

7575
```
@@ -79,8 +79,8 @@ System.DllNotFoundException
7979
Source=wolfSSL_CSharp
8080
StackTrace:
8181
at wolfSSL.CSharp.wolfssl.wolfSSL_SetLoggingCb(loggingCb vc)
82-
at wolfSSL.CSharp.wolfssl.SetLogging(loggingCb input) in C:\workspace\wolfssl-gojimmypi\wrapper\CSharp\wolfSSL_CSharp\wolfSSL.cs:line 2716
83-
at wolfSSL_TLS_Client.Main(String[] args) in C:\workspace\wolfssl-gojimmypi\wrapper\CSharp\wolfSSL-TLS-Client\wolfSSL-TLS-Client.cs:line 151
82+
at wolfSSL.CSharp.wolfssl.SetLogging(loggingCb input) in C:\workspace\wolfssl\wrapper\CSharp\wolfSSL_CSharp\wolfSSL.cs:line 2716
83+
at wolfSSL_TLS_Client.Main(String[] args) in C:\workspace\wolfssl\wrapper\CSharp\wolfSSL-TLS-Client\wolfSSL-TLS-Client.cs:line 151
8484
```
8585

8686
There's a separate `wolfSSL_CSharp-Clients.sln` solution file to allow concurrent client

wrapper/CSharp/user_settings.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
#ifndef _WIN_CSHARP_USER_SETTINGS_H_
2525
#define _WIN_CSHARP_USER_SETTINGS_H_
2626

27+
#define WOLFSSL_USER_SETTINGS_TAG "wolfssl v5.8.0 for C# Wrapper v1.0"
28+
29+
#ifdef WindowsCE
30+
#define NO_WOLFSSL_DIR
31+
#define WOLFSSL_NO_ATOMICS
32+
#define WC_NO_ASYNC_THREADING
33+
#define USE_WINDOWS_API
34+
#define WOLFSSL_SMALL_STACK
35+
#define MAX_SUPPORTED_THREADS 1024
36+
#define MAX_SUPPORTED_PRIV_KEYS 1024
37+
#define MAX_CONFIGURED_THREAD 512
38+
#endif
39+
2740
/* Features */
2841
#define NO_OLD_TLS
2942
#define WOLFSSL_TLS13

wrapper/CSharp/wolfSSL-TLS-Client/wolfSSL-TLS-Client.cs

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
#endif
3030

3131
using System;
32-
using System.Runtime.InteropServices;
33-
using System.Text;
3432
using System.IO;
3533
using System.Net;
3634
using System.Net.Sockets;
35+
using System.Runtime.InteropServices;
36+
using System.Text;
3737
using wolfSSL;
3838
using wolfSSL.CSharp;
3939

@@ -52,31 +52,13 @@ public class wolfSSL_TLS_Client
5252
public static int SERVER_PORT = 11111;
5353

5454
// Optionally set explicit cipher, see wolfssl.CTX_set_cipher_list()
55+
// #define USE_SPECIFIED_CIPHER
5556
public static string CIPHER_SUITE = "ECDHE-ECDSA-AES128-GCM-SHA256";
5657

5758

58-
#if WindowsCE || PocketPC
59-
/// <summary>
60-
/// Example of a logging function for Windows CE, string msg
61-
/// </summary>
62-
/// <param name="lvl">level of log</param>
63-
/// <param name="msg">message to log</param>
64-
public static void standard_log(int lvl, string msg)
65-
{
66-
string logMsg = wolfssl.MultiByteToWideChar(msg);
67-
Console.WriteLine(logMsg);
68-
}
69-
#else
70-
/// <summary>
71-
/// Example of a logging function, StringBuilder msg
72-
/// </summary>
73-
/// <param name="lvl">level of log</param>
74-
/// <param name="msg">message to log</param>
75-
public static void standard_log(int lvl, StringBuilder msg)
76-
{
59+
public static void standard_log(int lvl, StringBuilder msg) {
7760
Console.WriteLine(msg);
7861
}
79-
#endif
8062

8163
/// <summary>
8264
/// Show error code and level for either last transmit or receive history parameter
@@ -214,6 +196,9 @@ public static void Main(string[] args)
214196
/* example of function used for setting logging */
215197
wolfssl.SetLogging(standard_log);
216198

199+
/* optionally clear logging callback */
200+
/* wolfssl.ClearLogging(); */
201+
217202
wolfssl.Init();
218203

219204
Console.WriteLine("Calling ctx Init from wolfSSL");
@@ -225,7 +210,6 @@ public static void Main(string[] args)
225210
}
226211
Console.WriteLine("Finished init of ctx .... now load in CA");
227212

228-
229213
if (!File.Exists(caCert))
230214
{
231215
Console.WriteLine("Could not find CA cert file");

0 commit comments

Comments
 (0)