TPM2 engine support for openssl
cover TPM2 engine support for openssl
This is a completed version of the original RFC. It's working now both on the TPM2 simulator and on real hardware (I've converted my laptop to TPM2). I've updated it to use the latest version of the ASN.1 for the key format (still using a TCG OID).
I have it building here (it's what I'm currently using for my laptop VPNs):
https://build.opensuse.org/package/show/home:jejb1:Tumbleweed/openssl_tpm_engine
But note that this version also has experimental patches to activate the in-kernel TPM Resource Manager because for multiple applications TPM2 really doesn't work well without one. Since the patch for the RM is currently not upstream (yet), it's not going to work unless you have a patched kernel.
James
---
James Bottomley (1):
add TPM2 version of create_tpm2_key and libtpm2.so engine
Makefile.am | 12 +- create_tpm2_key.c | 451 +++++++++++++++++++++++++++++++++++++++++++ e_tpm2.c | 559 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tpm2-asn.h | 59 ++++++ tpm2-common.c | 175 +++++++++++++++++ tpm2-common.h | 10 + 6 files changed, 1264 insertions(+), 2 deletions(-) create mode 100644 create_tpm2_key.c create mode 100644 e_tpm2.c create mode 100644 tpm2-asn.h create mode 100644 tpm2-common.c create mode 100644 tpm2-common.h
Signature · 6 lines
2.6.6 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
PATCH 1/1 add TPM2 version of create_tpm2_key and libtpm2.so engine
This patch adds RSA signing for TPM2 keys. There's a limitation to the way TPM2 does signing: it must recognise the OID for the signature.
That fails for the MD5-SHA1 signatures of the TLS/SSL certificate
verification protocol, so I'm using RSA_Decrypt for both signing (encryption) and decryption ... meaning that this only works with TPM decryption keys. It is possible to use the prior code, which preserved the distinction of signing and decryption keys, but only at the expense of not being able to support SSL or TLS lower than 1.2
---
v2: - use TPM2_RSA_Decrypt for both decryption and signing operations
- Add authority processing
- Add TPM internal key creation
- allow persistent parents
- update to use transient connections to the TPM
--- Makefile.am | 12 +- create_tpm2_key.c | 451 +++++++++++++++++++++++++++++++++++++++++++ e_tpm2.c | 559 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tpm2-asn.h | 59 ++++++ tpm2-common.c | 175 +++++++++++++++++ tpm2-common.h | 10 + 6 files changed, 1264 insertions(+), 2 deletions(-) create mode 100644 create_tpm2_key.c create mode 100644 e_tpm2.c create mode 100644 tpm2-asn.h create mode 100644 tpm2-common.c create mode 100644 tpm2-common.h
Makefile.am +10 -2
@@ -2,12 +2,20 @@ SUBDIRS=. test EXTRA_DIST = README openssl.cnf.sample -openssl_engine_LTLIBRARIES=libtpm.la -bin_PROGRAMS=create_tpm_key +openssl_engine_LTLIBRARIES=libtpm.la libtpm2.la +bin_PROGRAMS=create_tpm_key create_tpm2_key openssl_enginedir=@libdir@/openssl/engines libtpm_la_LIBADD=-lcrypto -lc -ltspi libtpm_la_SOURCES=e_tpm.c e_tpm.h e_tpm_err.c +libtpm2_la_LIBADD=-lcrypto -lc -ltss +libtpm2_la_SOURCES=e_tpm2.c tpm2-common.c +libtpm2_la_CFLAGS=-g -Werror + create_tpm_key_SOURCES=create_tpm_key.c create_tpm_key_LDADD=-ltspi + +create_tpm2_key_SOURCES=create_tpm2_key.c tpm2-common.c +create_tpm2_key_LDADD=-lcrypto -ltss +create_tpm2_key_CFLAGS=-Werror
create_tpm2_key.c new file +451 -0
451 lines not on this page · raw message
e_tpm2.c new file +559 -0
559 lines not on this page · raw message
tpm2-asn.h new file +59 -0
59 lines not on this page · raw message
tpm2-common.c new file +175 -0
175 lines not on this page · raw message
tpm2-common.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _TPM2_COMMON_H +#define _TPM2_COMMON_H + +void tpm2_error (TPM_RC rc,const char *reason); +TPM_RC tpm2_load_srk (TSS_CONTEXT *tssContext,TPM_HANDLE *h,const char *auth,TPM2B_PUBLIC *pub); +void tpm2_flush_handle (TSS_CONTEXT *tssContext,TPM_HANDLE h); +EVP_PKEY *tpm2_to_openssl_public (TPMT_PUBLIC *pub); +void tpm2_flush_srk (TSS_CONTEXT *tssContext); + +#endif
Signature · 5 lines
2.6.6 -- openssl-dev mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Re: [tpmdd-devel] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
Quoted 8 lines · James Bottomley
This patch adds RSA signing for TPM2 keys. There's a limitation to the way TPM2 does signing: it must recognise the OID for the signature.
That fails for the MD5-SHA1 signatures of the TLS/SSL certificate
verification protocol, so I'm usingRSA_Decryptfor both signing (encryption) and decryption ... meaning that this only works with TPM decryption keys. It is possible to use the prior code, which preserved the distinction of signing and decryption keys, but only at the expense of not being able to support SSL or TLS lower than 1.2
[Note, I haven't looked closely at TPM2, but TPM1.2 has a concept of
key usage, and I assume that is carried over in the below comments]
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
For TPM1.2 you could create a sign-only key with the TPM_SS_RSASSAPKCS1v15_DER mode and feed it arbitary NIDs - the TPM did not check the data to sign, AFAIK.
Ideally the user should be able to setup a sign-only key and the correct SSL negotiation parameters and have a working system, eg a sign-only key used with TLS 1.3 and ephemeral keyx should work.
e_tpm2.c line 510
Quoted 6 lines
e_tpm2.c new file +6
-0+/* this is slightly paradoxical that we're doing a Decrypt +* operation: the only material difference between decrypt and +* encrypt is where the padding is applied or checked, so if +* you apply your own padding up to the RSA block size and use +* TPM_ALG_NULL, which means no padding check, a decrypt +* operation effectively becomes an encrypt */
IIRC this duality is exactly why key usage exists, and why good crypto practice has been to forbid decrypt/encrypt on the same key.
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 20170103231126.GE29656-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
Quoted 17 lines · Jason Gunthorpe
Quoted 8 lines · James Bottomley
This patch adds RSA signing for TPM2 keys. There's a limitation to the way TPM2 does signing: it must recognise the OID for the signature.
That fails for the MD5-SHA1 signatures of the TLS/SSL certificate
verification protocol, so I'm usingRSA_Decryptfor both signing (encryption) and decryption ... meaning that this only works with TPM decryption keys. It is possible to use the prior code, which preserved the distinction of signing and decryption keys, but only at the expense of not being able to support SSL or TLS lower than 1.2[Note, I haven't looked closely at TPM2, but TPM1.2 has a concept of
key usage, and I assume that is carried over in the below comments]I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
Quoted 7 lines
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
For TPM1.2 you could create a sign-only key with the
TPM_SS_RSASSAPKCS1v15_DERmode and feed it arbitary NIDs - the TPM did not check the data to sign, AFAIK.
Unfortunately, it does check the data and even more than that. First, it checks that the size of the passed data matches the size of the digest of the specified hashing algorithm. And then it constructs the DigestInfo with that algorithm ID on its side. So, yes, you have to use a raw Decrypt to support cases like SHA1+MD5.
Quoted 17 lines
Ideally the user should be able to setup a sign-only key and the correct SSL negotiation parameters and have a working system, eg a sign-only key used with TLS 1.3 and ephemeral keyx should work.
e_tpm2.c line 510
Quoted 6 lines
e_tpm2.c new file +6
-0+/* this is slightly paradoxical that we're doing a Decrypt +* operation: the only material difference between decrypt and +* encrypt is where the padding is applied or checked, so if +* you apply your own padding up to the RSA block size and use +* TPM_ALG_NULL, which means no padding check, a decrypt +* operation effectively becomes an encrypt */ IIRC this duality is exactly why key usage exists, and why good crypto practice has been to forbid decrypt/encrypt on the same key.
Jason
Quoted 7 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [TrouSerS-tech] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
In reply to a message not in the archiveQuoted 11 lines · Jason Gunthorpe
Quoted 9 lines · James Bottomley
This patch adds RSA signing for TPM2 keys. There's a limitation to the way TPM2 does signing: it must recognise the OID for the signature. That fails for the MD5-SHA1 signatures of the TLS/SSL certificate verification protocol, so I'm using
RSA_Decryptfor both signing (encryption) and decryption ... meaning that this only works with TPM decryption keys. It is possible to use the prior code, which preserved the distinction of signing and decryption keys, but only at the expense of not being able to support SSL or TLS lower than 1.2
Quoted 2 lines
[Note, I haven't looked closely at TPM2, but TPM1.2 has a concept of
key usage, and I assume that is carried over in the below comments]
The TPM1.2 all uses the correct signing functions, the problem is only with 2.0.
Quoted 7 lines
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
The problem is the MD5-SHA1 signature of SSL and TLS < v1.2. This
cannot be performed by the TPM because it's not listed as a supported signature, so the choice is either to deprecate these protocols (not really viable since they're in wide use in old websites) or use decrypt to do the signatures. Once we get to the point of having to use decrypt, there's no reason to preserve the signing distinction since we never know when a key will be used to decrypt or sign.
Note that google took an alternative approach and modified their TSS to work with a MD5-SHA1 signature:
https://chromium-review.googlesource.com/#/c/420811/
But this requires a modification to the TPM as well, which we can't do.
Quoted 8 lines
For TPM1.2 you could create a sign-only key with the
TPM_SS_RSASSAPKCS1v15_DERmode and feed it arbitary NIDs - the TPM did not check the data to sign, AFAIK.Ideally the user should be able to setup a sign-only key and the correct SSL negotiation parameters and have a working system, eg a sign-only key used with TLS 1.3 and ephemeral keyx should work.
Quoted 12 lines
e_tpm2.c line 510
Quoted 9 lines
(quoted diff) +2
-0+ /* this is slightly paradoxical that we're doing a Decrypt + * operation: the only material difference between decryptand
(quoted diff) +1
-0+ * encrypt is where the padding is applied or checked, soif
(quoted diff) +1
-0+ * you apply your own padding up to the RSA block size anduse
e_tpm2.c new file +2
-0+* TPM_ALG_NULL, which means no padding check, a decrypt +* operation effectively becomes an encrypt */ IIRC this duality is exactly why key usage exists, and why good crypto practice has been to forbid decrypt/encrypt on the same key.
Given the signature restrictions, TPM 2.0 just can't be made to work with the older SSL/TLS protocols, so I'm opting to keep compatibility and not benefit from the distinction between signing and decryption keys.
James
Quoted 11 lines
Jason
---------------------------------------------------------------------
---------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TrouSerS-tech mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 1483485776.2464.50.camel-d9PhHud1JfjCXq6kfMZ53/[email protected]
Re: [TrouSerS-tech] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
Quoted 8 lines · James Bottomley
Quoted 7 lines
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
Quoted 7 lines
The problem is the MD5-SHA1 signature of SSL and TLS < v1.2. This
cannot be performed by the TPM because it's not listed as a supported signature, so the choice is either to deprecate these protocols (not really viable since they're in wide use in old websites) or use decrypt to do the signatures. Once we get to the point of having to use decrypt, there's no reason to preserve the signing distinction since we never know when a key will be used to decrypt or sign.
I'm not disputing your analysis, just remarking that it seem very undesirable to ban *all* sign-only keys just to support a single legacy SSL configuration.
This is why I suggest looking at the sign being requested and using the sign path if it is *possible*, otherwise requiring a key with the broader key usage.
Not everything is SSL - openssh uses these routines too and it should be able to use the sign only key type without a limitation?
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 20170103234053.GA32185-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [TrouSerS-tech] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
Quoted 19 lines · Jason Gunthorpe
Quoted 9 lines · James Bottomley
Quoted 8 lines
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
Quoted 8 lines
The problem is the MD5-SHA1 signature of SSL and TLS < v1.2. This
cannot be performed by the TPM because it's not listed as a supported signature, so the choice is either to deprecate these protocols (not really viable since they're in wide use in old websites) or use decrypt to do the signatures. Once we get to the point of having to use decrypt, there's no reason to preserve the signing distinction since we never know when a key will be used to decrypt or sign.
Quoted 3 lines
I'm not disputing your analysis, just remarking that it seem very undesirable to ban *all* sign-only keys just to support a single legacy SSL configuration.
It's not just a single situation. MD5-SHA1 is where it will fall apart on backwards compatibility but my current TPM doesn't understand anything other than sha1 or sha256, so it wouldn't allow more state of the art algorithms like sha224, sha384 or sha512 either.
Quoted 3 lines
This is why I suggest looking at the sign being requested and using the sign path if it is *possible*, otherwise requiring a key with the broader key usage.
It's a trade off: the user configuration nightmare: how does an ordinary user know what type of TPM key they need ... they'll need to know what their TPM is capable of and what signatures they're likely to need. VS the benefits of having single use keys.
I'm just not sure I see enough benefits to trying to preserve the decrypt vs sign distinction, whereas I do see the floods of complaints from users who got it wrong or think it should work as advertised.
Quoted 2 lines
Not everything is SSL - openssh uses these routines too and it should be able to use the sign only key type without a limitation?
Agreed that openssh only has forward compatibility problems, but it still has them thanks to the newer algorithm problem.
Actually, the next problem would be gnome-keyring. It does openssl signatures and fishing the algorithm type out by the time
James
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 1483489026.2464.76.camel-d9PhHud1JfjCXq6kfMZ53/[email protected]
Re: [TrouSerS-tech] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
Quoted 10 lines · James Bottomley
Quoted 3 lines · Jason Gunthorpe
I'm not disputing your analysis, just remarking that it seem very undesirable to ban *all* sign-only keys just to support a single legacy SSL configuration.
It's not just a single situation. MD5-SHA1 is where it will fall apart on backwards compatibility but my current TPM doesn't understand anything other than sha1 or sha256, so it wouldn't allow more state of the art algorithms like sha224, sha384 or sha512 either.
Okay, yes, that is horrible :( If it is that bad it might not be worth the effort..
Quoted 3 lines
I'm just not sure I see enough benefits to trying to preserve the decrypt vs sign distinction, whereas I do see the floods of complaints from users who got it wrong or think it should work as advertised.
I probably wouldn't change the process for key generation - make the tools default to decrypt keys and have an advanced option for sign-only.
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 20170104004217.GA390-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
add TPM2 version of create_tpm2_key and libtpm2.so engine -> Hash algoritms
Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote on 01/03/2017 07:42:17 PM:
Quoted 6 lines
Quoted 3 lines
... but my current TPM doesn't understand
anything other than sha1 or sha256, so it wouldn't allow more state of the art algorithms like sha224, sha384 or sha512 either.Okay, yes, that is horrible :( If it is that bad it might not be worth the effort.
The place to ask for new algorithms is the TCG's Device Driver WG. It's an odd WG name, but this is the WG where the TPM mandatory algorithms are specified.
A real, commercial use case will likely be an effective argument, since these are resource constrained and cost sensitive.
SHA-384 and SHA-512 are currently optional, which traditionally means they won't be implemented.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
A message that is not in the archive (sent off-list or not yet received): OF69E51003.6475FD35-ON8525809E.00669529-8525809E.0067575C-8eTO7WVQ4XIsd+ienQ86orlN3bxYEBpz@public.gmane.org
Re: add TPM2 version of create_tpm2_key and libtpm2.so engine -> Hash algoritms
Quoted 10 lines · Kenneth Goldman
Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote on 01/03/2017 07:42:17 PM:
Quoted 2 lines
Quoted 2 lines
... but my current TPM doesn't understand
anything other than sha1 or sha256, so it wouldn't allow more stateof
Quoted 4 lines
Quoted 1 line
the art algorithms like sha224, sha384 or sha512 either.
Okay, yes, that is horrible :( If it is that bad it might not be worth the effort.
Quoted 7 lines
The place to ask for new algorithms is the TCG's Device Driver WG. It's an odd WG name, but this is the WG where the TPM mandatory algorithms are specified. A real, commercial use case will likely be an effective argument, since these are resource constrained and cost sensitive. SHA-384 and SHA-512 are currently optional, which traditionally means they won't be implemented.
We don't need the algorithm in the TPM. We just need to be able to RSA sign an arbitary OID + externally computed hash like TPM 1.2 could.
What is the recommended way to create a key with a sign-only intent that can be used with arbitary OID + computed hash?
James is proposing using the Decrypt op to do this job.
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [Ibmtpm20tss-users] [tpmdd-devel] add TPM2 version of create_tpm2_key and libtpm2.so engine -> Hash algoritms
Quoted 22 lines · Jason Gunthorpe
Quoted 13 lines · Kenneth Goldman
Jason Gunthorpe <[email protected]> wrote on
01/03/2017
07:42:17 PM:Quoted 2 lines
Quoted 2 lines
... but my current TPM doesn't understand anything other than sha1 or sha256, so it wouldn't allow
more state
ofQuoted 3 lines
Quoted 1 line
the art algorithms like sha224, sha384 or sha512 either.
Okay, yes, that is horrible :( If it is that bad it might not
be worth
Quoted 1 line
the effort.
Quoted 7 lines
The place to ask for new algorithms is the TCG's Device Driver WG. It's an odd WG name, but this is the WG where the TPM mandatory algorithms are specified. A real, commercial use case will likely be an effective argument, since these are resource constrained and cost sensitive. SHA-384 and SHA-512 are currently optional, which traditionally means they won't be implemented.
Quoted 6 lines
We don't need the algorithm in the TPM. We just need to be able to RSA sign an arbitary OID + externally computed hash like TPM 1.2 could.
What is the recommended way to create a key with a sign-only intent that can be used with arbitary OID + computed hash?
There isn't one. TPM_ALG_NULL is illegal for sign operations. The Part 1 Architecture Guide (version 1.16 lists all the potentially supported OIDs in section B.6). The idea is that the TPM is supposed to be able to validate that you're not causing it to generate a nefarious signature, so you pass in the hash alone along with the algorithm and it validates the legality of the hash and then returns back the OID prepended hash signed by the key.
Quoted 1 line
James is proposing using the Decrypt op to do this job.
I believe the TCG has decided this is the only way to sign arbitrary data.
James
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): 1483559121.2561.67.camel-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Re: [Ibmtpm20tss-users] add TPM2 version of create_tpm2_key and libtpm2.so engine -> Hash algoritms
James Bottomley <[email protected]> wrote on 01/04/2017 02:45:21 PM:
Quoted 4 lines
Quoted 1 line
James is proposing using the Decrypt op to do this job.
I believe the TCG has decided this is the only way to sign arbitrary data.
My suspicion is that this was an omission, not a decision. In fact, Part 1 explicitly describes a caller provided OID. It just wasn't implemented - yet.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
A message that is not in the archive (sent off-list or not yet received): 20170104185434.GA12614-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: add TPM2 version of create_tpm2_key and libtpm2.so engine -> Hash algoritms
Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote on 01/04/2017 01:54:34 PM:
Quoted 5 lines
We don't need the algorithm in the TPM. We just need to be able to RSA sign an arbitary OID + externally computed hash like TPM 1.2 could.
What is the recommended way to create a key with a sign-only intent that can be used with arbitary OID + computed hash?
Probably the long-term correct way is to go to the TCG and ask for a new feature. However, this is (often certified) hardware, so the turn around is likely to be a year.
Quoted 1 line
James is proposing using the Decrypt op to do this job.
That works. I've coded it. However, the key doesn't have "sign only intent", in that the caller not only provides the OID but also provides the padding.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
Re: [tpmdd-devel] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
In reply to Jason GunthorpeQuoted 17 lines · Jason Gunthorpe
Quoted 8 lines · James Bottomley
Quoted 7 lines
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
IMHO the best way to do this is to look at the sign operation openssl is trying to do and see if it can be sent down the sign path to the TPM. Only if that fails should the decrypt path be used.
Quoted 7 lines
The problem is the MD5-SHA1 signature of SSL and TLS < v1.2. This
cannot be performed by the TPM because it's not listed as a supported signature, so the choice is either to deprecate these protocols (not really viable since they're in wide use in old websites) or use decrypt to do the signatures. Once we get to the point of having to use decrypt, there's no reason to preserve the signing distinction since we never know when a key will be used to decrypt or sign.
Quoted 3 lines
I'm not disputing your analysis, just remarking that it seem very undesirable to ban *all* sign-only keys just to support a single legacy SSL configuration.
Could this configuration just marked as unsupported, or not?
Quoted 8 lines
This is why I suggest looking at the sign being requested and using the sign path if it is *possible*, otherwise requiring a key with the broader key usage.
Not everything is SSL - openssh uses these routines too and it should be able to use the sign only key type without a limitation?
Jason
/Jarkko
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [Ibmtpm20tss-users] [TrouSerS-tech] [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
In reply to a message not in the archiveTrimmed the CC list a bit. Where does this discussion really belong? Trousers is for TPM 1.2,
and it's not a TSS or TPM device driver issue.
If you're all TCG members, the TCG's TPM WG is the real place to go if you want to get
something fixed.
James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/[email protected]> wrote on 01/03/2017 06:22:56 PM:
Quoted 10 lines
Quoted 3 lines
[Note, I haven't looked closely at TPM2, but TPM1.2 has a concept of
key usage, and I assume that is carried over in the below comments]The TPM1.2 all uses the correct signing functions, the problem is only with 2.0.
Quoted 3 lines
I think it is very important to natively support the sign-only key usage restriction. TPM1.2 goes so far as to declare keys that can be used for arbitary decrypt as 'legacy do not use'.
TPM 2.0 has several features to support this:
- Signing keys, a usage restriction that can only sign.
- Policy only, with a policy restricted to specific commands, e.g., Quote or Sign.
- Restricted keys, that have a fixed algorithm and can only sign TPM generated data.
What it doesn't have is the ability (for a signing key) to prepend a caller
specified OID and padding.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
Re: [PATCH 1/1] add TPM2 version of create_tpm2_key and libtpm2.so engine
In reply to James BottomleyQuoted 7 lines · James Bottomley
Note that google took an alternative approach and modified their TSS to work with a MD5-SHA1 signature:
https://chromium-review.googlesource.com/#/c/420811/
But this requires a modification to the TPM as well, which we can't do.
Right. It's not a TSS issue. Modification is futile. It just passes parameters on to the TPM. The place for this change is the TCG's TPM work group.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi