Skip to content

Commit a303c6c

Browse files
committed
Fix is_openssl_patched
1 parent 655b63d commit a303c6c

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

scripts/utils-openssl.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,20 @@ clone_openssl() {
121121
}
122122

123123
is_openssl_patched() {
124-
if [ ! -f "${OPENSSL_SOURCE_DIR}/crypto/provider_predefined.c" ]; then
124+
# Return 0 if patched, 1 if not
125+
local dir="${OPENSSL_SOURCE_DIR:?OPENSSL_SOURCE_DIR not set}"
126+
local file="${dir%/}/crypto/provider_predefined.c"
127+
128+
# File must exist to be patched
129+
[[ -f "$file" ]] || return 1
130+
131+
# Any time we see libwolfprov, we're patched
132+
if grep -q 'libwolfprov' -- "$file"; then
125133
return 0
126134
fi
127135

128-
# Check if $OPENSSL_SOURCE_DIR is a git repository
129-
if [ -d ${OPENSSL_SOURCE_DIR}/.git ]; then
130-
pushd ${OPENSSL_SOURCE_DIR} &> /dev/null
131-
patch_applied=$(git diff --quiet "crypto/provider_predefined.c" 2>/dev/null && echo 1 || echo 0)
132-
popd &> /dev/null
133-
else
134-
# Not a git repo, may have been downloaded separately (from Debian sources)
135-
patch_applied=$(grep -q "libwolfprov" "${OPENSSL_SOURCE_DIR}/crypto/provider_predefined.c" && echo 1 || echo 0)
136-
fi
137-
return $patch_applied
136+
# Not patched
137+
return 1
138138
}
139139

140140
check_openssl_replace_default_mismatch() {

src/wp_wolfprov.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,9 @@ int wolfssl_provider_init(const OSSL_CORE_HANDLE* handle,
12421242
if (ok) {
12431243
if (wolfSSL_Debugging_ON() != 0) {
12441244
WOLFPROV_MSG(WP_LOG_PROVIDER,
1245-
"WARNING: wolfProvider built with debug but underlying wolfSSL is not!"
1246-
"Building wolfSSl with debug is highly recommended, proceeding...");
1245+
"WARNING: wolfProvider built with debug but underlying wolfSSL is not!");
1246+
WOLFPROV_MSG(WP_LOG_PROVIDER,
1247+
"\tBuilding wolfSSl with debug is highly recommended, proceeding...");
12471248
}
12481249
else {
12491250
wolfSSL_SetLoggingPrefix("wolfSSL");

0 commit comments

Comments
 (0)