Search code examples
copensslsha256libcrypto

Determine if OpenSSL uses the CPU SHA256 instructions


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?


Solution

  • 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