diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c41002ab..0a8f0cf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: git checkout -b "$branch" || true - name: Run build run: earthly --ci +all --distro=${{ matrix.distro }} - linux: + linux-x64: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -41,15 +41,15 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Build dependencies - run: ceedling project:linux verbosity[4] clobber dependencies:make + run: ceedling --mixin=linux_x64 clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source ./wolfcrypt/test/testwolfcrypt - name: Run build and test - run: ceedling project:linux verbosity[4] test:all + run: ceedling --mixin=linux_x64 test:all --verbosity=debug linux-multithread: runs-on: ubuntu-22.04 steps: @@ -59,15 +59,15 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Build dependencies - run: ceedling project:linux_multithread verbosity[4] clobber dependencies:make + run: ceedling --mixin=linux_multithread clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source ./wolfcrypt/test/testwolfcrypt - name: Run build and test - run: ceedling project:linux_multithread verbosity[4] test:all + run: ceedling --mixin=linux_multithread test:all --verbosity=debug linux-386: runs-on: ubuntu-22.04 steps: @@ -77,19 +77,19 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install gcc multi lib run: | sudo apt update sudo apt install -y gcc-multilib - name: Build dependencies - run: ceedling project:linux_386 verbosity[4] clobber dependencies:make + run: ceedling --mixin=linux_386 clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source ./wolfcrypt/test/testwolfcrypt - name: Run build and test - run: ceedling project:linux_386 verbosity[4] test:all + run: ceedling --mixin=linux_386 test:all --verbosity=debug linux-arm64: runs-on: ubuntu-22.04 steps: @@ -99,19 +99,19 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install ARM Tools run: | sudo apt update sudo apt install -y crossbuild-essential-arm64 qemu-user - name: Build dependencies - run: CROSS_COMPILE="aarch64-linux-gnu" CC="aarch64-linux-gnu-gcc" ceedling project:linux_arm64 verbosity[4] clobber dependencies:make + run: CROSS_COMPILE="aarch64-linux-gnu" CC="aarch64-linux-gnu-gcc" ceedling --mixin=linux_arm64 clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source QEMU_LD_PREFIX=/usr/aarch64-linux-gnu ./wolfcrypt/test/testwolfcrypt - name: Run build - run: CC="aarch64-linux-gnu-gcc" ceedling project:linux_arm64 verbosity[4] release + run: CC="aarch64-linux-gnu-gcc" ceedling --mixin=linux_arm64 release --verbosity=debug linux-arm: runs-on: ubuntu-22.04 steps: @@ -121,19 +121,19 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install ARM Tools run: | sudo apt update sudo apt install -y crossbuild-essential-armhf qemu-user - name: Build dependencies - run: CROSS_COMPILE="arm-linux-gnueabihf" CC="arm-linux-gnueabihf-gcc" ceedling project:linux_arm verbosity[4] clobber dependencies:make + run: CROSS_COMPILE="arm-linux-gnueabihf" CC="arm-linux-gnueabihf-gcc" ceedling --mixin=linux_arm clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf ./wolfcrypt/test/testwolfcrypt - name: Run build - run: CC="arm-linux-gnueabihf-gcc" ceedling project:linux_arm verbosity[4] release + run: CC="arm-linux-gnueabihf-gcc" ceedling --mixin=linux_arm release --verbosity=debug linux-arm-no-pqc: runs-on: ubuntu-22.04 steps: @@ -143,19 +143,19 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install ARM Tools run: | sudo apt update sudo apt install -y crossbuild-essential-armhf qemu-user - name: Build dependencies - run: CROSS_COMPILE="arm-linux-gnueabihf" CC="arm-linux-gnueabihf-gcc" ceedling project:linux_arm_no_pqc verbosity[4] clobber dependencies:make + run: CROSS_COMPILE="arm-linux-gnueabihf" CC="arm-linux-gnueabihf-gcc" ceedling --mixin=linux_arm_no_pqc clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf ./wolfcrypt/test/testwolfcrypt - name: Run build - run: CC="arm-linux-gnueabihf-gcc" ceedling project:linux_arm_no_pqc verbosity[4] release + run: CC="arm-linux-gnueabihf-gcc" ceedling --mixin=linux_arm_no_pqc release --verbosity=debug linux-riscv64: runs-on: ubuntu-22.04 steps: @@ -165,20 +165,20 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install RISC-V Toolchain run: | sudo apt update sudo apt install -y crossbuild-essential-riscv64 qemu-user - name: Build dependencies - run: CROSS_COMPILE="riscv64-linux-gnu" CC="riscv64-linux-gnu-gcc" ceedling project:linux_riscv64 verbosity[4] clobber dependencies:make + run: CROSS_COMPILE="riscv64-linux-gnu" CC="riscv64-linux-gnu-gcc" ceedling --mixin=linux_riscv64 clobber dependencies:make --verbosity=debug - name: Run wolfSSL Tests run: | - cd third_party/wolfssl + cd third_party/wolfssl/source QEMU_LD_PREFIX=/usr/riscv64-linux-gnu ./wolfcrypt/test/testwolfcrypt - name: Run build - run: CC="riscv64-linux-gnu-gcc" ceedling project:linux_riscv64 verbosity[4] release - macos: + run: CC="riscv64-linux-gnu-gcc" ceedling --mixin=linux_riscv64 release --verbosity=debug + macos-x64: runs-on: macos-13 steps: - uses: actions/checkout@v4 @@ -187,14 +187,14 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install automake run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool - name: Build dependencies - run: ceedling project:macos verbosity[4] clobber dependencies:make + run: ceedling --mixin=macos_x64 clobber dependencies:make --verbosity=debug - name: Run build and test - run: ceedling project:macos verbosity[4] test:all - macos_arm64: + run: ceedling --mixin=macos_x64 clobber test:all --verbosity=debug + macos-arm64: runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -203,13 +203,13 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install automake run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool - name: Build dependencies - run: ceedling project:macos_arm64 verbosity[4] clobber dependencies:make + run: ceedling --mixin=macos_arm64 clobber dependencies:make --verbosity=debug - name: Run build and test - run: ceedling project:macos_arm64 verbosity[4] test:all + run: ceedling --mixin=macos_arm64 clobber test:all --verbosity=debug windows: runs-on: windows-2022 strategy: @@ -229,7 +229,7 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: gem install ceedling -v 0.31.1 --no-user-install + run: gem install ceedling --no-user-install - name: Check Ceedling version run: ceedling version - name: Set up Visual Studio shell @@ -239,13 +239,13 @@ jobs: - if: ${{ matrix.config.project != 'windows_arm64' }} # Skip making dependencies for ARM64 as we can only apply git patch once for WolfSSL name: Build dependencies - run: ceedling project:${{ matrix.config.project }} verbosity[4] clobber dependencies:make + run: ceedling --project=ceedling/${{ matrix.config.project }}.yml clobber dependencies:make --verbosity=debug - if: ${{ matrix.config.project != 'windows_arm64' }} name: Run build and test - run: ceedling project:${{ matrix.config.project }} verbosity[4] test:all + run: ceedling --project=ceedling/${{ matrix.config.project }}.yml test:all --verbosity=debug - if: ${{ matrix.config.project == 'windows_arm64' }} name: Run build - run: ceedling project:${{ matrix.config.project }} verbosity[4] release + run: ceedling --project=ceedling/${{ matrix.config.project }}.yml release ios: runs-on: macos-latest steps: @@ -255,11 +255,11 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install automake run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool - name: Run build - run: ceedling project:ios verbosity[4] release + run: ceedling --project=ceedling/ios.yml release --verbosity=debug - name: Copy all public headers into the umbrella framework run: cp public/*.h ios/Lightway/Lightway - name: Build xcframework @@ -275,11 +275,11 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Install automake run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool - name: Run build - run: ceedling project:tvos verbosity[4] release + run: ceedling --project=ceedling/tvos.yml release --verbosity=debug android: runs-on: ubuntu-22.04 strategy: @@ -293,8 +293,8 @@ jobs: ruby-version: '3.0' bundler-cache: true - name: Install Ceedling - run: sudo gem install ceedling -v 0.31.1 --no-user-install + run: sudo gem install ceedling --no-user-install - name: Run build run: | source android/android_env.sh ${{ matrix.arch }} - ceedling project:android verbosity[4] release + ceedling --mixin=android-${{ matrix.arch }} release --verbosity=debug diff --git a/3rd_party_deps.yml b/3rd_party_deps.yml deleted file mode 100644 index 19c50ae3..00000000 --- a/3rd_party_deps.yml +++ /dev/null @@ -1,26 +0,0 @@ -:environment: - - :HE_WOLFSSL_SOURCE: https://github.com/wolfSSL/wolfssl - - :HE_WOLFSSL_TAG: v5.8.0-stable - - :HE_WOLFSSL_CONF_FLAGS: >- - --disable-benchmark - --disable-dh - --disable-examples - --disable-oldtls - --disable-shared - --enable-sys-ca-certs - --disable-dilithium - --enable-aes-bitsliced - --enable-curve25519 - --enable-dtls - --enable-dtls13 - --enable-dtls-frag-ch - --enable-dtls-mtu - --enable-secure-renegotiation - --enable-singlethreaded - --enable-sni - --enable-sp=yes,4096 - --enable-static - --enable-tls13 - --enable-experimental - --enable-sha3 - --enable-kyber=all,original,ml-kem diff --git a/Earthfile b/Earthfile index 7cb241d5..af23f153 100644 --- a/Earthfile +++ b/Earthfile @@ -1,35 +1,35 @@ VERSION 0.8 -ARG distro=bullseye +ARG distro=bookworm FROM --platform=linux/amd64 debian:$distro-slim WORKDIR /libhelium debian-deps: RUN apt-get update - RUN apt-get -y install --no-install-recommends build-essential git automake m4 libtool-bin cmake ruby-full python3-pip + RUN apt-get -y install --no-install-recommends build-essential git automake m4 libtool-bin cmake ruby-full python3-pip clang # Not including colrm seems to give an error when configuring wolfssl RUN apt-get -y install --no-install-recommends bsdmainutils - RUN gem install ceedling -v 0.31.1 --no-user-install + RUN gem install ceedling --no-user-install RUN apt-get -y install --no-install-recommends gcovr libhelium-deps: FROM +debian-deps # Copy in the build configs - COPY *.yml . + COPY --dir project.yml ceedling . # Make the directory structure so that the config can be parsed # To improve caching we want to separate this out as the WolfSSL dependency # fetch and build are the slowest parts of the process. - RUN mkdir -p src include test/support third_party/wolfssl + RUN mkdir -p src/he include test/support third_party/wolfssl # Copy the patch files COPY --dir wolfssl ./ # Build and fetch the dependencies - RUN ceedling dependencies:make project:linux + RUN ceedling --mixin=linux_x64 clobber dependencies:make build: FROM +libhelium-deps # Copy in the source and include files COPY --dir src include ./ # Generate the release - RUN ceedling release project:linux + RUN ceedling --mixin=linux_x64 clobber release # Store the artifacts SAVE ARTIFACT build/release/libhelium.a ./libhelium.a AS LOCAL ./artifacts/libhelium.a SAVE ARTIFACT build/artifacts/compile_commands.json AS LOCAL ./artifacts/compile_commands.json @@ -41,13 +41,13 @@ test-copy: test: FROM +test-copy # Run the tests - RUN ceedling test project:linux + RUN ceedling --mixin=linux_x64 test SAVE ARTIFACT build/artifacts/compile_commands.json AS LOCAL ./artifacts/compile_commands.json coverage: FROM +test-copy # Generate code coverage - RUN ceedling gcov:all utils:gcov project:linux + RUN ceedling --mixin=linux_x64 gcov:all SAVE ARTIFACT build/artifacts/gcov/*.html AS LOCAL ./artifacts/code_coverage/html/ SAVE ARTIFACT build/artifacts/gcov/*.xml AS LOCAL ./artifacts/code_coverage/xml/ diff --git a/README.adoc b/README.adoc index 17af4c78..25e5beae 100644 --- a/README.adoc +++ b/README.adoc @@ -41,22 +41,37 @@ earthly +all == Build and Run (Ceedling) -. Install ceedling gem somewhere on your path. We only support ceedling v0.31.1 as v1.0.0 has some breaking changes. +. Install ceedling (1.0.0) gem somewhere on your path. + [source,bash] -gem install ceedling -v 0.31.1 +gem install ceedling -. Windows only: Start git-bash (or similar) via a `Developer Command Prompt for VS 2019` for all subsequent commands +* Windows only: Start git-bash (or similar) via a `Developer Command Prompt for VS 2019` for all subsequent commands -. Build and run tests, $PLATFORM is `[linux|macos|windows]` +. Build and run tests, + +* For linux, + [source,bash] -ceedling test project:$PLATFORM +ceedling --mixin=linux test + +* For macOs, +[source,bash] +ceedling --mixin=macos_arm64 test . Build lib for release + [source,bash] -ceedling release project:$PLATFORM +ceedling --mixin=linux release + +=== Note +[platforms] +Refer `ceedling/*.yml` for other supported platforms. + +The default project is tuned for unix based platforms. For windows, use project instead of +mixins like: +[source,bash] +ceedling --project=ceedling/windows_64.yml release == Documentation diff --git a/android.yml b/android.yml deleted file mode 100644 index fec06506..00000000 --- a/android.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- # ceedling project file for android -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - C_EXTRA_FLAGS= -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DFP_MAX_BITS=8192 -fomit-frame-pointer -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - - LIBS=-llog -landroid - :build: - - git apply ../../wolfssl/*.patch - - autoreconf -i - - ./configure $CROSS_OPTS C_EXTRA_FLAGS="$C_EXTRA_FLAGS" --prefix=$(pwd)/../builds/wolfssl_build $HE_WOLFSSL_CONF_FLAGS --disable-crypttests - - make - - make install - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/android/android_env.sh b/android/android_env.sh index 69a80ed9..49c4711a 100755 --- a/android/android_env.sh +++ b/android/android_env.sh @@ -71,4 +71,6 @@ CONFIG_OPTS=() CONFIG_OPTS+=("--host=${CHOST}") CONFIG_OPTS+=($ARCH_OPTS) +export PATH=${TOOLCHAIN}:$PATH + export CROSS_OPTS=${CONFIG_OPTS[@]} diff --git a/ceedling/android-arm64-v8a.yml b/ceedling/android-arm64-v8a.yml new file mode 100644 index 00000000..896e1783 --- /dev/null +++ b/ceedling/android-arm64-v8a.yml @@ -0,0 +1,19 @@ +--- # ceedling project file for android + +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-crypttests #{ENV['CROSS_OPTS']} + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -fomit-frame-pointer + - :LIBS: -llog -landroid + + +:tools: + :test_compiler: + :executable: aarch64-linux-android21-clang + :release_compiler: + :executable: aarch64-linux-android21-clang + +:flags: + :release: + :compile: + - -march=armv8-a+crypto diff --git a/ceedling/android-armeabi-v7a.yml b/ceedling/android-armeabi-v7a.yml new file mode 100644 index 00000000..b7c42f96 --- /dev/null +++ b/ceedling/android-armeabi-v7a.yml @@ -0,0 +1,21 @@ +--- # ceedling project file for android + +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-crypttests #{ENV['CROSS_OPTS']} + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -fomit-frame-pointer + - :LIBS: -llog -landroid + + +:tools: + :test_compiler: + :executable: armv7a-linux-androideabi21-clang + :release_compiler: + :executable: armv7a-linux-androideabi21-clang + +:flags: + :release: + :compile: + - -march=armv7-a + - -mfloat-abi=softfp + - -mfpu=vfpv3-d16 diff --git a/ceedling/android-x86.yml b/ceedling/android-x86.yml new file mode 100644 index 00000000..442ce675 --- /dev/null +++ b/ceedling/android-x86.yml @@ -0,0 +1,21 @@ +--- # ceedling project file for android + +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-crypttests #{ENV['CROSS_OPTS']} + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -fomit-frame-pointer + - :LIBS: -llog -landroid + + +:tools: + :test_compiler: + :executable: i686-linux-android21-clang + :release_compiler: + :executable: i686-linux-android21-clang + +:flags: + :release: + :compile: + - -march=i686 + - -msse3 + - -m32 diff --git a/ceedling/android-x86_64.yml b/ceedling/android-x86_64.yml new file mode 100644 index 00000000..7fcba514 --- /dev/null +++ b/ceedling/android-x86_64.yml @@ -0,0 +1,22 @@ +--- # ceedling project file for android + +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-crypttests #{ENV['CROSS_OPTS']} + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -fomit-frame-pointer + - :LIBS: -llog -landroid + + +:tools: + :test_compiler: + :executable: x86_64-linux-android21-clang + :release_compiler: + :executable: x86_64-linux-android21-clang + +:flags: + :release: + :compile: + - -march=x86-64 + - -msse4.2 + - -mpopcnt + - -m64 diff --git a/ceedling/ios.yml b/ceedling/ios.yml new file mode 100644 index 00000000..530246d4 --- /dev/null +++ b/ceedling/ios.yml @@ -0,0 +1,34 @@ +--- # ceedling project file for iOS +:mixins: + :enabled: + - base + - wolfssl + - ios_tvos + :load_paths: + - ceedling + - ceedling/mixins + +:dependencies: + :deps: + - :name: WolfSSL + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/build + :artifact: third_party/wolfssl/install/wolfssl_ios + :fetch: + :method: :git + :source: $HE_WOLFSSL_SOURCE + :tag: $HE_WOLFSSL_TAG + :build: + - git apply ../../../wolfssl/*.patch || true + - autoreconf -i + - cp ../../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh + - PREFIX=$(pwd)/../install/wolfssl_ios ./autotools-ios-helper.sh -iphoneuniversal + :artifacts: + :includes: + - include + :static_libraries: + - universal/libwolfssl.a + +:environment: + - MACOSX_DEPLOYMENT_TARGET: "12.0" diff --git a/ceedling/linux_386.yml b/ceedling/linux_386.yml new file mode 100644 index 00000000..c5dd2717 --- /dev/null +++ b/ceedling/linux_386.yml @@ -0,0 +1,23 @@ +--- # ceedling project file for Linux i386 + +:environment: + - CC: clang -m32 + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-asm --disable-sp-asm --disable-intelasm + - :HE_PLATFORM_LDFLAGS: -m32 + +:flags: + :release: + :compile: + - -m32 + :test: + :compile: + - -m32 + :link: + - -m32 + +:tools: + :test_compiler: + :executable: clang + :release_compiler: + :executable: clang diff --git a/ceedling/linux_arm.yml b/ceedling/linux_arm.yml new file mode 100644 index 00000000..79f6b0ce --- /dev/null +++ b/ceedling/linux_arm.yml @@ -0,0 +1,11 @@ +--- # ceedling project file for Linux + +:environment: + - :HE_CROSS_COMPILE: --host=#{ENV['CROSS_COMPILE']} + - :HE_PLATFORM_CFLAGS: -DWOLFSSL_NO_ATOMICS + +:tools: + :test_compiler: + :executable: arm-linux-gnueabihf-gcc + :release_compiler: + :executable: arm-linux-gnueabihf-gcc diff --git a/ceedling/linux_arm64.yml b/ceedling/linux_arm64.yml new file mode 100644 index 00000000..56061d04 --- /dev/null +++ b/ceedling/linux_arm64.yml @@ -0,0 +1,13 @@ +--- # ceedling project file for Linux + +:environment: + - :HE_CROSS_COMPILE: --host=#{ENV['CROSS_COMPILE']} + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --enable-sp-asm --enable-armasm + - :HE_PLATFORM_CFLAGS: -DWOLFSSL_NO_ATOMICS + +:tools: + :test_compiler: + :executable: aarch64-linux-gnu-gcc + :release_compiler: + :executable: aarch64-linux-gnu-gcc diff --git a/ceedling/linux_arm_no_pqc.yml b/ceedling/linux_arm_no_pqc.yml new file mode 100644 index 00000000..7ba9b5b1 --- /dev/null +++ b/ceedling/linux_arm_no_pqc.yml @@ -0,0 +1,21 @@ +--- # ceedling project file for Linux + +:environment: + - :HE_CROSS_COMPILE: --host=#{ENV['CROSS_COMPILE']} + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-kyber --disable-sha3 + - :HE_PLATFORM_CFLAGS: -UWOLFSSL_ML_KEM_USE_OLD_IDS -DWOLFSSL_NO_ATOMICS -Werror -Wno-pragmas -Wall -Wextra -Wno-strict-aliasing + +:defines: + :test: + - HE_NO_PQC + :test_preprocess: + - HE_NO_PQC + :release: + - HE_NO_PQC + +:tools: + :test_compiler: + :executable: arm-linux-gnueabihf-gcc + :release_compiler: + :executable: arm-linux-gnueabihf-gcc diff --git a/ceedling/linux_multithread.yml b/ceedling/linux_multithread.yml new file mode 100644 index 00000000..230fdfda --- /dev/null +++ b/ceedling/linux_multithread.yml @@ -0,0 +1,19 @@ +--- # ceedling project file for Linux +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --enable-aesni --enable-sp-asm --enable-intelasm --disable-singlethreaded + - :HE_PLATFORM_CFLAGS: -Wno-error=stringop-overflow + +:defines: + :test: + - HE_ENABLE_MULTITHREADED + +:tools: + :test_compiler: + :executable: clang + :release_compiler: + :executable: clang + +:libraries: + :system: + - atomic diff --git a/ceedling/linux_riscv64.yml b/ceedling/linux_riscv64.yml new file mode 100644 index 00000000..7392fcf5 --- /dev/null +++ b/ceedling/linux_riscv64.yml @@ -0,0 +1,21 @@ +--- # ceedling project file for Linux + +:environment: + - :HE_CROSS_COMPILE: --host=#{ENV['CROSS_COMPILE']} + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --disable-kyber --disable-sha3 + - :HE_PLATFORM_CFLAGS: -UWOLFSSL_ML_KEM_USE_OLD_IDS -DWOLFSSL_NO_ATOMICS + +:defines: + :test: + - HE_NO_PQC + :test_preprocess: + - HE_NO_PQC + :release: + - HE_NO_PQC + +:tools: + :test_compiler: + :executable: riscv64-linux-gnu-gcc + :release_compiler: + :executable: riscv64-linux-gnu-gcc diff --git a/ceedling/linux_x64.yml b/ceedling/linux_x64.yml new file mode 100644 index 00000000..f0b24cb2 --- /dev/null +++ b/ceedling/linux_x64.yml @@ -0,0 +1,12 @@ +--- # ceedling project file for Linux + +:environment: + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --enable-aesni --enable-sp-asm --enable-intelasm + - :HE_PLATFORM_CFLAGS: -Wno-error=stringop-overflow + +:tools: + :test_compiler: + :executable: clang + :release_compiler: + :executable: clang diff --git a/ceedling/macos_arm64.yml b/ceedling/macos_arm64.yml new file mode 100644 index 00000000..253af7c4 --- /dev/null +++ b/ceedling/macos_arm64.yml @@ -0,0 +1,19 @@ +--- # ceedling project file for macOS + +:environment: + - MACOSX_DEPLOYMENT_TARGET: "10.16" + - :HE_CROSS_COMPILE: --host=aarch64-apple-darwin + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --enable-sp-asm --enable-armasm + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -target arm64-apple-darwin + - :CC: clang + +:flags: + :release: + :compile: + - -target arm64-apple-darwin + :test: + :link: + - -framework CoreFoundation + - -framework Security + diff --git a/ceedling/macos_x64.yml b/ceedling/macos_x64.yml new file mode 100644 index 00000000..468182e4 --- /dev/null +++ b/ceedling/macos_x64.yml @@ -0,0 +1,18 @@ +--- # ceedling project file for macOS + +:environment: + - MACOSX_DEPLOYMENT_TARGET: "10.12" + - :HE_CROSS_COMPILE: --host=x86_64-apple-darwin + - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- + --enable-aesni --enable-sp-asm --enable-intelasm + - :HE_PLATFORM_CFLAGS: -DFP_MAX_BITS=8192 -target x86_64-apple-darwin + - :CC: clang + +:flags: + :release: + :compile: + - -target x86_64-apple-darwin + :test: + :link: + - -framework CoreFoundation + - -framework Security diff --git a/ceedling/mixins/base.yml b/ceedling/mixins/base.yml new file mode 100644 index 00000000..1f961ec9 --- /dev/null +++ b/ceedling/mixins/base.yml @@ -0,0 +1,84 @@ +--- +:project: + :use_exceptions: FALSE + :use_test_preprocessor: :mocks + :use_deep_preprocessor: :mocks + :use_auxiliary_dependencies: TRUE + :build_root: build + :compile_threads: 1 + :release_build: TRUE + :test_file_prefix: test_ + :which_ceedling: gem + :output: helium + :default_tasks: + - test:all + +:extension: + :executable: .out + +:paths: + :test: + - +:test/** + - -:test/support + :include: + - include/** + - src/he/** + :source: + - src/** + :support: + - test/support + +:defines: + :release: + - _FORTIFY_SOURCE=2 + :test: + - TEST + - WOLFSSL_DTLS + - WOLFSSL_DTLS + - WOLFSSL_DTLS13 + - WOLFSSL_DTLS_CH_FRAG + - WOLFSSL_DTLS_MTU + - HAVE_SECURE_RENEGOTIATION + - WOLFSSL_TLS13 + - NO_PSK + - NO_OLD_TLS + - HAVE_ECC + - HAVE_SNI + - SINGLE_THREADED + - HAVE_SUPPORTED_CURVES + - HAVE_ENCRYPT_THEN_MAC + +:cmock: + :mock_prefix: mock_ + :when_no_prototypes: :warn + :enforce_strict_ordering: TRUE + :includes: + - he.h + - he_internal.h + - wolfssl_testable_types.h + :plugins: + - :ignore + - :callback + - :ignore_arg + - :expect_any_args + :treat_as: + uint8: HEX8 + uint16: HEX16 + uint32: UINT32 + int8: INT8 + bool: UINT8 + :treat_as_array: + va_list: void + :strippables: + - WOLFSSL_API + - WOLFSSL_LOCAL + +:plugins: + :enabled: + - report_tests_pretty_stdout + - module_generator + - report_tests_raw_output_log + - report_tests_log_factory + - gcov + - dependencies + - compile_commands_json_db diff --git a/unix.yml b/ceedling/mixins/ios_tvos.yml similarity index 50% rename from unix.yml rename to ceedling/mixins/ios_tvos.yml index 9fdb319e..b705e2ca 100644 --- a/unix.yml +++ b/ceedling/mixins/ios_tvos.yml @@ -1,4 +1,6 @@ --- # ceedling include file for shared Linux/Mac items +:release_build: + :output: libhelium.a # Add -gcov to the plugins list to make sure of the gcov plugin # You will need to have gcov and gcovr both installed to make it work. @@ -14,15 +16,19 @@ :reports: - SonarQube -:tools_test_file_preprocessor: - :arguments: - - -include third_party/builds/wolfssl_build/include/wolfssl/options.h - - -include third_party/builds/wolfssl_build/include/wolfssl/wolfcrypt/settings.h -:tools_test_includes_preprocessor: - :arguments: - - -include third_party/builds/wolfssl_build/include/wolfssl/options.h - - -include third_party/builds/wolfssl_build/include/wolfssl/wolfcrypt/settings.h - - -include third_party/builds/wolfssl_build/include/wolfssl/ssl.h +:tools: + :test_file_preprocessor: + :executable: clang + :arguments: + - -include third_party/wolfssl/install/include/wolfssl/options.h + - -include third_party/wolfssl/install/include/wolfssl/wolfcrypt/settings.h + :test_includes_preprocessor: + :executable: clang + :arguments: + - -include third_party/wolfssl/install/include/wolfssl/options.h + - -include third_party/wolfssl/install/include/wolfssl/wolfcrypt/settings.h + - -include third_party/wolfssl/install/include/wolfssl/ssl.h + :tools_release_linker: :arguments: - -lm @@ -36,17 +42,13 @@ :flags: :release: :compile: - :*: - - -g - - -fPIC - - -O3 + - -g + - -fPIC + - -O3 :test: :compile: - :*: - - -g - - -fPIC - - -fsanitize=address + - -g + - -fPIC + - -fsanitize=address :link: - :*: - - -fsanitize=address -... + - -fsanitize=address diff --git a/ceedling/mixins/unix.yml b/ceedling/mixins/unix.yml new file mode 100644 index 00000000..1eb309aa --- /dev/null +++ b/ceedling/mixins/unix.yml @@ -0,0 +1,96 @@ +--- # ceedling include file for shared Linux/Mac items +:environment: + - :HE_WOLFSSL_CONF_FLAGS: >- + --disable-benchmark + --disable-dh + --disable-examples + --disable-oldtls + --disable-shared + --enable-sys-ca-certs + --disable-dilithium + --enable-aes-bitsliced + --enable-curve25519 + --enable-dtls + --enable-dtls13 + --enable-dtls-frag-ch + --enable-dtls-mtu + --enable-secure-renegotiation + --enable-singlethreaded + --enable-sni + --enable-sp=yes,4096 + --enable-static + --enable-tls13 + --enable-experimental + --enable-sha3 + --enable-kyber=all,original,ml-kem + +:release_build: + :output: libhelium.a + +:dependencies: + :deps: + - :name: WolfSSL + :paths: + :fetch: third_party/wolfssl/source + :source: third_party/wolfssl/source + :build: third_party/wolfssl/install + :fetch: + :method: :git + :source: $HE_WOLFSSL_SOURCE + :tag: $HE_WOLFSSL_TAG + :environment: + - CFLAGS_COMMON=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS + :build: + - git apply ../../../wolfssl/*.patch || true + - autoreconf -i + - CFLAGS="$CFLAGS $CFLAGS_COMMON $HE_PLATFORM_CFLAGS" LDFLAGS="$LDFLAGS_COMMON $HE_PLATFORM_LDFLAGS" ./configure $HE_CROSS_COMPILE $HE_WOLFSSL_CONF_FLAGS $HE_WOLFSSL_ADDL_CONF_FLAGS --prefix="$(pwd)/../install" + - make + - make install + :artifacts: + :includes: + - include + - include/wolfssl + :static_libraries: + - lib/libwolfssl.a + +# Add -gcov to the plugins list to make sure of the gcov plugin +# You will need to have gcov and gcovr both installed to make it work. +# For more information on these options, see docs in plugins/gcov +:gcov: + :html_report: TRUE + :html_report_type: detailed + :html_medium_threshold: 75 + :html_high_threshold: 90 + :xml_report: TRUE + :gcovr: + #:report_exclude: "^post.*" + :reports: + - SonarQube + +:libraries: + :system: + - m + +# For default compiler `gcc`, ceedling defines this properly +# For customr compiler (even for clang) we need to define this ourselves +:tools: + :release_linker: + :executable: ar + :arguments: + - rcs + - ${2} + - ${1} + +:flags: + :release: + :compile: + - -g + - -fPIC + - -O3 + :test: + :compile: + - -g + - -fPIC + - -fsanitize=address + :link: + - -fsanitize=address diff --git a/windows.yml b/ceedling/mixins/windows.yml similarity index 100% rename from windows.yml rename to ceedling/mixins/windows.yml diff --git a/ceedling/mixins/wolfssl.yml b/ceedling/mixins/wolfssl.yml new file mode 100644 index 00000000..9ba4838f --- /dev/null +++ b/ceedling/mixins/wolfssl.yml @@ -0,0 +1,9 @@ +--- # Mixin for WolfSsl + +:environment: + - :HE_WOLFSSL_SOURCE: https://github.com/wolfSSL/wolfssl + - :HE_WOLFSSL_TAG: v5.8.0-stable + +:tools: + :deps_linker: + :optional: true diff --git a/ceedling/tvos.yml b/ceedling/tvos.yml new file mode 100644 index 00000000..7c8cc662 --- /dev/null +++ b/ceedling/tvos.yml @@ -0,0 +1,34 @@ +--- # ceedling project file for iOS +:mixins: + :enabled: + - base + - wolfssl + - ios_tvos + :load_paths: + - ceedling + - ceedling/mixins + +:dependencies: + :deps: + - :name: WolfSSL + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/build + :artifact: third_party/wolfssl/install/wolfssl_tvos + :fetch: + :method: :git + :source: $HE_WOLFSSL_SOURCE + :tag: $HE_WOLFSSL_TAG + :build: + - git apply ../../../wolfssl/*.patch + - autoreconf -i + - cp ../../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh + - PREFIX=$(pwd)/../install/wolfssl_tvos ./autotools-ios-helper.sh -appletvuniversal + :artifacts: + :includes: + - include + :static_libraries: + - Release-tvos-universal/lib/libwolfssl.a + +:environment: + - MACOSX_DEPLOYMENT_TARGET: "15.0" diff --git a/windows_32.yml b/ceedling/windows_32.yml similarity index 75% rename from windows_32.yml rename to ceedling/windows_32.yml index 519ec764..2955a05c 100644 --- a/windows_32.yml +++ b/ceedling/windows_32.yml @@ -1,25 +1,33 @@ --- # ceedling project file for Windows -:import: - - 3rd_party_deps.yml - - windows.yml +:mixins: + :enabled: + - base + - wolfssl + - windows + :load_paths: + - ceedling + - ceedling/mixins :dependencies: - :libraries: + :deps: - :name: WolfSSL - :source_path: third_party/wolfssl + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/source :fetch: :method: :git :source: "%HE_WOLFSSL_SOURCE%" :tag: "%HE_WOLFSSL_TAG%" :build: - - git apply ../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch - - git apply ../../wolfssl/0003-use-proper-warnings-on-MSVC.patch - - git apply ../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch - - "cp ../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" - - "cat ../../windows/wolfssl-user_settings-32.h >> wolfssl/user_settings.h" + - git apply ../../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch + - git apply ../../../wolfssl/0003-use-proper-warnings-on-MSVC.patch + - git apply ../../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch + - "cp ../../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" + - "cat ../../../windows/wolfssl-user_settings-32.h >> wolfssl/user_settings.h" - "cp -f wolfssl/user_settings.h IDE/WIN/user_settings.h" - - "cp -f ../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" + - "cp -f ../../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" - "MSBuild.exe wolfssl.vcxproj -verbosity:detailed -t:Build -p:Configuration=Release -p:Platform=Win32 -p:PlatformToolset=v143" + - mkdir ..\install\include && robocopy "." "..\install\include" *.h /S /NJH /NJS || true :artifacts: :includes: - / @@ -42,7 +50,8 @@ - /GL - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR + - /I"${5}" + - /D"${6}" - /Fo"${2}" - "${1}" :test_linker: @@ -65,8 +74,7 @@ - /I test_file_preprocessor - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR - - /D"$": DEFINES_TEST_PREPROCESS + - /D"${6}" - /Fi"${2}" - "${1}" # This is `gcc -E -MM -MG` which outputs a make dependency rule. @@ -89,7 +97,7 @@ - /MT - /I"$": COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_RELEASE_AND_VENDOR + - /D"${6}" - /Fo"${2}" - "${1}" :release_linker: diff --git a/windows_64.yml b/ceedling/windows_64.yml similarity index 74% rename from windows_64.yml rename to ceedling/windows_64.yml index 4fa82796..15b17f0a 100644 --- a/windows_64.yml +++ b/ceedling/windows_64.yml @@ -1,25 +1,33 @@ --- # ceedling project file for Windows -:import: - - 3rd_party_deps.yml - - windows.yml +:mixins: + :enabled: + - base + - wolfssl + - windows + :load_paths: + - ceedling + - ceedling/mixins :dependencies: - :libraries: + :deps: - :name: WolfSSL - :source_path: third_party/wolfssl + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/source :fetch: :method: :git :source: "%HE_WOLFSSL_SOURCE%" :tag: "%HE_WOLFSSL_TAG%" :build: - - git apply ../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch - - git apply ../../wolfssl/0003-use-proper-warnings-on-MSVC.patch - - git apply ../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch - - "cp ../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" - - "cat ../../windows/wolfssl-user_settings-64.h >> wolfssl/user_settings.h" + - git apply ../../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch + - git apply ../../../wolfssl/0003-use-proper-warnings-on-MSVC.patch + - git apply ../../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch + - "cp ../../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" + - "cat ../../../windows/wolfssl-user_settings-64.h >> wolfssl/user_settings.h" - "cp -f wolfssl/user_settings.h IDE/WIN/user_settings.h" - - "cp -f ../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" + - "cp -f ../../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" - "MSBuild.exe wolfssl.vcxproj -verbosity:detailed -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v143" + - mkdir ..\install\include && robocopy "." "..\install\include" *.h /S /NJH /NJS || true :artifacts: :includes: - / @@ -42,7 +50,8 @@ - /GL - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR + - /I"${5}" + - /D"${6}" - /Fo"${2}" - "${1}" :test_linker: @@ -65,8 +74,7 @@ - /I test_file_preprocessor - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR - - /D"$": DEFINES_TEST_PREPROCESS + - /D"${6}" - /Fi"${2}" - "${1}" # This is `gcc -E -MM -MG` which outputs a make dependency rule. @@ -89,7 +97,7 @@ - /MT - /I"$": COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_RELEASE_AND_VENDOR + - /D"${6}" - /Fo"${2}" - "${1}" :release_linker: @@ -100,5 +108,3 @@ - /MACHINE:X64 - "${1}" - /OUT:"${2}" - -... diff --git a/windows_64_multithread.yml b/ceedling/windows_64_multithread.yml similarity index 74% rename from windows_64_multithread.yml rename to ceedling/windows_64_multithread.yml index 26ae74dc..00b55686 100644 --- a/windows_64_multithread.yml +++ b/ceedling/windows_64_multithread.yml @@ -1,26 +1,34 @@ --- # ceedling project file for Windows -:import: - - 3rd_party_deps.yml - - windows.yml +:mixins: + :enabled: + - base + - wolfssl + - windows + :load_paths: + - ceedling + - ceedling/mixins :dependencies: - :libraries: + :deps: - :name: WolfSSL - :source_path: third_party/wolfssl + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/source :fetch: :method: :git :source: "%HE_WOLFSSL_SOURCE%" :tag: "%HE_WOLFSSL_TAG%" :build: - - git apply ../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch - - git apply ../../wolfssl/0003-use-proper-warnings-on-MSVC.patch - - git apply ../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch - - "cp ../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" - - "cat ../../windows/wolfssl-user_settings-64.h >> wolfssl/user_settings.h" - - "cat ../../windows/wolfssl-user_settings-multithread.h >> wolfssl/user_settings.h" + - git apply ../../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch + - git apply ../../../wolfssl/0003-use-proper-warnings-on-MSVC.patch + - git apply ../../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch + - "cp ../../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" + - "cat ../../../windows/wolfssl-user_settings-64.h >> wolfssl/user_settings.h" + - "cat ../../../windows/wolfssl-user_settings-multithread.h >> wolfssl/user_settings.h" - "cp -f wolfssl/user_settings.h IDE/WIN/user_settings.h" - - "cp -f ../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" + - "cp -f ../../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" - "MSBuild.exe wolfssl.vcxproj -verbosity:detailed -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v143" + - mkdir ..\install\include && robocopy "." "..\install\include" *.h /S /NJH /NJS || true :artifacts: :includes: - / @@ -46,7 +54,8 @@ - /GL - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR + - /I"${5}" + - /D"${6}" - /Fo"${2}" - "${1}" :test_linker: @@ -69,8 +78,7 @@ - /I test_file_preprocessor - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR - - /D"$": DEFINES_TEST_PREPROCESS + - /D"${6}" - /Fi"${2}" - "${1}" # This is `gcc -E -MM -MG` which outputs a make dependency rule. @@ -96,7 +104,7 @@ - /MT - /I"$": COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_RELEASE_AND_VENDOR + - /D"${6}" - /Fo"${2}" - "${1}" :release_linker: diff --git a/windows_arm64.yml b/ceedling/windows_arm64.yml similarity index 75% rename from windows_arm64.yml rename to ceedling/windows_arm64.yml index 938e734d..316aae39 100644 --- a/windows_arm64.yml +++ b/ceedling/windows_arm64.yml @@ -1,25 +1,33 @@ --- # ceedling project file for Windows -:import: - - 3rd_party_deps.yml - - windows.yml +:mixins: + :enabled: + - base + - wolfssl + - windows + :load_paths: + - ceedling + - ceedling/mixins :dependencies: - :libraries: + :deps: - :name: WolfSSL - :source_path: third_party/wolfssl + :paths: + :source: third_party/wolfssl/source + :build: third_party/wolfssl/source :fetch: :method: :git :source: "%HE_WOLFSSL_SOURCE%" :tag: "%HE_WOLFSSL_TAG%" :build: - - git apply ../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch - - git apply ../../wolfssl/0003-use-proper-warnings-on-MSVC.patch - - git apply ../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch - - "cp ../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" - - "cat ../../windows/wolfssl-user_settings-arm-64.h >> wolfssl/user_settings.h" + - git apply ../../../wolfssl/0001-CVPN-1945-Lower-max-mtu-for-DTLS-1.3-handshake-message.patch + - git apply ../../../wolfssl/0003-use-proper-warnings-on-MSVC.patch + - git apply ../../../wolfssl/0004-mlkem-codepoint-backward-compatible.patch + - "cp ../../../windows/wolfssl-user_settings-common.h wolfssl/user_settings.h" + - "cat ../../../windows/wolfssl-user_settings-arm-64.h >> wolfssl/user_settings.h" - "cp -f wolfssl/user_settings.h IDE/WIN/user_settings.h" - - "cp -f ../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" + - "cp -f ../../../windows/wolfssl.vcxproj ./wolfssl.vcxproj" - "MSBuild.exe wolfssl.vcxproj -verbosity:detailed -t:Build -p:Configuration=Release -p:Platform=ARM64 -p:PlatformToolset=v143" + - mkdir ..\install\include && robocopy "." "..\install\include" *.h /S /NJH /NJS || true :artifacts: :includes: - / @@ -42,7 +50,8 @@ - /GL - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR + - /I"${5}" + - /D"${6}" - /Fo"${2}" - "${1}" :test_linker: @@ -65,8 +74,7 @@ - /I test_file_preprocessor - /I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_TEST_AND_VENDOR - - /D"$": DEFINES_TEST_PREPROCESS + - /D"${6}" - /Fi"${2}" - "${1}" # This is `gcc -E -MM -MG` which outputs a make dependency rule. @@ -89,7 +97,7 @@ - /MT - /I"$": COLLECTION_PATHS_SOURCE_INCLUDE_VENDOR - /I"$": COLLECTION_PATHS_RELEASE_TOOLCHAIN_INCLUDE - - /D"$": COLLECTION_DEFINES_RELEASE_AND_VENDOR + - /D"${6}" - /Fo"${2}" - "${1}" :release_linker: diff --git a/ios.yml b/ios.yml deleted file mode 100644 index 9b6591fd..00000000 --- a/ios.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- # ceedling project file for iOS -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_ios - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :build: - - git apply ../../wolfssl/*.patch - - autoreconf -i - - "cp ../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh" - - "./autotools-ios-helper.sh -iphoneuniversal" - :artifacts: - :includes: - - include/** - :static_libraries: - - universal/libwolfssl.a - -:environment: - - MACOSX_DEPLOYMENT_TARGET: "12.0" diff --git a/ios/Lightway/Lightway.xcodeproj/project.pbxproj b/ios/Lightway/Lightway.xcodeproj/project.pbxproj index 2d5fef21..5f3f5a51 100644 --- a/ios/Lightway/Lightway.xcodeproj/project.pbxproj +++ b/ios/Lightway/Lightway.xcodeproj/project.pbxproj @@ -466,7 +466,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; "EXCLUDED_ARCHS[sdk=appletvsimulator*]" = arm64; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; - HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/builds/wolfssl_ios/include/"; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/wolfssl/install/wolfssl_ios/include/"; INFOPLIST_FILE = Lightway/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; @@ -475,7 +475,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/builds/wolfssl_ios/Release$(EFFECTIVE_PLATFORM_NAME)/lib"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/wolfssl/install/wolfssl_ios/Release$(EFFECTIVE_PLATFORM_NAME)/lib"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-lwolfssl"; PRODUCT_BUNDLE_IDENTIFIER = com.expressvpn.Lightway; @@ -503,7 +503,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; "EXCLUDED_ARCHS[sdk=appletvsimulator*]" = arm64; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; - HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/builds/wolfssl_ios/include/"; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/wolfssl/install/wolfssl_ios/include/"; INFOPLIST_FILE = Lightway/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; @@ -512,7 +512,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/builds/wolfssl_ios/Release$(EFFECTIVE_PLATFORM_NAME)/lib"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/../../third_party/wolfssl/install/wolfssl_ios/Release$(EFFECTIVE_PLATFORM_NAME)/lib"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-lwolfssl"; PRODUCT_BUNDLE_IDENTIFIER = com.expressvpn.Lightway; diff --git a/ios/autotools-ios-helper.sh b/ios/autotools-ios-helper.sh index 290fb502..558b90e6 100755 --- a/ios/autotools-ios-helper.sh +++ b/ios/autotools-ios-helper.sh @@ -135,7 +135,7 @@ build_tvos_universal_binary() { "${PREFIX}/${CONFIG}-appletvsimulator/lib/${LIB_NAME}" } # Locations -PREFIX=${PREFIX:-"$(pwd)/../builds/wolfssl_ios"} +PREFIX=${PREFIX:-"$(pwd)/../install/wolfssl_ios"} CONFIG=${CONFIG:-"Release"} PLATFORMS="${PREFIX}"/platforms UNIVERSAL="${PREFIX}"/universal diff --git a/linux.yml b/linux.yml deleted file mode 100644 index 54a68a4b..00000000 --- a/linux.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- # ceedling project file for Linux -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS -Wno-error=stringop-overflow - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure $HE_WOLFSSL_CONF_FLAGS $HE_WOLFSSL_ADDL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build --enable-aesni --enable-sp-asm --enable-intelasm" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/linux_386.yml b/linux_386.yml deleted file mode 100644 index accc5bb6..00000000 --- a/linux_386.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -m32 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - - LDFLAGS= -m32 - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure $HE_WOLFSSL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build --disable-asm --disable-sp-asm --disable-intelasm" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a - -:environment: - - CC: clang -m32 - -:flags: - :release: - :compile: - :*: - - -m32 - :test: - :compile: - :*: - - -m32 - :link: - :*: - - -m32 diff --git a/linux_arm.yml b/linux_arm.yml deleted file mode 100644 index 9916f69b..00000000 --- a/linux_arm.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- # ceedling project file for Linux -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure --host=$CROSS_COMPILE $HE_WOLFSSL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/linux_arm64.yml b/linux_arm64.yml deleted file mode 100644 index 597963c4..00000000 --- a/linux_arm64.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- # ceedling project file for Linux -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure --host=$CROSS_COMPILE $HE_WOLFSSL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build --enable-sp-asm --enable-armasm" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/linux_arm_no_pqc.yml b/linux_arm_no_pqc.yml deleted file mode 100644 index 174e482b..00000000 --- a/linux_arm_no_pqc.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- # ceedling project file for Linux -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:defines: - :test: - - HE_NO_PQC - :test_preprocess: - - HE_NO_PQC - :release: - - HE_NO_PQC - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -Werror -Wno-pragmas -Wall -Wextra -Wno-strict-aliasing - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure --host=$CROSS_COMPILE $HE_WOLFSSL_CONF_FLAGS --disable-kyber --disable-sha3 --prefix=$(pwd)/../builds/wolfssl_build" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/linux_multithread.yml b/linux_multithread.yml deleted file mode 100644 index 8726d7cf..00000000 --- a/linux_multithread.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- # ceedling project file for Linux -:import: - - linux.yml - -:defines: - :test: - - HE_ENABLE_MULTITHREADED - -:tools_test_linker: - :arguments: - - -latomic - -:environment: - - :HE_WOLFSSL_ADDL_CONF_FLAGS: >- - --disable-singlethreaded diff --git a/linux_riscv64.yml b/linux_riscv64.yml deleted file mode 100644 index 87f2f770..00000000 --- a/linux_riscv64.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- # ceedling project file for Linux -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:defines: - :test: - - HE_NO_PQC - :test_preprocess: - - HE_NO_PQC - :release: - - HE_NO_PQC - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DUSE_CERT_BUFFERS_4096 -DUSE_CERT_BUFFERS_256 -DWOLFSSL_NO_ATOMICS -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT - :build: - - git apply ../../wolfssl/*.patch || true - - "autoreconf -i" - - "./configure --host=$CROSS_COMPILE $HE_WOLFSSL_CONF_FLAGS --disable-kyber --disable-sha3 --prefix=$(pwd)/../builds/wolfssl_build" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a diff --git a/macos.yml b/macos.yml deleted file mode 100644 index 1e7e2bd4..00000000 --- a/macos.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- # ceedling project file for macOS -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -target x86_64-apple-darwin -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - - CC=clang - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure --host=x86_64-apple-darwin $HE_WOLFSSL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build --enable-aesni --enable-sp-asm --enable-intelasm" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a - -:flags: - :release: - :compile: - :*: - - -target x86_64-apple-darwin - -:environment: - - MACOSX_DEPLOYMENT_TARGET: "10.12" diff --git a/macos_arm64.yml b/macos_arm64.yml deleted file mode 100644 index df4f2f64..00000000 --- a/macos_arm64.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- # ceedling project file for macOS -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_build - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :environment: - - CFLAGS=-O3 -fPIC -D_FORTIFY_SOURCE=2 -DWOLFSSL_MIN_RSA_BITS=2048 -DWOLFSSL_MIN_ECC_BITS=256 -DFP_MAX_BITS=8192 -target arm64-apple-darwin -DWOLFSSL_NO_SPHINCS -DWOLFSSL_TLS13_MIDDLEBOX_COMPAT -DWOLFSSL_ML_KEM_USE_OLD_IDS - - CC=clang - :build: - - git apply ../../wolfssl/*.patch - - "autoreconf -i" - - "./configure --host=aarch64-apple-darwin $HE_WOLFSSL_CONF_FLAGS --prefix=$(pwd)/../builds/wolfssl_build --enable-sp-asm --enable-armasm" - - "make" - - "make install" - :artifacts: - :includes: - - include - - include/wolfssl # needed e.g. for mock_ssl.h to find wolfssl/ssl.h - :static_libraries: - - lib/libwolfssl.a - -:flags: - :release: - :compile: - :*: - - -target arm64-apple-darwin - -:environment: - - MACOSX_DEPLOYMENT_TARGET: "10.16" diff --git a/project.yml b/project.yml index 7f9db4fd..a472b4e5 100644 --- a/project.yml +++ b/project.yml @@ -1,68 +1,9 @@ ---- -:project: - :use_exceptions: FALSE - :use_test_preprocessor: TRUE - :use_auxiliary_dependencies: TRUE - :build_root: build - :release_build: TRUE - :test_file_prefix: test_ - :which_ceedling: gem - :output: helium - :default_tasks: - - test:all - -:extension: - :executable: .out - -:paths: - :test: - - +:test/** - - -:test/support - :include: - - include/** - :source: - - src/** - :support: - - test/support - -:defines: - :release: - - _FORTIFY_SOURCE=2 - :test: - - TEST - -:cmock: - :mock_prefix: mock_ - :when_no_prototypes: :warn - :enforce_strict_ordering: TRUE - :includes: - - he.h - - he_internal.h - - wolfssl_testable_types.h - :plugins: - - :ignore - - :callback - - :ignore_arg - - :expect_any_args - :treat_as: - uint8: HEX8 - uint16: HEX16 - uint32: UINT32 - int8: INT8 - bool: UINT8 - :treat_as_array: - va_list: void - :strippables: - - WOLFSSL_API - - WOLFSSL_LOCAL - -:plugins: +--- +:mixins: :enabled: - - stdout_pretty_tests_report - - module_generator - - raw_output_report - - xml_tests_report - - junit_tests_report - - gcov - - dependencies - - compile_commands_json + - base + - wolfssl + - unix + :load_paths: + - ceedling + - ceedling/mixins diff --git a/test/he/test_conn.c b/test/he/test_conn.c index a0c694ca..f6a524d2 100644 --- a/test/he/test_conn.c +++ b/test/he/test_conn.c @@ -40,6 +40,7 @@ #include "mock_pmtud.h" // External Mocks +TEST_INCLUDE_PATH("third_party/wolfssl/install/include/wolfssl") #include "mock_ssl.h" #include "mock_wolfio.h" // TODO Research whether it's possible to directly use a Wolf header instead of our fake one diff --git a/test/he/test_conn_connect.c b/test/he/test_conn_connect.c index 93ca969b..062e154d 100644 --- a/test/he/test_conn_connect.c +++ b/test/he/test_conn_connect.c @@ -42,6 +42,7 @@ #include "mock_frag.h" // External Mocks +TEST_INCLUDE_PATH("third_party/wolfssl/install/include/wolfssl") #include "mock_ssl.h" #include "mock_wolfio.h" diff --git a/test/he/test_flow.c b/test/he/test_flow.c index e14d7f18..88827d9d 100644 --- a/test/he/test_flow.c +++ b/test/he/test_flow.c @@ -44,6 +44,7 @@ #include "mock_mss.h" // External Mocks +TEST_INCLUDE_PATH("third_party/wolfssl/install/include/wolfssl") #include "mock_ssl.h" uint8_t *packet = NULL; diff --git a/test/he/test_msg_handlers.c b/test/he/test_msg_handlers.c index bbd9fd89..cfca1be2 100644 --- a/test/he/test_msg_handlers.c +++ b/test/he/test_msg_handlers.c @@ -40,6 +40,7 @@ #include "mock_pmtud.h" // External Mocks +TEST_INCLUDE_PATH("third_party/wolfssl/install/include/wolfssl") #include "mock_ssl.h" #include "mock_wolfio.h" @@ -50,11 +51,11 @@ he_network_config_ipv4_t empty_network_config = {0}; he_msg_auth_buf_t msg_auth = {.header.auth_type = HE_AUTH_TYPE_USERPASS}; -int call_counter = 0; +static int msg_hndlrs_call_counter = 0; he_return_code_t fixture_network_config_cb(he_conn_t *conn, he_network_config_ipv4_t *config, void *context) { - call_counter++; + msg_hndlrs_call_counter++; memcpy(&empty_network_config, config, sizeof(he_network_config_ipv4_t)); return HE_SUCCESS; } @@ -62,40 +63,40 @@ he_return_code_t fixture_network_config_cb(he_conn_t *conn, he_network_config_ip he_return_code_t fixture_network_config_cb_will_fail(he_conn_t *conn, he_network_config_ipv4_t *config, void *context) { - call_counter++; + msg_hndlrs_call_counter++; memcpy(&empty_network_config, config, sizeof(he_network_config_ipv4_t)); return HE_ERR_CALLBACK_FAILED; } he_return_code_t event_cb_pong(he_conn_t *conn, he_conn_event_t event, void *context) { - call_counter++; + msg_hndlrs_call_counter++; TEST_ASSERT_EQUAL(HE_EVENT_PONG, event); return HE_SUCCESS; } bool auth_cb_fail(he_conn_t *conn, char const *username, char const *password, void *context) { - call_counter++; + msg_hndlrs_call_counter++; return false; } bool auth_cb_succeed(he_conn_t *conn, char const *username, char const *password, void *context) { - call_counter++; + msg_hndlrs_call_counter++; return true; } bool auth_token_cb_succeed(he_conn_t *conn, const uint8_t *token, size_t length, void *context) { - call_counter++; + msg_hndlrs_call_counter++; return true; } bool auth_buf_cb_succeed(he_conn_t *conn, uint8_t auth_type, uint8_t *buffer, uint16_t length, void *context) { - call_counter++; + msg_hndlrs_call_counter++; return true; } he_return_code_t inside_write_cb(he_conn_t *conn, uint8_t *packet, size_t length, void *context) { - call_counter++; + msg_hndlrs_call_counter++; return true; } @@ -107,7 +108,7 @@ void setUp(void) { memset(&empty_msg_config, 0, sizeof(he_msg_config_ipv4_t)); memset(&empty_network_config, 0, sizeof(he_network_config_ipv4_t)); memset(&empty_data, 0, sizeof(empty_data)); - call_counter = 0; + msg_hndlrs_call_counter = 0; } void tearDown(void) { @@ -258,7 +259,7 @@ void test_msg_config_wrong_state_not_authenticating(void) { void test_msg_config_packet_too_small(void) { conn->state = HE_STATE_AUTHENTICATING; ret = he_handle_msg_config_ipv4(conn, empty_data, 0); - TEST_ASSERT_EQUAL(0, call_counter); + TEST_ASSERT_EQUAL(0, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_ERR_PACKET_TOO_SMALL, ret); } @@ -292,7 +293,7 @@ void test_msg_config_with_config_callback(void) { TEST_ASSERT_EQUAL_STRING("", &empty_network_config.peer_ip); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); } @@ -310,7 +311,7 @@ void test_msg_config_with_config_callback_that_fails(void) { TEST_ASSERT_EQUAL_STRING("", &empty_network_config.peer_ip); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_ERR_CALLBACK_FAILED, ret); } @@ -326,7 +327,7 @@ void test_msg_config_with_sane_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(1242, empty_network_config.mtu); @@ -343,7 +344,7 @@ void test_msg_config_with_too_large_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); @@ -360,7 +361,7 @@ void test_msg_config_with_overflow_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); @@ -377,7 +378,7 @@ void test_msg_config_with_negative_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); @@ -394,7 +395,7 @@ void test_msg_config_with_bad_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); @@ -414,7 +415,7 @@ void test_msg_config_with_evil_mtu(void) { ret = he_handle_msg_config_ipv4(conn, (uint8_t *)&empty_msg_config, sizeof(he_msg_config_ipv4_t)); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); TEST_ASSERT_EQUAL(HE_MAX_MTU, empty_network_config.mtu); @@ -533,7 +534,7 @@ void test_msg_data_old_protocol_something_with_cb(void) { he_internal_is_ipv4_packet_valid_ExpectAnyArgsAndReturn(true); ret = he_handle_msg_data(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); } void test_msg_data_plugin_drop(void) { @@ -549,7 +550,7 @@ void test_msg_data_plugin_drop(void) { he_plugin_egress_ExpectAnyArgsAndReturn(HE_ERR_PLUGIN_DROP); ret = he_handle_msg_data(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_SUCCESS, ret); - TEST_ASSERT_EQUAL(0, call_counter); + TEST_ASSERT_EQUAL(0, msg_hndlrs_call_counter); } void test_msg_data_plugin_fail(void) { @@ -565,7 +566,7 @@ void test_msg_data_plugin_fail(void) { he_plugin_egress_ExpectAnyArgsAndReturn(HE_ERR_FAILED); ret = he_handle_msg_data(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_ERR_FAILED, ret); - TEST_ASSERT_EQUAL(0, call_counter); + TEST_ASSERT_EQUAL(0, msg_hndlrs_call_counter); } void test_msg_data_plugin_overflow(void) { @@ -581,7 +582,7 @@ void test_msg_data_plugin_overflow(void) { he_plugin_egress_Stub(stub_overflow_plugin); ret = he_handle_msg_data(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_ERR_FAILED, ret); - TEST_ASSERT_EQUAL(0, call_counter); + TEST_ASSERT_EQUAL(0, msg_hndlrs_call_counter); } void test_deprecated_msg_13_bad_state(void) { @@ -771,7 +772,7 @@ void test_msg_auth_auth_access_denied(void) { // We should get access denied and the call counter should be 1 he_return_code_t res = he_handle_msg_auth(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_ERR_ACCESS_DENIED, res); - TEST_ASSERT_EQUAL(1, call_counter); + TEST_ASSERT_EQUAL(1, msg_hndlrs_call_counter); } void test_msg_auth_fail_network_config_cb(void) { @@ -793,7 +794,7 @@ void test_msg_auth_fail_network_config_cb(void) { // We should get access denied and the call counter should be 1 he_return_code_t res = he_handle_msg_auth(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_ERR_CALLBACK_FAILED, res); - TEST_ASSERT_EQUAL(2, call_counter); + TEST_ASSERT_EQUAL(2, msg_hndlrs_call_counter); } void test_msg_auth_auth_access_granted(void) { @@ -816,7 +817,7 @@ void test_msg_auth_auth_access_granted(void) { // We should get success here and the call counter should be 2 he_return_code_t res = he_handle_msg_auth(conn, empty_data, sizeof(empty_data)); TEST_ASSERT_EQUAL(HE_SUCCESS, res); - TEST_ASSERT_EQUAL(2, call_counter); + TEST_ASSERT_EQUAL(2, msg_hndlrs_call_counter); } void test_msg_auth_token_packet_too_small(void) { @@ -893,7 +894,7 @@ void test_msg_auth_token_access_granted(void) { he_return_code_t res = he_handle_msg_auth(conn, (uint8_t *)auth_message, sizeof(he_msg_auth_token_t) + 12); TEST_ASSERT_EQUAL(HE_SUCCESS, res); - TEST_ASSERT_EQUAL(2, call_counter); + TEST_ASSERT_EQUAL(2, msg_hndlrs_call_counter); } void test_msg_auth_buf_packet_too_small(void) { @@ -969,7 +970,7 @@ void test_msg_auth_buf_access_granted(void) { he_return_code_t res = he_handle_msg_auth(conn, (uint8_t *)auth_message, sizeof(he_msg_auth_buf_t) + 10); TEST_ASSERT_EQUAL(HE_SUCCESS, res); - TEST_ASSERT_EQUAL(2, call_counter); + TEST_ASSERT_EQUAL(2, msg_hndlrs_call_counter); } void test_msg_auth_invalid_auth_type(void) { @@ -994,7 +995,7 @@ void test_msg_auth_invalid_auth_type(void) { he_return_code_t res = he_handle_msg_auth(conn, (uint8_t *)auth_message, sizeof(he_msg_auth_buf_t) + 10); TEST_ASSERT_EQUAL(HE_ERR_ACCESS_DENIED, res); - TEST_ASSERT_EQUAL(0, call_counter); + TEST_ASSERT_EQUAL(0, msg_hndlrs_call_counter); } void test_he_handle_msg_auth_response_with_config(void) { diff --git a/test/he/test_mss.c b/test/he/test_mss.c index 15c0532f..c8599f4a 100644 --- a/test/he/test_mss.c +++ b/test/he/test_mss.c @@ -155,37 +155,37 @@ void test_clamp_mss_with_malformed_opt(void) { TEST_ASSERT_EQUAL(HE_SUCCESS, ret); } -#if 0 -#include -#include - -// This is a special test that can only run with raw socket support -// To run this: -// 1. Use a linux machine -// 2. Regenerate the scapy packet with the the code below -// 3. Replace the packet with chexdump(packet) of the new scapy packet -// 4. Recompile the tests -// 5. Run this test with superuser privileges - -void test_mss_integration(void) { - int sd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); - fprintf(stderr, "%d\n", sd); - - // scapy: packet = IP(dst='8.8.8.8')/TCP(dport=53,flags='S', options=[("MSS", 1200)]) - uint8_t packet[] = {0x45, 0x00, 0x00, 0x2c, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06, 0xa9, 0xbc, 0xc0, 0xa8, 0x00, 0x57, 0x08, 0x08, 0x08, 0x08, 0x00, 0x14, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x20, 0x00, 0xa7, 0xd2, 0x00, 0x00, 0x02, 0x04, 0x04, 0xb0}; - - he_internal_clamp_mss(packet, sizeof(packet), 600); - - struct sockaddr_in sin; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - - // Port numbers - sin.sin_port = htons(53); - - // IP addresses - sin.sin_addr.s_addr = inet_addr("8.8.8.8"); - ssize_t send_len = sendto(sd, packet, sizeof(packet), 0, (struct sockaddr *)&sin, sizeof(sin)); - fprintf(stderr, "%zd\n", send_len); -} -#endif +// #if 0 +// #include +// #include +// +// // This is a special test that can only run with raw socket support +// // To run this: +// // 1. Use a linux machine +// // 2. Regenerate the scapy packet with the the code below +// // 3. Replace the packet with chexdump(packet) of the new scapy packet +// // 4. Recompile the tests +// // 5. Run this test with superuser privileges +// +// void test_mss_integration(void) { +// int sd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); +// fprintf(stderr, "%d\n", sd); +// +// // scapy: packet = IP(dst='8.8.8.8')/TCP(dport=53,flags='S', options=[("MSS", 1200)]) +// uint8_t packet[] = {0x45, 0x00, 0x00, 0x2c, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06, 0xa9, 0xbc, 0xc0, 0xa8, 0x00, 0x57, 0x08, 0x08, 0x08, 0x08, 0x00, 0x14, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x20, 0x00, 0xa7, 0xd2, 0x00, 0x00, 0x02, 0x04, 0x04, 0xb0}; +// +// he_internal_clamp_mss(packet, sizeof(packet), 600); +// +// struct sockaddr_in sin; +// memset(&sin, 0, sizeof(sin)); +// sin.sin_family = AF_INET; +// +// // Port numbers +// sin.sin_port = htons(53); +// +// // IP addresses +// sin.sin_addr.s_addr = inet_addr("8.8.8.8"); +// ssize_t send_len = sendto(sd, packet, sizeof(packet), 0, (struct sockaddr *)&sin, sizeof(sin)); +// fprintf(stderr, "%zd\n", send_len); +// } +// #endif diff --git a/test/support/test_defs.c b/test/support/test_defs.c new file mode 100644 index 00000000..c4760287 --- /dev/null +++ b/test/support/test_defs.c @@ -0,0 +1,103 @@ +#include "test_defs.h" + +char *bad_string_too_long = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + +char *good_username = "fsdfkjsfrwejkr"; +char *good_password = "dsgfdfgghgfhgf"; +char *good_hostname = "server1.expressvpn.com"; + +uint8_t fake_cert[5] = {0x10, 0x11, 0x12, 0x13, 0x14}; + +uint8_t empty_data[1500] = {0}; + +uint8_t fake_ipv4_packet[24] = {0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +uint8_t bad_fake_ipv4_packet[24] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +uint8_t fake_he_packet[16] = {0x48, 0x65, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +uint8_t fake_he_packet_session_reject[16] = {0x48, 0x65, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + +uint16_t calculate_wolf_mtu(uint16_t he_mtu) { + return he_mtu - HE_PACKET_OVERHEAD + HE_WOLF_MAX_HEADER_SIZE; +} + +int call_counter; + +he_return_code_t write_cb(he_conn_t *conn, uint8_t *packet, size_t length, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t state_cb(he_conn_t *conn, he_conn_state_t new_state, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t nudge_time_cb(he_conn_t *conn, int timeout, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t network_config_ipv4_cb(he_conn_t *conn, he_network_config_ipv4_t *config, + void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t server_config_cb(he_conn_t *conn, uint8_t *buffer, size_t length, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t state_change_cb(he_conn_t *conn, he_conn_state_t new_state, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t event_cb(he_conn_t *conn, he_conn_event_t event, void *context) { + call_counter++; + return HE_SUCCESS; +} + +bool auth_cb(he_conn_t *conn, char const *username, char const *password, void *context) { + call_counter++; + return HE_SUCCESS; +} + +bool auth_buf_cb(he_conn_t *conn, uint8_t auth_type, uint8_t *buffer, uint16_t length, + void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t pop_network_config_cb(he_conn_t *conn, he_network_config_ipv4_t *config, + void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t pmtud_time_cb(he_conn_t *conn, int timeout, void *context) { + if(timeout > 0) { + call_counter++; + } + return HE_SUCCESS; +} + +he_return_code_t pmtud_state_change_cb(he_conn_t *conn, he_pmtud_state_t state, void *context) { + call_counter++; + return HE_SUCCESS; +} + +he_return_code_t stub_overflow_plugin(he_plugin_chain_t *chain, uint8_t *packet, size_t *length, + size_t capacity, int numCalls) { + *length = capacity + 1; + return HE_SUCCESS; +} + diff --git a/test/support/test_defs.h b/test/support/test_defs.h index b6de5810..1d3e7a49 100644 --- a/test/support/test_defs.h +++ b/test/support/test_defs.h @@ -1,107 +1,48 @@ #ifndef HE_TEST_DEFS #define HE_TEST_DEFS -#define FIXTURE_FATAL_ERROR -1 - -char *bad_string_too_long = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - -char *good_username = "fsdfkjsfrwejkr"; -char *good_password = "dsgfdfgghgfhgf"; -char *good_hostname = "server1.expressvpn.com"; - -uint8_t fake_cert[] = {0x10, 0x11, 0x12, 0x13, 0x14}; +#include +#include "he.h" +#include "he_internal.h" -uint8_t empty_data[1500] = {0}; - -uint8_t fake_ipv4_packet[] = {0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +#define FIXTURE_FATAL_ERROR -1 -uint8_t bad_fake_ipv4_packet[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +extern char *bad_string_too_long; -uint8_t fake_he_packet[] = {0x48, 0x65, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +extern char *good_username; +extern char *good_password; +extern char *good_hostname; -uint8_t fake_he_packet_session_reject[] = {0x48, 0x65, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +extern uint8_t fake_cert[5]; -uint16_t calculate_wolf_mtu(uint16_t he_mtu) { - return he_mtu - HE_PACKET_OVERHEAD + HE_WOLF_MAX_HEADER_SIZE; -} +extern uint8_t empty_data[1500]; -int call_counter; +extern uint8_t fake_ipv4_packet[24]; +extern uint8_t bad_fake_ipv4_packet[24]; -he_return_code_t write_cb(he_conn_t *conn, uint8_t *packet, size_t length, void *context) { - call_counter++; - return HE_SUCCESS; -} +extern int call_counter; -he_return_code_t state_cb(he_conn_t *conn, he_conn_state_t new_state, void *context) { - call_counter++; - return HE_SUCCESS; -} +extern uint8_t fake_he_packet[16]; +extern uint8_t fake_he_packet_session_reject[16]; -he_return_code_t nudge_time_cb(he_conn_t *conn, int timeout, void *context) { - call_counter++; - return HE_SUCCESS; -} +uint16_t calculate_wolf_mtu(uint16_t he_mtu); +he_return_code_t write_cb(he_conn_t *conn, uint8_t *packet, size_t length, void *context); +he_return_code_t state_cb(he_conn_t *conn, he_conn_state_t new_state, void *context); +he_return_code_t nudge_time_cb(he_conn_t *conn, int timeout, void *context); he_return_code_t network_config_ipv4_cb(he_conn_t *conn, he_network_config_ipv4_t *config, - void *context) { - call_counter++; - return HE_SUCCESS; -} - -he_return_code_t server_config_cb(he_conn_t *conn, uint8_t *buffer, size_t length, void *context) { - call_counter++; - return HE_SUCCESS; -} - -he_return_code_t state_change_cb(he_conn_t *conn, he_conn_state_t new_state, void *context) { - call_counter++; - return HE_SUCCESS; -} - -he_return_code_t event_cb(he_conn_t *conn, he_conn_event_t event, void *context) { - call_counter++; - return HE_SUCCESS; -} - -bool auth_cb(he_conn_t *conn, char const *username, char const *password, void *context) { - call_counter++; - return HE_SUCCESS; -} - + void *context); +he_return_code_t server_config_cb(he_conn_t *conn, uint8_t *buffer, size_t length, void *context); +he_return_code_t state_change_cb(he_conn_t *conn, he_conn_state_t new_state, void *context); +he_return_code_t event_cb(he_conn_t *conn, he_conn_event_t event, void *context); +bool auth_cb(he_conn_t *conn, char const *username, char const *password, void *context); bool auth_buf_cb(he_conn_t *conn, uint8_t auth_type, uint8_t *buffer, uint16_t length, - void *context) { - call_counter++; - return HE_SUCCESS; -} - + void *context); he_return_code_t pop_network_config_cb(he_conn_t *conn, he_network_config_ipv4_t *config, - void *context) { - call_counter++; - return HE_SUCCESS; -} - -he_return_code_t pmtud_time_cb(he_conn_t *conn, int timeout, void *context) { - if(timeout > 0) { - call_counter++; - } - return HE_SUCCESS; -} - -he_return_code_t pmtud_state_change_cb(he_conn_t *conn, he_pmtud_state_t state, void *context) { - call_counter++; - return HE_SUCCESS; -} + void *context); +he_return_code_t pmtud_time_cb(he_conn_t *conn, int timeout, void *context); +he_return_code_t pmtud_state_change_cb(he_conn_t *conn, he_pmtud_state_t state, void *context); he_return_code_t stub_overflow_plugin(he_plugin_chain_t *chain, uint8_t *packet, size_t *length, - size_t capacity, int numCalls) { - *length = capacity + 1; - return HE_SUCCESS; -} - + size_t capacity, int numCalls); #endif // HE_TEST_DEFS diff --git a/tvos.yml b/tvos.yml deleted file mode 100644 index cf345a08..00000000 --- a/tvos.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- # ceedling project file for iOS -:import: - - 3rd_party_deps.yml - - unix.yml - -:release_build: - :output: libhelium.a - -:dependencies: - :libraries: - - :name: WolfSSL - :source_path: third_party/wolfssl - :artifact_path: third_party/builds/wolfssl_tvos - :fetch: - :method: :git - :source: $HE_WOLFSSL_SOURCE - :tag: $HE_WOLFSSL_TAG - :build: - - git apply ../../wolfssl/*.patch - - autoreconf -i - - cp ../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh - - PREFIX=$(pwd)/../builds/wolfssl_tvos ./autotools-ios-helper.sh -appletvuniversal - :artifacts: - :includes: - - include/** - :static_libraries: - - Release-tvos-universal/lib/libwolfssl.a - -:environment: - - MACOSX_DEPLOYMENT_TARGET: "15.0"