Fix indentation and add goto cleanup; stmt

This commit is contained in:
Andres Amaya Garcia 2017-07-21 14:21:53 +01:00
parent b2b063ff35
commit aa464ef23a
3 changed files with 6 additions and 5 deletions

View File

@ -436,7 +436,8 @@ int mbedtls_md_hmac( const mbedtls_md_info_t *md_info,
goto cleanup; goto cleanup;
if( ( ret = mbedtls_md_hmac_update( &ctx, input, ilen ) ) != 0 ) if( ( ret = mbedtls_md_hmac_update( &ctx, input, ilen ) ) != 0 )
goto cleanup; goto cleanup;
ret = mbedtls_md_hmac_finish( &ctx, output ); if( ( ret = mbedtls_md_hmac_finish( &ctx, output ) ) != 0 )
goto cleanup;
cleanup: cleanup:
mbedtls_md_free( &ctx ); mbedtls_md_free( &ctx );

View File

@ -378,11 +378,11 @@ int mbedtls_ripemd160_finish_ext( mbedtls_ripemd160_context *ctx,
ret = mbedtls_ripemd160_update_ext( ctx, ripemd160_padding, padn ); ret = mbedtls_ripemd160_update_ext( ctx, ripemd160_padding, padn );
if( ret != 0 ) if( ret != 0 )
return( ret ); return( ret );
ret = mbedtls_ripemd160_update_ext( ctx, msglen, 8 ); ret = mbedtls_ripemd160_update_ext( ctx, msglen, 8 );
if( ret != 0 ) if( ret != 0 )
return( ret ); return( ret );
PUT_UINT32_LE( ctx->state[0], output, 0 ); PUT_UINT32_LE( ctx->state[0], output, 0 );
PUT_UINT32_LE( ctx->state[1], output, 4 ); PUT_UINT32_LE( ctx->state[1], output, 4 );

View File

@ -320,10 +320,10 @@ int mbedtls_sha256_finish_ext( mbedtls_sha256_context *ctx,
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
if( ( ret = mbedtls_sha256_update_ext( ctx, sha256_padding, padn ) ) != 0 ) if( ( ret = mbedtls_sha256_update_ext( ctx, sha256_padding, padn ) ) != 0 )
return( ret ); return( ret );
if( ( ret = mbedtls_sha256_update_ext( ctx, msglen, 8 ) ) != 0 ) if( ( ret = mbedtls_sha256_update_ext( ctx, msglen, 8 ) ) != 0 )
return( ret ); return( ret );
PUT_UINT32_BE( ctx->state[0], output, 0 ); PUT_UINT32_BE( ctx->state[0], output, 0 );
PUT_UINT32_BE( ctx->state[1], output, 4 ); PUT_UINT32_BE( ctx->state[1], output, 4 );