Skip to content
Closed
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
18 changes: 8 additions & 10 deletions default_stub/wp_default_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,22 @@
* along with wolfProvider. If not, see <http://www.gnu.org/licenses/>.
*/

#include <openssl/provider.h>
/* Note: to simplify the build process, we are not using the OpenSSL headers.
* Instead, we are using functions that don't specify parameters. This
* allows us to build the stub without having to clone OpenSSL first,
* nor use the system OpenSSL headers.
*/

/* Prototype of public function that initializes the wolfSSL provider. */
OSSL_provider_init_fn wolfssl_provider_init;
int wolfssl_provider_init();

/* Prototype for the wolfprov_provider_init function */
int wolfprov_provider_init(const OSSL_CORE_HANDLE* handle,
const OSSL_DISPATCH* in,
const OSSL_DISPATCH** out,
void** provCtx);
int wolfprov_provider_init();

/*
* Provider implementation stub
*/
int wolfprov_provider_init(const OSSL_CORE_HANDLE* handle,
const OSSL_DISPATCH* in,
const OSSL_DISPATCH** out,
void** provCtx)
int wolfprov_provider_init()
{
return 0;
}
4 changes: 0 additions & 4 deletions scripts/build-wolfprovider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ source ${SCRIPT_DIR}/utils-wolfprovider.sh

echo "Using openssl: $OPENSSL_TAG, wolfssl: $WOLFSSL_TAG"

if [ "$WOLFPROV_REPLACE_DEFAULT" = "1" ]; then
build_default_stub
fi

init_wolfprov

exit $?
6 changes: 2 additions & 4 deletions scripts/utils-openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ clone_openssl() {

if [ ! -d ${OPENSSL_SOURCE_DIR} ]; then
printf "\tOpenSSL source directory not found: ${OPENSSL_SOURCE_DIR}\n"
printf "\tParent directory:\n"
tree -L 2 $(dirname ${OPENSSL_SOURCE_DIR}/..) || true
CLONE_TAG=${USE_CUR_TAG:+${OPENSSL_TAG_CUR}}
CLONE_TAG=${CLONE_TAG:-${OPENSSL_TAG}}

Expand Down Expand Up @@ -165,7 +163,7 @@ install_openssl() {
clone_openssl
patch_openssl
check_openssl_replace_default_mismatch
cd ${OPENSSL_SOURCE_DIR}
pushd ${OPENSSL_SOURCE_DIR} &> /dev/null

if [ ! -d ${OPENSSL_INSTALL_DIR} ]; then
printf "\tConfigure OpenSSL ${OPENSSL_TAG} ... "
Expand Down Expand Up @@ -223,7 +221,7 @@ install_openssl() {
printf "Done.\n"
fi

cd ..
popd &> /dev/null
}

init_openssl() {
Expand Down
32 changes: 26 additions & 6 deletions scripts/utils-wolfprovider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source ${SCRIPT_DIR}/utils-general.sh

WOLFPROV_SOURCE_DIR=${SCRIPT_DIR}/..
WOLFPROV_INSTALL_DIR=${SCRIPT_DIR}/../wolfprov-install
LIBDEFAULT_STUB_SOURCE_DIR=${SCRIPT_DIR}/../default_stub
LIBDEFAULT_STUB_INSTALL_DIR=${SCRIPT_DIR}/../libdefault-stub-install
WOLFPROV_WITH_WOLFSSL=--with-wolfssl=${WOLFSSL_INSTALL_DIR}

Expand Down Expand Up @@ -58,9 +59,12 @@ WOLFPROV_DEBUG=${WOLFPROV_DEBUG:-0}
WOLFPROV_CLEAN=${WOLFPROV_CLEAN:-0}
WOLFPROV_DISTCLEAN=${WOLFPROV_DISTCLEAN:-0}

build_default_stub() {
install_default_stub() {
printf "\nBuilding default stub library ...\n"
cd ${SCRIPT_DIR}/../default_stub
pushd ${LIBDEFAULT_STUB_SOURCE_DIR} &> /dev/null

# Ensure openssl is present for header files
clone_openssl

printf "\tGenerate build system ... "
if [ ! -e "configure" ]; then
Expand Down Expand Up @@ -104,7 +108,7 @@ build_default_stub() {
fi
printf "Done.\n"

cd ${SCRIPT_DIR}/..
popd &> /dev/null
}

clean_wolfprov() {
Expand All @@ -116,12 +120,21 @@ clean_wolfprov() {
make clean >>$LOG_FILE 2>&1
fi
# Clean default_stub build artifacts
if [ -f "default_stub/Makefile" ]; then
if [ -f "${LIBDEFAULT_STUB_SOURCE_DIR}/Makefile" ]; then
printf "Cleaning default stub ...\n"
make -C default_stub clean >>$LOG_FILE 2>&1
make -C ${LIBDEFAULT_STUB_SOURCE_DIR} clean >>$LOG_FILE 2>&1
fi
# Remove root libdefault.la file
rm -f libdefault.la
# Remove autoconf files in default_stub
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/aclocal.m4
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/config.h
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/config.log
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/config.status
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/configure
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/depcomp
rm -f ${LIBDEFAULT_STUB_SOURCE_DIR}/install-sh
# Remove entire wolfProvider install directory
rm -rf ${WOLFPROV_INSTALL_DIR}
fi
if [ "$WOLFPROV_DISTCLEAN" -eq "1" ]; then
Expand All @@ -132,7 +145,7 @@ clean_wolfprov() {
}

install_wolfprov() {
cd ${WOLFPROV_SOURCE_DIR}
pushd ${WOLFPROV_SOURCE_DIR} &> /dev/null

# Add stub library path for replace-default functionality after dependencies are installed
if [ "$WOLFPROV_REPLACE_DEFAULT" = "1" ]; then
Expand All @@ -143,6 +156,11 @@ install_wolfprov() {
fi
fi

# Build stub first so we can link OpenSSL against it
if [ "$WOLFPROV_REPLACE_DEFAULT" = "1" ]; then
install_default_stub
fi

init_openssl
init_wolfssl

Expand Down Expand Up @@ -209,6 +227,8 @@ install_wolfprov() {
exit 1
fi
printf "Done.\n"

popd &> /dev/null
}

init_wolfprov() {
Expand Down
Loading