tpm2-software / tpm2-tools

The source repository for the Trusted Platform Module (TPM2.0) tools
https://tpm2-software.github.io
716 stars 378 forks source link

ECC algorithm is not working in tpm2_createprimary command. #1257

Closed Nilesh-Deshmukh closed 5 years ago

Nilesh-Deshmukh commented 5 years ago

Hi,

I am using the TPM SLB 9665TT2.0 Infineon ’s chip which supports ECC algorithm. https://www.infineon.com/cms/en/product/security-smart-card-solutions/optiga-embedded-security-solutions/optiga-tpm/slb-9665tt2.0/

When I try the create the primary key using ECC algorithm, command failed with below error; root@sjm-Default-string:/home/sjm# tpm2_createprimary -A e -g sha256 -G ecc -o primary.context ERROR: Tss2_Sys_CreatePrimary(0x2CA) - tpm:parameter(2):the type of the value is not appropriate for the use ERROR: Unable to run tpm2_createprimary

tool version is 3.0.2

root@sjm-Default-string:/home/sjm# tpm2_createprimary -v tool="tpm2_createprimary" version="3.0.2-685-g119c29e" tctis="dynamic" tcti-default=tabrmd dlclose=enabled

Thanks and Regards, Nilesh

williamcroberts commented 5 years ago

Actually your tool version is not 3.0.2. Due to the way the branching is occuring and how git describe works the output is a little tricky. A clean release wont have those details, the most important thing is the git sha at the end your checked out on.

Since it's a primary object, -G "ecc" defaults to: TPM2_ECC_NIST_P256

it's the same as doing -G ecc256

You can get supported curves from your TPM by doing:

$ ./tools/tpm2_getcap -c ecc-curves
TPM2_ECC_NIST_P256: 0x3
TPM2_ECC_NIST_P384: 0x4
TPM2_ECC_BN_P256: 0x10

Please make sure your curve is supported. If the default selection doesn't work, specify the algorithm you need.

arg curve
ecc192 TPM2_ECC_NIST_P192
ecc224 TPM2_ECC_NIST_P224
ecc256 TPM2_ECC_NIST_P256
ecc384 TPM2_ECC_NIST_P384
ecc521 TPM2_ECC_NIST_P521

These types of support questions are also better asked on the mailing list. Since their is no known bug, I am closing this. We try to keep only bugs in the tracker and support is handled via the mailing list. This is all covered in the readme.