-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
check why the key generation is slow on some devices #511
Comments
Checked it on a Samsung Galaxy S7 and it took 1-2 minutes. Pretty strange.
|
the reason for this seems to be the bundled openssl() version; when using this version on desktop, there is the same issue |
closing this here in favour to deltachat/deltachat-core#376 which already dived deeper into the OpenSSL code. |
the keysize seems to have a rather large impact: 3072bit key generation took about 60 seconds, 2048bit only about 10 on a "slow" nexus 4 |
currently, the key generation is done during
dc_configure()
after the connection could be established.in the code, this is here https://github.com/deltachat/deltachat-core/blob/master/src/dc_configure.c#L697 (the progress is at 92% during key generation)
i have suspected some issues with the openssl random number generation, and played around a bit when i noticed that
RAND_seed()
andRAND_status()
needs to be seeded for every thread explicitly - without success. however, it was just "playing around", this needs more research to exclude this.i also notices,
RSA_generate_key_ex()
provides a callback that may give more hints. maybe also openssl needs to be updated.on telegram-delta i profiled the generation in july using
times()
: motog4play (openssl=1.0.1t, _SC_CLK_TCK=100) returned utime=2500 stime=400, cutime=0, cstime=0 while i7pc (openssl=1.0.2g, _SC_CLK_TCK=100) returned utime=16, stime=0, cutime=0, cstime=0 - so the issue seems not to be blocking or so.interesting:
$ openssl speed rsa
returns thousands of keypairs per second - we would need only one ...related: deltachat/deltachat-core#224, https://gitlab.com/sequoia-pgp/sequoia/issues/19
@Boehrsi @angelo-fuchs how long does configure() take on your devices?
The text was updated successfully, but these errors were encountered: