Replace all le64 "xor" calculations with le64_xor(...).

edge.strict_endians
Erik Larsson 2016-01-28 08:28:58 +01:00
parent 14190d81b3
commit 46dfbe17ec
2 changed files with 8 additions and 6 deletions

View File

@ -340,4 +340,6 @@
#define le32_xor(a, b) ((a) ^ (b))
#define le64_xor(a, b) ((a) ^ (b))
#endif /* defined _NTFS_ENDIANS_H */

View File

@ -1301,11 +1301,11 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset)
}
/* Apply the IV. */
if (le32_eq(fek->alg_id, CALG_AES_256)) {
((le64*)data)[0] ^= cpu_to_le64(0x5816657be9161312ULL + offset);
((le64*)data)[1] ^= cpu_to_le64(0x1989adbe44918961ULL + offset);
((le64*)data)[0] = le64_xor(((le64*)data)[0], cpu_to_le64(0x5816657be9161312ULL + offset));
((le64*)data)[1] = le64_xor(((le64*)data)[1], cpu_to_le64(0x1989adbe44918961ULL + offset));
} else {
/* All other algos (Des, 3Des, DesX) use the same IV. */
((le64*)data)[0] ^= cpu_to_le64(0x169119629891ad13ULL + offset);
((le64*)data)[0] = le64_xor(((le64*)data)[0], cpu_to_le64(0x169119629891ad13ULL + offset));
}
return 512;
}
@ -1331,11 +1331,11 @@ static int ntfs_fek_encrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset)
*/
/* Apply the IV. */
if (le32_eq(fek->alg_id, CALG_AES_256)) {
((le64*)data)[0] ^= cpu_to_le64(0x5816657be9161312ULL + offset);
((le64*)data)[1] ^= cpu_to_le64(0x1989adbe44918961ULL + offset);
((le64*)data)[0] = le64_xor(((le64*)data)[0], cpu_to_le64(0x5816657be9161312ULL + offset));
((le64*)data)[1] = le64_xor(((le64*)data)[1], cpu_to_le64(0x1989adbe44918961ULL + offset));
} else {
/* All other algos (Des, 3Des, DesX) use the same IV. */
((le64*)data)[0] ^= cpu_to_le64(0x169119629891ad13ULL + offset);
((le64*)data)[0] = le64_xor(((le64*)data)[0], cpu_to_le64(0x169119629891ad13ULL + offset));
}
if (le32_eq(fek->alg_id, CALG_DESX)) {
int k;