mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
Fix testing against KATs
This commit is contained in:
parent
115a3f5faa
commit
a8bb139ea6
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@ -24,3 +24,9 @@ jobs:
|
|||||||
- name: Build Rust bindings
|
- name: Build Rust bindings
|
||||||
run: |
|
run: |
|
||||||
cd src/rustapi/pqc-sys && cargo build
|
cd src/rustapi/pqc-sys && cargo build
|
||||||
|
- name: Run KAT tests
|
||||||
|
run: |
|
||||||
|
cd test/katrunner &&
|
||||||
|
curl http://amongbytes.com/~flowher/permalinks/kat.zip --output kat.zip
|
||||||
|
unzip kat.zip
|
||||||
|
cargo run -- --katdir KAT
|
||||||
|
@ -17,9 +17,14 @@ fn signature_scheme(el: &TestVector) {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let p = pqc_sig_alg_by_id(el.scheme_id as u8);
|
let p = pqc_sig_alg_by_id(el.scheme_id as u8);
|
||||||
assert_ne!(p.is_null(), true);
|
assert_ne!(p.is_null(), true);
|
||||||
|
// pqc doesn't use "envelope" API. From the other
|
||||||
|
// hand in KATs for signature scheme, the signature
|
||||||
|
// is concatenaed with a message. Use only part with
|
||||||
|
// the signature.
|
||||||
|
let sm_len = el.sig.sm.len() - el.sig.msg.len();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pqc_sig_verify(p,
|
pqc_sig_verify(p,
|
||||||
el.sig.sm.as_ptr(), el.sig.sm.len() as u64,
|
el.sig.sm.as_ptr(), sm_len as u64,
|
||||||
el.sig.msg.as_ptr(), el.sig.msg.len() as u64,
|
el.sig.msg.as_ptr(), el.sig.msg.len() as u64,
|
||||||
el.sig.pk.as_ptr()),
|
el.sig.pk.as_ptr()),
|
||||||
true);
|
true);
|
||||||
|
Loading…
Reference in New Issue
Block a user