mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1686] Try to get rid of as much OpenSSL EVP and BIO crap as possible, as well as Gladman stuff. #1110
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#1110
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 @magnumripper on GitHub (Aug 19, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1686
High-level interfaces and abstraction layers are not the best things you can put in high-performance code.
Unfortunately our own AES (aes.h) can only do CBC (right now anyway).
Here is a start, at least ID possible files/formats to work on (edited by jfoug):
EVP_ stuff
BIO_ stuff
Gladman stuff
@magnumripper commented on GitHub (Aug 20, 2015):
The RAR patch shows all benefits: Less code, cleaner code, no OpenMP problems and workarounds, better performance.
@jfoug commented on GitHub (Aug 20, 2015):
Yes,, dumping the very high level oSSL crap whenever we can, sometimes makes things MUCH better. I have seen 2x or 4x improvements (10x if we have SIMD stuff). An yes, things like openmp issues go away along with all sorts of other shit.
This should almost be in the coding style, to use our own fast and internally maintained code, over 3rd party stuff whenever we can.
@magnumripper commented on GitHub (Aug 20, 2015):
Agreed. I hate high-level stuff, frameworks and abstractions - well at least in JtR I do.
I was the one adding EVP crap to RAR long ago though. That was the way to get AES-NI at the time.
Anyway, I wonder if we could do EDE3 using Solar's/Deepika's bitslice DES. Maybe tricky. Those HMAC-SHA1 should be piece of cake. If we don't have a shared function already we should add one (we might even be able to use SIMD while at it).
Base64, wow lol.
@jfoug commented on GitHub (Aug 20, 2015):
Another set of stuff that was hard to wean ppl off of was that gladman hmac crap. It was harder than using the damn pbkdf2*.h files (by far), but some simply would not use anything but that gladman code. I am glad (pun intended) it is gone man.
@magnumripper commented on GitHub (Aug 20, 2015):
Yeah BTW I thought all gladman files were gone but I see they are still there:
We should probably fix that too. Or is there anything good in them?
@jfoug commented on GitHub (Aug 20, 2015):
I thought we smoked them?? Someone put them back 👎 👎 👎
@magnumripper commented on GitHub (Aug 20, 2015):
We probably just stopped using them for PBKDF2. But dropping them should be easy. I'm adding it to the list for this issue.
@jfoug commented on GitHub (Aug 21, 2015):
babb42fThese header includes were not needed.@jfoug commented on GitHub (Aug 21, 2015):
Gladman code totally gone. Actually VERY trivial (other than a couple defines needed moved into pkzip.h).
The only thing used was hmac_sha1() function, so I wrote 'our own' for JtR. It is faster than gladmans code. It is only about 15% faster, but still faster 👍
Ok, after a couple of false starts (thank you CI's and I hope I have it all this time) the gladman code has now been eliminated.
Grrrrrrr, there may still be a non-SIMD 32 bit problems. ..... New code is great (simplifies a lot), but there simply is a lot of work to get things 'right'.
@jfoug commented on GitHub (Aug 21, 2015):
992af99openbsd-softraid. This crap is easy to remove, now that i have added hmac_sha1.h There should be NO excuse now, for @kholia or others using other type code for these simple things. IF we need to add other hmac algos, then by all means speak up, and we can EASILY add them.@jfoug commented on GitHub (Aug 23, 2015):
f837171dmg hmac:sha1 only (still the DES stuff to do)@jfoug commented on GitHub (Aug 23, 2015):
My opinion about removing the EVP_* and BIO_* checks from the configure, even if we do remove all current code that uses them, is that we should not remove them.
Some of these changes are HARD, and not trivial. Having these options available to developers to quickly add a format is really needed. Later we can clean them up and 'own' the code. Some things like the PKCS12_bio 'can' be done with our owned code (and when I did it, I got a couple orders of magnitude improvement, and could do SIMD), BUT it takes a lot of code reversing to get to an understanding of the actual algorithm used. However, using already created samples moving to a john format quickly pretty much means that we need to know and use these high level interfaces at times.
@magnumripper commented on GitHub (Aug 23, 2015):
Yeah that sounds like a good idea
@jfoug commented on GitHub (Aug 24, 2015):
Building full oSSL with VC with debug symbols in it (no asm also). This should make stepping into a lot of the code to really see the simplicity of the 'real' algorithm SOOOO much easier. Things seem to be building well. I used perl inside cygwin, so the canned .bat files from the oSSL sources had to be interpreted and turned into commands properly handled in cygwin (mostly changing \ to / ) But with the ability to step into oSSL functions will help in figuring out if we can remove them.
@magnumripper commented on GitHub (Aug 27, 2015):
I suspect the DMG format (especially OpenCL) has huge problems with OpenMP. We should try to switch to some lower-level interface even if still using OpenSSL.
@jfoug commented on GitHub (Aug 27, 2015):
I bet there are more than just that format. I have been digging into oSSL, and yes, they have thread support, but it sucks, AND you actually LOSE performance going to OMP, because all of the oSSL code handles multi threading by letting only 1 thread at a time run, IF it even works properly. So removing the oSSL, then managing threading by making sure that each thread gets it's OWN data to work on, so that all threads can run, IS the right way to go.
Again, when cygwin was having those horrible issues on certain formats with OMP, once I ported code out of oSSL, all of those problems went away, and huge performance improvements were seen.
@magnumripper commented on GitHub (Sep 3, 2015):
I really need to fix the DMG format. Had to disable OpenMP completely for it due to segfaults from threading, and it was a major performance hit. I will look into it.
@magnumripper commented on GitHub (Sep 4, 2015):
DMG fixed. Note, I added this to jumbo.[hc]
blocksizeis obviously 16 for AES, 8 for DES and so on.The EVP functions check padding but now we need to do it ourselves. Goes like this:
@kholia commented on GitHub (Jun 19, 2016):
Commit
063b838e02fixes the problem for ssh-ng format.@kholia commented on GitHub (Mar 8, 2017):
BIO_ stuff is all gone now. Let's keep the support for it in our autoconf scripts for now.
https://www.cryptopp.com/wiki/OPENSSL_EVP_BytesToKey documents the algorithm behind
EVP_BytesToKeyfunction.