* grub-core/disk/cryptodisk.c (grub_cryptodisk_endecrypt): Rename

argument from encrypt to do_encrypt to avoid shadowing.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-10 12:11:50 +01:00
parent 6f48ca0143
commit 7b5784d4d3
2 changed files with 12 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/cryptodisk.c (grub_cryptodisk_endecrypt): Rename
argument from encrypt to do_encrypt to avoid shadowing.
2012-02-09 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-09 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/multiboot_elfxx.c (grub_multiboot_load_elf): Fix * grub-core/loader/multiboot_elfxx.c (grub_multiboot_load_elf): Fix

View file

@ -215,14 +215,14 @@ lrw_xor (const struct lrw_sector *sec,
static gcry_err_code_t static gcry_err_code_t
grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev, grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
grub_uint8_t * data, grub_size_t len, grub_uint8_t * data, grub_size_t len,
grub_disk_addr_t sector, int encrypt) grub_disk_addr_t sector, int do_encrypt)
{ {
grub_size_t i; grub_size_t i;
gcry_err_code_t err; gcry_err_code_t err;
/* The only mode without IV. */ /* The only mode without IV. */
if (dev->mode == GRUB_CRYPTODISK_MODE_ECB && !dev->rekey) if (dev->mode == GRUB_CRYPTODISK_MODE_ECB && !dev->rekey)
return (encrypt ? grub_crypto_ecb_encrypt (dev->cipher, data, data, len) return (do_encrypt ? grub_crypto_ecb_encrypt (dev->cipher, data, data, len)
: grub_crypto_ecb_decrypt (dev->cipher, data, data, len)); : grub_crypto_ecb_decrypt (dev->cipher, data, data, len));
for (i = 0; i < len; i += (1U << dev->log_sector_size)) for (i = 0; i < len; i += (1U << dev->log_sector_size))
@ -293,7 +293,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
switch (dev->mode) switch (dev->mode)
{ {
case GRUB_CRYPTODISK_MODE_CBC: case GRUB_CRYPTODISK_MODE_CBC:
if (encrypt) if (do_encrypt)
err = grub_crypto_cbc_encrypt (dev->cipher, data + i, data + i, err = grub_crypto_cbc_encrypt (dev->cipher, data + i, data + i,
(1U << dev->log_sector_size), iv); (1U << dev->log_sector_size), iv);
else else
@ -304,7 +304,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
break; break;
case GRUB_CRYPTODISK_MODE_PCBC: case GRUB_CRYPTODISK_MODE_PCBC:
if (encrypt) if (do_encrypt)
err = grub_crypto_pcbc_encrypt (dev->cipher, data + i, data + i, err = grub_crypto_pcbc_encrypt (dev->cipher, data + i, data + i,
(1U << dev->log_sector_size), iv); (1U << dev->log_sector_size), iv);
else else
@ -326,7 +326,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
{ {
grub_crypto_xor (data + i + j, data + i + j, iv, grub_crypto_xor (data + i + j, data + i + j, iv,
dev->cipher->cipher->blocksize); dev->cipher->cipher->blocksize);
if (encrypt) if (do_encrypt)
err = grub_crypto_ecb_encrypt (dev->cipher, data + i + j, err = grub_crypto_ecb_encrypt (dev->cipher, data + i + j,
data + i + j, data + i + j,
dev->cipher->cipher->blocksize); dev->cipher->cipher->blocksize);
@ -349,7 +349,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
generate_lrw_sector (&sec, dev, (grub_uint8_t *) iv); generate_lrw_sector (&sec, dev, (grub_uint8_t *) iv);
lrw_xor (&sec, dev, data + i); lrw_xor (&sec, dev, data + i);
if (encrypt) if (do_encrypt)
err = grub_crypto_ecb_encrypt (dev->cipher, data + i, err = grub_crypto_ecb_encrypt (dev->cipher, data + i,
data + i, data + i,
(1U << dev->log_sector_size)); (1U << dev->log_sector_size));
@ -363,7 +363,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
} }
break; break;
case GRUB_CRYPTODISK_MODE_ECB: case GRUB_CRYPTODISK_MODE_ECB:
if (encrypt) if (do_encrypt)
grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i, grub_crypto_ecb_encrypt (dev->cipher, data + i, data + i,
(1U << dev->log_sector_size)); (1U << dev->log_sector_size));
else else