From: Michael Vrable <mvrable@cs.ucsd.edu>
Date: Mon, 18 Oct 2010 21:48:57 +0000 (-0700)
Subject: The signature on log items should not extend to the pointer locations.
X-Git-Url: http://git.vrable.net/?a=commitdiff_plain;h=8d1fc55062e6aba768bf398ad0b1161e949eb662;p=bluesky.git

The signature on log items should not extend to the pointer locations.

This allows the cleaner to rewrite the pointers without invalidating the
signature.
---

diff --git a/bluesky/crypto.c b/bluesky/crypto.c
index 89f6b12..fd47491 100644
--- a/bluesky/crypto.c
+++ b/bluesky/crypto.c
@@ -177,7 +177,7 @@ void bluesky_crypt_block_encrypt(gchar *cloud_block, size_t len,
     }
 
     bluesky_crypt_hmac((char *)&header->crypt_iv,
-                       cloud_block + len - (char *)&header->crypt_iv,
+                       cloud_block + len - (char *)&header->crypt_iv - GUINT32_FROM_LE(header->size3),
                        keys->authentication_key,
                        header->crypt_auth);
 
@@ -205,7 +205,7 @@ gboolean bluesky_crypt_block_decrypt(gchar *cloud_block, size_t len,
     }
 
     bluesky_crypt_hmac((char *)&header->crypt_iv,
-                       cloud_block + len - (char *)&header->crypt_iv,
+                       cloud_block + len - (char *)&header->crypt_iv - GUINT32_FROM_LE(header->size3),
                        keys->authentication_key,
                        hmac_check);
     if (memcmp(hmac_check, header->crypt_auth, CRYPTO_HASH_SIZE) != 0) {