Cómo solucionar tpm2_ptool tpm:parameter(2):curve not supported

Problema

Estás intentando crear una clave usando tpm2_ptool con un comando como

fix_tpm2_ptool.sh
tpm2_ptool addkey --label=ssh --userpin=zeigh6iraewich1aengip6Dee2bait --algorithm=ecc384

y obtienes el error tpm:parameter(2):curve not supported:

tpm2_ptool_curve_not_supported.txt
Traceback (most recent call last):
  File "/usr/bin/tpm2_ptool", line 33, in <module>
    sys.exit(load_entry_point('tpm2-pkcs11-tools==1.33.7', 'console_scripts', 'tpm2_ptool')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/tpm2_ptool.py", line 26, in main
    commandlet.init('A tool for manipulating the tpm2-pkcs11 database')
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/command.py", line 102, in init
    commandlet.get()[d['which']](d)
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 295, in __call__
    objects = super(AddKeyCommand, self).__call__(args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 202, in __call__
    tertiarypriv, tertiarypub, tertiarypubdata = self.new_key_create(
                                                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 289, in new_key_create
    tertiarypriv, tertiarypub, tertiarypubdata = tpm2.create(
                                                 ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/tpm2.py", line 226, in create
    raise RuntimeError("Could not execute tpm2_create: %s" %
RuntimeError: Could not execute tpm2_create: b'WARNING:esys:src/tss2-esys/api/Esys_Create.c:399:Esys_Create_Finish() Received TPM Error \nERROR:esys:src/tss2-esys/api/Esys_Create.c:134:Esys_Create() Esys Finish ErrorCode (0x000002e6) \nERROR: Esys_Create(0x2E6) - tpm:parameter(2):curve not supported\nERROR: Unable to run tpm2_create\n'

Solución

Tu implementación TPM específica no soporta la curva que estás intentando usar. Puedes averiguar qué curvas (elípticas)

Mientras que tpm2_ptool soporta las siguientes curvas:

  • ecc224
  • ecc256
  • ecc384
  • ecc521

tu implementación TPM (ya sea un TPM físico o un TPM de software) puede no soportar todas ellas.

Típicamente, cuando tu TPM no soporta p. ej. una curva de 384 bit, tampoco soportará ninguna curva con un conteo de bits mayor. Por lo tanto, recomiendo probar la siguiente curva más pequeña.

try_ecc256.sh
tpm2_ptool addkey --label=ssh --userpin=zeigh6iraewich1aengip6Dee2bait --algorithm=ecc256

Según Dell, los TPMs compatibles con TPM 2.0 deben soportar al menos ecc256.

Continúa probando curvas más pequeñas hasta que encuentres una que funcione. La mejor manera de averiguar qué curvas son soportadas es probarlas todas, intentar buscar documentación usualmente toma mucho más tiempo y a menudo no tiene éxito en absoluto.


Echa un vistazo a artículos similares por categoría: Criptografía