| 1 | --- |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). You may not use |
| 5 | # this file except in compliance with the License. A copy of the License is |
| 6 | # located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0/ |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed on an |
| 11 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | # implied. See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | version: 0.2 |
| 15 | |
| 16 | env: |
| 17 | shell: bash |
| 18 | variables: |
| 19 | # Select a libcrypto to test the backwards-compatible RAND engine override flag. |
| 20 | # The flag is now a no-op (the custom RAND engine was removed), but we verify |
| 21 | # that builds with the flag set to 0 still pass all tests. |
| 22 | S2N_LIBCRYPTO: "openssl-1.0.2" |
| 23 | CTEST_OUTPUT_ON_FAILURE: 1 |
| 24 | |
| 25 | phases: |
| 26 | pre_build: |
| 27 | commands: |
| 28 | - | |
| 29 | if [ -d "third-party-src" ]; then |
| 30 | cd third-party-src; |
| 31 | fi |
| 32 | build: |
| 33 | on-failure: ABORT |
| 34 | commands: |
| 35 | - | |
| 36 | cmake . -Brand_override_enabled \ |
| 37 | -DCMAKE_PREFIX_PATH=/usr/local/"${S2N_LIBCRYPTO}" \ |
| 38 | -DCMAKE_BUILD_TYPE=RelWithDebInfo |
| 39 | - cmake --build ./rand_override_enabled -- -j $(nproc) |
| 40 | - | |
| 41 | cmake . -Brand_override_disabled \ |
| 42 | -DCMAKE_PREFIX_PATH=/usr/local/"${S2N_LIBCRYPTO}" \ |
| 43 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 44 | -DS2N_OVERRIDE_LIBCRYPTO_RAND_ENGINE=0 |
| 45 | - cmake --build ./rand_override_disabled -- -j $(nproc) |
| 46 | post_build: |
| 47 | on-failure: ABORT |
| 48 | commands: |
| 49 | # CTEST_PARALLEL_LEVEL is set outside of env/variables to ensure that `nproc` is evaluated. |
| 50 | - export CTEST_PARALLEL_LEVEL=$(nproc) |
| 51 | # Verify that s2n-tls tests pass with the RAND engine override disabled. |
| 52 | # The S2N_OVERRIDE_LIBCRYPTO_RAND_ENGINE flag is kept for backwards |
| 53 | # compatibility, but the custom RAND engine was removed as part of the |
| 54 | # DRBG removal. The flag is now a no-op. |
| 55 | - make -C rand_override_disabled test |
| 56 | # Verify that s2n-tls tests also pass with the default (override enabled) build. |
| 57 | - make -C rand_override_enabled test -- ARGS="-R 's2n_random_test'" |