a5bd9f6
From 2f505c89522520243b7164a744953afa6dc8691d Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sun, 10 Mar 2013 19:39:14 +0100
a5bd9f6
Subject: [PATCH 206/364] 	* grub-core/commands/verify.c
a5bd9f6
 (grub_verify_signature): Use unsigned 	operations to have intended shifts and
a5bd9f6
 not divisions.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                   | 5 +++++
a5bd9f6
 grub-core/commands/verify.c | 9 ++++++---
a5bd9f6
 2 files changed, 11 insertions(+), 3 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 334f81d..c2821c9 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/commands/verify.c (grub_verify_signature): Use unsigned
a5bd9f6
+	operations to have intended shifts and not divisions.
a5bd9f6
+
a5bd9f6
+2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* grub-core/loader/i386/pc/plan9.c (fill_disk): Fix types to use
a5bd9f6
 	intended shifts rather than division.
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c
a5bd9f6
index d399d0f..38bb941 100644
a5bd9f6
--- a/grub-core/commands/verify.c
a5bd9f6
+++ b/grub-core/commands/verify.c
a5bd9f6
@@ -510,10 +510,13 @@ grub_verify_signature (grub_file_t f, grub_file_t sig,
a5bd9f6
       /* TRANSLATORS: %08x is 32-bit key id.  */
a5bd9f6
       return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"), keyid);
a5bd9f6
 
a5bd9f6
-    int nbits = gcry_mpi_get_nbits (sk->mpis[1]);
a5bd9f6
-    grub_dprintf ("crypt", "must be %d bits got %d bits\n", (int)nbits, (int)(8 * hash->mdlen));
a5bd9f6
+    unsigned nbits = gcry_mpi_get_nbits (sk->mpis[1]);
a5bd9f6
+    grub_dprintf ("crypt", "must be %u bits got %d bits\n", nbits,
a5bd9f6
+		  (int)(8 * hash->mdlen));
a5bd9f6
 
a5bd9f6
-    if (gcry_mpi_scan (&hmpi, GCRYMPI_FMT_USG, hval, nbits / 8 < (int) hash->mdlen ? nbits / 8 : (int) hash->mdlen, 0))
a5bd9f6
+    if (gcry_mpi_scan (&hmpi, GCRYMPI_FMT_USG, hval,
a5bd9f6
+		       nbits / 8 < (unsigned) hash->mdlen ? nbits / 8
a5bd9f6
+		       : (unsigned) hash->mdlen, 0))
a5bd9f6
       return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
a5bd9f6
     if (!grub_crypto_pk_dsa)
a5bd9f6
       return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("module `%s' isn't loaded"), "gcry_dsa");
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6