Fix gcrypt final() function backend call.
authorMilan Broz <gmazyland@gmail.com>
Mon, 25 Jul 2011 21:15:41 +0000 (21:15 +0000)
committerMilan Broz <gmazyland@gmail.com>
Mon, 25 Jul 2011 21:15:41 +0000 (21:15 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@580 36d66b0a-2a48-0410-832c-cd162a569da5

lib/crypto_backend/crypto_gcrypt.c

index 2c9e72d..072faeb 100644 (file)
@@ -139,9 +139,9 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        if (!hash)
                return -EINVAL;
 
+       memcpy(buffer, hash, length);
        crypt_hash_restart(ctx);
 
-       memcpy(buffer, hash, length);
        return 0;
 }
 
@@ -214,9 +214,9 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        if (!hash)
                return -EINVAL;
 
+       memcpy(buffer, hash, length);
        crypt_hmac_restart(ctx);
 
-       memcpy(buffer, hash, length);
        return 0;
 }