coreboot/src/lib
Patrick Georgi 1d029b40c9 lib/jpeg: Replace decoder with Wuffs' implementation
To quote its repo[0]: Wuffs is a memory-safe programming language (and
a standard library written in that language) for Wrangling Untrusted
File Formats Safely. Wrangling includes parsing, decoding and encoding.

It compiles its library, written in its own language, to a C/C++ source
file that can then be used independently without needing support for
the language. That library is now imported to src/vendorcode/wuffs/.

This change modifies our linters to ignore that directory because
it's supposed to contain the wuffs compiler's result verbatim.

Nigel Tao provided an initial wrapper around wuffs' jpeg decoder
that implements our JPEG API. I further changed it a bit regarding
data placement, dropped stuff from our API that wasn't ever used,
or isn't used anymore, and generally made it fit coreboot a bit
better. Features are Nigel's, bugs are mine.

This commit also adapts our jpeg fuzz test to work with the modified
API. After limiting it to deal only with approximately screen sized
inputs, it fuzzed for 25 hours CPU time without a single hang or
crash. This is a notable improvement over running the test with our
old decoder which crashes within a minute.

Finally, I tried the new parser with a pretty-much-random JPEG file
I got from the internet, and it just showed it (once the resolution
matched), which is also a notable improvement over the old decoder
which is very particular about the subset of JPEG it supports.

In terms of code size, a QEmu build's ramstage increases
from 128060 bytes decompressed (64121 bytes after LZMA)
  to 172304 bytes decompressed (82734 bytes after LZMA).

[0] https://github.com/google/wuffs

Change-Id: If8fa7da69da1ad412f27c2c5e882393c7739bc82
Signed-off-by: Patrick Georgi <patrick@coreboot.org>
Based-on-work-by: Nigel Tao <nigeltao@golang.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78271
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-12-13 16:17:34 +00:00
..
gnat
asan.c Allow to build romstage sources inside the bootblock 2023-11-09 13:20:18 +00:00
b64_decode.c
bmp_logo.c
boot_device.c
bootblock.c
bootmem.c
bootmode.c lib: Perform display init in normal boot mode if BMP_LOGO is set 2023-05-16 13:08:12 +00:00
bootsplash.c lib/jpeg: Replace decoder with Wuffs' implementation 2023-12-13 16:17:34 +00:00
cb.ads
cbfs.c Allow to build romstage sources inside the bootblock 2023-11-09 13:20:18 +00:00
cbfs_master_header.c
cbmem_common.c
cbmem_console.c lib/cbmem_console.c: Use C99 flexible arrays 2023-07-30 09:59:46 +00:00
cbmem_stage_cache.c
compute_ip_checksum.c
coreboot_table.c Center bootsplash on bigger framebuffers 2023-07-17 14:49:04 +00:00
crc_byte.c
decompressor.c
delay.c
device_tree.c lib/device_tree.c: Fix print_property 2023-11-16 12:01:40 +00:00
dimm_info_util.c lib/dimm_info_util.c: Add newlines to log messages 2023-06-03 16:12:54 +00:00
dp_aux.c
edid.c
edid_fill_fb.c
espi_debug.c
ext_stage_cache.c
fallback_boot.c
fit.c Convert literal uses of CONFIG_MAINBOARD_{VENDOR,PART_NUMBER} 2023-05-05 13:56:34 +00:00
fit_payload.c
fmap.c fmap: Map less space in fallback path without CBFS verification 2023-11-13 14:19:01 +00:00
fw_config.c lib/fw_config: Make fw_config_is_provisioned() always available 2023-06-17 02:40:57 +00:00
gcc.c
gcov-glue.c
gcov-io.c
gcov-io.h lib/gcov-io.h: Use C99 flexible arrays 2023-08-01 13:34:27 +00:00
gcov-iov.h
gpio.c
halt.c
hardwaremain.c commonlib/console/post_code.h: Change post code prefix to POSTCODE 2023-06-23 15:06:04 +00:00
hexdump.c
hexstrtobin.c
hw-time-timer.adb
identity.c lib/version: Move board identification strings 2023-04-22 16:20:49 +00:00
imd.c
imd_cbmem.c
jpeg.c lib/jpeg: Replace decoder with Wuffs' implementation 2023-12-13 16:17:34 +00:00
jpeg.h lib/jpeg: Replace decoder with Wuffs' implementation 2023-12-13 16:17:34 +00:00
Kconfig
Kconfig.cbfs_verification Kconfig.cbfs_verification: Update TOCTOU_SAFETY combination with VBOOT 2023-11-07 22:30:20 +00:00
libgcc.c
libgcov.c
list.c
lzma.c
lzmadecode.c
lzmadecode.h
Makefile.inc drivers/net/ne2k: Make it work for bootblock 2023-11-07 17:22:33 +00:00
malloc.c
master_header_pointer.c
memchr.c
memcmp.c
memcpy.c
memmove.c
memrange.c memrange: Honor limit in the last step of top-down stealing 2023-08-26 20:29:37 +00:00
memset.c
metadata_hash.c
nhlt.c
primitive_memtest.c
prog_loaders.c Allow to build romstage sources inside the bootblock 2023-11-09 13:20:18 +00:00
prog_ops.c
program.ld x86: Add .data section support for pre-memory stages 2023-09-14 21:02:07 +00:00
ramdetect.c drivers/ipmi to lib: Fix misspellings & capitalization issues 2023-12-13 10:42:30 +00:00
ramtest.c commonlib/console/post_code.h: Change post code prefix to POSTCODE 2023-06-23 15:06:04 +00:00
reg_script.c
region_file.c
reset.c
rmodule.c
rmodule.ld
romstage_handoff.c
rtc.c
selfboot.c
smbios.c drivers/ipmi to lib: Fix misspellings & capitalization issues 2023-12-13 10:42:30 +00:00
smbios_defaults.c arch/x86,lib: Migrate SMBIOS implementation to common code 2023-06-22 22:24:57 +00:00
spd_bin.c
spd_cache.c
stack.c
string.c
thread.c
timer.c
timer_queue.c
timestamp.c
ubsan.c lib/ubsan.c: Restore Jonas' copyright 2023-05-22 12:33:32 +00:00
uuid.c
ux_locales.c lib: Update locales for non-VBOOT platforms 2023-11-16 05:19:20 +00:00
version.c lib/version: Move board identification strings 2023-04-22 16:20:49 +00:00
wrdd.c
xxhash.c