jedisct1 / rust-aegis

AEGIS high performance ciphers for Rust.
MIT License
24 stars 4 forks source link

`cargo test` fails in version 0.2.4 #1

Closed initsecret closed 1 year ago

initsecret commented 1 year ago

cargo test seem to fail for me with the C implementation and I can reproduce the failure on master and on ed865c0 (the first commit with a working C implementation.) The pure Rust implementation seems to pass without any failures. I have attached my terminal output for both cases below.

Output with C Implementation

$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.03s
     Running unittests src/lib.rs (target/debug/deps/aegis-957d58fb485d0871)

running 2 tests
test tests::test_aegis ... FAILED
test tests::test_aegis_in_place ... FAILED

failures:

---- tests::test_aegis stdout ----
thread 'tests::test_aegis' panicked at 'assertion failed: `(left == right)`
  left: `[141, 64, 71, 9, 97, 25, 128, 6, 46, 223, 247, 224, 147, 182, 84, 131, 7, 150, 188, 19, 4, 178, 20, 94, 184, 221, 38, 116, 7, 1, 7, 133, 143, 218, 13, 230, 36, 160, 222, 186, 187, 224, 62, 36, 31, 29, 120, 235, 143, 7, 75, 130, 197, 22, 111, 110, 6, 179, 210, 94, 8, 5, 199, 197, 54, 100, 229, 84, 231, 171, 163, 174, 114, 190, 74, 203, 195, 66, 74, 30, 141, 243, 157, 229, 147, 61, 148, 224, 11, 135, 171, 99, 0, 25, 67, 231, 209, 206, 250, 101, 230, 121, 0, 97, 65, 220, 131, 208, 40, 255, 168, 212, 128, 65]`,
 right: `[137, 147, 98, 134, 30, 108, 100, 90, 185, 139, 110, 255, 169, 201, 98, 232, 138, 159, 166, 71, 169, 80, 96, 205, 2, 109, 22, 101, 71, 138, 231, 79, 130, 148, 159, 175, 131, 148, 166, 200, 180, 159, 139, 138, 80, 104, 188, 50, 89, 53, 204, 111, 12, 212, 196, 143, 98, 25, 129, 118, 132, 115, 95, 13, 232, 167, 13, 59, 19, 143, 58, 59, 42, 206, 238, 139, 2, 251, 194, 222, 185, 59, 143, 116, 231, 175, 233, 67, 229, 11, 219, 127, 160, 215, 89, 217, 109, 89, 76, 225, 102, 118, 69, 94, 252, 2, 69, 205, 251, 65, 159, 177, 3, 101]`', src/lib.rs:68:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- tests::test_aegis_in_place stdout ----
thread 'tests::test_aegis_in_place' panicked at 'assertion failed: `(left == right)`
  left: `[141, 64, 71, 9, 97, 25, 128, 6, 46, 223, 247, 224, 147, 182, 84, 131, 7, 150, 188, 19, 4, 178, 20, 94, 184, 221, 38, 116, 7, 1, 7, 133, 143, 218, 13, 230, 36, 160, 222, 186, 187, 224, 62, 36, 31, 29, 120, 235, 143, 7, 75, 130, 197, 22, 111, 110, 6, 179, 210, 94, 8, 5, 199, 197, 54, 100, 229, 84, 231, 171, 163, 174, 114, 190, 74, 203, 195, 66, 74, 30, 141, 243, 157, 229, 147, 61, 148, 224, 11, 135, 171, 99, 0, 25, 67, 231, 209, 206, 250, 101, 230, 121, 0, 97, 65, 220, 131, 208, 40, 255, 168, 212, 128, 65]`,
 right: `[137, 147, 98, 134, 30, 108, 100, 90, 185, 139, 110, 255, 169, 201, 98, 232, 138, 159, 166, 71, 169, 80, 96, 205, 2, 109, 22, 101, 71, 138, 231, 79, 130, 148, 159, 175, 131, 148, 166, 200, 180, 159, 139, 138, 80, 104, 188, 50, 89, 53, 204, 111, 12, 212, 196, 143, 98, 25, 129, 118, 132, 115, 95, 13, 232, 167, 13, 59, 19, 143, 58, 59, 42, 206, 238, 139, 2, 251, 194, 222, 185, 59, 143, 116, 231, 175, 233, 67, 229, 11, 219, 127, 160, 215, 89, 217, 109, 89, 76, 225, 102, 118, 69, 94, 252, 2, 69, 205, 251, 65, 159, 177, 3, 101]`', src/lib.rs:96:9

failures:
    tests::test_aegis
    tests::test_aegis_in_place

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `--lib`

Output with Pure Rust Implementation

$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.03s
     Running unittests src/lib.rs (target/debug/deps/aegis-957d58fb485d0871)

running 2 tests
test tests::test_aegis ... ok
test tests::test_aegis_in_place ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests aegis

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
jedisct1 commented 1 year ago

This is actually unrelated to the C implementation. The order of the Aegis128L.init() parameters have been reversed, and the tests still passed them in the wrong order.

Thanks!

initsecret commented 1 year ago

Thank you.