Skip to content

Commit

Permalink
key: move to noalg keys to support different hashing algos
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Linderud <morten@linderud.pw>
  • Loading branch information
Foxboron committed Feb 18, 2024
1 parent 20b3710 commit 7403dab
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,7 @@ func createECCKey(ecc tpm2.TPMECCCurve, sha tpm2.TPMAlgID) tpm2.TPM2B[tpm2.TPMTP
&tpm2.TPMSECCParms{
CurveID: ecc,
Scheme: tpm2.TPMTECCScheme{
Scheme: tpm2.TPMAlgECDSA,
Details: tpm2.NewTPMUAsymScheme(
tpm2.TPMAlgECDSA,
&tpm2.TPMSSigSchemeECDSA{
HashAlg: tpm2.TPMAlgSHA256,
},
),
Scheme: tpm2.TPMAlgNull,
},
},
),
Expand All @@ -319,13 +313,7 @@ func createRSAKey(bits tpm2.TPMKeyBits, sha tpm2.TPMAlgID) tpm2.TPM2B[tpm2.TPMTP
tpm2.TPMAlgRSA,
&tpm2.TPMSRSAParms{
Scheme: tpm2.TPMTRSAScheme{
Scheme: tpm2.TPMAlgRSASSA,
Details: tpm2.NewTPMUAsymScheme(
tpm2.TPMAlgRSASSA,
&tpm2.TPMSSigSchemeRSASSA{
HashAlg: tpm2.TPMAlgSHA256,
},
),
Scheme: tpm2.TPMAlgNull,
},
KeyBits: bits,
},
Expand Down Expand Up @@ -480,13 +468,7 @@ func ImportKey(tpm transport.TPMCloser, pk any, pin, comment []byte) (*Key, erro
&tpm2.TPMSECCParms{
CurveID: curveid,
Scheme: tpm2.TPMTECCScheme{
Scheme: tpm2.TPMAlgECDSA,
Details: tpm2.NewTPMUAsymScheme(
tpm2.TPMAlgECDSA,
&tpm2.TPMSSigSchemeECDSA{
HashAlg: tpm2.TPMAlgSHA256,
},
),
Scheme: tpm2.TPMAlgNull,
},
},
),
Expand Down Expand Up @@ -523,13 +505,7 @@ func ImportKey(tpm transport.TPMCloser, pk any, pin, comment []byte) (*Key, erro
tpm2.TPMAlgRSA,
&tpm2.TPMSRSAParms{
Scheme: tpm2.TPMTRSAScheme{
Scheme: tpm2.TPMAlgRSASSA,
Details: tpm2.NewTPMUAsymScheme(
tpm2.TPMAlgRSASSA,
&tpm2.TPMSSigSchemeRSASSA{
HashAlg: tpm2.TPMAlgSHA256,
},
),
Scheme: tpm2.TPMAlgNull,
},
KeyBits: 2048,
},
Expand Down

0 comments on commit 7403dab

Please sign in to comment.