Skip to content
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

LibreSSL 3.7.x doesn't have NID_sm2 #841

Closed
orbea opened this issue Apr 13, 2023 · 3 comments
Closed

LibreSSL 3.7.x doesn't have NID_sm2 #841

orbea opened this issue Apr 13, 2023 · 3 comments

Comments

@orbea
Copy link

orbea commented Apr 13, 2023

When building tpm2-tss it fails since NID_sm2 is not implemented.

https://github.com/tpm2-software/tpm2-tss/blob/3d3c9a81db1354fe75dd27f5a87551c101034b0d/src/tss2-esys/esys_crypto_ossl.c#L924

This is easy to workaround by hiding the case.

#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
    case TPM2_ECC_SM2_P256:
        curveId = NID_sm2;
        key_size = 32;
        break;
#endif

Are there good reasons why LibreSSL should implement this in the future?

I made WIP upstream PR here. tpm2-software/tpm2-tss#2380

@4a6f656c
Copy link
Contributor

SM2 is a digital signature algorithm specified by China:

https://datatracker.ietf.org/doc/html/draft-shen-sm2-ecdsa-02

LibreSSL has code to support this, however it needs further work before it could be enabled (and unfortunately that is currently low on the list of priorities).

Instead of using OPENSSL_VERSION_NUMBER or LIBRESSL_VERSION_NUMBER, I would suggest that code use
#ifdef NID_sm2 - that way it will automatically start working if/when LibreSSL exposes the algorithm (and stops if OpenSSL/LibreSSL removes it for some reason).

orbea added a commit to orbea/tpm2-tss that referenced this issue Apr 15, 2023
The NID_sm2 algorithm is not currently supported by LibreSSL which
causes build failures. However instead of checking the OpenSSL version
number it is possible to just check if NID_sm2 is defined instead. This
way it will be automatically enabled when LibreSSL does support it and
disabled in the event the OpenSSL stops supporting it.

LibreSSL issue: libressl/portable#841
@orbea
Copy link
Author

orbea commented Apr 15, 2023

Thanks for the information and suggestion. I made a new PR for tpm2-tss with just this change. tpm2-software/tpm2-tss#2602

I will leave this issue open for now as a way to track the SM2 support, but I am fine with it being a low priority.

orbea added a commit to orbea/tpm2-tss that referenced this issue Apr 15, 2023
The NID_sm2 algorithm is not currently supported by LibreSSL which
causes build failures. However instead of checking the OpenSSL version
number it is possible to just check if NID_sm2 is defined instead. This
way it will be automatically enabled when LibreSSL does support it and
disabled in the event the OpenSSL stops supporting it.

LibreSSL issue: libressl/portable#841

Signed-off-by: orbea <[email protected]>
@4a6f656c
Copy link
Contributor

I will leave this issue open for now as a way to track the SM2 support, but I am fine with it being a low priority.

Issue #635 already exists for this purpose. As such, I'll close this issue.

orbea added a commit to orbea/tpm2-tss that referenced this issue Apr 17, 2023
The NID_sm2 algorithm is not currently supported by LibreSSL which
causes build failures. However instead of checking the OpenSSL version
number it is possible to just check if NID_sm2 is defined instead. This
way it will be automatically enabled when LibreSSL does support it and
disabled in the event the OpenSSL stops supporting it.

LibreSSL issue: libressl/portable#841

Signed-off-by: orbea <[email protected]>
JuergenReppSIT pushed a commit to tpm2-software/tpm2-tss that referenced this issue Apr 20, 2023
The NID_sm2 algorithm is not currently supported by LibreSSL which
causes build failures. However instead of checking the OpenSSL version
number it is possible to just check if NID_sm2 is defined instead. This
way it will be automatically enabled when LibreSSL does support it and
disabled in the event the OpenSSL stops supporting it.

LibreSSL issue: libressl/portable#841

Signed-off-by: orbea <[email protected]>
AndreasFuchsTPM pushed a commit to tpm2-software/tpm2-tss that referenced this issue Jan 30, 2024
The NID_sm2 algorithm is not currently supported by LibreSSL which
causes build failures. However instead of checking the OpenSSL version
number it is possible to just check if NID_sm2 is defined instead. This
way it will be automatically enabled when LibreSSL does support it and
disabled in the event the OpenSSL stops supporting it.

LibreSSL issue: libressl/portable#841

Signed-off-by: orbea <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants