diff --git a/.github/workflows/kauma.yaml b/.github/workflows/kauma.yaml index 46708e4..73205af 100644 --- a/.github/workflows/kauma.yaml +++ b/.github/workflows/kauma.yaml @@ -66,4 +66,4 @@ jobs: docker tag ghcr.io/johndoe31415/labwork-docker:master labwork - name: Run labwork container run: | - docker run -v $PWD:/dut/ labwork /bin/bash -c '/dut/build && /dut/kauma ./example_challenges/block2poly.json' + docker run -v $PWD:/dut/ labwork /bin/bash -c '/dut/build && /dut/kauma ./test_json/kauma_tests.json' diff --git a/build b/build index 9bc156d..e9c8ecc 100755 --- a/build +++ b/build @@ -1,7 +1,8 @@ #!/bin/bash -export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu -export OPENSSL_INCLUDE_DIR=/usr/include/openssl SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd $SCRIPT_DIR -cargo build --release --locked --offline + +ln -s /rust/vendor $SCRIPT_DIR/vendor + +cargo build --release --offline diff --git a/kauma b/kauma index 3a19a04..b2752c5 100755 --- a/kauma +++ b/kauma @@ -1,7 +1,4 @@ #!/bin/bash -export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu -export OPENSSL_INCLUDE_DIR=/usr/include/openssl - SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd $SCRIPT_DIR -cargo run --release --locked --offline -- $@ +cargo run --release --locked --offline -- --verbose $@ diff --git a/src/tasks/mod.rs b/src/tasks/mod.rs index 8ebb547..d59f199 100644 --- a/src/tasks/mod.rs +++ b/src/tasks/mod.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use crate::utils::parse::{Responses, Testcase, Testcases}; -use tasks01::{block2poly::block2poly, poly2block::poly2block, sea128::sea128}; +use tasks01::{block2poly::block2poly, gfmul::gfmul, poly2block::poly2block, sea128::sea128}; use anyhow::{anyhow, Result}; use serde_json::{json, Value}; @@ -34,6 +34,11 @@ pub fn task_deploy(testcase: &Testcase) -> Result { let json = json!({"output" : result}); Ok(json) } + "gfmul" => { + let result = gfmul(args)?; + let json = json!({"product" : result}); + Ok(json) + } _ => Err(anyhow!( "Fatal. No compatible action found. Json data was {:?}. Arguments were; {:?}", testcase, diff --git a/src/test_json/kauma_tests.json b/src/test_json/kauma_tests.json new file mode 100644 index 0000000..96df45c --- /dev/null +++ b/src/test_json/kauma_tests.json @@ -0,0 +1,48 @@ +{ + "testcases": { + "b856d760-023d-4b00-bad2-15d2b6da22fe": { + "action": "block2poly", + "arguments": { + "semantic": "xex", + "block": "ARIAAAAAAAAAAAAAAAAAgA==" + } + }, + "254eaee7-05fd-4e0d-8292-9b658a852245": { + "action": "poly2block", + "arguments": { + "semantic": "xex", + "coefficients": [ + 12, + 127, + 9, + 0 + ] + } + } + }, + "254eaee7-05fd-4e0d-8292-9b658a852245": { + "action": "gfmul", + "arguments": { + "semantic": "xex", + "a": "ARIAAAAAAAAAAAAAAAAAgA==", + "b": "AgAAAAAAAAAAAAAAAAAAAA==" + } + }, + "b856d760-023d-4b00-bad2-15d2b6da22fe": { + "action": "sea128", + "arguments": { + "mode": "encrypt", + "key": "istDASeincoolerKEYrofg==", + "input": "yv66vvrO263eyviIiDNEVQ==" + } + }, + "254eaee7-05fd-4e0d-8292-9b658b852245": { + "action": "sea128", + "arguments": { + "mode": "decrypt", + "key": "istDASeincoolerKEYrofg==", + "input": "D5FDo3iVBoBN9gVi9/MSKQ==" + } + } + } +