You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's an interesting idea! The TL;DR is that we don't support this and as far as I can tell, it would be a bit of work to support in the first place.
I had to dig a bit around the specs/implementation of that tpm2_makecredential tool. It seems the TPM2_MakeCredential call (and by extension the ESYS one as well) just perform some convenience cryptographic operations that could be performed off-chip if you have the public part of the sealing key.
This command does not use any TPM secrets nor does it require authorization. It is a convenience function, using the TPM to perform cryptographic calculations that could be done externally.
So in the tool they have code to actually do that, here. I think in this crate's case if we want to do the same thing, we'd do it as an abstraction or maybe a utilty function - not on Context as those are strictly operations done directly involving a TPM.
Actually, come to think of it, this might be better suited for a separate (small) crate - separate folder in this repo - that pulls in only the FFI types and doesn't link with the TSS library, since you don't need to call it, you just need some of the types defined by it.
I actually have an implementation of this for myself, which I planned to open source next week.
If we want, I can also just try to put it here, but otherwise I can send a link to my code once I published that.
There are a couple of problems with that implementation - I was hoping to use it for Parsec testing as well, however:
It relies on some openssl stuff that's only available on Red Hat distros, through a fork of the repo (mainly talking about the KDF functions)
It doesn't actually implement the "making the credential" part - the function ends in a todo! after deriving the keys, so the actual credential encryption isn't done.
🤦 I just connected dots that someone was asking about it and didn't read the implementation to the end that it ends with a todo! haha. Too bad that we don't have a Rust implementation (since the one in C from tpm2 would need to be ported just like I did for the Duplicate call).
Okay, it was a noise after all - sorry for the commotion! 🙇
No, I think it's good to have an update on that here! I should've actually written something about it back when I was doing my key attestation work :)
I hope I'll have some time to actually implement the "missing" KDF functions in Rust (by reusing some other pure-Rust crypto crates), implement MakeCredential and then publish that for anyone's use, but I don't really have the bandwidth for that right now - maybe in a couple of months!
Indeed, I saw that OpenSSL 3 provides the right tools, but there were no proper bindings in Rust, and I couldn't wait for the proper bindings to come out 😢 Glad to see it's been done, though!! Have you tried upstreaming/making the changes in the "official" openssl crate?
yeah, it has been closed because the author merged target branch and I haven't put the effort to rebase/resend the PR.
but if you'd like to, here was my PR: sfackler/rust-openssl#1426
yeah, it has been closed because the author merged target branch and I haven't put the effort to rebase/resend the PR. but if you'd like to, here was my PR: sfackler/rust-openssl#1426
It's been really hard to get traction with sfackler on anything, it may be worth using the RustCrypto ecosystem https://github.com/RustCrypto/
That is my plan.
it mostly needs an implementation of kbkdf for RSA support (RustCrypto/KDFs#87). I don't remember which KDF is required for EC, but it is also missing.
I've made a prototype implementation here: #563
I'm sharing early, I'm using a bunch of pre-release versions, and I did not completely finish the type system yet. But I think both KDFs (KDFa and KDFe) are correct.
Have a look at #563 !
Support is there. We can’t merge that yet, but if you want to try you can (you will need pre-release version of rustcrypto crates)
@baloo
Thank you very much!
The pre-release version are not on crates.io yet, is there an easy way to pull those or do I need to use git for every single one?
Since I read that you are involved in RustCrypto, do you know how long these releases are away?
At this very moment, git is the only way.
I don’t have an exact timeline yet. Some of it depends on crates not under rustcrypto umbrella and requires coordination.
Activity
ionut-arm commentedon Dec 10, 2020
Hi!
That's an interesting idea! The TL;DR is that we don't support this and as far as I can tell, it would be a bit of work to support in the first place.
I had to dig a bit around the specs/implementation of that
tpm2_makecredential
tool. It seems theTPM2_MakeCredential
call (and by extension the ESYS one as well) just perform some convenience cryptographic operations that could be performed off-chip if you have the public part of the sealing key.So in the tool they have code to actually do that, here. I think in this crate's case if we want to do the same thing, we'd do it as an
abstraction
or maybe a utilty function - not onContext
as those are strictly operations done directly involving a TPM.Actually, come to think of it, this might be better suited for a separate (small) crate - separate folder in this repo - that pulls in only the FFI types and doesn't link with the TSS library, since you don't need to call it, you just need some of the types defined by it.
puiterwijk commentedon Dec 10, 2020
I actually have an implementation of this for myself, which I planned to open source next week.
If we want, I can also just try to put it here, but otherwise I can send a link to my code once I published that.
ionut-arm commentedon Dec 10, 2020
Sweet! Is this in Rust?
I'd be more than happy for it to be hosted here, unless you want to upstream it somewhere else - as long as there's an option out there!
baloo commentedon Feb 27, 2021
I have a usecase that could use a non-TPM backed implementation of
make_credentials
. If you were willing to share @puiterwijk I'd love to try it out.wiktor-k commentedon Feb 10, 2022
I didn't try it but just recently by a random chance I found this: https://github.com/puiterwijk/tpmless-tpm2-rs/blob/main/src/credentials.rs#L62 :
From @puiterwijk's crate that's described as "Various TPM 2 related functions without the need of a live TPM".
Hopefully this will be relevant to you, if not sorry for the noise :)
ionut-arm commentedon Feb 10, 2022
There are a couple of problems with that implementation - I was hoping to use it for Parsec testing as well, however:
todo!
after deriving the keys, so the actual credential encryption isn't done.wiktor-k commentedon Feb 10, 2022
🤦 I just connected dots that someone was asking about it and didn't read the implementation to the end that it ends with a
todo!
haha. Too bad that we don't have a Rust implementation (since the one in C from tpm2 would need to be ported just like I did for the Duplicate call).Okay, it was a noise after all - sorry for the commotion! 🙇
ionut-arm commentedon Feb 10, 2022
No, I think it's good to have an update on that here! I should've actually written something about it back when I was doing my key attestation work :)
I hope I'll have some time to actually implement the "missing" KDF functions in Rust (by reusing some other pure-Rust crypto crates), implement
MakeCredential
and then publish that for anyone's use, but I don't really have the bandwidth for that right now - maybe in a couple of months!baloo commentedon Feb 10, 2022
I got the make credentials crypto to work with openssl3 (afaik only openssl3 provides the required kdf methods) and custom patches for openssl-rs here: https://github.com/baloo/reproducibility-lab/blob/main/pkgs/pcr-eventlog-attestation/src/tpm/credential.rs
ionut-arm commentedon Feb 10, 2022
Indeed, I saw that OpenSSL 3 provides the right tools, but there were no proper bindings in Rust, and I couldn't wait for the proper bindings to come out 😢 Glad to see it's been done, though!! Have you tried upstreaming/making the changes in the "official"
openssl
crate?baloo commentedon Feb 10, 2022
yeah, it has been closed because the author merged target branch and I haven't put the effort to rebase/resend the PR.
but if you'd like to, here was my PR: sfackler/rust-openssl#1426
Merge pull request parallaxsecond#160 from ionut-arm/e2e-tests
Firstyear commentedon Jul 22, 2024
It's been really hard to get traction with sfackler on anything, it may be worth using the RustCrypto ecosystem https://github.com/RustCrypto/
baloo commentedon Jul 22, 2024
That is my plan.
it mostly needs an implementation of kbkdf for RSA support (RustCrypto/KDFs#87). I don't remember which KDF is required for EC, but it is also missing.
Firstyear commentedon Jul 22, 2024
Yep, I'm planning similar for does some improved aes examples and maybe even x509. Would been keen to see and review any prs :)
baloo commentedon Jan 29, 2025
I've made a prototype implementation here: #563
I'm sharing early, I'm using a bunch of pre-release versions, and I did not completely finish the type system yet. But I think both KDFs (KDFa and KDFe) are correct.
su-sd commentedon Mar 18, 2025
@baloo Are there any plans to support ECC keys for make_credential in reproducibility-lab?
baloo commentedon Mar 18, 2025
Have a look at #563 !
Support is there. We can’t merge that yet, but if you want to try you can (you will need pre-release version of rustcrypto crates)
su-sd commentedon Mar 18, 2025
@baloo
Thank you very much!
The pre-release version are not on crates.io yet, is there an easy way to pull those or do I need to use git for every single one?
Since I read that you are involved in RustCrypto, do you know how long these releases are away?
baloo commentedon Mar 18, 2025
At this very moment, git is the only way.
I don’t have an exact timeline yet. Some of it depends on crates not under rustcrypto umbrella and requires coordination.
baloo commentedon Mar 19, 2025
I do have a branch with my cargo lock. It’s a month or so old but it should work if you want to try things out: https://github.com/baloo/rust-tss-esapi/tree/baloo/make-credentials%2Block