Skip to content

ALG_SM3_256 cannot be enabled with OpenSSL 3.x #18

Description

@gotthardp

Enabling ALG_SM3_256 causes a build error on OpenSSL 3.x:

TpmToOsslHash.h:77:14: fatal error: openssl/sm3.h: No such file or directory
   77 | #    include <openssl/sm3.h>
      |              ^~~~~~~~~~~~~~~

This is because the sm3.h is an internal file, which is not available on standard installations.

In fact, all xxx_Init, xxx_Update and xxx_Final functions listed in src/TpmToOsslHash.h are deprecated since OpenSSL 3.0.0, see https://docs.openssl.org/3.2/man3/SHA256_Init.

I suggest to rewrite the hashes using EVP_DigestInit, EVP_DigestUpdate and EVP_DigestFinal. These are available for a quite long time and compatible with both OpenSSL 1.1.1x and OpenSSL 3.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions