-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The exported sha256_sse() function fails to properly hash blocks that are larger than 65536 bytes in size #20
Comments
Many thanks for rising the issue. These API's are exported only for IPsec usage when HMAC-SHAx is used for authentication and key size is larger than SHAx block size. These API's are not really optimized for performance because these potential HMAC key reductions are not frequent operations in IPSec. For best SHA hash performance and handling of large files I would recommend ISA-L crypto library Having said that we will have a look into this issue as the exported API should be functional for larger data sizes. Thanks, |
Hi Tomasz, I have believe you mean to use isa-l_crypto since isa-l only hash CRC type hashing. Unfortunately, I am having an issue getting the correct SHA256 hash out of that as well. Please see the following issue report: intel/isa-l_crypto#14 |
Correct, ISA-L crypto is the one that I pointed to.
|
Example output:
|
Plus output for the test files mentioned above. Maybe this is something specific to sha256sum tool
|
I am closing the issue as ipsec-mb library and openssl produce same SHA256 hash values for the same buffers. |
Note that this is true of all of the exported sha256_*() functions, not just the sse version. I am just using the sse version to demonstrate. I was hoping to use these functions to efficiently hash large files on an Intel based system, but if only blocks up to 64KB are supported for hashing, these functions are far less useful!
Here is a sample C++ program. You can try it on files that are <=65536 bytes in size and then on files that are >65536 bytes in size. It will fail to produce a correct hash for files that are >65536 bytes in size.
Examples:
Generate data files:
65536 byte example - SUCCESS
Output of application using sha256_sse() to compute the SHA256 hash:
Correct sha256sum output for comparison (matches above output at the hex level):
65537 byte example - FAILURE
Output of application using sha256_sse() to compute the SHA256 hash:
Correct sha256sum output for comparison (does not match above output at the hex level):
Source code:
The text was updated successfully, but these errors were encountered: