mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 18:35:42 +01:00
Compute public key if absent when reading EC key
This commit is contained in:
parent
4fc090af9c
commit
ff29f9c825
@ -513,7 +513,7 @@ static int pk_parse_key_sec1_der( ecp_keypair *eck,
|
||||
}
|
||||
|
||||
/*
|
||||
* Is 'publickey' present?
|
||||
* Is 'publickey' present? If not, create it from the private key.
|
||||
*/
|
||||
if( ( ret = asn1_get_tag( &p, end, &len,
|
||||
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 1 ) ) == 0 )
|
||||
@ -535,6 +535,12 @@ static int pk_parse_key_sec1_der( ecp_keypair *eck,
|
||||
ecp_keypair_free( eck );
|
||||
return( POLARSSL_ERR_PK_KEY_INVALID_FORMAT + ret );
|
||||
}
|
||||
else if( ( ret = ecp_mul( &eck->grp, &eck->Q, &eck->d, &eck->grp.G,
|
||||
NULL, NULL ) ) != 0 )
|
||||
{
|
||||
ecp_keypair_free( eck );
|
||||
return( POLARSSL_ERR_PK_KEY_INVALID_FORMAT + ret );
|
||||
}
|
||||
|
||||
if( ( ret = ecp_check_privkey( &eck->grp, &eck->d ) ) != 0 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user