dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0105-Fix-compilation-with-older-compilers.patch

f96e0b
From 395b75cfab614ada328c1dd88b94a4e5867f641c Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Sun, 13 Jan 2013 21:06:25 +0100
f96e0b
Subject: [PATCH 105/482] 	Fix compilation with older compilers.
f96e0b
f96e0b
	* grub-core/Makefile.core.def (mpi): Add mpi-inline.c.
f96e0b
	* grub-core/lib/libgcrypt_wrap/cipher_wrap.h: Remove redundant
f96e0b
	declarations.
f96e0b
	* grub-core/lib/posix_wrap/string.h: Include sys/types.h.
f96e0b
	* grub-core/lib/posix_wrap/sys/types.h: Add common types.
f96e0b
	* grub-core/lib/xzembed/xz_dec_lzma2.c (dict_put): Replace byte
f96e0b
	identifier with b.
f96e0b
	* grub-core/lib/xzembed/xz_dec_stream.c (dec_vli): Likewise.
f96e0b
	* include/grub/crypto.h: Add type defines.
f96e0b
	* util/import_gcrypth.sed: Remove duplicate type defines.
f96e0b
---
f96e0b
 ChangeLog                                  | 15 +++++++++++++++
f96e0b
 grub-core/Makefile.core.def                |  1 +
f96e0b
 grub-core/lib/libgcrypt_wrap/cipher_wrap.h |  6 ------
f96e0b
 grub-core/lib/posix_wrap/string.h          |  3 ++-
f96e0b
 grub-core/lib/posix_wrap/sys/types.h       |  6 ++++++
f96e0b
 grub-core/lib/xzembed/xz_dec_lzma2.c       |  4 ++--
f96e0b
 grub-core/lib/xzembed/xz_dec_stream.c      | 10 +++++-----
f96e0b
 include/grub/crypto.h                      |  8 +++++---
f96e0b
 util/import_gcrypth.sed                    |  3 +++
f96e0b
 9 files changed, 39 insertions(+), 17 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 6bb855b..ea90383 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,20 @@
f96e0b
 2013-01-13  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	Fix compilation with older compilers.
f96e0b
+
f96e0b
+	* grub-core/Makefile.core.def (mpi): Add mpi-inline.c.
f96e0b
+	* grub-core/lib/libgcrypt_wrap/cipher_wrap.h: Remove redundant
f96e0b
+	declarations.
f96e0b
+	* grub-core/lib/posix_wrap/string.h: Include sys/types.h.
f96e0b
+	* grub-core/lib/posix_wrap/sys/types.h: Add common types.
f96e0b
+	* grub-core/lib/xzembed/xz_dec_lzma2.c (dict_put): Replace byte
f96e0b
+	identifier with b.
f96e0b
+	* grub-core/lib/xzembed/xz_dec_stream.c (dec_vli): Likewise.
f96e0b
+	* include/grub/crypto.h: Add type defines.
f96e0b
+	* util/import_gcrypth.sed: Remove duplicate type defines.
f96e0b
+
f96e0b
+2013-01-13  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	New command list_trusted.
f96e0b
 
f96e0b
 	* grub-core/commands/verify.c (grub_cmd_list): New function.
f96e0b
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
f96e0b
index 588e4cd..f4dd645 100644
f96e0b
--- a/grub-core/Makefile.core.def
f96e0b
+++ b/grub-core/Makefile.core.def
f96e0b
@@ -1874,6 +1874,7 @@ module = {
f96e0b
   common = lib/libgcrypt-grub/mpi/mpih-div.c;
f96e0b
   common = lib/libgcrypt-grub/mpi/mpicoder.c;
f96e0b
   common = lib/libgcrypt-grub/mpi/mpih-rshift.c;
f96e0b
+  common = lib/libgcrypt-grub/mpi/mpi-inline.c;
f96e0b
   common = lib/libgcrypt_wrap/mem.c;
f96e0b
 
f96e0b
   cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
f96e0b
diff --git a/grub-core/lib/libgcrypt_wrap/cipher_wrap.h b/grub-core/lib/libgcrypt_wrap/cipher_wrap.h
f96e0b
index d7ae274..118b2f1 100644
f96e0b
--- a/grub-core/lib/libgcrypt_wrap/cipher_wrap.h
f96e0b
+++ b/grub-core/lib/libgcrypt_wrap/cipher_wrap.h
f96e0b
@@ -34,12 +34,6 @@
f96e0b
 #undef __GNU_LIBRARY__
f96e0b
 #define __GNU_LIBRARY__ 1
f96e0b
 
f96e0b
-typedef grub_uint64_t u64;
f96e0b
-typedef grub_uint32_t u32;
f96e0b
-typedef grub_uint16_t u16;
f96e0b
-typedef grub_uint8_t byte;
f96e0b
-typedef grub_size_t size_t;
f96e0b
-
f96e0b
 #define U64_C(c) (c ## ULL)
f96e0b
 
f96e0b
 #define PUBKEY_FLAG_NO_BLINDING    (1 << 0)
f96e0b
diff --git a/grub-core/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h
f96e0b
index 885845b..53ef0a9 100644
f96e0b
--- a/grub-core/lib/posix_wrap/string.h
f96e0b
+++ b/grub-core/lib/posix_wrap/string.h
f96e0b
@@ -20,6 +20,7 @@
f96e0b
 #define GRUB_POSIX_STRING_H	1
f96e0b
 
f96e0b
 #include <grub/misc.h>
f96e0b
+#include <sys/types.h>
f96e0b
 
f96e0b
 #define HAVE_STRCASECMP 1
f96e0b
 
f96e0b
@@ -49,7 +50,7 @@ memcpy (void *dest, const void *src, grub_size_t n)
f96e0b
 }
f96e0b
 
f96e0b
 static inline int
f96e0b
-memcmp (const void *s1, const void *s2, size_t n)
f96e0b
+memcmp (const void *s1, const void *s2, grub_size_t n)
f96e0b
 {
f96e0b
   return grub_memcmp (s1, s2, n);
f96e0b
 }
f96e0b
diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h
f96e0b
index fe75d8d..62a2672 100644
f96e0b
--- a/grub-core/lib/posix_wrap/sys/types.h
f96e0b
+++ b/grub-core/lib/posix_wrap/sys/types.h
f96e0b
@@ -44,6 +44,12 @@ typedef grub_int64_t int64_t;
f96e0b
 
f96e0b
 #define HAVE_U64_TYPEDEF 1
f96e0b
 typedef grub_uint64_t u64;
f96e0b
+#define HAVE_U32_TYPEDEF 1
f96e0b
+typedef grub_uint32_t u32;
f96e0b
+#define HAVE_U16_TYPEDEF 1
f96e0b
+typedef grub_uint16_t u16;
f96e0b
+#define HAVE_BYTE_TYPEDEF 1
f96e0b
+typedef grub_uint8_t byte;
f96e0b
 
f96e0b
 #define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG
f96e0b
 #define SIZEOF_UNSIGNED_INT 4
f96e0b
diff --git a/grub-core/lib/xzembed/xz_dec_lzma2.c b/grub-core/lib/xzembed/xz_dec_lzma2.c
f96e0b
index 7899e9e..4f4fb85 100644
f96e0b
--- a/grub-core/lib/xzembed/xz_dec_lzma2.c
f96e0b
+++ b/grub-core/lib/xzembed/xz_dec_lzma2.c
f96e0b
@@ -327,9 +327,9 @@ static inline uint32_t dict_get(
f96e0b
 /*
f96e0b
  * Put one byte into the dictionary. It is assumed that there is space for it.
f96e0b
  */
f96e0b
-static inline void dict_put(struct dictionary *dict, uint8_t byte)
f96e0b
+static inline void dict_put(struct dictionary *dict, uint8_t b)
f96e0b
 {
f96e0b
-	dict->buf[dict->pos++] = byte;
f96e0b
+	dict->buf[dict->pos++] = b;
f96e0b
 
f96e0b
 	if (dict->full < dict->pos)
f96e0b
 		dict->full = dict->pos;
f96e0b
diff --git a/grub-core/lib/xzembed/xz_dec_stream.c b/grub-core/lib/xzembed/xz_dec_stream.c
f96e0b
index 6170b0c..f5a86eb 100644
f96e0b
--- a/grub-core/lib/xzembed/xz_dec_stream.c
f96e0b
+++ b/grub-core/lib/xzembed/xz_dec_stream.c
f96e0b
@@ -197,20 +197,20 @@ static bool fill_temp(struct xz_dec *s, struct xz_buf *b)
f96e0b
 static enum xz_ret dec_vli(struct xz_dec *s,
f96e0b
 		const uint8_t *in, size_t *in_pos, size_t in_size)
f96e0b
 {
f96e0b
-	uint8_t byte;
f96e0b
+	uint8_t b;
f96e0b
 
f96e0b
 	if (s->pos == 0)
f96e0b
 		s->vli = 0;
f96e0b
 
f96e0b
 	while (*in_pos < in_size) {
f96e0b
-		byte = in[*in_pos];
f96e0b
+		b = in[*in_pos];
f96e0b
 		++*in_pos;
f96e0b
 
f96e0b
-		s->vli |= (vli_type)(byte & 0x7F) << s->pos;
f96e0b
+		s->vli |= (vli_type)(b & 0x7F) << s->pos;
f96e0b
 
f96e0b
-		if ((byte & 0x80) == 0) {
f96e0b
+		if ((b & 0x80) == 0) {
f96e0b
 			/* Don't allow non-minimal encodings. */
f96e0b
-			if (byte == 0 && s->pos != 0)
f96e0b
+			if (b == 0 && s->pos != 0)
f96e0b
 				return XZ_DATA_ERROR;
f96e0b
 
f96e0b
 			s->pos = 0;
f96e0b
diff --git a/include/grub/crypto.h b/include/grub/crypto.h
f96e0b
index 557b944..ea2f13e 100644
f96e0b
--- a/include/grub/crypto.h
f96e0b
+++ b/include/grub/crypto.h
f96e0b
@@ -66,9 +66,10 @@ typedef enum
f96e0b
     GPG_ERR_WRONG_PUBKEY_ALGO,
f96e0b
     GPG_ERR_OUT_OF_MEMORY,
f96e0b
     GPG_ERR_TOO_LARGE
f96e0b
-  } gcry_err_code_t;
f96e0b
-#define gpg_err_code_t gcry_err_code_t
f96e0b
-#define gpg_error_t gcry_err_code_t
f96e0b
+  } gpg_err_code_t;
f96e0b
+typedef gpg_err_code_t gpg_error_t;
f96e0b
+typedef gpg_error_t gcry_error_t;
f96e0b
+typedef gpg_err_code_t gcry_err_code_t;
f96e0b
 #define gcry_error_t gcry_err_code_t
f96e0b
 #if 0
f96e0b
 enum gcry_cipher_modes 
f96e0b
@@ -174,6 +175,7 @@ typedef struct gcry_md_spec
f96e0b
   struct gcry_md_spec *next;
f96e0b
 } gcry_md_spec_t;
f96e0b
 
f96e0b
+struct gcry_mpi;
f96e0b
 typedef struct gcry_mpi *gcry_mpi_t;
f96e0b
 
f96e0b
 /* Type for the pk_generate function.  */
f96e0b
diff --git a/util/import_gcrypth.sed b/util/import_gcrypth.sed
f96e0b
index dead8e6..6cb53cf 100644
f96e0b
--- a/util/import_gcrypth.sed
f96e0b
+++ b/util/import_gcrypth.sed
f96e0b
@@ -8,5 +8,8 @@
f96e0b
 /^# *include <sys\/socket\.h>/ d
f96e0b
 /^# *include <sys\/time\.h>/ d
f96e0b
 /^# *include <gpg-error\.h>/ s,#include <gpg-error.h>,#include <grub/gcrypt/gpg-error.h>,
f96e0b
+/^typedef gpg_error_t gcry_error_t;/ d
f96e0b
+/^typedef gpg_err_code_t gcry_err_code_t;/ d
f96e0b
+/^typedef struct gcry_mpi \*gcry_mpi_t;/ d
f96e0b
 s,_gcry_mpi_invm,gcry_mpi_invm,g
f96e0b
 p
f96e0b
\ No newline at end of file
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b