intel / ipp-crypto

Apache License 2.0
314 stars 85 forks source link

Compiling without OpenSSL? #68

Closed rs78GT closed 6 months ago

rs78GT commented 6 months ago

I tried to compile it on Devuan 5 , and I got this error:

CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR: Found unsuitable version "1.1.1v", but required is at least "3.0.8" (found /usr/local/lib/libcrypto.so, ) Call Stack (most recent call first): /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.25/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args) sources/ippcp/crypto_mb/CMakeLists.txt:80 (find_package)

I understand, what is that error about, but I do not want, and I will not install OpenSSL > 3.0 . I need the sha256 function only (I guess IPP doesn't have ripemd160), and I would like to test the speed of this library against OpenSSL.

If there is a solution, please let me know. Thank you!

ElenaTyuleneva commented 6 months ago

Hi @rs78GT, Only crypto multi-buffer library has a dependency on OpenSSL. If you are interested just in single-buffer ippcp library you can specify -DNO_CRYPTO_MB:BOOL=TRUE CMake configuration flag, then only ippcp library will be built.

FYI - OpenSSL 1.1.1.* is EOL since September, 2023

rs78GT commented 6 months ago

Hi @ElenaTyuleneva , thanks for the replay! The only interesting part would be the SIMD message processing, so.. if you just saying, all the SSE/AVX code depends on OpenSSL.. all of this just waste of time! On the other hand, the OpenSSL>3 crap.. half day figure out where is the RIPEMD160, oh wait.. there is no ripemd anymore, why is it slow as *** , how can I compile it with functions what I need, etc. If you look around, I am not the only one with the same problem.. anyway! If something is working, don't fix it! My mistake, I have to be more careful, before wasting time to set back everything! Of course, just cut it out something, what was used everywhere (just like Bitcoin) is an excellent move! Oh my..

paveldyakov commented 6 months ago

Hi @rs78GT,

In IPP Crypto we have two types of functions (located in sub-libraries): single-buffer functions (e.g. https://www.intel.com/content/www/us/en/docs/ipp-crypto/developer-guide-reference/2021-9/one-way-hash-primitives.html) and multi-buffer functions (https://www.intel.com/content/www/us/en/docs/ipp-crypto/developer-guide-reference/2021-9/multi-buffer-cryptography-functions.html)

Both single- and multi- buffer functions are SIMD optimized (e.g. for AVX512). And only multi-buffer functions have the dependency from OpenSSL.

Hope the information provided by @ElenaTyuleneva and me can help you. Please let us know if you have more questions.

rs78GT commented 6 months ago

Hi @paveldyakov and @ElenaTyuleneva, thank you very much for your time and for the information! I try to find stand-alone solutions for SHA256 and RIPEMD160. I am too dumb to write them myself (there are few "dark" area in the exact mathematics), but anyway! I don't think I can beat the developers with plenty of years assembly background! :)

If I am not mistaken, the OpenSSL is already using SIMD instructions, just not as multi message input at once, but multi block from the same message. I have only SSE and AVX1 (Xeon E5 2690v2) instruction set, and I am looking around for the fastest hashing functions. Something without hundreds of header dependencies, hundreds separated, unnecessary function calls, etc.

So long story short, I hope I find something what I can "cut out" from it's own library and use as inline function. Naaah' that would be fast!!! :)

ElenaTyuleneva commented 6 months ago

@rs78GT , are there any other questions from your side or we can close this issue?

rs78GT commented 6 months ago

@ElenaTyuleneva sorry, I forgot to close the issue! Mea Maxima Culpa! Thank you and have a good day! Zsolt