Skip to content
Snippets Groups Projects
install-prereqs-ubuntu.sh 1.76 KiB
Newer Older
  • Learn to ignore specific revisions
  • Johanna Henrich's avatar
    Johanna Henrich committed
    #!/bin/bash
    set -ex
    
    apt update
    apt install -y git \
                   build-essential \
                   autoconf \
                   automake \
                   libtool \
                   ninja-build \
                   libssl-dev \
                   libpcre3-dev \
                   wget
    
    NGINX_VERSION=1.20.1
    CMAKE_VERSION=3.18
    CMAKE_BUILD=3
    
    mkdir -p tmp
    cd tmp
    ROOT=$(pwd)
    
    # Fetch all the files we need
    wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.${CMAKE_BUILD}-Linux-x86_64.sh
    git clone -n --single-branch --branch main https://github.com/open-quantum-safe/liboqs.git
    cd liboqs
    git checkout 2e2ddb4e0493014694820471396984b30d59cf97
    cd ..
    git clone -n --single-branch --branch OQS-OpenSSL_1_1_1-stable https://github.com/open-quantum-safe/openssl.git
    cd openssl
    git checkout 63b48cdde3cdf8dab966e31ea277e03e2d233f57
    cd ..
    wget nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && tar -zxvf nginx-${NGINX_VERSION}.tar.gz
    
    # Install the latest CMake
    mkdir cmake
    sh cmake-${CMAKE_VERSION}.${CMAKE_BUILD}-Linux-x86_64.sh --skip-license --prefix=${ROOT}/cmake
    
    # build liboqs
    cd liboqs
    mkdir build && cd build
    ${ROOT}/cmake/bin/cmake -GNinja -DCMAKE_INSTALL_PREFIX=${ROOT}/openssl/oqs ..
    ninja && ninja install
    
    # build nginx (which builds OQS-OpenSSL)
    cd ${ROOT}
    cd nginx-${NGINX_VERSION}
    ./configure --prefix=${ROOT}/nginx \
                    --with-debug \
                    --with-http_ssl_module --with-openssl=${ROOT}/openssl \
                    --without-http_gzip_module \
                    --with-cc-opt="-I ${ROOT}/openssl/oqs/include" \
                    --with-ld-opt="-L ${ROOT}/openssl/oqs/lib";
    sed -i 's/libcrypto.a/libcrypto.a -loqs/g' objs/Makefile;
    sed -i 's/EVP_MD_CTX_create/EVP_MD_CTX_new/g; s/EVP_MD_CTX_destroy/EVP_MD_CTX_free/g' src/event/ngx_event_openssl.c;
    make && make install;