iPXE
crc32.c File Reference
#include <ipxe/crc32.h>

Go to the source code of this file.

Macros

#define CRCPOLY   0xedb88320

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 FILE_SECBOOT (PERMITTED)
u32 crc32_le (u32 seed, const void *data, size_t len)
 Calculate 32-bit little-endian CRC checksum.

Macro Definition Documentation

◆ CRCPOLY

#define CRCPOLY   0xedb88320

Definition at line 27 of file crc32.c.

Referenced by crc32_le().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ crc32_le()

u32 crc32_le ( u32 seed,
const void * data,
size_t len )

Calculate 32-bit little-endian CRC checksum.

Parameters
seedInitial value
dataData to checksum
lenLength of data

Usually seed is initially zero or all one bits, depending on the protocol. To continue a CRC checksum over multiple calls, pass the return value from one call as the seed parameter to the next.

Definition at line 40 of file crc32.c.

41{
42 u32 crc = seed;
43 const u8 *src = data;
44 u32 mult;
45 int i;
46
47 while ( len-- ) {
48 crc ^= *src++;
49 for ( i = 0; i < 8; i++ ) {
50 mult = ( crc & 1 ) ? CRCPOLY : 0;
51 crc = ( crc >> 1 ) ^ mult;
52 }
53 }
54
55 return crc;
56}
static const void * src
Definition string.h:48
#define CRCPOLY
Definition crc32.c:27
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
#define u8
Definition igbvf_osdep.h:40
#define u32
Definition vga.h:21

References CRCPOLY, data, len, src, u32, and u8.

Referenced by efirng_get_noise(), fcoe_deliver(), fcoe_rx(), icmpcol(), ipv6col(), start_dhcpv6(), tkip_decrypt(), tkip_encrypt(), validator_start_download(), wep_decrypt(), and wep_encrypt().