summary refs log tree commit diff stats
path: root/include/qemu/crc32c.h
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2013-04-29 14:48:16 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2013-05-03 10:31:58 +0200
commit8e1b02b8ef2eefcb2ff3855531d7bc2ea71e1fb4 (patch)
tree7d148ba86aaf7485263483521c7259042346799c /include/qemu/crc32c.h
parent8ca27ce2e1150486ea2db4116a03706b28294f16 (diff)
downloadfocaccia-qemu-8e1b02b8ef2eefcb2ff3855531d7bc2ea71e1fb4.tar.gz
focaccia-qemu-8e1b02b8ef2eefcb2ff3855531d7bc2ea71e1fb4.zip
qemu: add castagnoli crc32c checksum algorithm
This adds the Castagnoli CRC32C algorithm, using the 0x11EDC6F41
polynomial.

This is extracted from the linux kernel cryptographic crc32.c module.

The algorithm is based on:

Castagnoli93: Guy Castagnoli and Stefan Braeuer and Martin Herrman
             "Optimization of Cyclic Redundancy-Check Codes with 24
              and 32 Parity Bits", IEEE Transactions on Communication,
              Volume 41, Number 6, June 1993

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/qemu/crc32c.h')
-rw-r--r--include/qemu/crc32c.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/qemu/crc32c.h b/include/qemu/crc32c.h
new file mode 100644
index 0000000000..56d1c3bfde
--- /dev/null
+++ b/include/qemu/crc32c.h
@@ -0,0 +1,35 @@
+/*
+ *  Castagnoli CRC32C Checksum Algorithm
+ *
+ *  Polynomial: 0x11EDC6F41
+ *
+ *  Castagnoli93: Guy Castagnoli and Stefan Braeuer and Martin Herrman
+ *               "Optimization of Cyclic Redundancy-Check Codes with 24
+ *                 and 32 Parity Bits",IEEE Transactions on Communication,
+ *                Volume 41, Number 6, June 1993
+ *
+ *  Copyright (c) 2013 Red Hat, Inc.,
+ *
+ *  Authors:
+ *   Jeff Cody <jcody@redhat.com>
+ *
+ *  Based on the Linux kernel cryptographic crc32c module,
+ *
+ *  Copyright (c) 2004 Cisco Systems, Inc.
+ *  Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ */
+
+#ifndef QEMU_CRC32_H
+#define QEMU_CRC32_H
+
+#include "qemu-common.h"
+
+uint32_t crc32c(uint32_t crc, const uint8_t *data, unsigned int length);
+
+#endif