mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2871] Replace uses of crypto_scrypt() with (y)escrypt_r() #1827
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1827
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @solardiz on GitHub (Nov 10, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2871
The
crypto_scrypt()interface (de)allocates memory each time, which is unnecessary overhead when we use it repeatedly. We have a better interface that avoids this, and it's already used inscrypt_fmt.c. However, 3 other formats usecrypto_scrypt(). Those should be switched to the better interface as well, usingscrypt_fmt.cas an example. This should be easy to do - first task for a new contributor maybe?(We'll also need to switch from escrypt to yescrypt as a separate task later, but this interface will remain almost the same, so the work on this issue won't be wasted.)
The speed improvement (maybe 30% or so) should be confirmed with benchmarks (both single- and multi-threaded).
A difficulty here is that at least
multibit_fmt_plug.ccombines very different hash versions in one format, which we might want to deal with separately (split it into two formats); for benchmarking and testing, we may temporarily comment out the wrong-version test vectors. Another issue is that this format only has one test vector that uses scrypt - we should add more.@solardiz commented on GitHub (Nov 12, 2017):
BTW, we have conceptually similar issues for Argon2 and POMELO (any others?)
@solardiz commented on GitHub (Dec 22, 2017):
Also, we shouldn't silently ignore errors from the underlying hashes. Doing so like django_scrypt_fmt_plug.c currently does (set the output to all zeroes) may lead to false negatives. Doing so like ethereum_fmt_plug.c and multibit_fmt_plug.c currently do may lead to false negatives (likely) and false positives (unlikely, but possible).
scrypt_fmt.c does it almost right: sets a flag from within the maybe-parallel section (strictly speaking, we'd need a
#pragma omp criticalon that flag assignment, but in practice it's benign), then exits the process with an error message if the flag was set (the error message is too specific, though: while memory allocation failure is the most likely problem, we don't really know what the actual error was).Similar issues probably apply to Argon2 and POMELO formats, and likely more. I did not check those.
@solardiz commented on GitHub (Mar 15, 2018):
This could proceed now: yescrypt 1.0 is out, and should be integrated either in jumbo or possibly even in core (along with a (ye)scrypt format in core, although jumbo might then need to re-add the various many scrypt hash encodings that it currently supports and that are unsupported by the yescrypt 1.0 tree itself - it's just the encodings, not different hash computation, so re-addable on top of that tree and perhaps inside a format). If magnum or anyone has a preference here, let me know.
@solardiz commented on GitHub (Apr 11, 2019):
I replace the underlying code with current yescrypt post-1.0.3 in #3790, but in that PR I don't yet approach making other changes proposed in here.