|
| 1 | +# Notes on the wolfSSL FIPS 140-3 v7.0.0 (Post-Quantum) Windows project |
| 2 | + |
| 3 | +First, if you did not get the FIPS files with your archive, you must contact |
| 4 | +wolfSSL to obtain them. |
| 5 | + |
| 6 | +The IDE/WIN-PQ-FIPSv7/wolfssl-fips.sln solution is for the FIPS 140-3 v7.0.0 |
| 7 | +module. In addition to the classical algorithms it includes the post-quantum |
| 8 | +algorithms ML-KEM (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205) and the |
| 9 | +stateful hash-based signatures LMS and XMSS (SP 800-208). |
| 10 | + |
| 11 | +# Building the wolfssl-fips project |
| 12 | + |
| 13 | +The wolfCrypt FIPS library for Windows is a part of the wolfSSL library. It |
| 14 | +must be built as a static library, for the moment. |
| 15 | + |
| 16 | +The library project is built with Whole Program Optimization disabled. This is |
| 17 | +required so that necessary components of the library are not optimized away. |
| 18 | +There are two functions added to the library that are used as markers in |
| 19 | +memory for the in-core memory check of the code. WPO consolidates them into a |
| 20 | +single function. WPO also optimizes away the automatic FIPS entry function. |
| 21 | + |
| 22 | +Each of the source files inside the FIPS boundary defines their own code and |
| 23 | +constant section. The code section names start with ".fipsA$" and the constant |
| 24 | +section names start with ".fipsB$". Each subsection has a letter to organize |
| 25 | +them in a specific order. This specific ordering puts marker functions and |
| 26 | +constants on either end of the boundary so it can be hashed. |
| 27 | + |
| 28 | + |
| 29 | +# In Core Memory Test |
| 30 | + |
| 31 | +The In Core Memory test calculates a checksum (HMAC-SHA512 for the v7.0.0 |
| 32 | +module) of the wolfCrypt FIPS library code and constant data and compares it |
| 33 | +with a known value in the code. |
| 34 | + |
| 35 | +The following wolfCrypt FIPS project linker settings are required for the DLL Win32 configuration: |
| 36 | +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) |
| 37 | +needs to be disabled on all builds as the feature throws off the in-core memory calculation causing the test to fail. |
| 38 | +2) The [Incremental Link](https://learn.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=msvc-170) |
| 39 | +option need turned off so function pointers go to actual code, not a jump instruction. |
| 40 | +3) The [FixedBaseAddress](https://learn.microsoft.com/en-us/cpp/build/reference/fixed-fixed-base-address?view=msvc-170) |
| 41 | +option to YES, which disables the support for ASLR. |
| 42 | + |
| 43 | +The "verifyCore" check value in the source fips_test.c needs to be updated when |
| 44 | +building the code. The POS performs this check and the default failure callback |
| 45 | +will print out the calculated checksum. When developing your code, copy this |
| 46 | +value and paste it back into your code in the verifyCore initializer then |
| 47 | +rebuild the code. When statically linking, you may have to recalculate your |
| 48 | +check value when changing your application. |
| 49 | + |
| 50 | +# Build Options |
| 51 | + |
| 52 | +The default build options should be the proper default set of options: |
| 53 | + |
| 54 | + * HAVE_FIPS |
| 55 | + * HAVE_FIPS_VERSION=7 |
| 56 | + * HAVE_FIPS_VERSION_MINOR=0 |
| 57 | + * HAVE_THREAD_LS |
| 58 | + * WOLFSSL_KEY_GEN |
| 59 | + * HAVE_AESGCM |
| 60 | + * HAVE_HASHDRBG |
| 61 | + * WOLFSSL_SHA384 |
| 62 | + * WOLFSSL_SHA512 |
| 63 | + * NO_PSK |
| 64 | + * NO_RC4 |
| 65 | + * NO_DSA |
| 66 | + * NO_MD4 |
| 67 | + * WOLFSSL_SHA224 |
| 68 | + * WOLFSSL_SHA3 |
| 69 | + * WC_RSA_PSS |
| 70 | + * WC_RSA_NO_PADDING |
| 71 | + * HAVE_ECC |
| 72 | + * ECC_SHAMIR |
| 73 | + * HAVE_ECC_CDH |
| 74 | + * ECC_TIMING_RESISTANT |
| 75 | + * TFM_TIMING_RESISTANT |
| 76 | + * WOLFSSL_AES_COUNTER |
| 77 | + * WOLFSSL_AES_DIRECT |
| 78 | + * HAVE_AES_ECB |
| 79 | + * HAVE_AESCCM |
| 80 | + * WOLFSSL_CMAC |
| 81 | + * HAVE_HKDF |
| 82 | + * WOLFSSL_VALIDATE_ECC_IMPORT |
| 83 | + * WOLFSSL_VALIDATE_FFC_IMPORT |
| 84 | + * HAVE_FFDHE_Q |
| 85 | + * NO_DES |
| 86 | + * NO_DES3 |
| 87 | + * NO_MD5 |
| 88 | + * NO_OLD_TLS |
| 89 | + * WOLFSSL_TLS13 |
| 90 | + * HAVE_TLS_EXTENSIONS |
| 91 | + * HAVE_SUPPORTED_CURVES |
| 92 | + * GCM_TABLE_4BIT |
| 93 | + * WOLFSSL_NO_SHAKE256 |
| 94 | + * WOLFSSL_VALIDATE_ECC_KEYGEN |
| 95 | + * WOLFSSL_ECDSA_SET_K |
| 96 | + * WOLFSSL_WOLFSSH |
| 97 | + * WOLFSSL_PUBLIC_MP |
| 98 | + * WC_RNG_SEED_CB |
| 99 | + * TFM_ECC256 |
| 100 | + * ECC_USER_CURVES |
| 101 | + * HAVE_ECC192 |
| 102 | + * HAVE_ECC224 |
| 103 | + * HAVE_ECC256 |
| 104 | + * HAVE_ECC384 |
| 105 | + * HAVE_ECC521 |
| 106 | + * HAVE_FFDHE_2048 |
| 107 | + * HAVE_FFDHE_3072 |
| 108 | + * HAVE_FFDHE_4096 |
| 109 | + * HAVE_FFDHE_6144 |
| 110 | + * HAVE_FFDHE_8192 |
| 111 | + * FP_MAX_BITS 16384 |
| 112 | + |
| 113 | +The "NO" options explicitly disable algorithms that are not allowed in |
| 114 | +FIPS mode. |
| 115 | + |
| 116 | +Additionally one may enable: |
| 117 | + |
| 118 | + * WOLFSSL_AESNI |
| 119 | + * OPENSSL_EXTRA |
| 120 | + |
| 121 | +These settings are defined in IDE/WIN-PQ-FIPSv7/user_settings.h. |
0 commit comments