Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix libcrypto helpers #4422

Merged
merged 18 commits into from
Apr 25, 2024
Merged
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
8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
buildInputs = [ pkgs.cmake openssl_3_0 ];
packages = common_packages;
S2N_LIBCRYPTO = "openssl-3.0";
OPENSSL_1_0_2_INSTALL_DIR = "${openssl_1_0_2}";
OPENSSL_1_1_1_INSTALL_DIR = "${openssl_1_1_1}";
OPENSSL_3_0_INSTALL_DIR = "${openssl_3_0}";
AWSLC_INSTALL_DIR = "${aws-lc}";
GNUTLS_INSTALL_DIR = "${pkgs.gnutls}";
LIBRESSL_INSTALL_DIR = "${libressl}";
# Integ s_client/server tests expect openssl 1.1.1.
shellHook = ''
echo Setting up $S2N_LIBCRYPTO environment from flake.nix...
Expand Down Expand Up @@ -141,7 +147,7 @@
# Integ s_client/server tests expect openssl 1.1.1.
# GnuTLS-cli and serv utilities needed for some integration tests.
shellHook = ''
echo Setting up $S2N_LIBCRYPTO enviornment from flake.nix...
echo Setting up $S2N_LIBCRYPTO environment from flake.nix...
export PATH=${openssl_1_1_1}/bin:$PATH
export PS1="[nix $S2N_LIBCRYPTO] $PS1"
source ${writeScript ./nix/shell.sh}
Expand Down
18 changes: 17 additions & 1 deletion nix/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ banner()
echo "+---------------------------------------------------------+"
}

function libcrypto_alias {
local libcrypto_name=$1
local libcrypto_binary_path=$2
if [[ -f $libcrypto_binary_path ]]; then
alias $libcrypto_name=$libcrypto_binary_path
echo "Libcrypto binary $libcrypto_binary_path available as $libcrypto_name"
else
banner "Could not find libcrypto $libcrypto_binary_path for alias"
fi
}
libcrypto_alias openssl102 "${OPENSSL_1_0_2_INSTALL_DIR}/bin/openssl"
libcrypto_alias openssl111 "${OPENSSL_1_1_1_INSTALL_DIR}/bin/openssl"
libcrypto_alias openssl30 "${OPENSSL_3_0_INSTALL_DIR}/bin/openssl"
libcrypto_alias bssl "${AWSLC_INSTALL_DIR}/bin/bssl"
libcrypto_alias libressl "${LIBRESSL_INSTALL_DIR}/bin/openssl"
#No need to alias gnutls because it is included in common_packages (see flake.nix).

function clean {
banner "Cleanup ./build"
Expand Down Expand Up @@ -118,7 +134,7 @@ function do-clang-format {

function test_toolchain_counts {
# This is a starting point for a unit test of the devShell.
# The choosen S2N_LIBCRYPTO should be 2, and the others should be zero.
# The chosen S2N_LIBCRYPTO should be 2, and the others should be zero.
banner "Checking the CMAKE_INCLUDE_PATH for libcrypto counts"
echo $CMAKE_INCLUDE_PATH|gawk 'BEGIN{RS=":"; o10=0; o11=0; o3=0;awslc=0;libre=0}
/openssl-3.0/{o3++}
Expand Down
Loading