Re: [PATCH v7 5/5] keys: asymmetric: Add tpm2_key_ecdsa

2024-05-28 Thread Jarkko Sakkinen
On Wed May 29, 2024 at 2:15 AM EEST, Stefan Berger wrote: > > + ptr[TPM2_KEY_ECDSA_SIG_R_TAG] = 0x02; /* INTEGER */ > > + ptr[TPM2_KEY_ECDSA_SIG_R_SIZE] = SHA256_DIGEST_SIZE + r_0; > > The size of the signature has nothing to do with the size of the hash. > SHA256_DIGEST_SIZE (32) happens to m

Re: [PATCH v7 5/5] keys: asymmetric: Add tpm2_key_ecdsa

2024-05-28 Thread Stefan Berger
On 5/28/24 17:08, Jarkko Sakkinen wrote: * Asymmetric TPM2 ECDSA key with signing and verification. * Enabled with CONFIG_ASYMMETRIC_TPM2_KEY_ECDSA_SUBTYPE. Cc: Stefan Berger Signed-off-by: Jarkko Sakkinen --- v7: * Rewrote the signature encoder. * Added the missing sha256() call to the sig

Re: [PATCH v7 5/5] keys: asymmetric: Add tpm2_key_ecdsa

2024-05-28 Thread Jarkko Sakkinen
On Wed May 29, 2024 at 12:42 AM EEST, Jarkko Sakkinen wrote: > On Wed May 29, 2024 at 12:08 AM EEST, Jarkko Sakkinen wrote: > > + /* Encode the ASN.1 signature: */ > > +#define TPM2_KEY_ECDSA_SIG_SIZE(2 + 2 * (2 + > > SHA256_DIGEST_SIZE) + r_0 + s_0) > > + pr_info("sig_size=%d\n",

Re: [PATCH v7 5/5] keys: asymmetric: Add tpm2_key_ecdsa

2024-05-28 Thread Jarkko Sakkinen
On Wed May 29, 2024 at 12:08 AM EEST, Jarkko Sakkinen wrote: > + /* Encode the ASN.1 signature: */ > +#define TPM2_KEY_ECDSA_SIG_SIZE (2 + 2 * (2 + > SHA256_DIGEST_SIZE) + r_0 + s_0) > + pr_info("sig_size=%d\n", TPM2_KEY_ECDSA_SIG_SIZE); > + ptr[0] = 0x30; /* SEQUENCE */ >