mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 18:35:44 +00:00
TinyCrypt PK parse: Move TC-based EC public key parsing code-block
Keep code-paths handling legacy-ECC vs. TinyCrypt together for better readability.
This commit is contained in:
parent
3bef643987
commit
8cf2f5e466
|
@ -718,18 +718,18 @@ int mbedtls_pk_parse_subpubkey( unsigned char **p, const unsigned char *end,
|
|||
if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||
if( pk_alg == MBEDTLS_PK_ECKEY )
|
||||
{
|
||||
ret = pk_get_ueccpubkey( p, end, (uint8_t*) pk->pk_ctx );
|
||||
} else
|
||||
#endif /* MBEDTLS_USE_TINYCRYPT */
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
if( pk_alg == MBEDTLS_PK_RSA )
|
||||
{
|
||||
ret = pk_get_rsapubkey( p, end, mbedtls_pk_rsa( *pk ) );
|
||||
} else
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||
if( pk_alg == MBEDTLS_PK_ECKEY )
|
||||
{
|
||||
ret = pk_get_ueccpubkey( p, end, (uint8_t*) pk->pk_ctx );
|
||||
} else
|
||||
#else /* MBEDTLS_USE_TINYCRYPT */
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
if( pk_alg == MBEDTLS_PK_ECKEY_DH || pk_alg == MBEDTLS_PK_ECKEY )
|
||||
{
|
||||
|
@ -738,6 +738,7 @@ int mbedtls_pk_parse_subpubkey( unsigned char **p, const unsigned char *end,
|
|||
ret = pk_get_ecpubkey( p, end, mbedtls_pk_ec( *pk ) );
|
||||
} else
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
#endif /* MBEDTLS_USE_TINYCRYPT */
|
||||
ret = MBEDTLS_ERR_PK_UNKNOWN_PK_ALG;
|
||||
|
||||
if( ret == 0 && *p != end )
|
||||
|
|
Loading…
Reference in a new issue