Introduce crc32 calculation support

This is necessary to verify legacy kernels (vmlinuz format). The code
was borrowed from u-boot with the following simplifications:

 - no watchdog invocation during calculation;
 - no option of supplying the prebuilt polynomial table;

It is added here instead of libpayload to avoid license term
discussions. It could be moved to libpayload later if appropriate.

BUG=chrome-os-partner:27784
TEST=tested along with other patches by verifying the legacy kernel
     blob (both header and body CRC calculations matched).

Change-Id: I1f027170c206753cede732d7856b1aa28327c5f2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/204871
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2 files changed