Skip to content

Commit 9b20510

Browse files
authored
Merge pull request #223 from aidangarske/env-setup-fips
Add FIPS mode for env-setup script
2 parents 8400ddc + 697dfeb commit 9b20510

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/env-setup

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# It can be used on the command line, or by workflows.
33
# 'source' this file, don't run it directly
44
# To disable wolfProvider, run 'unset OPENSSL_CONF'
5+
# To enable FIPS mode, set WOLFSSL_ISFIPS=1 before sourcing this file
56

67
if [[ -n "${ZSH_VERSION:-}" ]]; then
78
[[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && is_sourced=1 || is_sourced=0
@@ -42,7 +43,16 @@ fi
4243

4344
# Set variables with default values if not already set
4445
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:=$REPO_ROOT/wolfssl-install/lib:$OPENSSL_LIB_PATH}"
45-
export OPENSSL_CONF="${OPENSSL_CONF:=$REPO_ROOT/provider.conf}"
46+
47+
# Auto-detect FIPS mode and use appropriate config
48+
if [ "${WOLFSSL_ISFIPS:-0}" = "1" ]; then
49+
DEFAULT_PROVIDER_CONF="$REPO_ROOT/provider-fips.conf"
50+
echo "FIPS mode detected, using provider-fips.conf"
51+
else
52+
DEFAULT_PROVIDER_CONF="$REPO_ROOT/provider.conf"
53+
fi
54+
export OPENSSL_CONF="${OPENSSL_CONF:=$DEFAULT_PROVIDER_CONF}"
55+
4656
export OPENSSL_MODULES="${OPENSSL_MODULES:=$REPO_ROOT/wolfprov-install/lib}"
4757
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:=$OPENSSL_LIB_PATH/pkgconfig}"
4858

0 commit comments

Comments
 (0)