rustpq / pqcrypto

Rust Post-Quantum cryptography
212 stars 38 forks source link

fatal runtime error: stack overflow #17

Closed marcbrevoort-cyberhive closed 3 years ago

marcbrevoort-cyberhive commented 3 years ago

There seems to be an issue with the McEliece crate. When calling this as per the API documentation,

use pqcrypto_classicmceliece::mceliece460896::keypair as mckeypair;
use pqcrypto_classicmceliece::mceliece460896::encapsulate as mcencapsulate;
use pqcrypto_classicmceliece::mceliece460896::decapsulate as mcdecapsulate;

#[test]
pub fn test_generate_keypair() {
    let (pk, sk) = mckeypair();
    let (ss1, ct) = mcencapsulate(&pk);
    let ss2 = mcdecapsulate(&ct, &sk);
    assert!(ss1==ss2);
}

(names prefixed with mc to avoid the possibility of namespace clashes)

the test crashes with

thread 'key::test::test_generate_keypair' has overflowed its stack
fatal runtime error: stack overflow
thomwiggers commented 3 years ago

You need RUST_MIN_STACK quite big; mceliece is very stack-intensive

thomwiggers commented 3 years ago

A note should be set in implementations.yaml to add this note to the generated implementations, just like is done for Frodo, Rainbow.

marcbrevoort-cyberhive commented 3 years ago

You need RUST_MIN_STACK quite big; mceliece is very stack-intensive

That helped!