crypt_and_hash: check MAC earlier

This commit is contained in:
Manuel Pégourié-Gonnard 2013-11-25 17:55:17 +01:00 committed by Paul Bakker
parent da1ff38715
commit 0f2eacbd09

View File

@ -455,17 +455,6 @@ int main( int argc, char *argv[] )
}
}
/*
* Write the final block of data
*/
cipher_finish( &cipher_ctx, output, &olen );
if( fwrite( output, 1, olen, fout ) != olen )
{
fprintf( stderr, "fwrite(%ld bytes) failed\n", (long) olen );
goto exit;
}
/*
* Verify the message authentication code.
*/
@ -488,6 +477,17 @@ int main( int argc, char *argv[] )
"or file corrupted.\n" );
goto exit;
}
/*
* Write the final block of data
*/
cipher_finish( &cipher_ctx, output, &olen );
if( fwrite( output, 1, olen, fout ) != olen )
{
fprintf( stderr, "fwrite(%ld bytes) failed\n", (long) olen );
goto exit;
}
}
ret = 0;