mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2024-09-20 11:20:08 +00:00
Fix cofactor return with cvc.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
d09a7cf9c8
commit
8fe2677a56
@ -109,7 +109,13 @@ size_t asn1_cvc_public_key_ecdsa(mbedtls_ecdsa_context *ecdsa, uint8_t *buf, siz
|
||||
size_t y_new_size = 0;
|
||||
*p++ = 0x86; p += format_tlv_len(y_size, p); mbedtls_ecp_point_write_binary(&ecdsa->grp, &ecdsa->Q, MBEDTLS_ECP_PF_UNCOMPRESSED, &y_new_size, p, y_size); p += y_size;
|
||||
//cofactor
|
||||
*p++ = 0x87; p += format_tlv_len(c_size, p); *p++ = 1;
|
||||
*p++ = 0x87; p += format_tlv_len(c_size, p);
|
||||
if (ecdsa->grp.id == MBEDTLS_ECP_DP_CURVE448)
|
||||
*p++ = 4;
|
||||
else if (ecdsa->grp.id == MBEDTLS_ECP_DP_CURVE25519)
|
||||
*p++ = 8;
|
||||
else
|
||||
*p++ = 1;
|
||||
return tot_len;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user