Fix potential problem with calling zfs_to_cpu and cpu_to_be in a row.

* grub-core/fs/zfs/zfscrypt.c (grub_zfs_decrypt_real): Use explicit
	byteswap when needed.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-08 19:44:18 +01:00
parent 27610c3836
commit 3ae17eb83c
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
Fix potential problem with calling zfs_to_cpu and cpu_to_be in a row.
* grub-core/fs/zfs/zfscrypt.c (grub_zfs_decrypt_real): Use explicit
byteswap when needed.
2011-11-08 Vladimir Serbinenko <phcoder@gmail.com> 2011-11-08 Vladimir Serbinenko <phcoder@gmail.com>
Fix FreeBSD compilation. Fix FreeBSD compilation.

View file

@ -277,8 +277,9 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
grub_err_t err; grub_err_t err;
grub_memcpy (sw, nonce, 16); grub_memcpy (sw, nonce, 16);
if (endian != GRUB_ZFS_BIG_ENDIAN)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
sw[i] = grub_cpu_to_be32 (grub_zfs_to_cpu32 (sw[i], endian)); sw[i] = grub_swap_bytes32 (sw[i]);
if (!cipher) if (!cipher)
return grub_error (GRUB_ERR_ACCESS_DENIED, return grub_error (GRUB_ERR_ACCESS_DENIED,