build: crc_test depends on unix

For some reason the link fails for me with ounit 2. This is probably
a problem with the ounit package, but the workaround is fairly harmless.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
API: Cstruct.ts have a built-in notion of 'offset' and 'length'

Rather than pass in additional 'offset' and 'length' parameters,
the client can use the 'Cstruct.sub' function to create a "view"
over the same underlying buffer.

Future versions of Cstruct (> 1.0.1) have extensive bounds-checking
built-in, which we get for free if we encourage the use of
'Cstruct.sub'. For now we keep our additional bounds-checks so
that we're safe for all versions of Cstruct.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
API: since there are multiple CRC algorithms, move CRC-32 into a module

There are many different variants of CRC, catalogued on the wikipedia
page:

http://en.wikipedia.org/wiki/Cyclic_redundancy_check#Commonly_used_and_standardized_CRCs

This library currently only supports CRC-32 (as used in Ethernet, *zip,
MPEG etc) but we could add support for other variants later, especially
CRC-32C (as used in iSCSI) which can be hardware-accelerated on modern
CPUs.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Add copyright and license information to the crc_stubs.c

Since the original code is based on work by Gary S. Brown

http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/libkern/crc32.c

with the license, "You may use this program, or code or tables extracted
from it, as desired without restriction.", we'll distribute our
derivative work under a similarly permissive ISC license.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Add the ISC license to other files

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
test: add cases for LVM2's use of CRC-32

LVM2's crc implementation omits the pre- and post- xor with ~0U and
passes in an unusual initial value, for no good reason.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Add README.md and MAINTAINERS

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Add CHANGES file

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
test: the bounds checks only apply to the string interface

In the case of Cstructs, we can rely on the cstruct library performing
bounds checks.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #1 from djs55/improve-cstruct-api

Make the Cstruct API a bit more natural