iPXE
|
DEFLATE decompression algorithm. More...
Go to the source code of this file.
Data Structures | |
struct | deflate_huf_symbols |
A Huffman-coded set of symbols of a given length. More... | |
struct | deflate_alphabet |
A Huffman-coded alphabet. More... | |
struct | deflate_static_length_pattern |
A static Huffman alphabet length pattern. More... | |
struct | deflate |
Decompressor. More... | |
struct | deflate_chunk |
A chunk of data. More... | |
Macros | |
#define | DEFLATE_HEADER_BITS 3 |
Block header length (in bits) More... | |
#define | DEFLATE_HEADER_BFINAL_BIT 0 |
Block header final block flags bit. More... | |
#define | DEFLATE_HEADER_BTYPE_LSB 1 |
Block header type LSB. More... | |
#define | DEFLATE_HEADER_BTYPE_MASK 0x03 |
Block header type mask. More... | |
#define | DEFLATE_HEADER_BTYPE_LITERAL 0 |
Block header type: literal data. More... | |
#define | DEFLATE_HEADER_BTYPE_STATIC 1 |
Block header type: static Huffman alphabet. More... | |
#define | DEFLATE_HEADER_BTYPE_DYNAMIC 2 |
Block header type: dynamic Huffman alphabet. More... | |
#define | DEFLATE_LITERAL_LEN_BITS 16 |
Literal header LEN/NLEN field length (in bits) More... | |
#define | DEFLATE_DYNAMIC_BITS 14 |
Dynamic header length (in bits) More... | |
#define | DEFLATE_DYNAMIC_HLIT_LSB 0 |
Dynamic header HLIT field LSB. More... | |
#define | DEFLATE_DYNAMIC_HLIT_MASK 0x1f |
Dynamic header HLIT field mask. More... | |
#define | DEFLATE_DYNAMIC_HDIST_LSB 5 |
Dynamic header HDIST field LSB. More... | |
#define | DEFLATE_DYNAMIC_HDIST_MASK 0x1f |
Dynamic header HDIST field mask. More... | |
#define | DEFLATE_DYNAMIC_HCLEN_LSB 10 |
Dynamic header HCLEN field LSB. More... | |
#define | DEFLATE_DYNAMIC_HCLEN_MASK 0x0f |
Dynamic header HCLEN field mask. More... | |
#define | DEFLATE_CODELEN_BITS 3 |
Dynamic header code length length (in bits) More... | |
#define | DEFLATE_HUFFMAN_BITS 15 |
Maximum length of a Huffman symbol (in bits) More... | |
#define | DEFLATE_HUFFMAN_QL_BITS 7 |
Quick lookup length for a Huffman symbol (in bits) More... | |
#define | DEFLATE_HUFFMAN_QL_SHIFT ( 16 - DEFLATE_HUFFMAN_QL_BITS ) |
Quick lookup shift. More... | |
#define | DEFLATE_LITLEN_END 256 |
Literal/length end of block code. More... | |
#define | DEFLATE_LITLEN_MAX_CODE 287 |
Maximum value of a literal/length code. More... | |
#define | DEFLATE_DISTANCE_MAX_CODE 31 |
Maximum value of a distance code. More... | |
#define | DEFLATE_CODELEN_MAX_CODE 18 |
Maximum value of a code length code. More... | |
#define | ZLIB_HEADER_BITS 16 |
ZLIB header length (in bits) More... | |
#define | ZLIB_HEADER_CM_LSB 0 |
ZLIB header compression method LSB. More... | |
#define | ZLIB_HEADER_CM_MASK 0x0f |
ZLIB header compression method mask. More... | |
#define | ZLIB_HEADER_CM_DEFLATE 8 |
ZLIB header compression method: DEFLATE. More... | |
#define | ZLIB_HEADER_FDICT_BIT 13 |
ZLIB header preset dictionary flag bit. More... | |
#define | ZLIB_ADLER32_BITS 32 |
ZLIB ADLER32 length (in bits) More... | |
Enumerations | |
enum | deflate_format { DEFLATE_RAW, DEFLATE_ZLIB } |
Compression formats. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
struct deflate_static_length_pattern | __attribute__ ((packed)) |
static | __attribute__ ((always_inline)) void deflate_chunk_init(struct deflate_chunk *chunk |
Initialise chunk of data. More... | |
static int | deflate_finished (struct deflate *deflate) |
Check if decompression has finished. More... | |
void | deflate_init (struct deflate *deflate, enum deflate_format format) |
Initialise decompressor. More... | |
int | deflate_inflate (struct deflate *deflate, struct deflate_chunk *in, struct deflate_chunk *out) |
Inflate compressed data. More... | |
Variables | |
uint8_t | fill |
Length pair. More... | |
uint8_t | count |
Repetition count. More... | |
struct deflate | __attribute__ |
static userptr_t | data |
static userptr_t size_t | offset = offset |
Offset of the first segment within the content. More... | |
static userptr_t size_t size_t | len |
DEFLATE decompression algorithm.
Definition in file deflate.h.
#define DEFLATE_HEADER_BITS 3 |
#define DEFLATE_HEADER_BFINAL_BIT 0 |
#define DEFLATE_HEADER_BTYPE_MASK 0x03 |
#define DEFLATE_HEADER_BTYPE_LITERAL 0 |
#define DEFLATE_HEADER_BTYPE_STATIC 1 |
#define DEFLATE_HEADER_BTYPE_DYNAMIC 2 |
#define DEFLATE_LITERAL_LEN_BITS 16 |
#define DEFLATE_DYNAMIC_BITS 14 |
#define DEFLATE_DYNAMIC_HLIT_LSB 0 |
#define DEFLATE_DYNAMIC_HLIT_MASK 0x1f |
#define DEFLATE_DYNAMIC_HDIST_LSB 5 |
#define DEFLATE_DYNAMIC_HDIST_MASK 0x1f |
#define DEFLATE_DYNAMIC_HCLEN_LSB 10 |
#define DEFLATE_DYNAMIC_HCLEN_MASK 0x0f |
#define DEFLATE_CODELEN_BITS 3 |
#define DEFLATE_HUFFMAN_BITS 15 |
#define DEFLATE_HUFFMAN_QL_BITS 7 |
#define DEFLATE_HUFFMAN_QL_SHIFT ( 16 - DEFLATE_HUFFMAN_QL_BITS ) |
#define DEFLATE_LITLEN_END 256 |
#define DEFLATE_LITLEN_MAX_CODE 287 |
#define DEFLATE_DISTANCE_MAX_CODE 31 |
#define DEFLATE_CODELEN_MAX_CODE 18 |
#define ZLIB_HEADER_CM_LSB 0 |
#define ZLIB_HEADER_CM_MASK 0x0f |
#define ZLIB_HEADER_CM_DEFLATE 8 |
#define ZLIB_HEADER_FDICT_BIT 13 |
#define ZLIB_ADLER32_BITS 32 |
enum deflate_format |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
struct deflate_static_length_pattern __attribute__ | ( | (packed) | ) |
|
inlinestatic |
Initialise chunk of data.
chunk | Chunk of data to initialise |
data | Data |
offset | Starting offset |
len | Length |
|
inlinestatic |
Check if decompression has finished.
deflate | Decompressor |
finished | Decompression has finished |
Definition at line 273 of file deflate.h.
References NULL, and deflate::resume.
Referenced by deflate_okx(), png_image_end(), and zlib_deflate().
void deflate_init | ( | struct deflate * | deflate, |
enum deflate_format | format | ||
) |
Initialise decompressor.
deflate | Decompressor |
format | Compression format code |
Definition at line 999 of file deflate.c.
References assert(), base, bit, bits, deflate_distance_base, deflate_litlen_base, deflate_reverse, format, deflate::format, and memset().
Referenced by deflate_okx(), png_pixbuf(), and zlib_deflate().
int deflate_inflate | ( | struct deflate * | deflate, |
struct deflate_chunk * | in, | ||
struct deflate_chunk * | out | ||
) |
Inflate compressed data.
deflate | Decompressor |
in | Compressed input data |
out | Output data buffer |
rc | Return status code |
The caller can use deflate_finished() to determine whether a successful return indicates that the decompressor is merely waiting for more input.
Data will not be written beyond the specified end of the output data buffer, but the offset within the output data buffer will be updated to reflect the amount that should have been written. The caller can use this to find the length of the decompressed data before allocating the output data buffer.
Definition at line 492 of file deflate.c.
References assert(), bits, cm, code, deflate_static_length_pattern::count, DBGC, DBGC2, DBGCP, deflate_accumulate(), DEFLATE_CODELEN_BITS, deflate_codelen_map, DEFLATE_CODELEN_MAX_CODE, deflate_copy(), deflate_decode(), deflate_discard_to_byte(), deflate_distance_base, DEFLATE_DYNAMIC_BITS, DEFLATE_DYNAMIC_HCLEN_LSB, DEFLATE_DYNAMIC_HCLEN_MASK, DEFLATE_DYNAMIC_HDIST_LSB, DEFLATE_DYNAMIC_HDIST_MASK, DEFLATE_DYNAMIC_HLIT_LSB, DEFLATE_DYNAMIC_HLIT_MASK, deflate_extract(), DEFLATE_HEADER_BFINAL_BIT, DEFLATE_HEADER_BITS, DEFLATE_HEADER_BTYPE_DYNAMIC, DEFLATE_HEADER_BTYPE_LITERAL, DEFLATE_HEADER_BTYPE_LSB, DEFLATE_HEADER_BTYPE_STATIC, DEFLATE_LITERAL_LEN_BITS, deflate_litlen_base, DEFLATE_LITLEN_END, DEFLATE_RAW, deflate_set_length(), deflate_static_length_patterns, DEFLATE_ZLIB, deflate::distance_codelen, deflate::distance_count, deflate::dup_distance, deflate::dup_len, EINVAL, ENOTSUP, extra, deflate::extra_bits, deflate_static_length_pattern::fill, deflate::format, deflate::header, header, in, index, isprint(), len, deflate::length, deflate::length_index, deflate::length_target, deflate::lengths, deflate::litlen, deflate::litlen_count, memset(), NULL, out, rc, deflate::remaining, deflate::resume, virt_to_user(), ZLIB_ADLER32_BITS, ZLIB_HEADER_BITS, ZLIB_HEADER_CM_DEFLATE, ZLIB_HEADER_CM_LSB, ZLIB_HEADER_CM_MASK, and ZLIB_HEADER_FDICT_BIT.
Referenced by deflate_okx(), png_image_data(), and zlib_deflate().
static int fill |
Length pair.
Definition at line 12 of file deflate.h.
Referenced by ehci_ring_fill(), ehci_ring_remaining(), memset_var(), net80211_probe_step(), uhci_ring_fill(), uhci_ring_remaining(), usb_prefill(), usbio_endpoint_enqueue(), usbio_interrupt_callback(), usbkbd_fill(), usbkbd_iskey(), vmbus_send(), vmxnet3_transmit(), xenstore_recv(), xenstore_send(), and xhci_ring_remaining().
struct deflate __attribute__ |
uint32_t offset = offset |
Offset of the first segment within the content.
Interrupt wrapper address offset.
Definition at line 259 of file deflate.h.
Referenced by __vxge_hw_desc_offset_up(), __vxge_hw_vpath_pci_read(), acpi_currticks(), acpi_extract_sx(), acpi_settings_fetch(), acpi_zsdt(), acpimac_extract(), acpimac_extract_auxmac(), acpimac_extract_rtxmac(), aes_setkey(), alloc_iob_fail_okx(), alloc_iob_okx(), alloc_iob_raw(), alloc_memblock(), apply_dns_settings(), ar9003_hw_tx_iq_cal_post_proc(), ar9285_hw_pa_cal(), ar9300_read_otp(), ar9300_uncompress_block(), arbel_cmd_unmap_icm(), arbel_ring_doorbell(), asn1_okx(), ath5k_cal_data_offset_2413(), ath5k_eeprom_init_11a_pcal_freq(), ath5k_eeprom_init_11bg_2413(), ath5k_eeprom_init_modes(), ath5k_eeprom_read_ants(), ath5k_eeprom_read_ctl_info(), ath5k_eeprom_read_freq_list(), ath5k_eeprom_read_mac(), ath5k_eeprom_read_modes(), ath5k_eeprom_read_pcal_info_2413(), ath5k_eeprom_read_pcal_info_5111(), ath5k_eeprom_read_pcal_info_5112(), ath5k_eeprom_read_target_rate_pwr_info(), ath5k_eeprom_read_turbo_modes(), ath5k_hw_eeprom_read(), ath5k_hw_rfb_op(), ath9k_olc_get_pdadcs(), atl1e_setup_ring_resources(), axge_in_complete(), axge_read_byte(), axge_read_dword(), axge_read_register(), axge_read_word(), axge_write_byte(), axge_write_dword(), axge_write_register(), axge_write_word(), base64_decode(), bios_currticks(), blktrans_xferbuf_read(), blktrans_xferbuf_write(), bnx2_ctx_wr(), bnx2_init_context(), bnx2_reg_rd_ind(), bnx2_reg_wr_ind(), bofm_locate_section(), bzimage_load_initrd(), bzimage_load_initrds(), call_bootsector(), cert_exec(), check_bios_interrupts(), clear_b0_fpga_memories(), cms_digest(), day_of_week(), dbg_hex_dump_da(), dbg_hex_dump_da_row(), deflate_alphabet(), deflate_copy(), deflate_okx(), dhcp_option(), dhcpopt_fetch(), dhcpopt_store(), dhcpopt_update_used_len(), digest_exec(), dm96xx_read_register(), dm96xx_read_registers(), dm96xx_write_register(), dm96xx_write_registers(), dns_decode(), dns_label(), dns_list_okx(), dns_question(), dns_skip(), dns_skip_search(), dns_xfer_deliver(), ecam_find(), efi_disk_io_read_disk(), efi_disk_io_write_disk(), efi_file_read_chunk(), efi_pxe_buf_write(), efi_snp_nvdata(), efifb_draw(), efifb_glyph(), efipci_ioremap(), ehci_enqueue(), ehci_extended_capability(), ena_clear_caps(), ena_set_base(), ena_set_caps(), exanic_poll_rx(), exanic_transmit(), fbcon_clear(), fbcon_draw(), fbcon_draw_cursor(), fbcon_picture_init(), fbcon_redraw(), fbcon_store(), fcpcmd_recv_rddata(), fdt_alias(), fdt_child(), fdt_mac(), fdt_path(), fdt_property(), fdt_string(), find_dhcp_option_with_encap(), find_smbios_entry(), find_smbios_structure(), find_strings_terminator(), fragment_reassemble(), gcm_tag(), get_e(), goto_find_label(), gzip_extract(), hermon_cmd_unmap_icm(), hermon_mod_stat_cfg(), hfa384x_copy_from_bap(), hfa384x_copy_to_bap(), hfa384x_prepare_bap(), history_entry(), history_move(), hunt_mcdi_copyout(), i2c_bit_read(), i2c_bit_write(), i2c_select(), ibft_install(), ibft_string(), icplus_set_base(), if(), image_asn1(), image_x509(), inject_corruption_nonzero(), ioremap_pages(), is_pnp_bios(), iscsi_rx_data_in(), iscsi_start_data_out(), iscsi_tx_data_out(), linda_post_send(), linda_readq(), linda_verify_uc_ram(), linda_writel(), linda_writeq(), load_cpu_fw(), malloc_phys_offset(), md4_update(), md5_update(), mlx_pci_config(), mlx_pci_config_byte(), mlx_pci_config_dword(), mlx_pci_config_word(), mlx_pci_gw_check_capability_id(), mlx_pci_mem_read(), mlx_pci_mem_read_priv(), mlx_pci_mem_write(), mlx_pci_mem_write_priv(), mlx_pci_read(), mlx_pci_read_priv(), mlx_pci_write(), mlx_pci_write_priv(), multiboot_find_header(), multiboot_load_raw(), natsemi_create_ring(), natsemi_hwaddr_insane(), nbi_load_segment(), nbi_process_segments(), ndp_fetch(), ndp_register_settings(), ndp_rx_options(), netdev_priv_offset(), netfront_transmit(), netvsc_buffer_copy(), nfs_read(), nodnic_port_thin_init(), ntlm_challenge(), ntlm_data_okx(), pci_backup(), pci_backup_excluded(), pci_msix_ioremap(), pci_restore(), pciea_bar_value(), pciea_offset(), peerdist_info_get(), peerdist_info_v1_block_offset(), peerdist_info_v1_blocks(), pem_asn1(), pem_image_asn1(), pem_image_probe(), pem_marker(), pem_next(), phantom_clp_cmd(), phantom_clp_fetch(), phantom_clp_store(), phantom_crb_access_128m(), phantom_crb_access_2m(), phantom_crb_access_32m(), phantom_dmesg(), phantom_get_macaddr(), phantom_read_test_mem(), phantom_read_test_mem_block(), phantom_readl(), phantom_writel(), phy_read(), phy_write(), png_palette(), png_unfilter_pass(), pnm_data(), prep_pci_cfg_cap(), print_user_string(), pxenv_file_api_check(), qib7322_post_send(), qib7322_readq(), qib7322_writel(), qib7322_writeq(), read_smbios_string(), read_srom_word(), read_user(), real_to_user(), reg_delay(), resize_dhcp_option(), rsdp_find_rsdt_range(), script_exec_line(), set_dhcp_option(), sha1_update(), sha256_update(), sha512_update(), smscusb_fdt_fetch_mac(), t509_id_read_eeprom(), t509_load_eeprom_word(), tcpip_bind(), tftp_rx_data(), tg3_nvram_read(), tg3_nvram_read_be32(), tg3_nvram_read_using_eeprom(), trivial_memchr_user(), trivial_memset_user(), trivial_strlen_user(), trivial_user_to_virt(), trivial_userptr_add(), txnic_poll_cq(), txnic_refill_rq(), txnic_send(), vesafb_glyph(), virtio_pci_map_capability(), vmbus_xfer_page_iobufs(), vp_get(), vpm_get(), vpm_ioread16(), vpm_ioread32(), vpm_ioread8(), vpm_iowrite16(), vpm_iowrite32(), vpm_iowrite8(), vxge_hw_fifo_txd_offset_up(), vxge_hw_ring_replenish(), vxge_hw_ring_rxd_offset_up(), vxge_hw_set_fw_api(), xenstore_recv(), xenstore_send(), xfer_seek(), xferbuf_malloc_read(), xferbuf_malloc_write(), xferbuf_read(), xferbuf_umalloc_read(), xferbuf_umalloc_write(), xferbuf_write(), xhci_extended_capability(), and xhci_supported_protocol().
chunk len |