iPXE
|
Big integer support. More...
Go to the source code of this file.
Typedefs | |
typedef uint32_t | bigint_element_t |
Element of a big integer. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | __attribute__ ((always_inline)) void bigint_init_raw(uint32_t *value0 |
Initialise big integer. More... | |
__asm__ | __volatile__ ("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*value) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax") |
__asm__ | __volatile__ ("xor %0, %0\n\t" "\n1:\n\t" "lodsl\n\t" "adcl %%eax, (%5,%0,4)\n\t" "inc %0\n\t" "loop 1b\n\t" :"=&r"(index), "=&S"(discard_S), "=&c"(discard_c), "=@ccc"(carry), "+m"(*value) :"r"(value0), "1"(addend0), "2"(size) :"eax") |
__asm__ | __volatile__ ("xor %0, %0\n\t" "\n1:\n\t" "lodsl\n\t" "sbbl %%eax, (%5,%0,4)\n\t" "inc %0\n\t" "loop 1b\n\t" :"=&r"(index), "=&S"(discard_S), "=&c"(discard_c), "=@ccc"(borrow), "+m"(*value) :"r"(value0), "1"(subtrahend0), "2"(size) :"eax") |
__asm__ | __volatile__ ("xor %0, %0\n\t" "\n1:\n\t" "rcll $1, (%4,%0,4)\n\t" "inc %0\n\t" "loop 1b\n\t" :"=&r"(index), "=&c"(discard_c), "=@ccc"(out), "+m"(*value) :"r"(value0), "1"(size)) |
__asm__ | __volatile__ ("clc\n\t" "\n1:\n\t" "rcrl $1, -4(%3,%0,4)\n\t" "loop 1b\n\t" :"=&c"(discard_c), "=@ccc"(out), "+m"(*value) :"r"(value0), "0"(size)) |
static | __attribute__ ((always_inline, pure)) int bigint_is_zero_raw(const uint32_t *value0 |
Test if big integer is equal to zero. More... | |
__asm__ | __volatile__ ("xor %0, %0\n\t" "repe scasl\n\t" "sete %b0\n\t" :"=&a"(result), "=&D"(discard_D), "=&c"(discard_c) :"1"(value0), "2"(size)) |
__asm__ | __volatile__ ("\n1:\n\t" "movl -4(%3, %1, 4), %k2\n\t" "cmpl -4(%4, %1, 4), %k2\n\t" "loope 1b\n\t" "setae %b0\n\t" :"=q"(result), "=&c"(discard_c), "=&r"(discard_tmp) :"r"(value0), "r"(reference0), "0"(0), "1"(size)) |
__asm__ | __volatile__ ("\n1:\n\t" "bsrl -4(%2,%1,4), %0\n\t" "loopz 1b\n\t" "rol %1\n\t" "rol %1\n\t" "leal 1(%k0,%k1,8), %k0\n\t" "jnz 2f\n\t" "xor %0, %0\n\t" "\n2:\n\t" :"=&r"(result), "=&c"(discard_c) :"r"(value0), "1"(size)) |
__asm__ | __volatile__ ("rep movsl\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %2\n\t" "rep stosl\n\t" :"=&D"(discard_D), "=&S"(discard_S), "=&c"(discard_c), "+m"(*dest) :"g"(pad_size), "0"(dest0), "1"(source0), "2"(source_size) :"eax") |
__asm__ | __volatile__ ("rep movsl\n\t" :"=&D"(discard_D), "=&S"(discard_S), "=&c"(discard_c), "+m"(*dest) :"0"(dest0), "1"(source0), "2"(dest_size) :"eax") |
__asm__ | __volatile__ ("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*out_bytes) :"r"(value0), "0"(out), "1"(len) :"eax") |
__asm__ | __volatile__ ("mull %3\n\t" "addl %5, %0\n\t" "adcl $0, %1\n\t" "addl %0, %2\n\t" "adcl $0, %1\n\t" :"=&a"(discard_a), "=&d"(*carry), "+m"(*result) :"g"(multiplicand), "0"(multiplier), "r"(*carry)) |
Variables | |
static unsigned int | size |
static unsigned int const void * | data |
static unsigned int const void size_t | len |
long | pad_len = ( sizeof ( *value ) - len ) |
void * | discard_D |
long | discard_c |
static uint32_t * | value0 |
long | index = ( bit / ( 8 * sizeof ( value->element[0] ) ) ) |
void * | discard_S |
int | carry |
int | borrow |
int | out |
int | result |
static const uint32_t * | reference0 |
long | discard_tmp |
static unsigned int | source_size |
static unsigned int uint32_t * | dest0 |
static unsigned int uint32_t unsigned int | dest_size |
long | pad_size = ( dest_size - source_size ) |
static unsigned int source_size | __unused |
static const uint32_t | multiplier |
Port multiplier number. More... | |
Big integer support.
Definition in file bigint.h.
typedef uint32_t bigint_element_t |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Initialise big integer.
Multiply big integer elements.
Finalise big integer.
Shrink big integer.
Grow big integer.
Find highest bit set in big integer.
Shift big integer right.
Shift big integer left.
Subtract big integers.
Add big integers.
value0 | Element 0 of big integer to initialise |
size | Number of elements |
data | Raw data |
len | Length of raw data |
addend0 | Element 0 of big integer to add |
value0 | Element 0 of big integer to be added to |
size | Number of elements |
carry | Carry flag |
subtrahend0 | Element 0 of big integer to subtract |
value0 | Element 0 of big integer to be subtracted from |
size | Number of elements |
borrow | Borrow flag |
value0 | Element 0 of big integer |
size | Number of elements |
out | Bit shifted out |
value0 | Element 0 of big integer |
size | Number of elements |
max_bit | Highest bit set + 1 (or 0 if no bits set) |
source0 | Element 0 of source big integer |
source_size | Number of elements in source big integer |
dest0 | Element 0 of destination big integer |
dest_size | Number of elements in destination big integer |
value0 | Element 0 of big integer to finalise |
size | Number of elements |
out | Output buffer |
len | Length of output buffer |
multiplicand | Multiplicand element |
multiplier | Multiplier element |
result | Result element |
carry | Carry element |
__asm__ __volatile__ | ( | "\n1:\n\t" "movb - | 1%3,%1, |
%%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %% | eax, | ||
%%eax\n\t" "mov % | 4 | ||
) |
__asm__ __volatile__ | ( | "xor % | 0, |
%0\n\t" "\n1:\n\t" "lodsl\n\t" "adcl %% | eax | ||
) |
__asm__ __volatile__ | ( | "xor % | 0, |
%0\n\t" "\n1:\n\t" "lodsl\n\t" "sbbl %% | eax | ||
) |
__asm__ __volatile__ | ( | "xor % | 0, |
%0\n\t" "\n1:\n\t" "rcll | $1 | ||
) |
__asm__ __volatile__ | ( | "clc\n\t" "\n1:\n\t" "rcrl | $1 | ) |
|
inlinestatic |
Test if big integer is equal to zero.
Compare big integers.
value0 | Element 0 of big integer |
size | Number of elements |
is_zero | Big integer is equal to zero |
value0 | Element 0 of big integer |
reference0 | Element 0 of reference big integer |
size | Number of elements |
geq | Big integer is greater than or equal to the reference |
__asm__ __volatile__ | ( | "xor % | 0 | ) |
__asm__ __volatile__ | ( | "\n1:\n\t" "movl - | 4%3, %1, 4, |
%k2\n\t" "cmpl - | 4%4, %1, 4 | ||
) |
__asm__ __volatile__ | ( | "\n1:\n\t" "bsrl - | 4%2,%1,4, |
%0\n\t" "loopz 1b\n\t" "rol %1\n\t" "rol %1\n\t" "leal | 1%k0,%k1, 8, | ||
%k0\n\t" "jnz 2f\n\t" "xor % | 0 | ||
) |
__asm__ __volatile__ | ( | "rep movsl\n\t" "xorl %% | eax, |
%%eax\n\t" "mov % | 4 | ||
) |
__asm__ __volatile__ | ( | ) |
__asm__ __volatile__ | ( | "mull %3\n\t" "addl % | 5, |
%0\n\t" "adcl | $0, | ||
%1\n\t" "addl % | 0, | ||
%2\n\t" "adcl | $0 | ||
) |
unsigned int size |
Definition at line 30 of file bigint.h.
Referenced by bzimage_load_initrd(), cms_decrypt(), cms_verify_padding(), efi_file_read_initrd(), ib_pull(), ib_push(), inet6_aton(), iob_pad(), iscsi_tx_data_out(), iscsi_tx_login_request(), rsa_encode_digest(), tls_new_ciphertext(), and vmbus_send().
void * discard_D |
Definition at line 31 of file bigint.h.
Referenced by call_bootsector(), copy_from_real_libkir(), copy_to_real_libkir(), meme820(), nbi_boot16(), nbi_boot32(), pcibios_discover(), pcibios_read(), pcibios_write(), pxe_start_nbp(), and undinet_call().
long discard_c |
Definition at line 32 of file bigint.h.
Referenced by bios_putchar(), copy_from_real_libkir(), copy_to_real_libkir(), cpuid_supported(), int13_load_mbr(), int13con_init(), pcibios_write(), pxe_start_nbp(), rdrand_get_noise(), rdtsc_probe(), tcpip_continue_chksum(), and ucode_exec().
static uint32_t * value0 |
Definition at line 58 of file bigint.h.
Referenced by bigint_add_sample(), bigint_bit_is_set_sample(), bigint_done_sample(), bigint_init_sample(), bigint_is_geq_sample(), bigint_is_zero_sample(), bigint_max_set_bit_sample(), bigint_montgomery_raw(), bigint_montgomery_relaxed_raw(), bigint_montgomery_sample(), bigint_ntoa_raw(), bigint_shl_sample(), bigint_shr_sample(), and bigint_subtract_sample().
Definition at line 62 of file bigint.h.
Referenced by _tg3_flag(), _tg3_flag_clear(), _tg3_flag_set(), a3c90x_prepare_rx_desc(), acpi_find(), acpi_find_via_rsdt(), acpi_table(), acpi_test_find(), amd8111e_poll(), amd8111e_transmit(), amd8111e_wait_tx_ring(), arbel_cmd_hw2sw_eq(), arbel_cmd_read_mgm(), arbel_cmd_sw2hw_eq(), arbel_cmd_sw2hw_mpt(), arbel_cmd_write_mgm(), arbel_mcast_attach(), arbel_mcast_detach(), ath5k_hw_rfb_op(), atl1e_clean_tx_ring(), b44_cam_write(), bitmap_set(), bitmap_test(), cpio_header(), deflate_inflate(), deflate_length(), deflate_set_length(), des_generate(), dns_send_packet(), draw_menu_item(), dynui_item(), ecam_find(), ecam_read(), ecam_write(), efi_block_boot(), efi_entropy_tick(), efi_file_read_dir(), efi_usb_async_start(), efi_usb_async_stop(), efi_usb_close(), efi_usb_control_transfer(), efi_usb_get_endpoint_descriptor(), efi_usb_get_string_descriptor(), efi_usb_is_open(), efi_usb_open(), efi_usb_sync_transfer(), efi_wait_for_event_wrapper(), efifb_draw(), efifb_draw_unknown(), efifb_dynamic(), efifb_glyph(), efipci_discover_any(), efipci_discover_one(), ehci_dequeue(), ehci_endpoint_poll(), ehci_enqueue(), ena_admin(), ena_admin_req(), ena_poll_rx(), ena_poll_tx(), ena_refill_rx(), ena_transmit(), exanic_expired(), exanic_probe_port(), exanic_remove_port(), falcon_read_sram(), falcon_write_sram(), gve_address(), gve_admin(), gve_admin_command(), gve_buffer(), gve_poll_rx(), gve_transmit(), hermon_cmd_hw2sw_eq(), hermon_cmd_hw2sw_mpt(), hermon_cmd_query_eq(), hermon_cmd_read_mcg(), hermon_cmd_sw2hw_eq(), hermon_cmd_sw2hw_mpt(), hermon_cmd_write_mcg(), hermon_mcast_attach(), hermon_mcast_detach(), intelxl_admin_command(), intelxl_admin_event_init(), intelxl_context(), intelxl_context_dump(), intelxl_context_line(), intelxlvf_admin_event(), isapnp_read_iobase(), isapnp_read_irqno(), jump_scroll(), nodnic_port_add_mac_filter(), nodnic_port_recv_db_dma(), nodnic_port_remove_mac_filter(), nodnic_port_send_db_dma(), nodnic_port_update_ring_doorbell(), nvconfig_get_tlv_type_and_class(), nvconfig_nvdata_access(), nvconfig_nvdata_default_access(), nvconfig_read_rom_ini_values(), nvconfig_set_fw_reset_level(), pcnet32_dwio_read_bcr(), pcnet32_dwio_read_csr(), pcnet32_dwio_write_bcr(), pcnet32_dwio_write_csr(), pcnet32_wio_read_bcr(), pcnet32_wio_read_csr(), pcnet32_wio_write_bcr(), pcnet32_wio_write_csr(), peerdist_info_block(), peerdist_info_segment(), peerdist_info_v1_block_offset(), peerdist_info_v1_segment(), peerdist_info_v2_segment(), phantom_clp_cmd(), phantom_refill_rx_ring(), phantom_transmit(), phantom_update_macaddr(), pnm_bitmap(), pxe_menu_draw_item(), qib7322_send_buffer_offset(), read_smbios_string(), ring_next(), select_setting_row(), sign_extend32(), smbios_fetch(), smscusb_get_statistics(), uhci_dequeue(), uhci_endpoint_poll(), uhci_enqueue(), usb_autoconfigure(), usb_clear_feature(), usb_config_descriptor(), usb_control(), usb_endpoint_described(), usb_endpoint_descriptor(), usb_get_config_descriptor(), usb_get_descriptor(), usb_get_status(), usb_get_string_descriptor(), usb_hub_clear_port_feature(), usb_hub_set_port_feature(), usb_message(), usb_set_configuration(), usb_set_feature(), usb_settings_fetch(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_control_poll(), usbio_endpoint_close(), usbio_endpoint_enqueue(), usbio_interrupt_callback(), usbio_interrupt_poll(), vesafb_glyph(), xen_hvm_get_param(), xhci_dequeue(), xhci_enqueue(), xhci_ring_consumed(), and xhci_set_tr_dequeue_pointer().
void * discard_S |
Definition at line 63 of file bigint.h.
Referenced by copy_from_real_libkir(), copy_to_real_libkir(), nbi_boot16(), nbi_boot32(), and tcpip_continue_chksum().
Definition at line 65 of file bigint.h.
Referenced by apm_poweroff(), bigint_montgomery_relaxed_raw(), bigint_reduce_raw(), and gcm_multiply_x().
const uint32_t* reference0 |
Definition at line 195 of file bigint.h.
Referenced by bigint_is_geq_sample().
unsigned int source_size |
Definition at line 248 of file bigint.h.
Referenced by bigint_grow_sample(), bigint_shrink_sample(), and efi_load_image_wrapper().
static unsigned int source_size uint32_t * dest0 |
Definition at line 248 of file bigint.h.
Referenced by bigint_copy_sample(), bigint_grow_sample(), and bigint_shrink_sample().
static unsigned int source_size uint32_t unsigned int dest_size |
Definition at line 249 of file bigint.h.
Referenced by bigint_grow_sample(), and bigint_shrink_sample().
long pad_size = ( dest_size - source_size ) |
uint8_t multiplier |
Port multiplier number.
Definition at line 330 of file bigint.h.
Referenced by bigint_mod_exp_ladder(), bigint_multiply_raw(), bigint_multiply_sample(), x25519_multiply(), and x25519_multiply_okx().