Hi Messias,
Our new wolfTPM version 2.2.0 has fix for this error and improved attestation examples.
https://github.com/wolfSSL/wolfTPM/releases/tag/v2.2.0
Make/ActivateCredential examples can now work with EK using the new "-eh" option.
Please find example output below:
dimitartomov@Dimitars-MacBook-Pro wolfTPM % ./examples/keygen/keygen -eh
TPM2.0 Key generation example
Key Blob: keyblob.bin
Algorithm: RSA
Template: AIK
Use Parameter Encryption: NULL
RSA AIK template
Creating new RSA key...
New key created and loaded (pub 280, priv 222 bytes)
Wrote 508 bytes to keyblob.bin
Wrote 320 bytes to ek.pub
Wrote AK Name digest
dimitartomov@Dimitars-MacBook-Pro wolfTPM % ./examples/attestation/make_credential -eh
Using keys under the Endorsement Hierarchy
Demo how to create a credential challenge for remote attestation
Credential will be stored in cred.blob
wolfTPM2_Init: success
Reading 320 bytes from ek.pub
Reading the private part of the key
Public key for encryption loaded
Read AK Name digest
TPM2_MakeCredential success
Wrote credential blob and secret to cred.blob, 648 bytes
dimitartomov@Dimitars-MacBook-Pro wolfTPM % ./examples/attestation/activate_credential -eh
Use Endorsement Key
Demo how to create a credential blob for remote attestation
wolfTPM2_Init: success
Credential will be read from cred.blob
EK loaded
Reading 508 bytes from keyblob.bin
Reading the private part of the key
AK loaded at 0x80000001
Read credential blob and secret from cred.blob, 648 bytes
TPM2_ActivateCredential success