Browse Source

refactor: move arch specific code to rpo folder, don't run SVE on CI

al-gkr-basic-workflow
Grzegorz Swirski 1 year ago
parent
commit
01be4d6b9d
8 changed files with 8 additions and 45 deletions
  1. +2
    -2
      .github/workflows/ci.yml
  2. +2
    -2
      .pre-commit-config.yaml
  3. +0
    -10
      arch/arm64-sve/CMakeLists.txt
  4. +0
    -0
      arch/arm64-sve/rpo/library.c
  5. +0
    -0
      arch/arm64-sve/rpo/library.h
  6. +0
    -0
      arch/arm64-sve/rpo/rpo_hash.h
  7. +0
    -27
      arch/arm64-sve/test.c
  8. +4
    -4
      build.rs

+ 2
- 2
.github/workflows/ci.yml

@ -39,7 +39,7 @@ jobs:
matrix:
toolchain: [stable, nightly]
os: [ubuntu]
features: [--all-features, --no-default-features]
features: ["--features default,std,serde", --no-default-features]
steps:
- uses: actions/checkout@main
- name: Install rust
@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
features: [--all-features, --no-default-features]
features: ["--features default,std,serde", --no-default-features]
steps:
- uses: actions/checkout@main
- name: Install minimal nightly with clippy

+ 2
- 2
.pre-commit-config.yaml

@ -35,8 +35,8 @@ repos:
name: Cargo check --all-targets --no-default-features
args: ["+stable", "check", "--all-targets", "--no-default-features"]
- id: cargo
name: Cargo check --all-targets --all-features
args: ["+stable", "check", "--all-targets", "--all-features"]
name: Cargo check --all-targets --features default,std,serde
args: ["+stable", "check", "--all-targets", "--features", "default,std,serde"]
# Unlike fmt, clippy will not be automatically applied
- id: cargo
name: Cargo clippy

+ 0
- 10
arch/arm64-sve/CMakeLists.txt

@ -1,10 +0,0 @@
cmake_minimum_required(VERSION 3.0)
project(rpo_sve C)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+sve -Wall -Wextra -pedantic -g -O3")
add_library(rpo_sve library.c rpo_hash.h)
add_executable(rpo_test test.c)
target_link_libraries(rpo_test rpo_sve)

arch/arm64-sve/library.c → arch/arm64-sve/rpo/library.c


arch/arm64-sve/library.h → arch/arm64-sve/rpo/library.h


arch/arm64-sve/rpo_hash.h → arch/arm64-sve/rpo/rpo_hash.h


+ 0
- 27
arch/arm64-sve/test.c

@ -1,27 +0,0 @@
#include <stdio.h>
#include "library.h"
void print_array(size_t len, uint64_t arr[len]);
int main() {
uint64_t C[STATE_WIDTH] = {1, 1, 1, 1 ,1, 1, 1, 1 ,1, 1, 1, 1};
uint64_t T[STATE_WIDTH] = {1, 2, 3, 4, 1, 2, 3, 4,1, 2, 3, 4};
add_constants_and_apply_sbox(T, C);
add_constants_and_apply_inv_sbox(T, C);
print_array(STATE_WIDTH, T);
return 0;
}
void print_array(size_t len, uint64_t arr[len])
{
printf("[");
for (size_t i = 0; i < len; i++)
{
printf("%lu ", arr[i]);
}
printf("]\n");
}

+ 4
- 4
build.rs

@ -5,12 +5,12 @@ fn main() {
#[cfg(feature = "arch-arm64-sve")]
fn compile_arch_arm64_sve() {
println!("cargo:rerun-if-changed=arch/arm64-sve/library.c");
println!("cargo:rerun-if-changed=arch/arm64-sve/library.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo_hash.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/library.c");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/library.h");
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/rpo_hash.h");
cc::Build::new()
.file("arch/arm64-sve/library.c")
.file("arch/arm64-sve/rpo/library.c")
.flag("-march=armv8-a+sve")
.flag("-O3")
.compile("rpo_sve");

Loading…
Cancel
Save