The signature on log items should not extend to the pointer locations.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 18 Oct 2010 21:48:57 +0000 (14:48 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Mon, 18 Oct 2010 21:48:57 +0000 (14:48 -0700)
This allows the cleaner to rewrite the pointers without invalidating the
signature.

bluesky/crypto.c

index 89f6b12..fd47491 100644 (file)
@@ -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) {