Skip to content

Commit dcc8071

Browse files
authored
Merge pull request #161 from haydenroche5/visual_studio
Add Visual Studio support.
2 parents 3c204ec + 3e1668a commit dcc8071

31 files changed

+1444
-139
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,20 @@
5050
/scripts/*.log
5151
*.gcno
5252
*.gcda
53+
54+
# Visual Studio files to ignore
55+
.vs
56+
x64
57+
Release
58+
DLL Release
59+
Debug
60+
DLL Debug
61+
test.rc
62+
test.aps
63+
test/resource.h
64+
65+
# Eclipse files to ignore
66+
.autotools
67+
.cproject
68+
.project
69+
.settings

Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ check_PROGRAMS =
66
dist_noinst_SCRIPTS =
77
DISTCLEANFILES =
88
pkginclude_HEADERS =
9+
EXTRA_DIST =
910

1011
ACLOCAL_AMFLAGS = -I m4
1112

@@ -36,3 +37,11 @@ test: check
3637
AM_DISTCHECK_CONFIGURE_FLAGS=CPPFLAGS="-I@abs_top_srcdir@/include \
3738
@OPENSSL_INCLUDES@" \
3839
LDFLAGS="@OPENSSL_LDFLAGS@"
40+
41+
EXTRA_DIST+= README.md
42+
43+
EXTRA_DIST += \
44+
wolfEngine.sln \
45+
wolfEngine.vcxproj \
46+
wolfEngine.vcxproj.filters \
47+
wolfEngine.vcxproj.user

README.md

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
## Description
33

44
wolfEngine is a library that can be used as an Engine in OpenSSL.
@@ -40,7 +40,7 @@ wolfEngine is a library that can be used as an Engine in OpenSSL.
4040
* SHA-3 support is only available with OpenSSL versions 1.1.1+.
4141
* EC_KEY_METHOD is only available with OpenSSL versions 1.1.1+.
4242

43-
## Building
43+
## Building on *nix Systems
4444

4545
### OpenSSL
4646

@@ -91,7 +91,7 @@ make check
9191
* To use a custom user_settings.h file to override the defines produced by `./configure`, add `--enable-usersettings` and place a user_settings.h file with the defines you want in the include directory. See the root of the project for an example user_settings.h.
9292
* To build wolfEngine with debug support, add `--enable-debug`. Then, to activate the debug logging at runtime, your application should send this control command to wolfEngine (denoted "e" here): `ENGINE_ctrl_cmd(e, "enable_debug", 1, NULL, NULL, 0)`.
9393

94-
## Testing
94+
## Testing on *nix Systems
9595

9696
### Unit Tests
9797
To run automated unit tests:
@@ -102,3 +102,109 @@ If you get an error like `error while loading shared libraries: libssl.so.3` the
102102

103103
### Integration Tests
104104
There are no automated integration tests, yet.
105+
106+
## Building on Windows
107+
108+
The `wolfEngine.sln` solution supplied in the root of the wolfEngine project
109+
expects the following directory structure:
110+
111+
```
112+
.
113+
├── openssl
114+
├── wolfEngine
115+
└── wolfssl
116+
```
117+
118+
### Building OpenSSL
119+
120+
Follow the instructions in the OpenSSL `INSTALL` file. The list of commands to run are:
121+
```
122+
$ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }
123+
$ nmake clean # This command needs to be run if OpenSSL has previously been built in this directory with a different configuration.
124+
$ nmake
125+
```
126+
127+
### Building wolfSSL
128+
129+
Compile wolfSSL using one of the solution projects available in the
130+
project (`wolfssl.sln` or `wolfssl64.sln`). The following is a list of defines
131+
that are generated when using the configure script. You do not need to turn all
132+
of them on but this list will provide full functionality. For ease of use, it is
133+
recommended to add the desired defines to the `user_settings.h` file used in
134+
the chosen wolfSSL Visual Studio solution. Please make sure to update the defines
135+
in the wolfEngine `user_settings.h` file to match the defines used to compile
136+
wolfSSL.
137+
138+
```
139+
/* Settings generated by the configure script when compiling for wolfEngine */
140+
#define HAVE_AES_ECB
141+
#define WC_RSA_NO_PADDING
142+
#define WOLFSSL_PUBLIC_MP
143+
#define ECC_MIN_KEY_SZ 192
144+
#define WOLFSSL_PSS_LONG_SALT
145+
#define WOLFSSL_PSS_SALT_LEN_DISCOVER
146+
#define WOLFSSL_TLS13
147+
#define HAVE_TLS_EXTENSIONS
148+
#define HAVE_SUPPORTED_CURVES
149+
#define HAVE_FFDHE_2048
150+
#define HAVE_THREAD_LS
151+
#define TFM_TIMING_RESISTANT
152+
#define ECC_TIMING_RESISTANT
153+
#define WC_RSA_BLINDING
154+
#define HAVE_AESCCM
155+
#define WOLFSSL_AES_COUNTER
156+
#define WOLFSSL_AES_DIRECT
157+
#define WOLFSSL_SHA224
158+
#define WOLFSSL_SHA512
159+
#define WOLFSSL_SHA384
160+
#define WOLFSSL_KEY_GEN
161+
#define HAVE_HKDF
162+
#define HAVE_X963_KDF
163+
#define NO_DSA
164+
#define HAVE_ECC
165+
#define TFM_ECC256
166+
#define ECC_SHAMIR
167+
#define WC_RSA_PSS
168+
#define WOLFSSL_BASE64_ENCODE
169+
#define NO_RC4
170+
#define WOLFSSL_CMAC
171+
#define NO_HC128
172+
#define NO_RABBIT
173+
#define WOLFSSL_SHA3
174+
#define WOLFSSL_SHAKE256
175+
#define HAVE_POLY1305
176+
#define HAVE_ONE_TIME_AUTH
177+
#define HAVE_CHACHA
178+
#define HAVE_HASHDRBG
179+
#define HAVE_EXTENDED_MASTER
180+
#define HAVE_ENCRYPT_THEN_MAC
181+
#define NO_PSK
182+
#define NO_MD4
183+
#define NO_PWDBASED
184+
#define USE_FAST_MATH
185+
#define WC_NO_ASYNC_THREADING
186+
#define HAVE_DH_DEFAULT_PARAMS
187+
#define GCM_TABLE_4BIT
188+
#define HAVE_AESGCM
189+
#define HAVE_WC_INTROSPECTION
190+
#define OPENSSL_COEXIST
191+
#define NO_OLD_RNGNAME
192+
#define NO_OLD_WC_NAMES
193+
#define NO_OLD_SSL_NAMES
194+
#define NO_OLD_SHA_NAMES
195+
#define NO_OLD_MD5_NAME
196+
```
197+
198+
### Building wolfEngine
199+
200+
It is enough to compile the wolfEngine solution to generate the DLL file.
201+
Please make sure that you have updated the `user_settings.h` header to match
202+
the defines used to compile wolfSSL. The `test` project in the wolfEngine
203+
solution compiles an executable file that is dynamically linked to the
204+
wolfEngine and OpenSSL libraries. The `test` solution copies the OpenSSL DLL
205+
files into the output directory. If you want to skip this step and use system
206+
supplied versions of OpenSSL, delete the command under:
207+
208+
```
209+
test Properties -> Configuration Properties -> Build Events -> Post-Build Event -> Command Line
210+
```

bench.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626
#ifdef WOLFENGINE_USER_SETTINGS
2727
#include <user_settings.h>
28-
#endif
28+
#else
2929
#include <wolfssl/options.h>
30+
#endif
3031
#include <wolfssl/wolfcrypt/wc_port.h>
3132

3233
#include <wolfengine/we_wolfengine.h>

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ fi
7171
AC_CHECK_HEADERS([wolfssl/wolfcrypt/kdf.h])
7272
AC_CHECK_FUNCS([wc_DhSetNamedKey])
7373

74+
# Export symbols in dynamic lib
75+
CFLAGS="$CFLAGS -DBUILDING_WOLFENGINE"
76+
7477
# DEBUG
7578
DEBUG_CFLAGS="-g -O0 -DWOLFENGINE_DEBUG"
7679
AX_DEBUG

include/include.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ noinst_HEADERS += include/wolfengine/we_internal.h \
77

88
pkginclude_HEADERS += include/wolfengine/we_wolfengine.h \
99
include/wolfengine/we_logging.h \
10-
include/wolfengine/we_fips.h
10+
include/wolfengine/we_fips.h \
11+
include/wolfengine/we_visibility.h

include/wolfengine/we_fips.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424

2525
#ifdef WOLFENGINE_USER_SETTINGS
2626
#include "user_settings.h"
27+
#else
28+
#include <wolfssl/options.h>
2729
#endif
2830

29-
#include <wolfssl/options.h>
31+
#include <wolfengine/we_visibility.h>
32+
3033

3134
enum wolfEngine_FipsCheck {
3235
/* check that RSA key size is valid */
@@ -47,8 +50,8 @@ enum wolfEngine_FipsCheck {
4750
};
4851

4952
/* Set FIPS checks, bitmask of wolfEngine_FipsCheck. */
50-
void wolfEngine_SetFipsChecks(long checksMask);
53+
WOLFENGINE_API void wolfEngine_SetFipsChecks(long checksMask);
5154
/* Get FIPS checks mask. */
52-
long wolfEngine_GetFipsChecks(void);
55+
WOLFENGINE_API long wolfEngine_GetFipsChecks(void);
5356

5457
#endif /* WE_FIPS_H */

0 commit comments

Comments
 (0)