+2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Fix mips compilation.
+
+ * grub-core/lib/xzembed/xz_dec_stream.c (xz_dec): Restrict hash_id to
+ normal decoder.
+ (hashes): Use in embed decoder as well (for sizes).
+ (dec_stream_header): Fix embed decompressor logic.
+ (dec_stream_footer): Likewise.
+
2011-11-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Issue
#ifndef GRUB_EMBED_DECOMPRESSOR
const gcry_md_spec_t *hash;
const gcry_md_spec_t *crc32;
+ grub_uint8_t hash_id;
#endif
grub_size_t hash_size;
- grub_uint8_t hash_id;
/* True if we are operating in single-call mode. */
bool single_call;
return XZ_STREAM_END;
}
-#ifndef GRUB_EMBED_DECOMPRESSOR
-static struct
+static const struct
{
const char *name;
grub_size_t size;
[0x04] = { "CRC64", 8},
[0x0A] = { "SHA256", 32},
};
-#endif
/* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */
static enum xz_ret dec_stream_header(struct xz_dec *s)
}
#endif
+#ifndef GRUB_EMBED_DECOMPRESSOR
/*
- * Decode the Stream Flags field. Of integrity checks, we support
- * only none (Check ID = 0) and CRC32 (Check ID = 1).
+ * Decode the Stream Flags field.
*/
if (s->temp.buf[HEADER_MAGIC_SIZE] != 0
|| s->temp.buf[HEADER_MAGIC_SIZE + 1] >= ARRAY_SIZE (hashes)
s->hash_id = s->temp.buf[HEADER_MAGIC_SIZE + 1];
-#ifndef GRUB_EMBED_DECOMPRESSOR
if (s->crc32)
{
s->crc32_context = kmalloc(s->crc32->contextsize, GFP_KERNEL);
s->hash->init(s->index.hash.hash_context);
s->hash->init(s->block.hash.hash_context);
}
-#else
- s->hash = 0;
-#endif
-#if 1
if (!s->hash)
return XZ_OPTIONS_ERROR;
#endif
}
else
{
+#ifndef GRUB_EMBED_DECOMPRESSOR
s->hash = 0;
+#endif
s->hash_size = 0;
}
if ((s->index.size >> 2) != get_le32(s->temp.buf + 4))
return XZ_DATA_ERROR;
+#ifndef GRUB_EMBED_DECOMPRESSOR
if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->hash_id)
return XZ_DATA_ERROR;
+#endif
/*
* Use XZ_STREAM_END instead of XZ_OK to be more convenient