-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for AWS-LC build in ESDK (#750)
* add support for AWS-LC build in ESDK * align with clang format linters * clang format linters need another whitespace * different memory freeing behaviour * clarify some ambiguities * remove local testing change * update aws-lc version tag * fix OPENSSL_ROOT_DIR * rerun CI * test adding delay in timing Co-authored-by: Alex Chew <[email protected]> Co-authored-by: Andrew Jewell <[email protected]> Co-authored-by: Alex Chew <[email protected]>
- Loading branch information
1 parent
072bce0
commit c40940e
Showing
7 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/bash | ||
|
||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This script is similar to |install-shared-deps.sh| except below differences: | ||
# 1. OpenSSL is replaced with awslc. | ||
# 2. LibCurl version is updated to 7.74. | ||
# After this script, awslc(static and shared) and curl will be installed under /deps/install. | ||
|
||
set -euxo pipefail | ||
|
||
export AWSLC_SRC_DIR=/tmp/awslc | ||
export INSTALL_DIR=/deps/install | ||
export LD_LIBRARY_PATH=${INSTALL_DIR} | ||
export NUM_CPU_THREADS=$(nproc) | ||
|
||
function download_awslc() { | ||
AWSLC_GIT_URL='https://github.com/awslabs/aws-lc.git' | ||
AWSLC_TAG='v1.1.0' | ||
rm -rf ${AWSLC_SRC_DIR} | ||
mkdir -p ${AWSLC_SRC_DIR} | ||
git clone --depth 1 --branch ${AWSLC_TAG} "${AWSLC_GIT_URL}" "${AWSLC_SRC_DIR}" | ||
} | ||
|
||
function build_awslc() { | ||
BUILD_DIR=/tmp/build/awslc | ||
rm -rf ${BUILD_DIR} | ||
mkdir -p ${BUILD_DIR} | ||
CMAKE_BUILD_COMMAND="cmake ${AWSLC_SRC_DIR} $@ \ | ||
-GNinja \ | ||
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo" | ||
if [[ -n "${CFLAGS-}" ]]; then | ||
CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DCMAKE_C_FLAGS=${CFLAGS}" | ||
fi | ||
if [[ -n "${CXXFLAGS-}" ]]; then | ||
CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DCMAKE_CXX_FLAGS=${CXXFLAGS}" | ||
fi | ||
(cd ${BUILD_DIR} && ${CMAKE_BUILD_COMMAND}) | ||
cmake --build ${BUILD_DIR} | ||
cmake --build ${BUILD_DIR} --target install | ||
rm -rf ${BUILD_DIR} | ||
} | ||
|
||
function install_libcurl() { | ||
mkdir /deps/curl | ||
cd /deps/curl | ||
wget https://curl.haxx.se/download/curl-7.74.0.tar.gz | ||
tar xzf curl-*.tar.gz | ||
cd curl-*/ | ||
# awslc is forked from boringssl. | ||
# |OPENSSL_IS_AWSLC| macro is equivalent to |OPENSSL_IS_BORINGSSL|. | ||
# Replacing OPENSSL_IS_BORINGSSL with OPENSSL_IS_AWSLC. | ||
# | ||
# TODO: Remove the extra command below when curl has official support for AWS-LC. | ||
find ./ -type f -exec sed -i -e 's/OPENSSL_IS_BORINGSSL/OPENSSL_IS_AWSLC/g' {} \; | ||
./configure --with-ssl=/deps/install \ | ||
--prefix=/deps/install \ | ||
--disable-ldap \ | ||
--without-libidn \ | ||
--without-gnutls \ | ||
--without-nss \ | ||
--without-gssapi | ||
make -j"${NUM_CPU_THREADS}" | ||
make install | ||
cd / | ||
rm -rf /deps/curl | ||
} | ||
|
||
mkdir -p /deps | ||
|
||
download_awslc | ||
|
||
build_awslc '-DBUILD_SHARED_LIBS=ON' | ||
build_awslc '-DBUILD_SHARED_LIBS=OFF' | ||
|
||
install_libcurl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FROM ubuntu:latest | ||
|
||
# Needed for setup-apt-cache.sh | ||
ADD https://mirrors.kernel.org/ubuntu/pool/main/n/net-tools/net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb /tmp | ||
ADD https://mirrors.kernel.org/ubuntu/pool/universe/n/netcat/netcat-traditional_1.10-40_amd64.deb /tmp | ||
RUN dpkg -i /tmp/net-tools_*.deb /tmp/netcat-*.deb | ||
|
||
ADD bin/setup-apt-cache.sh /usr/local/bin/ | ||
ADD bin/setup-apt.sh /usr/local/bin/ | ||
RUN setup-apt-cache.sh | ||
RUN setup-apt.sh | ||
|
||
ENV PATH=/usr/local/bin:/usr/bin:/bin | ||
|
||
ENV CC=/usr/bin/gcc | ||
ENV CXX=/usr/bin/g++ | ||
ENV CFLAGS= | ||
ENV CXXFLAGS= | ||
ENV LDFLAGS= | ||
|
||
# Same paths as the main docker file, ubuntu-latest-x64.Dockerfile. | ||
ENV LDFLAGS="-Wl,-rpath -Wl,/deps/install/lib -Wl,-rpath -Wl,/deps/shared/install/lib -L/deps/install/lib -L/deps/shared/install/lib" | ||
|
||
ADD bin/apt-install-pkgs /usr/local/bin/ | ||
ADD bin/install-shared-deps-awslc.sh /usr/local/bin/ | ||
RUN install-shared-deps-awslc.sh | ||
|
||
ADD bin/install-aws-deps.sh /usr/local/bin | ||
RUN install-aws-deps.sh | ||
|
||
ADD bin/install-node.sh /usr/local/bin | ||
RUN install-node.sh | ||
|
||
# Remove apt proxy configuration before publishing the dockerfile | ||
RUN rm -f /etc/apt/apt.conf.d/99proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters