forked from wolfSSL/wolfssl
Fix build issues with DEBUG_WOLFSSL defined. Fix typo in user_settings.h for DEBUG_WOLFSSL. Fix issue with example client waiting on local server (shouldn’t be). Updated README.md with example output.
This commit is contained in:
@ -32,10 +32,104 @@ Please select one of the above options:
|
|||||||
|
|
||||||
Performs testing of all crypto algorithms.
|
Performs testing of all crypto algorithms.
|
||||||
|
|
||||||
|
```
|
||||||
|
Crypt Test
|
||||||
|
error test passed!
|
||||||
|
base64 test passed!
|
||||||
|
base64 test passed!
|
||||||
|
MD5 test passed!
|
||||||
|
SHA test passed!
|
||||||
|
SHA-256 test passed!
|
||||||
|
SHA-384 test passed!
|
||||||
|
SHA-512 test passed!
|
||||||
|
Hash test passed!
|
||||||
|
HMAC-MD5 test passed!
|
||||||
|
HMAC-SHA test passed!
|
||||||
|
HMAC-SHA256 test passed!
|
||||||
|
HMAC-SHA384 test passed!
|
||||||
|
HMAC-SHA512 test passed!
|
||||||
|
HMAC-KDF test passed!
|
||||||
|
X963-KDF test passed!
|
||||||
|
GMAC test passed!
|
||||||
|
Chacha test passed!
|
||||||
|
POLY1305 test passed!
|
||||||
|
ChaCha20-Poly1305 AEAD test passed!
|
||||||
|
DES test passed!
|
||||||
|
DES3 test passed!
|
||||||
|
AES test passed!
|
||||||
|
AES-GCM test passed!
|
||||||
|
AES-CCM test passed!
|
||||||
|
AES Key Wrap test passed!
|
||||||
|
RANDOM test passed!
|
||||||
|
RSA test passed!
|
||||||
|
DH test passed!
|
||||||
|
DSA test passed!
|
||||||
|
SRP test passed!
|
||||||
|
PWDBASED test passed!
|
||||||
|
openSSL extra test
|
||||||
|
OPENSSL test passed!
|
||||||
|
ECC test passed!
|
||||||
|
ECC Enc test passed!
|
||||||
|
ECC buffer test passed!
|
||||||
|
CURVE25519 test passed!
|
||||||
|
ED25519 test passed!
|
||||||
|
CMAC test passed!
|
||||||
|
PKCS7enveloped test passed!
|
||||||
|
PKCS7signed test passed!
|
||||||
|
PKCS7encrypted test passed!
|
||||||
|
mutex test passed!
|
||||||
|
memcb test passed!
|
||||||
|
Crypt Test: Return code 0
|
||||||
|
```
|
||||||
|
|
||||||
### `b` wolfCrypt Benchmark
|
### `b` wolfCrypt Benchmark
|
||||||
|
|
||||||
Performs benchmark of crypto algorithms.
|
Performs benchmark of crypto algorithms.
|
||||||
|
|
||||||
|
```
|
||||||
|
Benchmark Test
|
||||||
|
RNG 25 kB took 0.002 seconds, 11.017 MB/s
|
||||||
|
AES enc 25 kB took 0.002 seconds, 15.090 MB/s
|
||||||
|
AES dec 25 kB took 0.002 seconds, 15.119 MB/s
|
||||||
|
AES-GCM 25 kB took 0.003 seconds, 9.433 MB/s
|
||||||
|
AES-CTR 25 kB took 0.001 seconds, 22.378 MB/s
|
||||||
|
AES-CCM 25 kB took 0.002 seconds, 15.306 MB/s
|
||||||
|
CHACHA 25 kB took 0.002 seconds, 16.063 MB/s
|
||||||
|
CHA-POLY 25 kB took 0.001 seconds, 20.447 MB/s
|
||||||
|
3DES 25 kB took 0.002 seconds, 10.717 MB/s
|
||||||
|
|
||||||
|
MD5 25 kB took 0.00 seconds, 31.576 MB/s
|
||||||
|
POLY1305 25 kB took 0.000 seconds, 201.575 MB/s
|
||||||
|
SHA 25 kB took 0.00 seconds, 43.761 MB/s
|
||||||
|
SHA-256 25 kB took 0.001 seconds, 19.299 MB/s
|
||||||
|
SHA-384 25 kB took 0.002 seconds, 14.577 MB/s
|
||||||
|
SHA-512 25 kB took 0.001 seconds, 21.718 MB/s
|
||||||
|
AES-CMAC 25 kB took 0.00 seconds, 34.925 MB/s
|
||||||
|
|
||||||
|
RSA 2048 public 2.445 milliseconds, avg over 1 iterations
|
||||||
|
RSA 2048 private 64.711 milliseconds, avg over 1 iterations
|
||||||
|
|
||||||
|
RSA 1024 key generation 318.755 milliseconds, avg over 5 iterations
|
||||||
|
RSA 2048 key generation 22648.396 milliseconds, avg over 5 iterations
|
||||||
|
DH 2048 key generation 23.119 milliseconds, avg over 1 iterations
|
||||||
|
DH 2048 key agreement 26.756 milliseconds, avg over 1 iterations
|
||||||
|
|
||||||
|
ECC 256 key generation 2.984 milliseconds, avg over 5 iterations
|
||||||
|
EC-DHE key agreement 2.967 milliseconds, avg over 5 iterations
|
||||||
|
EC-DSA sign time 1.448 milliseconds, avg over 5 iterations
|
||||||
|
EC-DSA verify time 3.304 milliseconds, avg over 5 iterations
|
||||||
|
ECC encrypt 5.860 milliseconds, avg over 1 iterations
|
||||||
|
ECC decrypt 6.360 milliseconds, avg over 1 iterations
|
||||||
|
|
||||||
|
CURVE25519 256 key generation 1.416 milliseconds, avg over 5 iterations
|
||||||
|
CURVE25519 key agreement 1.332 milliseconds, avg over 5 iterations
|
||||||
|
|
||||||
|
ED25519 key generation 0.320 milliseconds, avg over 5 iterations
|
||||||
|
ED25519 sign time 0.595 milliseconds, avg over 5 iterations
|
||||||
|
ED25519 verify time 1.310 milliseconds, avg over 5 iterations
|
||||||
|
Benchmark Test: Return code 0
|
||||||
|
```
|
||||||
|
|
||||||
### `c` wolfSSL Client
|
### `c` wolfSSL Client
|
||||||
|
|
||||||
To configure the host address and port modify the `TLS_HOST_REMOTE` and `TLS_PORT` macros at top of `wolfExamples.c`. This example uses TLS 1.2 to connect to a remote host.
|
To configure the host address and port modify the `TLS_HOST_REMOTE` and `TLS_PORT` macros at top of `wolfExamples.c`. This example uses TLS 1.2 to connect to a remote host.
|
||||||
@ -48,6 +142,17 @@ To configure the port to listen on modify `TLS_PORT` at top of `wolfExamples.c`.
|
|||||||
|
|
||||||
Starts a TLS server thread listening on localhost. Starts the TLS client and performs connect, exchanges some data and disconnects.
|
Starts a TLS server thread listening on localhost. Starts the TLS client and performs connect, exchanges some data and disconnects.
|
||||||
|
|
||||||
|
```
|
||||||
|
Waiting for a connection...
|
||||||
|
Client connected successfully
|
||||||
|
Using Non-Blocking I/O: 0
|
||||||
|
Message for server: Client:
|
||||||
|
|
||||||
|
Recieved: I hear ya fa shizzle!
|
||||||
|
|
||||||
|
The client has closed the connection.
|
||||||
|
```
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
For more information please contact info@wolfssl.com.
|
For more information please contact info@wolfssl.com.
|
||||||
|
@ -17,7 +17,7 @@ extern "C" {
|
|||||||
#define INTIME_RTOS_MUTEX_MAX 10
|
#define INTIME_RTOS_MUTEX_MAX 10
|
||||||
|
|
||||||
#undef WOLF_EXAMPLES_STACK
|
#undef WOLF_EXAMPLES_STACK
|
||||||
#define WOLF_EXAMPLES_STACK 131072
|
#define WOLF_EXAMPLES_STACK 65536
|
||||||
|
|
||||||
#undef WOLFSSL_GENERAL_ALIGNMENT
|
#undef WOLFSSL_GENERAL_ALIGNMENT
|
||||||
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||||
@ -32,9 +32,11 @@ extern "C" {
|
|||||||
#undef NO_WOLFSSL_DIR
|
#undef NO_WOLFSSL_DIR
|
||||||
#define NO_WOLFSSL_DIR
|
#define NO_WOLFSSL_DIR
|
||||||
|
|
||||||
|
/* disable writev */
|
||||||
#undef NO_WRITEV
|
#undef NO_WRITEV
|
||||||
#define NO_WRITEV
|
#define NO_WRITEV
|
||||||
|
|
||||||
|
/* we provide main entry point */
|
||||||
#undef NO_MAIN_DRIVER
|
#undef NO_MAIN_DRIVER
|
||||||
#define NO_MAIN_DRIVER
|
#define NO_MAIN_DRIVER
|
||||||
|
|
||||||
@ -83,8 +85,13 @@ extern "C" {
|
|||||||
#undef HAVE_ALL_CURVES
|
#undef HAVE_ALL_CURVES
|
||||||
//#define HAVE_ALL_CURVES
|
//#define HAVE_ALL_CURVES
|
||||||
#ifndef HAVE_ALL_CURVES
|
#ifndef HAVE_ALL_CURVES
|
||||||
|
/* allows enabling custom curve sizes */
|
||||||
#undef ECC_USER_CURVES
|
#undef ECC_USER_CURVES
|
||||||
#define ECC_USER_CURVES
|
#define ECC_USER_CURVES
|
||||||
|
|
||||||
|
//#define HAVE_ECC112
|
||||||
|
//#define HAVE_ECC128
|
||||||
|
//#define HAVE_ECC160
|
||||||
#define HAVE_ECC192
|
#define HAVE_ECC192
|
||||||
#define HAVE_ECC224
|
#define HAVE_ECC224
|
||||||
//#define NO_ECC256
|
//#define NO_ECC256
|
||||||
@ -478,9 +485,9 @@ extern "C" {
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* Debugging */
|
/* Debugging */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
#undef WOLFSSL_DEBUG
|
#undef DEBUG_WOLFSSL
|
||||||
#define WOLFSSL_DEBUG
|
//#define DEBUG_WOLFSSL
|
||||||
#ifdef WOLFSSL_DEBUG
|
#ifdef DEBUG_WOLFSSL
|
||||||
/* Use this to measure / print heap usage */
|
/* Use this to measure / print heap usage */
|
||||||
#if 0
|
#if 0
|
||||||
#undef USE_WOLFSSL_MEMORY
|
#undef USE_WOLFSSL_MEMORY
|
||||||
|
@ -59,11 +59,6 @@ int wolfExample_TLSClient(const char* ip, int port)
|
|||||||
struct sockaddr_in servAddr; /* struct for server address */
|
struct sockaddr_in servAddr; /* struct for server address */
|
||||||
char sendBuff[TLS_MAXDATASIZE], rcvBuff[TLS_MAXDATASIZE];
|
char sendBuff[TLS_MAXDATASIZE], rcvBuff[TLS_MAXDATASIZE];
|
||||||
|
|
||||||
/* wait for server to be ready */
|
|
||||||
while (gServerReady != 1) {
|
|
||||||
RtSleep(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sockFd = socket(AF_INET, SOCK_STREAM, 0);
|
sockFd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (sockFd < 0) {
|
if (sockFd < 0) {
|
||||||
printf("Failed to create socket. Error: %d\n", errno);
|
printf("Failed to create socket. Error: %d\n", errno);
|
||||||
@ -299,6 +294,11 @@ int wolfExample_TLSLocal(int port)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* wait for server to be ready */
|
||||||
|
while (gServerReady != 1) {
|
||||||
|
RtSleep(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* run client */
|
/* run client */
|
||||||
ret = wolfExample_TLSClient(TLS_HOST_LOCAL, port);
|
ret = wolfExample_TLSClient(TLS_HOST_LOCAL, port);
|
||||||
|
|
||||||
|
@ -24,18 +24,6 @@ Global
|
|||||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Debug|INtime.Build.0 = Debug|INtime
|
{1731767D-573F-45C9-A466-191DA0D180CF}.Debug|INtime.Build.0 = Debug|INtime
|
||||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.ActiveCfg = Release|INtime
|
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.ActiveCfg = Release|INtime
|
||||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.Build.0 = Release|INtime
|
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.Build.0 = Release|INtime
|
||||||
{AA35919C-9D2D-4753-8FD1-E5D1644ABE65}.Debug|INtime.ActiveCfg = Debug|INtime
|
|
||||||
{AA35919C-9D2D-4753-8FD1-E5D1644ABE65}.Debug|INtime.Build.0 = Debug|INtime
|
|
||||||
{AA35919C-9D2D-4753-8FD1-E5D1644ABE65}.Release|INtime.ActiveCfg = Release|INtime
|
|
||||||
{AA35919C-9D2D-4753-8FD1-E5D1644ABE65}.Release|INtime.Build.0 = Release|INtime
|
|
||||||
{A7A65D11-2A66-4936-9476-16646CF896CA}.Debug|INtime.ActiveCfg = Debug|INtime
|
|
||||||
{A7A65D11-2A66-4936-9476-16646CF896CA}.Debug|INtime.Build.0 = Debug|INtime
|
|
||||||
{A7A65D11-2A66-4936-9476-16646CF896CA}.Release|INtime.ActiveCfg = Release|INtime
|
|
||||||
{A7A65D11-2A66-4936-9476-16646CF896CA}.Release|INtime.Build.0 = Release|INtime
|
|
||||||
{2359342B-C023-4443-8170-3471928C9334}.Debug|INtime.ActiveCfg = Debug|INtime
|
|
||||||
{2359342B-C023-4443-8170-3471928C9334}.Debug|INtime.Build.0 = Debug|INtime
|
|
||||||
{2359342B-C023-4443-8170-3471928C9334}.Release|INtime.ActiveCfg = Release|INtime
|
|
||||||
{2359342B-C023-4443-8170-3471928C9334}.Release|INtime.Build.0 = Release|INtime
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -232,14 +232,17 @@ extern "C" {
|
|||||||
#undef USE_CERT_BUFFERS_2048
|
#undef USE_CERT_BUFFERS_2048
|
||||||
#define USE_CERT_BUFFERS_2048
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
|
||||||
|
#undef USE_CERT_BUFFERS_256
|
||||||
|
#define USE_CERT_BUFFERS_256
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* Debugging */
|
/* Debugging */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
#undef WOLFSSL_DEBUG
|
#undef DEBUG_WOLFSSL
|
||||||
//#define WOLFSSL_DEBUG
|
//#define DEBUG_WOLFSSL
|
||||||
|
|
||||||
#ifdef WOLFSSL_DEBUG
|
#ifdef DEBUG_WOLFSSL
|
||||||
#define fprintf(file, format, ...) printf(format, ##__VA_ARGS__)
|
#define fprintf(file, format, ...) printf(format, ##__VA_ARGS__)
|
||||||
|
|
||||||
/* Use this to measure / print heap usage */
|
/* Use this to measure / print heap usage */
|
||||||
@ -255,7 +258,7 @@ extern "C" {
|
|||||||
#define NO_WOLFSSL_MEMORY
|
#define NO_WOLFSSL_MEMORY
|
||||||
|
|
||||||
#undef NO_ERROR_STRINGS
|
#undef NO_ERROR_STRINGS
|
||||||
#define NO_ERROR_STRINGS
|
//#define NO_ERROR_STRINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
8
wolfssl/wolfcrypt/logging.h
Normal file → Executable file
8
wolfssl/wolfcrypt/logging.h
Normal file → Executable file
@ -62,8 +62,12 @@ WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function);
|
|||||||
#endif /* defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) */
|
#endif /* defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) */
|
||||||
|
|
||||||
#ifdef DEBUG_WOLFSSL
|
#ifdef DEBUG_WOLFSSL
|
||||||
#if defined ( WIN32 )
|
#if defined(_WIN32)
|
||||||
#define __func__ __FUNCTION__
|
#if defined(INTIME_RTOS)
|
||||||
|
#define __func__ NULL
|
||||||
|
#else
|
||||||
|
#define __func__ __FUNCTION__
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* a is prepended to m and b is appended, creating a log msg a + m + b */
|
/* a is prepended to m and b is appended, creating a log msg a + m + b */
|
||||||
|
Reference in New Issue
Block a user