refactor: move arch specific code to rpo folder, don't run SVE on CI
This commit is contained in:
parent
701a187e7f
commit
01be4d6b9d
8 changed files with 8 additions and 45 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -39,7 +39,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
toolchain: [stable, nightly]
|
toolchain: [stable, nightly]
|
||||||
os: [ubuntu]
|
os: [ubuntu]
|
||||||
features: [--all-features, --no-default-features]
|
features: ["--features default,std,serde", --no-default-features]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- name: Install rust
|
- name: Install rust
|
||||||
|
@ -59,7 +59,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
features: [--all-features, --no-default-features]
|
features: ["--features default,std,serde", --no-default-features]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- name: Install minimal nightly with clippy
|
- name: Install minimal nightly with clippy
|
||||||
|
|
|
@ -35,8 +35,8 @@ repos:
|
||||||
name: Cargo check --all-targets --no-default-features
|
name: Cargo check --all-targets --no-default-features
|
||||||
args: ["+stable", "check", "--all-targets", "--no-default-features"]
|
args: ["+stable", "check", "--all-targets", "--no-default-features"]
|
||||||
- id: cargo
|
- id: cargo
|
||||||
name: Cargo check --all-targets --all-features
|
name: Cargo check --all-targets --features default,std,serde
|
||||||
args: ["+stable", "check", "--all-targets", "--all-features"]
|
args: ["+stable", "check", "--all-targets", "--features", "default,std,serde"]
|
||||||
# Unlike fmt, clippy will not be automatically applied
|
# Unlike fmt, clippy will not be automatically applied
|
||||||
- id: cargo
|
- id: cargo
|
||||||
name: Cargo clippy
|
name: Cargo clippy
|
||||||
|
|
|
@ -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)
|
|
|
@ -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");
|
|
||||||
}
|
|
8
build.rs
8
build.rs
|
@ -5,12 +5,12 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(feature = "arch-arm64-sve")]
|
#[cfg(feature = "arch-arm64-sve")]
|
||||||
fn compile_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/rpo/library.c");
|
||||||
println!("cargo:rerun-if-changed=arch/arm64-sve/library.h");
|
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/library.h");
|
||||||
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo_hash.h");
|
println!("cargo:rerun-if-changed=arch/arm64-sve/rpo/rpo_hash.h");
|
||||||
|
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
.file("arch/arm64-sve/library.c")
|
.file("arch/arm64-sve/rpo/library.c")
|
||||||
.flag("-march=armv8-a+sve")
|
.flag("-march=armv8-a+sve")
|
||||||
.flag("-O3")
|
.flag("-O3")
|
||||||
.compile("rpo_sve");
|
.compile("rpo_sve");
|
||||||
|
|
Loading…
Add table
Reference in a new issue