Home > Back-end >  Determine if OpenSSL uses the CPU SHA256 instructions
Determine if OpenSSL uses the CPU SHA256 instructions

Time:11-15

I'm using OpenSSL (openssl/sha.h) to calculate SHA256 hashes in a performance critical application, written in C. I'm wondering if OpenSSL really uses the SHA256 CPU instructions or if it just calculates SHA256 hash by itself?

Is there a way, to find which way OpenSSL is doing this calculation?

CodePudding user response:

The easiest way is to see the port source code as it is open (nomen omen)

For x86-064 you can see:

    sha256rnds2 $CDGH0,$ABEF0

which indicates that the library uses sha instructions.

https://github.com/openssl

CodePudding user response:

objdump -d /usr/lib/libcrypto.so.1.1|grep sha256rnds2 would tell if openssl uses any sha256 cpu instruction but it would not tell if or when those instructions are executed. You could start your program in a debugger and set a breakpoint for those instructions.

  • Related