1# Dockerfile 2# 3# Purpose 4# ------- 5# Defines a Docker container suitable to build and run all tests (all.sh), 6# except for those that use a proprietary toolchain. 7# 8# WARNING: this Dockerfile is no longer maintained! See 9# https://github.com/Mbed-TLS/mbedtls-test/blob/master/README.md#quick-start 10# for the set of Docker images we use on the CI. 11 12# Copyright The Mbed TLS Contributors 13# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 14ARG MAKEFLAGS_PARALLEL="" 15ARG MY_REGISTRY= 16 17FROM ${MY_REGISTRY}ubuntu:bionic 18 19 20ENV DEBIAN_FRONTEND noninteractive 21 22RUN apt-get update \ 23 && apt-get -y install software-properties-common \ 24 && rm -rf /var/lib/apt/lists 25 26RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa 27 28RUN apt-get update \ 29 && apt-get -y install \ 30 # mbedtls build/test dependencies 31 build-essential \ 32 clang \ 33 cmake \ 34 doxygen \ 35 gcc-arm-none-eabi \ 36 gcc-mingw-w64-i686 \ 37 gcc-multilib \ 38 g++-multilib \ 39 gdb \ 40 git \ 41 graphviz \ 42 lsof \ 43 python \ 44 python3-pip \ 45 python3 \ 46 pylint3 \ 47 valgrind \ 48 wget \ 49 # libnettle build dependencies 50 libgmp-dev \ 51 m4 \ 52 pkg-config \ 53 && rm -rf /var/lib/apt/lists/* 54 55# Build a static, legacy openssl from sources with sslv3 enabled 56# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh) 57# Note: openssl-1.0.2 and earlier has known build issues with parallel make. 58RUN cd /tmp \ 59 && wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz -qO- | tar xz \ 60 && cd openssl-1.0.1j \ 61 && ./config --openssldir=/usr/local/openssl-1.0.1j no-shared \ 62 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \ 63 && make install_sw \ 64 && rm -rf /tmp/openssl* 65ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl 66 67# Build OPENSSL as 1.0.2g 68RUN cd /tmp \ 69 && wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz -qO- | tar xz \ 70 && cd openssl-1.0.2g \ 71 && ./config --openssldir=/usr/local/openssl-1.0.2g no-shared \ 72 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \ 73 && make install_sw \ 74 && rm -rf /tmp/openssl* 75ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl 76 77# Build a new openssl binary for ARIA/CHACHA20 support 78# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh) 79RUN cd /tmp \ 80 && wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz -qO- | tar xz \ 81 && cd openssl-1.1.1a \ 82 && ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'${LIBRPATH}' no-shared \ 83 && make ${MAKEFLAGS_PARALLEL} \ 84 && make install_sw \ 85 && rm -rf /tmp/openssl* 86ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl 87 88# Build libnettle 2.7.1 (needed by legacy gnutls) 89RUN cd /tmp \ 90 && wget https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -qO- | tar xz \ 91 && cd nettle-2.7.1 \ 92 && ./configure --disable-documentation \ 93 && make ${MAKEFLAGS_PARALLEL} \ 94 && make install \ 95 && /sbin/ldconfig \ 96 && rm -rf /tmp/nettle* 97 98# Build legacy gnutls (3.3.8) 99RUN cd /tmp \ 100 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz -qO- | tar xJ \ 101 && cd gnutls-3.3.8 \ 102 && ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared --disable-guile --disable-doc \ 103 && make ${MAKEFLAGS_PARALLEL} \ 104 && make install \ 105 && rm -rf /tmp/gnutls* 106ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli 107ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv 108 109# Build libnettle 3.1 (needed by gnutls) 110RUN cd /tmp \ 111 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz -qO- | tar xz \ 112 && cd nettle-3.1 \ 113 && ./configure --disable-documentation \ 114 && make ${MAKEFLAGS_PARALLEL} \ 115 && make install \ 116 && /sbin/ldconfig \ 117 && rm -rf /tmp/nettle* 118 119# Build gnutls (3.4.10) 120RUN cd /tmp \ 121 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz -qO- | tar xJ \ 122 && cd gnutls-3.4.10 \ 123 && ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 \ 124 --with-included-libtasn1 --without-p11-kit \ 125 --disable-shared --disable-guile --disable-doc \ 126 && make ${MAKEFLAGS_PARALLEL} \ 127 && make install \ 128 && rm -rf /tmp/gnutls* 129ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli 130ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv 131 132# Build libnettle 3.4 (needed by gnutls next) 133RUN cd /tmp \ 134 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz -qO- | tar xz \ 135 && cd nettle-3.4.1 \ 136 && ./configure --disable-documentation \ 137 && make ${MAKEFLAGS_PARALLEL} \ 138 && make install \ 139 && /sbin/ldconfig \ 140 && rm -rf /tmp/nettle* 141 142# Build gnutls next (3.6.5) 143RUN cd /tmp \ 144 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz -qO- | tar xJ \ 145 && cd gnutls-3.6.5 \ 146 && ./configure --prefix=/usr/local/gnutls-3.6.5 --exec_prefix=/usr/local/gnutls-3.6.5 \ 147 --with-included-libtasn1 --with-included-unistring --without-p11-kit \ 148 --disable-shared --disable-guile --disable-doc \ 149 && make ${MAKEFLAGS_PARALLEL} \ 150 && make install \ 151 && rm -rf /tmp/gnutls* 152 153ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.6.5/bin/gnutls-cli 154ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.6.5/bin/gnutls-serv 155