mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-23 02:55:20 +00:00
TinyCrypt PK parse: Simplify TinyCrypt public key parsing
This commit is contained in:
parent
aebffdd363
commit
68d5478d8d
|
@ -550,8 +550,7 @@ static int pk_get_ecpubkey( unsigned char **p, const unsigned char *end,
|
|||
static int uecc_public_key_read_binary( uint8_t *pt,
|
||||
const unsigned char *buf, size_t ilen )
|
||||
{
|
||||
|
||||
if( ilen < 1 )
|
||||
if( ilen != 2 * NUM_ECC_BYTES + 1 )
|
||||
return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
|
||||
|
||||
/* We are not handling the point at infinity. */
|
||||
|
@ -559,9 +558,6 @@ static int uecc_public_key_read_binary( uint8_t *pt,
|
|||
if( buf[0] != 0x04 )
|
||||
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
||||
|
||||
if( ilen != 2 * NUM_ECC_BYTES + 1 )
|
||||
return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
|
||||
|
||||
memcpy( pt, buf + 1, ilen - 1);
|
||||
|
||||
return( 0 );
|
||||
|
|
Loading…
Reference in a new issue