Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .wolfssl_known_macro_extras
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ CONFIG_WOLFSSL_TLS_VERSION_1_3
CONFIG_WOLFTPM
CONFIG_WOLFTPM_EXAMPLE_NAME_ESPRESSIF
CONFIG_X86
CONFIG_X86_32
CONV_WITH_DIV
CPA_CY_API_VERSION_NUM_MAJOR
CPA_CY_API_VERSION_NUM_MINOR
Expand Down Expand Up @@ -255,6 +256,7 @@ ETHERNET_H
EV_TRIGGER
EXTERNAL_LOADER_APP
FD_CLOEXEC
FIPS_CODE_REVIEW
FIPS_OPTEST_FULL_RUN_AT_MODULE_INIT
FORCE_FAILURE_GETRANDOM
FP_ECC_CONTROL
Expand Down
121 changes: 121 additions & 0 deletions IDE/WIN-PQ-FIPSv7/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Notes on the wolfSSL FIPS 140-3 v7.0.0 (Post-Quantum) Windows project

First, if you did not get the FIPS files with your archive, you must contact
wolfSSL to obtain them.

The IDE/WIN-PQ-FIPSv7/wolfssl-fips.sln solution is for the FIPS 140-3 v7.0.0
module. In addition to the classical algorithms it includes the post-quantum
algorithms ML-KEM (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205) and the
stateful hash-based signatures LMS and XMSS (SP 800-208).

# Building the wolfssl-fips project

The wolfCrypt FIPS library for Windows is a part of the wolfSSL library. It
must be built as a static library, for the moment.

The library project is built with Whole Program Optimization disabled. This is
required so that necessary components of the library are not optimized away.
There are two functions added to the library that are used as markers in
memory for the in-core memory check of the code. WPO consolidates them into a
single function. WPO also optimizes away the automatic FIPS entry function.

Each of the source files inside the FIPS boundary defines their own code and
constant section. The code section names start with ".fipsA$" and the constant
section names start with ".fipsB$". Each subsection has a letter to organize
them in a specific order. This specific ordering puts marker functions and
constants on either end of the boundary so it can be hashed.


# In Core Memory Test

The In Core Memory test calculates a checksum (HMAC-SHA512 for the v7.0.0
module) of the wolfCrypt FIPS library code and constant data and compares it
with a known value in the code.

The following wolfCrypt FIPS project linker settings are required for the DLL Win32 configuration:
1) The [Randomized Base Address setting (ASLR)](https://learn.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization?view=msvc-170)
needs to be disabled on all builds as the feature throws off the in-core memory calculation causing the test to fail.
2) The [Incremental Link](https://learn.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=msvc-170)
option need turned off so function pointers go to actual code, not a jump instruction.
3) The [FixedBaseAddress](https://learn.microsoft.com/en-us/cpp/build/reference/fixed-fixed-base-address?view=msvc-170)
option to YES, which disables the support for ASLR.

The "verifyCore" check value in the source fips_test.c needs to be updated when
building the code. The POS performs this check and the default failure callback
will print out the calculated checksum. When developing your code, copy this
value and paste it back into your code in the verifyCore initializer then
rebuild the code. When statically linking, you may have to recalculate your
check value when changing your application.

# Build Options

The default build options should be the proper default set of options:

* HAVE_FIPS
* HAVE_FIPS_VERSION=7
* HAVE_FIPS_VERSION_MINOR=0
* HAVE_THREAD_LS
* WOLFSSL_KEY_GEN
* HAVE_AESGCM
* HAVE_HASHDRBG
* WOLFSSL_SHA384
* WOLFSSL_SHA512
* NO_PSK
* NO_RC4
* NO_DSA
* NO_MD4
* WOLFSSL_SHA224
* WOLFSSL_SHA3
* WC_RSA_PSS
* WC_RSA_NO_PADDING
* HAVE_ECC
* ECC_SHAMIR
* HAVE_ECC_CDH
* ECC_TIMING_RESISTANT
* TFM_TIMING_RESISTANT
* WOLFSSL_AES_COUNTER
* WOLFSSL_AES_DIRECT
* HAVE_AES_ECB
* HAVE_AESCCM
* WOLFSSL_CMAC
* HAVE_HKDF
* WOLFSSL_VALIDATE_ECC_IMPORT
* WOLFSSL_VALIDATE_FFC_IMPORT
* HAVE_FFDHE_Q
* NO_DES
* NO_DES3
* NO_MD5
* NO_OLD_TLS
* WOLFSSL_TLS13
* HAVE_TLS_EXTENSIONS
* HAVE_SUPPORTED_CURVES
* GCM_TABLE_4BIT
* WOLFSSL_NO_SHAKE256
* WOLFSSL_VALIDATE_ECC_KEYGEN
* WOLFSSL_ECDSA_SET_K
* WOLFSSL_WOLFSSH
* WOLFSSL_PUBLIC_MP
* WC_RNG_SEED_CB
* TFM_ECC256
* ECC_USER_CURVES
* HAVE_ECC192
* HAVE_ECC224
* HAVE_ECC256
* HAVE_ECC384
* HAVE_ECC521
* HAVE_FFDHE_2048
* HAVE_FFDHE_3072
* HAVE_FFDHE_4096
* HAVE_FFDHE_6144
* HAVE_FFDHE_8192
* FP_MAX_BITS 16384

The "NO" options explicitly disable algorithms that are not allowed in
FIPS mode.

Additionally one may enable:

* WOLFSSL_AESNI
* OPENSSL_EXTRA

These settings are defined in IDE/WIN-PQ-FIPSv7/user_settings.h.
11 changes: 11 additions & 0 deletions IDE/WIN-PQ-FIPSv7/include.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root

EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/README.txt
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/test.vcxproj
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/wolfssl-fips.sln
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/wolfssl-fips.vcxproj
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/user_settings.h
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/resource.h
EXTRA_DIST+= IDE/WIN-PQ-FIPSv7/wolfssl-fips.rc
14 changes: 14 additions & 0 deletions IDE/WIN-PQ-FIPSv7/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by wolfssl-fips.rc

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Loading
Loading