rnp icon indicating copy to clipboard operation
rnp copied to clipboard

Investigate why test_ffi_keygen_json_pair_dsa_elg runs so long.

Open ni4 opened this issue 3 years ago • 1 comments

Description

It just generates single 1024/1536 DSA/ElGamal keypair however it is the longest running test, so usually overall rnp_tests suite time depends on it. As instrumented most time is spent in Botan's primality test(s).

ni4 avatar Jan 14 '22 11:01 ni4

Here is the possible reason:

    if (bn_num_bytes(*y) < BITS_TO_BYTES(keybits)) {
        botan_privkey_destroy(key_priv);
        goto start;
    }

This would re-generate underlying group, spending again more time in the primality test. Also gives random code coverage changes. We should rewrite it to use botan's native classes instead of FFI.

Note: don't see a good way to extract Botan's native RNG from the FFI RNG struct as it uses calls from the private header. So we should rewrite all RNG-related crypto to the Botan's native classes or keep two RNG's - FFI and native one.

Note 2: this could also randomly cause coverage difference.

ni4 avatar Jan 24 '22 10:01 ni4

Closing this as it should be resolved by refactoring via issue #2005

ni4 avatar Feb 27 '23 11:02 ni4