Fixup: Minor style corrections around use of TinyCrypt

This commit is contained in:
Hanno Becker 2019-08-20 13:04:30 +01:00
parent e8f1448306
commit ad353f289b
2 changed files with 10 additions and 5 deletions

View File

@ -552,10 +552,13 @@ static int uecc_eckey_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
((void) md_alg); ((void) md_alg);
p = (unsigned char*) sig; p = (unsigned char*) sig;
if( (ret = extract_ecdsa_sig( &p, sig + sig_len, signature, NUM_ECC_BYTES ) ) != 0 ) ret = extract_ecdsa_sig( &p, sig + sig_len, signature, NUM_ECC_BYTES );
if( ret != 0 )
return( ret ); return( ret );
if( (ret = uECC_verify( (uint8_t *) ctx, hash, (unsigned) hash_len, signature, uecc_curve ) ) != 0 ) ret = uECC_verify( (uint8_t *) ctx, hash,
(unsigned) hash_len, signature, uecc_curve );
if( ret != 0 )
return( MBEDTLS_ERR_PK_SIG_LEN_MISMATCH ); return( MBEDTLS_ERR_PK_SIG_LEN_MISMATCH );
return( ret ); return( ret );

View File

@ -554,7 +554,7 @@ static int uecc_public_key_read_binary( uint8_t *pt,
if( ilen < 1 ) if( ilen < 1 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY ); return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
//We are not handling the infinity point right now /* We are not handling the point at infinity. */
if( buf[0] != 0x04 ) if( buf[0] != 0x04 )
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE ); return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
@ -917,7 +917,7 @@ static int pk_parse_key_sec1_der( mbedtls_uecc_keypair *keypair,
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 )
return( MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + ret ); return( MBEDTLS_ERR_PK_KEY_INVALID_FORMAT + ret );
memcpy(keypair->private_key, p, len); memcpy( keypair->private_key, p, len );
p += len; p += len;
@ -962,7 +962,9 @@ static int pk_parse_key_sec1_der( mbedtls_uecc_keypair *keypair,
if( ( ret = uecc_public_key_read_binary( keypair->public_key, if( ( ret = uecc_public_key_read_binary( keypair->public_key,
(const unsigned char *) p, end2 - p ) ) == 0 ) (const unsigned char *) p, end2 - p ) ) == 0 )
{
pubkey_done = 1; pubkey_done = 1;
}
else else
{ {
/* /*