-
Notifications
You must be signed in to change notification settings - Fork 366
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
tpm2 createprimary fails on Ubuntu 22.04 LTS When FIPS is enabled #2889
Comments
@galroty It would be great if you could test it with the branch https://github.com/JuergenReppSIT/tpm2-tss/tree/esys-add-ossl-err-log where the openssl logging is improved. |
Hi @JuergenReppSIT, I have been looking into this for a little while now, but I am a bit stuck. I built tpm2-tss with JuergenReppSIT@51bb7c1 and then build tpm2-tools, but I don't really get any change in output. I don't see the string "OpenSSL reported:" anywhere. Attached is the output of
We do indeed call iesys_cryptossl_hmac_start() with size=0. Maybe FIPS 140-3 doesn't allow this? I keep trying to add my own I can make you a Ubuntu 22.04 FIPS instance if you are especially interested. Thanks, |
@matthewruffell Thank you for testing. Its strange because the macro |
From my debugging I did see that becuase of size=0 it fails because of openssl fips runtime checks. Unfortenly the openssl error code wasn't set (was 0). When I disabled runtime check in /etc/ssl/fipsmodule.cnf it worked. I hard coded size to be 16 and then it also worked. I'm not sure why size is 0 and what it means but it seems problematic on fips enbaled systems. |
@JuergenReppSIT I built and installed your branch: |
@JuergenReppSIT Can you send me you ssh public key? An attachment, or email or link is fine. I'll make you a 22.04 FIPS instance. |
I have made some substantial progress on debugging, using the hints that @galroty provided. I downloaded the source code to the jammy openssl fips packages, and read the
Then open:
Okay, so if we look at SP800-131A [3], Section 10, Table 9, which can be found [3] https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf In reality, this gets implemented in openssl by the patch below. The patch is
Anyway, bringing this back to tpm2-tss. I did some test builds where I patched
When I recompile and run tpm2-tools:
it works. If I change size = 13, and recompile:
we fail with the same error. So, we have established root cause. All HMAC operations require a minimum @JuergenReppSIT do you think it would be possible to change the keylength? Or should Ubuntu Thanks, |
@matthewruffell @galroty Thank you for debugging the problem. |
@matthewruffell @matthewruffell I have created a PR tpm2-software/tpm2-tools/pull/3426 related to this problem. |
Hey,
I run on ubuntu 22 and after enabling fips (using Ubuntu pro, enabled fips-preview) tpm2 createprimary fails. before enabling fips everything worked fine.
user@user:~$ uname -a Linux user 5.15.0-73-fips #80+fips1-Ubuntu SMP Thu Jun 1 20:57:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
user@user:~$ sudo tpm2 createprimary [sudo] password for user: ERROR:esys_crypto:src/tss2-esys/esys_crypto_ossl.c:412:iesys_cryptossl_hmac_start() ErrorCode (0x00070001) DigestSignInit ERROR:esys_crypto:src/tss2-esys/esys_crypto.c:185:iesys_crypto_authHmac() Error ErrorCode (0x00070001) ERROR:esys:src/tss2-esys/esys_iutil.c:1244:iesys_compute_hmac() HMAC error ErrorCode (0x00070001) ERROR:esys:src/tss2-esys/esys_iutil.c:1354:iesys_gen_auths() Error while computing hmacs ErrorCode (0x00070001) ERROR:esys:src/tss2-esys/api/Esys_CreatePrimary.c:244:Esys_CreatePrimary_Async() Error in computation of auth values ErrorCode (0x00070001) ERROR:esys:src/tss2-esys/api/Esys_CreatePrimary.c:110:Esys_CreatePrimary() Error in async function ErrorCode (0x00070001) ERROR: Esys_CreatePrimary(0x70001) - esapi:Catch all for all errors not otherwise specified ERROR: Unable to run createprimary
user@user:~$ openssl version OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022) user@user:~$ openssl list -providers Providers: base name: OpenSSL Base Provider version: 3.0.2 status: active fips name: Ubuntu 22.04 OpenSSL Cryptographic Module version: 3.0.5-0ubuntu0.1+Fips2.1 status: active user@user:~$ [0] 0:bash 1:
I also tried building and installing tpm2-tss and tpm2-tools from master but it didn't help, and I encountered the same error.
I tried debugging a bit and noticed iesys_cryptossl_hmac_start receivies size=0.
please let me know if there is other information which may assist you.
Thank you
The text was updated successfully, but these errors were encountered: