FreeBSD/sys/dev/usb/wlan/if_upgt.c
/*
 * The firmware awaits a checksum for each frame we send to it.
 * The algorithm used therefor is uncommon but somehow similar to CRC32.
 */
The firmware awaits a checksum for each frame we send to it.
The algorithm used therefor is uncommon but somehow similar to CRC32.
The firmware awaits a checksum for each frame we send to it . The algorithm used therefor is uncommon but somehow similar to CRC32 .
static uint32_t
upgt_chksum_le(const uint32_t *buf, size_t size)
{
	size_t i;
	uint32_t crc = 0;
	for (i = 0; i < size; i += sizeof(uint32_t)) {
		crc = htole32(crc ^ *buf++);
		crc = htole32((crc >> 5) ^ (crc << 3));
	}
	return (crc);
}
static uint32_t upgt_chksum_le ( const uint32_t * buf , size_t size ) { size_t i ; uint32_t crc = 0 ; for ( i = 0 ; i < size ; i += sizeof ( uint32_t ) ) { crc = htole32 ( crc ^ * buf ++ ) ; crc = htole32 ( ( crc >> 5 ) ^ ( crc << 3 ) ) ; } return ( crc ) ; }
The firmware awaits a checksum for each frame we send to it.
The firmware awaits a checksum for each frame we send to it .