Skip to content

Commit 9b5d78f

Browse files
committed
WIP git tangle and sync with upstream
1 parent faa45c5 commit 9b5d78f

File tree

16 files changed

+347
-95
lines changed

16 files changed

+347
-95
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>

wolfssl/wolfio.h

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
#endif
5151
#endif
5252

53+
/* CE Not always reliably detected. Define our own _WIN32_WCE as needed. */
54+
#if defined(_WIN32_WCE) || defined(WINCE) || defined(PocketPC)
55+
#if !defined(_WIN32_WCE)
56+
#define _WIN32_WCE
57+
#endif
58+
#endif
5359
#if defined(USE_WOLFSSL_IO) || defined(WOLFSSL_USER_IO) || \
5460
defined(HAVE_HTTP_CLIENT)
5561
#ifdef HAVE_LIBZ
@@ -578,34 +584,40 @@ WOLFSSL_API int wolfIO_RecvFrom(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf,
578584
#endif
579585
#endif /* WOLFSSL_NO_SOCK */
580586

581-
WOLFSSL_API int wolfSSL_BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
582-
WOLFSSL_API int wolfSSL_BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
587+
#ifdef PocketPC
588+
#define WOLFSSL_CALL __stdcall
589+
#else
590+
#define WOLFSSL_CALL
591+
#endif
592+
593+
WOLFSSL_API int WOLFSSL_CALL wolfSSL_BioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
594+
WOLFSSL_API int WOLFSSL_CALL wolfSSL_BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
583595
#ifndef OPENSSL_COEXIST
584596
/* Preserve API previously exposed */
585597
#define BioSend wolfSSL_BioSend
586598
#define BioReceive wolfSSL_BioReceive
587599
#endif
588600

589-
WOLFSSL_LOCAL int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
601+
WOLFSSL_LOCAL int WOLFSSL_CALL SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx);
590602
#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
591603
WOLFSSL_LOCAL int BioReceiveInternal(WOLFSSL_BIO* biord, WOLFSSL_BIO* biowr,
592604
char* buf, int sz);
593605
#endif
594-
WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
606+
WOLFSSL_LOCAL int WOLFSSL_CALL SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
595607
#if defined(USE_WOLFSSL_IO)
596608
/* default IO callbacks */
597-
WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
598-
WOLFSSL_API int EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx);
609+
WOLFSSL_API int WOLFSSL_CALL EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
610+
WOLFSSL_API int WOLFSSL_CALL EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx);
599611

600612
#ifdef WOLFSSL_DTLS
601613
#ifdef NUCLEUS_PLUS_2_3
602614
#define SELECT_FUNCTION nucyassl_select
603615
WOLFSSL_LOCAL int nucyassl_select(INT sd, UINT32 timeout);
604616
#endif
605-
WOLFSSL_API int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz,
617+
WOLFSSL_API int WOLFSSL_CALL EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz,
606618
void *ctx);
607-
WOLFSSL_API int EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx);
608-
WOLFSSL_API int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz,
619+
WOLFSSL_API int WOLFSSL_CALL EmbedSendTo(WOLFSSL* ssl, char *buf, int sz, void *ctx);
620+
WOLFSSL_API int WOLFSSL_CALL EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz,
609621
void *ctx);
610622
#ifdef WOLFSSL_MULTICAST
611623
WOLFSSL_API int EmbedReceiveFromMcast(WOLFSSL *ssl, char *buf,
@@ -663,8 +675,8 @@ typedef int (*WolfSSLGenericIORecvCb)(char *buf, int sz, void *ctx);
663675

664676

665677
/* I/O callbacks */
666-
typedef int (*CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx);
667-
typedef int (*CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx);
678+
typedef int (WOLFSSL_CALL *CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx);
679+
typedef int (WOLFSSL_CALL *CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx);
668680
WOLFSSL_API void wolfSSL_CTX_SetIORecv(WOLFSSL_CTX *ctx, CallbackIORecv CBIORecv);
669681
WOLFSSL_API void wolfSSL_CTX_SetIOSend(WOLFSSL_CTX *ctx, CallbackIOSend CBIOSend);
670682
WOLFSSL_API void wolfSSL_SSLSetIORecv(WOLFSSL *ssl, CallbackIORecv CBIORecv);
@@ -917,10 +929,17 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
917929
#define XINET_PTON(a,b,c) *(unsigned *)(c) = inet_addr((b))
918930
#endif
919931
#elif defined(USE_WINDOWS_API) /* Windows-friendly definition */
920-
#if defined(__MINGW64__) && !defined(UNICODE)
932+
#if defined(UNICODE)
933+
/* Use Win API Pointer to a constant wide-character string */
934+
#define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c))
935+
#elif defined(__MINGW64__) && !defined(UNICODE)
921936
#define XINET_PTON(a,b,c) InetPton((a),(b),(c))
922937
#else
923-
#define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c))
938+
#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_WIN32_WCE)
939+
#define XINET_PTON(a,b,c) InetPton((a),(PCWSTR)(b),(c))
940+
#else
941+
#define XINET_PTON(a,b,c) InetPton((a),(PCSTR)(b),(c))
942+
#endif
924943
#endif
925944
#else
926945
#define XINET_PTON(a,b,c) inet_pton((a),(b),(c))

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

0 commit comments

Comments
 (0)