From e8cd86bb309cf90ec5e2aa211a765d3da45590b4 Mon Sep 17 00:00:00 2001 From: J08nY Date: Mon, 25 Mar 2024 15:07:53 +0100 Subject: Add CI. --- .appveyor.yml | 18 -- .github/workflows/build.yml | 82 ++++++++ .travis.yml | 63 ------ README.md | 10 +- build-standalone.xml | 224 --------------------- ext/libressl | 2 +- standalone/build.gradle.kts | 10 +- .../ectester/standalone/libs/NativeECLibrary.java | 16 +- 8 files changed, 107 insertions(+), 318 deletions(-) delete mode 100755 .appveyor.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml delete mode 100644 build-standalone.xml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100755 index 051d974..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: '{build}' -image: Visual Studio 2017 - -branches: - except: - - gh-pages - -environment: - JAVA_HOME: C:\Program Files\Java\jdk1.8.0 - -install: - - cinst ant - - git submodule update --init --recursive - -build_script: - - ant -f build-applet.xml build - - ant -f build-reader.xml package - - ant -f build-standalone.xml package \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..73ee885 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,82 @@ +name: Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + strategy: + matrix: + java: [ "8", "11", "17", "21" ] + env: + JAVA_VERSION: ${{ matrix.java }} + name: Build Java ${{ matrix.java }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: "temurin" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Setup libraries + run: | + sudo apt update + sudo apt install libmbedtls-dev libtomcrypt-dev libtommath-dev libssl-dev libcrypto++-dev libgcrypt20-dev nettle-dev libbotan-2-dev nasm + + - name: Build applets + run: if [ $JAVA_VERSION != 21 ]; then ./gradlew applet:buildJavaCard; fi + + - name: Build reader + run: ./gradlew reader:uberJar + + - name: Build libs + run: | + cd ext/boringssl + cmake -DBUILD_SHARED_LIBS=1 -Bbuild + cd build + make -j4 crypto + cd ../../.. + cd ext/libressl + ./autogen.sh + cmake -DBUILD_SHARED_LIBS=ON -Bbuild + cd build + make -j4 crypto + cd ../../.. + cd ext/ipp-crypto + CC=clang CXX=clang++ cmake CMakeLists.txt -Bbuild -DARCH=intel64 + cd build + make -j4 + cd ../../.. + + - name: Build standalone + run: | + ./gradlew standalone:libs || true + ./gradlew standalone:uberJar + + # ffs: https://github.com/adoptium/adoptium-support/issues/485 !!! + - name: List libraries + run: env LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/" ./gradlew standalone:run --args="list-libs" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: built-${{ matrix.java }} + path: | + applet/build/javacard/*.cap + reader/build/libs/ECTesterReader.jar + standalone/build/libs/ECTesterStandalone.jar \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index be60ac9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -os: linux -dist: bionic -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake - - libmbedtls-dev - - libtomcrypt-dev - - libtommath-dev - - libssl-dev - - libcrypto++-dev - - libgcrypt20-dev - - nettle-dev - - gcc-8 - - g++-8 -language: java -jdk: openjdk8 -env: - - CC=gcc-8 CXX=g++-8 - -install: - - eval "$(gimme 1.13)" - - cd ext/boringssl - - mkdir build - - cd build - - cmake -DBUILD_SHARED_LIBS=1 .. - - make crypto - - cd ../../.. - - cd ext/libressl - - ./autogen.sh - - mkdir build - - cd build - - cmake -DBUILD_SHARED_LIBS=ON .. - - make crypto - - cd ../../.. - -script: - - ant -f build-applet.xml build - - ant -f build-reader.xml package - - ant -f build-standalone.xml package - - ./util/test.sh - -before_deploy: - - zip "dist/ECTester.zip" "dist/ECTesterReader-dist.jar" "dist/ECTesterReader.jar" "applet/ectester221.cap" "applet/ectester222.cap" "dist/ECTesterStandalone-dist.jar" "dist/ECTesterStandalone.jar" - -deploy: - provider: releases - token: - secure: q2aJvu32K+nfbMR60nFCEkn+jYCKprlCRlIoPjuRz1HySX233Ccwpx1CAdNzEjY6FDFcoReKAg6r5vdPjJ4FRPAQ23TxffIYZPkykL5K/pUZJbM5xkazJY0Fp8i6Vyl0JfeanVib1PTyOSugplhCttFk5nb9JUFV36Tre66XntOl5y80Trn94F5aTlRjfW26UH65W7Aa6WZ0N4OX/ZsX+vEOJPAu+RLfOq9oBOx/loB8ntYM/e/6bEwJp6EedRQLDsiS4NavP3svH+GXsPLs5p3soyRXYsvvGKVnVjcjZURxDDdxv5YuCWUUfl9PbNB+Mqmx/HQxl50BKoKFqwap1+TnlbuTAiWaXeh3zdXuGB+TPg8KE8h6ueDneHd3Lpivgq79IvPWIH+N4b3Pa952+rD+JKBZ807efB+97OtWrkQL7/sLZESQUdIszE724HHOiArKpNajIX+kN6NJdul5xFCiQQHG+O7iDFQBavCGM9fk63mZRyGPxZQzS06BV2vIIHg0yx3igN+OKKMFCH+P3hYR1zL6o65OlgbL1ifTZ18GDvmVRNdi53/fxQ2n/mQmI4tQpn4ZB7Ddoxx4GlpjFjzdKk/P9nKwng0M9wrp8row/vb5S+1aPwSxp9/4ASP9dkvLcNjTkWhmGPrWe+82Y9JPK47uesx0YeaVI2C7IR0= - file: - - "dist/ECTesterReader-dist.jar" - - "dist/ECTesterReader.jar" - - "applet/ectester221.cap" - - "applet/ectester222.cap" - - "dist/ECTesterStandalone-dist.jar" - - "dist/ECTesterStandalone.jar" - - "dist/ECTester.zip" - cleanup: false - on: - tags: true - repo: crocs-muni/ECTester diff --git a/README.md b/README.md index d8d3eac..8c1da32 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![](docs/full.png) -[![Build status](https://api.travis-ci.org/crocs-muni/ECTester.svg?branch=master)](https://travis-ci.org/crocs-muni/ECTester) [![Build status](https://ci.appveyor.com/api/projects/status/02kcaf52op89910u?svg=true)](https://ci.appveyor.com/project/J08nY/ectester-cm6ng) [![GitHub release](https://img.shields.io/github/release/crocs-muni/ECTEster.svg)](https://github.com/crocs-muni/ECTester/releases) [![license](https://img.shields.io/github/license/crocs-muni/ECTester.svg)](https://github.com/crocs-muni/ECTester/blob/master/LICENSE) [![docs](https://img.shields.io/badge/docs-github.io-brightgreen.svg)](https://crocs-muni.github.io/ECTester/) +[![Build](https://github.com/crocs-muni/ECTester/actions/workflows/build.yml/badge.svg)](https://github.com/crocs-muni/ECTester/actions/workflows/build.yml) [![GitHub release](https://img.shields.io/github/release/crocs-muni/ECTEster.svg)](https://github.com/crocs-muni/ECTester/releases) [![license](https://img.shields.io/github/license/crocs-muni/ECTester.svg)](https://github.com/crocs-muni/ECTester/blob/master/LICENSE) [![docs](https://img.shields.io/badge/docs-github.io-brightgreen.svg)](https://crocs-muni.github.io/ECTester/) ECTester is a tool for testing and analysis of elliptic curve cryptography implementations on JavaCards and in cryptographic libraries. It consists of four separate parts: @@ -10,7 +10,7 @@ cryptographic libraries. It consists of four separate parts: - The ECTesterStandalone app, which works with software libraries - Jupyter notebooks for analysis and visualization of data from the apps -For more information on ECC support on JavaCards see the [github page](https://crocs-muni.github.io/ECTester/), with results, tables and docs. +For more information on ECC support on JavaCards see the [GitHub page](https://crocs-muni.github.io/ECTester/), with results, tables and docs. This project is developed by the [Centre for Research On Cryptography and Security](https://crocs.fi.muni.cz) at Faculty of Informatics, Masaryk University. @@ -360,9 +360,8 @@ BoringSSL, LibreSSL and ipp-crypto are included as git submodules. Make sure you after checking out the ECTester repository to initialize them. To build BoringSSL do: ``` cd ext/boringssl -mkdir build +cmake -GNinja -Bbuild -DBUILD_SHARED_LIBS=1 cd build -cmake -GNinja -DBUILD_SHARED_LIBS=1 .. ninja ``` @@ -370,9 +369,8 @@ To build LibreSSL do: ``` cd ext/libressl ./autogen.sh -mkdir build +cmake -GNinja -Bbuild -DBUILD_SHARED_LIBS=1 cd build -cmake -GNinja -DBUILD_SHARED_LIBS=1 .. ninja ``` diff --git a/build-standalone.xml b/build-standalone.xml deleted file mode 100644 index 731698b..0000000 --- a/build-standalone.xml +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project ECTesterStandalone. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/libressl b/ext/libressl index 5a590f8..577970a 160000 --- a/ext/libressl +++ b/ext/libressl @@ -1 +1 @@ -Subproject commit 5a590f8e0c1bb3b3bf7ba02ee7d3ac0c1e09a1ae +Subproject commit 577970ab842f7e352048d45fe930ddd21f4190f3 diff --git a/standalone/build.gradle.kts b/standalone/build.gradle.kts index 9f645fe..e1113e9 100644 --- a/standalone/build.gradle.kts +++ b/standalone/build.gradle.kts @@ -20,10 +20,12 @@ application { } tasks.withType { - options.compilerArgs.addAll(arrayOf( - "--add-modules", "jdk.crypto.ec", - "--add-exports", "jdk.crypto.ec/sun.security.ec=ALL-UNNAMED" - )) + if (JavaVersion.current() > JavaVersion.VERSION_1_8) { + options.compilerArgs.addAll(arrayOf( + "--add-modules", "jdk.crypto.ec", + "--add-exports", "jdk.crypto.ec/sun.security.ec=ALL-UNNAMED" + )) + } } tasks.register("libs") { diff --git a/standalone/src/main/java/cz/crcs/ectester/standalone/libs/NativeECLibrary.java b/standalone/src/main/java/cz/crcs/ectester/standalone/libs/NativeECLibrary.java index db85b02..2f469aa 100644 --- a/standalone/src/main/java/cz/crcs/ectester/standalone/libs/NativeECLibrary.java +++ b/standalone/src/main/java/cz/crcs/ectester/standalone/libs/NativeECLibrary.java @@ -34,7 +34,11 @@ public abstract class NativeECLibrary extends ProviderECLibrary { Path libPath = libDir.resolve(resource + "." + suffix); /* Write the shim. */ - FileUtil.writeNewer(ECTesterStandalone.LIB_RESOURCE_DIR + resource + "." + suffix, libPath); + boolean found = FileUtil.writeNewer(ECTesterStandalone.LIB_RESOURCE_DIR + resource + "." + suffix, libPath); + if (!found) { + //System.err.printf("Resource %s not found.\n", resource); + return false; + } /* Load the requirements, if they are bundled, write them in and load them. */ try { @@ -42,13 +46,19 @@ public abstract class NativeECLibrary extends ProviderECLibrary { if (requirement.endsWith(suffix)) { /* The requirement is bundled, write it */ Path reqPath = libReqDir.resolve(requirement); - FileUtil.writeNewer(ECTesterStandalone.LIB_RESOURCE_DIR + requirement, reqPath); + found = FileUtil.writeNewer(ECTesterStandalone.LIB_RESOURCE_DIR + requirement, reqPath); + if (!found) { + //System.err.printf("Requirement %s not found for %s.\n", requirement, resource); + return false; + } System.load(reqPath.toString()); } else { System.loadLibrary(requirement); } } } catch (UnsatisfiedLinkError ule) { + System.err.println(resource); + ule.printStackTrace(); return false; } @@ -57,6 +67,8 @@ public abstract class NativeECLibrary extends ProviderECLibrary { provider = createProvider(); return super.initialize(); } catch (IOException | UnsatisfiedLinkError ignored) { + System.err.println(resource); + ignored.printStackTrace(); } return false; } -- cgit v1.2.3-70-g09d2