payloads/libpayload/liblz4: Export magic number definitions
Move LZ4 magic number definitions to public header file so that it can be used in the payload. Also rename LEGACY_MAGICNUMBER to LZ4_LEGACY_MAGICNUMBER for clarity when using from the payload. BUG=None TEST=Build Hylia BIOS image and boot to OS/UI. Change-Id: Ief180105ec3fa7abf1013d0c5408aa96edde681b Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/91152 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
e0121eb463
commit
02867c2797
2 changed files with 4 additions and 4 deletions
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#define LZ4F_MAGICNUMBER 0x184D2204
|
||||
#define LZ4_LEGACY_MAGICNUMBER 0x184C2102
|
||||
|
||||
/* Decompresses an LZ4F image (multiple LZ4 blocks with frame header) from src
|
||||
* to dst, ensuring that it doesn't read more than srcn bytes and doesn't write
|
||||
* more than dstn. Buffer sizes must stay below 2GB. Can decompress files loaded
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ typedef uint64_t U64;
|
|||
/* Unaltered (just removed unrelated code) from github.com/Cyan4973/lz4/dev. */
|
||||
#include "lz4.c.inc" /* #include for inlining, do not link! */
|
||||
|
||||
#define LZ4F_MAGICNUMBER 0x184D2204
|
||||
#define LEGACY_MAGICNUMBER 0x184C2102
|
||||
|
||||
struct lz4_frame_header {
|
||||
uint32_t magic;
|
||||
union {
|
||||
|
|
@ -198,7 +195,7 @@ size_t ulz4ln(const void *src, size_t srcn, void *dst, size_t dstn)
|
|||
void *out = dst;
|
||||
size_t out_size = 0;
|
||||
|
||||
if (le32toh(*((const uint32_t *)in)) != LEGACY_MAGICNUMBER)
|
||||
if (le32toh(*((const uint32_t *)in)) != LZ4_LEGACY_MAGICNUMBER)
|
||||
return 0;
|
||||
|
||||
in += sizeof(uint32_t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue