Fix indentation and add goto cleanup; stmt
diff --git a/library/md.c b/library/md.c
index 625b34c..cec4243 100644
--- a/library/md.c
+++ b/library/md.c
@@ -436,7 +436,8 @@
goto cleanup;
if( ( ret = mbedtls_md_hmac_update( &ctx, input, ilen ) ) != 0 )
goto cleanup;
- ret = mbedtls_md_hmac_finish( &ctx, output );
+ if( ( ret = mbedtls_md_hmac_finish( &ctx, output ) ) != 0 )
+ goto cleanup;
cleanup:
mbedtls_md_free( &ctx );
diff --git a/library/ripemd160.c b/library/ripemd160.c
index 0fc12a1..bf5058f 100644
--- a/library/ripemd160.c
+++ b/library/ripemd160.c
@@ -378,11 +378,11 @@
ret = mbedtls_ripemd160_update_ext( ctx, ripemd160_padding, padn );
if( ret != 0 )
- return( ret );
+ return( ret );
ret = mbedtls_ripemd160_update_ext( ctx, msglen, 8 );
if( ret != 0 )
- return( ret );
+ return( ret );
PUT_UINT32_LE( ctx->state[0], output, 0 );
PUT_UINT32_LE( ctx->state[1], output, 4 );
diff --git a/library/sha256.c b/library/sha256.c
index fb03cd1..0e24d69 100644
--- a/library/sha256.c
+++ b/library/sha256.c
@@ -320,10 +320,10 @@
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
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 )
- return( ret );
+ return( ret );
PUT_UINT32_BE( ctx->state[0], output, 0 );
PUT_UINT32_BE( ctx->state[1], output, 4 );