11da177e4SLinus Torvalds /* 278dff418SBob Pearson * Aug 8, 2011 Bob Pearson with help from Joakim Tjernlund and George Spelvin 378dff418SBob Pearson * cleaned up code to current version of sparse and added the slicing-by-8 478dff418SBob Pearson * algorithm to the closely similar existing slicing-by-4 algorithm. 578dff418SBob Pearson * 61da177e4SLinus Torvalds * Oct 15, 2000 Matt Domsch <Matt_Domsch@dell.com> 71da177e4SLinus Torvalds * Nicer crc32 functions/docs submitted by linux@horizon.com. Thanks! 81da177e4SLinus Torvalds * Code was from the public domain, copyright abandoned. Code was 91da177e4SLinus Torvalds * subsequently included in the kernel, thus was re-licensed under the 101da177e4SLinus Torvalds * GNU GPL v2. 111da177e4SLinus Torvalds * 121da177e4SLinus Torvalds * Oct 12, 2000 Matt Domsch <Matt_Domsch@dell.com> 131da177e4SLinus Torvalds * Same crc32 function was used in 5 other places in the kernel. 141da177e4SLinus Torvalds * I made one version, and deleted the others. 151da177e4SLinus Torvalds * There are various incantations of crc32(). Some use a seed of 0 or ~0. 161da177e4SLinus Torvalds * Some xor at the end with ~0. The generic crc32() function takes 171da177e4SLinus Torvalds * seed as an argument, and doesn't xor at the end. Then individual 181da177e4SLinus Torvalds * users can do whatever they need. 191da177e4SLinus Torvalds * drivers/net/smc9194.c uses seed ~0, doesn't xor with ~0. 201da177e4SLinus Torvalds * fs/jffs2 uses seed 0, doesn't xor with ~0. 211da177e4SLinus Torvalds * fs/partitions/efi.c uses seed ~0, xor's with ~0. 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds * This source code is licensed under the GNU General Public License, 241da177e4SLinus Torvalds * Version 2. See the file COPYING for more details. 251da177e4SLinus Torvalds */ 261da177e4SLinus Torvalds 27fbedceb1SBob Pearson /* see: Documentation/crc32.txt for a description of algorithms */ 28fbedceb1SBob Pearson 291da177e4SLinus Torvalds #include <linux/crc32.h> 301da177e4SLinus Torvalds #include <linux/module.h> 311da177e4SLinus Torvalds #include <linux/types.h> 32cc0ac199SDaniel Borkmann #include <linux/sched.h> 331da177e4SLinus Torvalds #include "crc32defs.h" 3460e58d5cSBob Pearson 359a1dbf6aSBob Pearson #if CRC_LE_BITS > 8 3638b4fe5fSFabian Frederick # define tole(x) ((__force u32) cpu_to_le32(x)) 371da177e4SLinus Torvalds #else 381da177e4SLinus Torvalds # define tole(x) (x) 394f2a9463SJoakim Tjernlund #endif 404f2a9463SJoakim Tjernlund 419a1dbf6aSBob Pearson #if CRC_BE_BITS > 8 4238b4fe5fSFabian Frederick # define tobe(x) ((__force u32) cpu_to_be32(x)) 434f2a9463SJoakim Tjernlund #else 441da177e4SLinus Torvalds # define tobe(x) (x) 451da177e4SLinus Torvalds #endif 4660e58d5cSBob Pearson 471da177e4SLinus Torvalds #include "crc32table.h" 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds MODULE_AUTHOR("Matt Domsch <Matt_Domsch@dell.com>"); 5046c5801eSDarrick J. Wong MODULE_DESCRIPTION("Various CRC32 calculations"); 511da177e4SLinus Torvalds MODULE_LICENSE("GPL"); 521da177e4SLinus Torvalds 539a1dbf6aSBob Pearson #if CRC_LE_BITS > 8 || CRC_BE_BITS > 8 54ddcaccbcSJoakim Tjernlund 55324eb0f1SBob Pearson /* implements slicing-by-4 or slicing-by-8 algorithm */ 56ddcaccbcSJoakim Tjernlund static inline u32 57836e2af9SJoakim Tjernlund crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) 58ddcaccbcSJoakim Tjernlund { 590d2daf5cSAndrew Morton # ifdef __LITTLE_ENDIAN 605742332dSJoakim Tjernlund # define DO_CRC(x) crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8) 61324eb0f1SBob Pearson # define DO_CRC4 (t3[(q) & 255] ^ t2[(q >> 8) & 255] ^ \ 62324eb0f1SBob Pearson t1[(q >> 16) & 255] ^ t0[(q >> 24) & 255]) 63324eb0f1SBob Pearson # define DO_CRC8 (t7[(q) & 255] ^ t6[(q >> 8) & 255] ^ \ 64324eb0f1SBob Pearson t5[(q >> 16) & 255] ^ t4[(q >> 24) & 255]) 65ddcaccbcSJoakim Tjernlund # else 665742332dSJoakim Tjernlund # define DO_CRC(x) crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8) 67324eb0f1SBob Pearson # define DO_CRC4 (t0[(q) & 255] ^ t1[(q >> 8) & 255] ^ \ 68324eb0f1SBob Pearson t2[(q >> 16) & 255] ^ t3[(q >> 24) & 255]) 69324eb0f1SBob Pearson # define DO_CRC8 (t4[(q) & 255] ^ t5[(q >> 8) & 255] ^ \ 70324eb0f1SBob Pearson t6[(q >> 16) & 255] ^ t7[(q >> 24) & 255]) 71ddcaccbcSJoakim Tjernlund # endif 724f2a9463SJoakim Tjernlund const u32 *b; 73ddcaccbcSJoakim Tjernlund size_t rem_len; 740292c497SBob Pearson # ifdef CONFIG_X86 750292c497SBob Pearson size_t i; 760292c497SBob Pearson # endif 775742332dSJoakim Tjernlund const u32 *t0=tab[0], *t1=tab[1], *t2=tab[2], *t3=tab[3]; 7849ac572bSThiago Rafael Becker # if CRC_LE_BITS != 32 79324eb0f1SBob Pearson const u32 *t4 = tab[4], *t5 = tab[5], *t6 = tab[6], *t7 = tab[7]; 8049ac572bSThiago Rafael Becker # endif 81324eb0f1SBob Pearson u32 q; 82ddcaccbcSJoakim Tjernlund 83ddcaccbcSJoakim Tjernlund /* Align it */ 844f2a9463SJoakim Tjernlund if (unlikely((long)buf & 3 && len)) { 85ddcaccbcSJoakim Tjernlund do { 864f2a9463SJoakim Tjernlund DO_CRC(*buf++); 874f2a9463SJoakim Tjernlund } while ((--len) && ((long)buf)&3); 88ddcaccbcSJoakim Tjernlund } 89324eb0f1SBob Pearson 90324eb0f1SBob Pearson # if CRC_LE_BITS == 32 91ddcaccbcSJoakim Tjernlund rem_len = len & 3; 92ddcaccbcSJoakim Tjernlund len = len >> 2; 93324eb0f1SBob Pearson # else 94324eb0f1SBob Pearson rem_len = len & 7; 95324eb0f1SBob Pearson len = len >> 3; 96324eb0f1SBob Pearson # endif 97324eb0f1SBob Pearson 984f2a9463SJoakim Tjernlund b = (const u32 *)buf; 990292c497SBob Pearson # ifdef CONFIG_X86 1000292c497SBob Pearson --b; 1010292c497SBob Pearson for (i = 0; i < len; i++) { 1020292c497SBob Pearson # else 103ddcaccbcSJoakim Tjernlund for (--b; len; --len) { 1040292c497SBob Pearson # endif 105324eb0f1SBob Pearson q = crc ^ *++b; /* use pre increment for speed */ 106324eb0f1SBob Pearson # if CRC_LE_BITS == 32 107324eb0f1SBob Pearson crc = DO_CRC4; 108324eb0f1SBob Pearson # else 109324eb0f1SBob Pearson crc = DO_CRC8; 110324eb0f1SBob Pearson q = *++b; 111324eb0f1SBob Pearson crc ^= DO_CRC4; 112324eb0f1SBob Pearson # endif 113ddcaccbcSJoakim Tjernlund } 114ddcaccbcSJoakim Tjernlund len = rem_len; 115ddcaccbcSJoakim Tjernlund /* And the last few bytes */ 116ddcaccbcSJoakim Tjernlund if (len) { 117ddcaccbcSJoakim Tjernlund u8 *p = (u8 *)(b + 1) - 1; 1180292c497SBob Pearson # ifdef CONFIG_X86 1190292c497SBob Pearson for (i = 0; i < len; i++) 1200292c497SBob Pearson DO_CRC(*++p); /* use pre increment for speed */ 1210292c497SBob Pearson # else 122ddcaccbcSJoakim Tjernlund do { 123ddcaccbcSJoakim Tjernlund DO_CRC(*++p); /* use pre increment for speed */ 124ddcaccbcSJoakim Tjernlund } while (--len); 1250292c497SBob Pearson # endif 126ddcaccbcSJoakim Tjernlund } 127ddcaccbcSJoakim Tjernlund return crc; 1284f2a9463SJoakim Tjernlund #undef DO_CRC 129836e2af9SJoakim Tjernlund #undef DO_CRC4 130324eb0f1SBob Pearson #undef DO_CRC8 131ddcaccbcSJoakim Tjernlund } 132ddcaccbcSJoakim Tjernlund #endif 13360e58d5cSBob Pearson 1346e95fcaaSDaniel Borkmann 1352f72100cSRandy Dunlap /** 136f2e1d2acSGu Zheng * crc32_le_generic() - Calculate bitwise little-endian Ethernet AUTODIN II 137f2e1d2acSGu Zheng * CRC32/CRC32C 138f2e1d2acSGu Zheng * @crc: seed value for computation. ~0 for Ethernet, sometimes 0 for other 139f2e1d2acSGu Zheng * uses, or the previous crc32/crc32c value if computing incrementally. 140f2e1d2acSGu Zheng * @p: pointer to buffer over which CRC32/CRC32C is run 1412f72100cSRandy Dunlap * @len: length of buffer @p 142f2e1d2acSGu Zheng * @tab: little-endian Ethernet table 143f2e1d2acSGu Zheng * @polynomial: CRC32/CRC32c LE polynomial 1442f72100cSRandy Dunlap */ 14546c5801eSDarrick J. Wong static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p, 14646c5801eSDarrick J. Wong size_t len, const u32 (*tab)[256], 14746c5801eSDarrick J. Wong u32 polynomial) 1481da177e4SLinus Torvalds { 14960e58d5cSBob Pearson #if CRC_LE_BITS == 1 1501da177e4SLinus Torvalds int i; 1511da177e4SLinus Torvalds while (len--) { 1521da177e4SLinus Torvalds crc ^= *p++; 1531da177e4SLinus Torvalds for (i = 0; i < 8; i++) 15446c5801eSDarrick J. Wong crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0); 1551da177e4SLinus Torvalds } 15660e58d5cSBob Pearson # elif CRC_LE_BITS == 2 15760e58d5cSBob Pearson while (len--) { 15860e58d5cSBob Pearson crc ^= *p++; 15946c5801eSDarrick J. Wong crc = (crc >> 2) ^ tab[0][crc & 3]; 16046c5801eSDarrick J. Wong crc = (crc >> 2) ^ tab[0][crc & 3]; 16146c5801eSDarrick J. Wong crc = (crc >> 2) ^ tab[0][crc & 3]; 16246c5801eSDarrick J. Wong crc = (crc >> 2) ^ tab[0][crc & 3]; 1631da177e4SLinus Torvalds } 16460e58d5cSBob Pearson # elif CRC_LE_BITS == 4 16560e58d5cSBob Pearson while (len--) { 16660e58d5cSBob Pearson crc ^= *p++; 16746c5801eSDarrick J. Wong crc = (crc >> 4) ^ tab[0][crc & 15]; 16846c5801eSDarrick J. Wong crc = (crc >> 4) ^ tab[0][crc & 15]; 16960e58d5cSBob Pearson } 17060e58d5cSBob Pearson # elif CRC_LE_BITS == 8 1719a1dbf6aSBob Pearson /* aka Sarwate algorithm */ 1729a1dbf6aSBob Pearson while (len--) { 1739a1dbf6aSBob Pearson crc ^= *p++; 17446c5801eSDarrick J. Wong crc = (crc >> 8) ^ tab[0][crc & 255]; 1759a1dbf6aSBob Pearson } 1769a1dbf6aSBob Pearson # else 177ce4320ddSBob Pearson crc = (__force u32) __cpu_to_le32(crc); 178ddcaccbcSJoakim Tjernlund crc = crc32_body(crc, p, len, tab); 179ce4320ddSBob Pearson crc = __le32_to_cpu((__force __le32)crc); 1801da177e4SLinus Torvalds #endif 18160e58d5cSBob Pearson return crc; 1821da177e4SLinus Torvalds } 18346c5801eSDarrick J. Wong 18446c5801eSDarrick J. Wong #if CRC_LE_BITS == 1 18546c5801eSDarrick J. Wong u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) 18646c5801eSDarrick J. Wong { 18746c5801eSDarrick J. Wong return crc32_le_generic(crc, p, len, NULL, CRCPOLY_LE); 18846c5801eSDarrick J. Wong } 18946c5801eSDarrick J. Wong u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) 19046c5801eSDarrick J. Wong { 19146c5801eSDarrick J. Wong return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE); 19246c5801eSDarrick J. Wong } 19346c5801eSDarrick J. Wong #else 19446c5801eSDarrick J. Wong u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) 19546c5801eSDarrick J. Wong { 1968f243af4SJoe Mario return crc32_le_generic(crc, p, len, 1978f243af4SJoe Mario (const u32 (*)[256])crc32table_le, CRCPOLY_LE); 19846c5801eSDarrick J. Wong } 19946c5801eSDarrick J. Wong u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) 20046c5801eSDarrick J. Wong { 2018f243af4SJoe Mario return crc32_le_generic(crc, p, len, 2028f243af4SJoe Mario (const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE); 20346c5801eSDarrick J. Wong } 20446c5801eSDarrick J. Wong #endif 205*6d514b4eSGeorge Spelvin EXPORT_SYMBOL(crc32_le); 206*6d514b4eSGeorge Spelvin EXPORT_SYMBOL(__crc32c_le); 207*6d514b4eSGeorge Spelvin 208*6d514b4eSGeorge Spelvin /* 209*6d514b4eSGeorge Spelvin * This multiplies the polynomials x and y modulo the given modulus. 210*6d514b4eSGeorge Spelvin * This follows the "little-endian" CRC convention that the lsbit 211*6d514b4eSGeorge Spelvin * represents the highest power of x, and the msbit represents x^0. 212*6d514b4eSGeorge Spelvin */ 213*6d514b4eSGeorge Spelvin static u32 __attribute_const__ gf2_multiply(u32 x, u32 y, u32 modulus) 2146e95fcaaSDaniel Borkmann { 215*6d514b4eSGeorge Spelvin u32 product = x & 1 ? y : 0; 216*6d514b4eSGeorge Spelvin int i; 217*6d514b4eSGeorge Spelvin 218*6d514b4eSGeorge Spelvin for (i = 0; i < 31; i++) { 219*6d514b4eSGeorge Spelvin product = (product >> 1) ^ (product & 1 ? modulus : 0); 220*6d514b4eSGeorge Spelvin x >>= 1; 221*6d514b4eSGeorge Spelvin product ^= x & 1 ? y : 0; 2226e95fcaaSDaniel Borkmann } 2236e95fcaaSDaniel Borkmann 224*6d514b4eSGeorge Spelvin return product; 2256e95fcaaSDaniel Borkmann } 226*6d514b4eSGeorge Spelvin 227*6d514b4eSGeorge Spelvin /** 228*6d514b4eSGeorge Spelvin * crc32_generic_shift - Append len 0 bytes to crc, in logarithmic time 229*6d514b4eSGeorge Spelvin * @crc: The original little-endian CRC (i.e. lsbit is x^31 coefficient) 230*6d514b4eSGeorge Spelvin * @len: The number of bytes. @crc is multiplied by x^(8*@len) 231*6d514b4eSGeorge Spelvin * @polynomial: The modulus used to reduce the result to 32 bits. 232*6d514b4eSGeorge Spelvin * 233*6d514b4eSGeorge Spelvin * It's possible to parallelize CRC computations by computing a CRC 234*6d514b4eSGeorge Spelvin * over separate ranges of a buffer, then summing them. 235*6d514b4eSGeorge Spelvin * This shifts the given CRC by 8*len bits (i.e. produces the same effect 236*6d514b4eSGeorge Spelvin * as appending len bytes of zero to the data), in time proportional 237*6d514b4eSGeorge Spelvin * to log(len). 238*6d514b4eSGeorge Spelvin */ 239*6d514b4eSGeorge Spelvin static u32 __attribute_const__ crc32_generic_shift(u32 crc, size_t len, 240*6d514b4eSGeorge Spelvin u32 polynomial) 241*6d514b4eSGeorge Spelvin { 242*6d514b4eSGeorge Spelvin u32 power = polynomial; /* CRC of x^32 */ 243*6d514b4eSGeorge Spelvin int i; 244*6d514b4eSGeorge Spelvin 245*6d514b4eSGeorge Spelvin /* Shift up to 32 bits in the simple linear way */ 246*6d514b4eSGeorge Spelvin for (i = 0; i < 8 * (int)(len & 3); i++) 247*6d514b4eSGeorge Spelvin crc = (crc >> 1) ^ (crc & 1 ? polynomial : 0); 248*6d514b4eSGeorge Spelvin 249*6d514b4eSGeorge Spelvin len >>= 2; 250*6d514b4eSGeorge Spelvin if (!len) 251*6d514b4eSGeorge Spelvin return crc; 252*6d514b4eSGeorge Spelvin 253*6d514b4eSGeorge Spelvin for (;;) { 254*6d514b4eSGeorge Spelvin /* "power" is x^(2^i), modulo the polynomial */ 255*6d514b4eSGeorge Spelvin if (len & 1) 256*6d514b4eSGeorge Spelvin crc = gf2_multiply(crc, power, polynomial); 257*6d514b4eSGeorge Spelvin 258*6d514b4eSGeorge Spelvin len >>= 1; 259*6d514b4eSGeorge Spelvin if (!len) 260*6d514b4eSGeorge Spelvin break; 261*6d514b4eSGeorge Spelvin 262*6d514b4eSGeorge Spelvin /* Square power, advancing to x^(2^(i+1)) */ 263*6d514b4eSGeorge Spelvin power = gf2_multiply(power, power, polynomial); 264*6d514b4eSGeorge Spelvin } 265*6d514b4eSGeorge Spelvin 266*6d514b4eSGeorge Spelvin return crc; 267*6d514b4eSGeorge Spelvin } 268*6d514b4eSGeorge Spelvin 269*6d514b4eSGeorge Spelvin u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len) 270*6d514b4eSGeorge Spelvin { 271*6d514b4eSGeorge Spelvin return crc32_generic_shift(crc, len, CRCPOLY_LE); 272*6d514b4eSGeorge Spelvin } 273*6d514b4eSGeorge Spelvin 274*6d514b4eSGeorge Spelvin u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len) 275*6d514b4eSGeorge Spelvin { 276*6d514b4eSGeorge Spelvin return crc32_generic_shift(crc, len, CRC32C_POLY_LE); 277*6d514b4eSGeorge Spelvin } 278*6d514b4eSGeorge Spelvin EXPORT_SYMBOL(crc32_le_shift); 279*6d514b4eSGeorge Spelvin EXPORT_SYMBOL(__crc32c_le_shift); 2801da177e4SLinus Torvalds 2812f72100cSRandy Dunlap /** 282f2e1d2acSGu Zheng * crc32_be_generic() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32 2832f72100cSRandy Dunlap * @crc: seed value for computation. ~0 for Ethernet, sometimes 0 for 2842f72100cSRandy Dunlap * other uses, or the previous crc32 value if computing incrementally. 285f2e1d2acSGu Zheng * @p: pointer to buffer over which CRC32 is run 2862f72100cSRandy Dunlap * @len: length of buffer @p 287f2e1d2acSGu Zheng * @tab: big-endian Ethernet table 288f2e1d2acSGu Zheng * @polynomial: CRC32 BE polynomial 2892f72100cSRandy Dunlap */ 29046c5801eSDarrick J. Wong static inline u32 __pure crc32_be_generic(u32 crc, unsigned char const *p, 29146c5801eSDarrick J. Wong size_t len, const u32 (*tab)[256], 29246c5801eSDarrick J. Wong u32 polynomial) 2931da177e4SLinus Torvalds { 29460e58d5cSBob Pearson #if CRC_BE_BITS == 1 2951da177e4SLinus Torvalds int i; 2961da177e4SLinus Torvalds while (len--) { 2971da177e4SLinus Torvalds crc ^= *p++ << 24; 2981da177e4SLinus Torvalds for (i = 0; i < 8; i++) 2991da177e4SLinus Torvalds crc = 30046c5801eSDarrick J. Wong (crc << 1) ^ ((crc & 0x80000000) ? polynomial : 3011da177e4SLinus Torvalds 0); 3021da177e4SLinus Torvalds } 30360e58d5cSBob Pearson # elif CRC_BE_BITS == 2 30460e58d5cSBob Pearson while (len--) { 30560e58d5cSBob Pearson crc ^= *p++ << 24; 30646c5801eSDarrick J. Wong crc = (crc << 2) ^ tab[0][crc >> 30]; 30746c5801eSDarrick J. Wong crc = (crc << 2) ^ tab[0][crc >> 30]; 30846c5801eSDarrick J. Wong crc = (crc << 2) ^ tab[0][crc >> 30]; 30946c5801eSDarrick J. Wong crc = (crc << 2) ^ tab[0][crc >> 30]; 3101da177e4SLinus Torvalds } 31160e58d5cSBob Pearson # elif CRC_BE_BITS == 4 31260e58d5cSBob Pearson while (len--) { 31360e58d5cSBob Pearson crc ^= *p++ << 24; 31446c5801eSDarrick J. Wong crc = (crc << 4) ^ tab[0][crc >> 28]; 31546c5801eSDarrick J. Wong crc = (crc << 4) ^ tab[0][crc >> 28]; 31660e58d5cSBob Pearson } 31760e58d5cSBob Pearson # elif CRC_BE_BITS == 8 3189a1dbf6aSBob Pearson while (len--) { 3199a1dbf6aSBob Pearson crc ^= *p++ << 24; 32046c5801eSDarrick J. Wong crc = (crc << 8) ^ tab[0][crc >> 24]; 3219a1dbf6aSBob Pearson } 3229a1dbf6aSBob Pearson # else 323ce4320ddSBob Pearson crc = (__force u32) __cpu_to_be32(crc); 324ddcaccbcSJoakim Tjernlund crc = crc32_body(crc, p, len, tab); 325ce4320ddSBob Pearson crc = __be32_to_cpu((__force __be32)crc); 3261da177e4SLinus Torvalds # endif 32760e58d5cSBob Pearson return crc; 3281da177e4SLinus Torvalds } 32946c5801eSDarrick J. Wong 33046c5801eSDarrick J. Wong #if CRC_LE_BITS == 1 33146c5801eSDarrick J. Wong u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) 33246c5801eSDarrick J. Wong { 33346c5801eSDarrick J. Wong return crc32_be_generic(crc, p, len, NULL, CRCPOLY_BE); 33446c5801eSDarrick J. Wong } 33546c5801eSDarrick J. Wong #else 33646c5801eSDarrick J. Wong u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) 33746c5801eSDarrick J. Wong { 3388f243af4SJoe Mario return crc32_be_generic(crc, p, len, 3398f243af4SJoe Mario (const u32 (*)[256])crc32table_be, CRCPOLY_BE); 34046c5801eSDarrick J. Wong } 34146c5801eSDarrick J. Wong #endif 3421da177e4SLinus Torvalds EXPORT_SYMBOL(crc32_be); 3431da177e4SLinus Torvalds 3443863ef31SBob Pearson #ifdef CONFIG_CRC32_SELFTEST 3451da177e4SLinus Torvalds 3463863ef31SBob Pearson /* 4096 random bytes */ 3473863ef31SBob Pearson static u8 __attribute__((__aligned__(8))) test_buf[] = 3481da177e4SLinus Torvalds { 3493863ef31SBob Pearson 0x5b, 0x85, 0x21, 0xcb, 0x09, 0x68, 0x7d, 0x30, 3503863ef31SBob Pearson 0xc7, 0x69, 0xd7, 0x30, 0x92, 0xde, 0x59, 0xe4, 3513863ef31SBob Pearson 0xc9, 0x6e, 0x8b, 0xdb, 0x98, 0x6b, 0xaa, 0x60, 3523863ef31SBob Pearson 0xa8, 0xb5, 0xbc, 0x6c, 0xa9, 0xb1, 0x5b, 0x2c, 3533863ef31SBob Pearson 0xea, 0xb4, 0x92, 0x6a, 0x3f, 0x79, 0x91, 0xe4, 3543863ef31SBob Pearson 0xe9, 0x70, 0x51, 0x8c, 0x7f, 0x95, 0x6f, 0x1a, 3553863ef31SBob Pearson 0x56, 0xa1, 0x5c, 0x27, 0x03, 0x67, 0x9f, 0x3a, 3563863ef31SBob Pearson 0xe2, 0x31, 0x11, 0x29, 0x6b, 0x98, 0xfc, 0xc4, 3573863ef31SBob Pearson 0x53, 0x24, 0xc5, 0x8b, 0xce, 0x47, 0xb2, 0xb9, 3583863ef31SBob Pearson 0x32, 0xcb, 0xc1, 0xd0, 0x03, 0x57, 0x4e, 0xd4, 3593863ef31SBob Pearson 0xe9, 0x3c, 0xa1, 0x63, 0xcf, 0x12, 0x0e, 0xca, 3603863ef31SBob Pearson 0xe1, 0x13, 0xd1, 0x93, 0xa6, 0x88, 0x5c, 0x61, 3613863ef31SBob Pearson 0x5b, 0xbb, 0xf0, 0x19, 0x46, 0xb4, 0xcf, 0x9e, 3623863ef31SBob Pearson 0xb6, 0x6b, 0x4c, 0x3a, 0xcf, 0x60, 0xf9, 0x7a, 3633863ef31SBob Pearson 0x8d, 0x07, 0x63, 0xdb, 0x40, 0xe9, 0x0b, 0x6f, 3643863ef31SBob Pearson 0xad, 0x97, 0xf1, 0xed, 0xd0, 0x1e, 0x26, 0xfd, 3653863ef31SBob Pearson 0xbf, 0xb7, 0xc8, 0x04, 0x94, 0xf8, 0x8b, 0x8c, 3663863ef31SBob Pearson 0xf1, 0xab, 0x7a, 0xd4, 0xdd, 0xf3, 0xe8, 0x88, 3673863ef31SBob Pearson 0xc3, 0xed, 0x17, 0x8a, 0x9b, 0x40, 0x0d, 0x53, 3683863ef31SBob Pearson 0x62, 0x12, 0x03, 0x5f, 0x1b, 0x35, 0x32, 0x1f, 3693863ef31SBob Pearson 0xb4, 0x7b, 0x93, 0x78, 0x0d, 0xdb, 0xce, 0xa4, 3703863ef31SBob Pearson 0xc0, 0x47, 0xd5, 0xbf, 0x68, 0xe8, 0x5d, 0x74, 3713863ef31SBob Pearson 0x8f, 0x8e, 0x75, 0x1c, 0xb2, 0x4f, 0x9a, 0x60, 3723863ef31SBob Pearson 0xd1, 0xbe, 0x10, 0xf4, 0x5c, 0xa1, 0x53, 0x09, 3733863ef31SBob Pearson 0xa5, 0xe0, 0x09, 0x54, 0x85, 0x5c, 0xdc, 0x07, 3743863ef31SBob Pearson 0xe7, 0x21, 0x69, 0x7b, 0x8a, 0xfd, 0x90, 0xf1, 3753863ef31SBob Pearson 0x22, 0xd0, 0xb4, 0x36, 0x28, 0xe6, 0xb8, 0x0f, 3763863ef31SBob Pearson 0x39, 0xde, 0xc8, 0xf3, 0x86, 0x60, 0x34, 0xd2, 3773863ef31SBob Pearson 0x5e, 0xdf, 0xfd, 0xcf, 0x0f, 0xa9, 0x65, 0xf0, 3783863ef31SBob Pearson 0xd5, 0x4d, 0x96, 0x40, 0xe3, 0xdf, 0x3f, 0x95, 3793863ef31SBob Pearson 0x5a, 0x39, 0x19, 0x93, 0xf4, 0x75, 0xce, 0x22, 3803863ef31SBob Pearson 0x00, 0x1c, 0x93, 0xe2, 0x03, 0x66, 0xf4, 0x93, 3813863ef31SBob Pearson 0x73, 0x86, 0x81, 0x8e, 0x29, 0x44, 0x48, 0x86, 3823863ef31SBob Pearson 0x61, 0x7c, 0x48, 0xa3, 0x43, 0xd2, 0x9c, 0x8d, 3833863ef31SBob Pearson 0xd4, 0x95, 0xdd, 0xe1, 0x22, 0x89, 0x3a, 0x40, 3843863ef31SBob Pearson 0x4c, 0x1b, 0x8a, 0x04, 0xa8, 0x09, 0x69, 0x8b, 3853863ef31SBob Pearson 0xea, 0xc6, 0x55, 0x8e, 0x57, 0xe6, 0x64, 0x35, 3863863ef31SBob Pearson 0xf0, 0xc7, 0x16, 0x9f, 0x5d, 0x5e, 0x86, 0x40, 3873863ef31SBob Pearson 0x46, 0xbb, 0xe5, 0x45, 0x88, 0xfe, 0xc9, 0x63, 3883863ef31SBob Pearson 0x15, 0xfb, 0xf5, 0xbd, 0x71, 0x61, 0xeb, 0x7b, 3893863ef31SBob Pearson 0x78, 0x70, 0x07, 0x31, 0x03, 0x9f, 0xb2, 0xc8, 3903863ef31SBob Pearson 0xa7, 0xab, 0x47, 0xfd, 0xdf, 0xa0, 0x78, 0x72, 3913863ef31SBob Pearson 0xa4, 0x2a, 0xe4, 0xb6, 0xba, 0xc0, 0x1e, 0x86, 3923863ef31SBob Pearson 0x71, 0xe6, 0x3d, 0x18, 0x37, 0x70, 0xe6, 0xff, 3933863ef31SBob Pearson 0xe0, 0xbc, 0x0b, 0x22, 0xa0, 0x1f, 0xd3, 0xed, 3943863ef31SBob Pearson 0xa2, 0x55, 0x39, 0xab, 0xa8, 0x13, 0x73, 0x7c, 3953863ef31SBob Pearson 0x3f, 0xb2, 0xd6, 0x19, 0xac, 0xff, 0x99, 0xed, 3963863ef31SBob Pearson 0xe8, 0xe6, 0xa6, 0x22, 0xe3, 0x9c, 0xf1, 0x30, 3973863ef31SBob Pearson 0xdc, 0x01, 0x0a, 0x56, 0xfa, 0xe4, 0xc9, 0x99, 3983863ef31SBob Pearson 0xdd, 0xa8, 0xd8, 0xda, 0x35, 0x51, 0x73, 0xb4, 3993863ef31SBob Pearson 0x40, 0x86, 0x85, 0xdb, 0x5c, 0xd5, 0x85, 0x80, 4003863ef31SBob Pearson 0x14, 0x9c, 0xfd, 0x98, 0xa9, 0x82, 0xc5, 0x37, 4013863ef31SBob Pearson 0xff, 0x32, 0x5d, 0xd0, 0x0b, 0xfa, 0xdc, 0x04, 4023863ef31SBob Pearson 0x5e, 0x09, 0xd2, 0xca, 0x17, 0x4b, 0x1a, 0x8e, 4033863ef31SBob Pearson 0x15, 0xe1, 0xcc, 0x4e, 0x52, 0x88, 0x35, 0xbd, 4043863ef31SBob Pearson 0x48, 0xfe, 0x15, 0xa0, 0x91, 0xfd, 0x7e, 0x6c, 4053863ef31SBob Pearson 0x0e, 0x5d, 0x79, 0x1b, 0x81, 0x79, 0xd2, 0x09, 4063863ef31SBob Pearson 0x34, 0x70, 0x3d, 0x81, 0xec, 0xf6, 0x24, 0xbb, 4073863ef31SBob Pearson 0xfb, 0xf1, 0x7b, 0xdf, 0x54, 0xea, 0x80, 0x9b, 4083863ef31SBob Pearson 0xc7, 0x99, 0x9e, 0xbd, 0x16, 0x78, 0x12, 0x53, 4093863ef31SBob Pearson 0x5e, 0x01, 0xa7, 0x4e, 0xbd, 0x67, 0xe1, 0x9b, 4103863ef31SBob Pearson 0x4c, 0x0e, 0x61, 0x45, 0x97, 0xd2, 0xf0, 0x0f, 4113863ef31SBob Pearson 0xfe, 0x15, 0x08, 0xb7, 0x11, 0x4c, 0xe7, 0xff, 4123863ef31SBob Pearson 0x81, 0x53, 0xff, 0x91, 0x25, 0x38, 0x7e, 0x40, 4133863ef31SBob Pearson 0x94, 0xe5, 0xe0, 0xad, 0xe6, 0xd9, 0x79, 0xb6, 4143863ef31SBob Pearson 0x92, 0xc9, 0xfc, 0xde, 0xc3, 0x1a, 0x23, 0xbb, 4153863ef31SBob Pearson 0xdd, 0xc8, 0x51, 0x0c, 0x3a, 0x72, 0xfa, 0x73, 4163863ef31SBob Pearson 0x6f, 0xb7, 0xee, 0x61, 0x39, 0x03, 0x01, 0x3f, 4173863ef31SBob Pearson 0x7f, 0x94, 0x2e, 0x2e, 0xba, 0x3a, 0xbb, 0xb4, 4183863ef31SBob Pearson 0xfa, 0x6a, 0x17, 0xfe, 0xea, 0xef, 0x5e, 0x66, 4193863ef31SBob Pearson 0x97, 0x3f, 0x32, 0x3d, 0xd7, 0x3e, 0xb1, 0xf1, 4203863ef31SBob Pearson 0x6c, 0x14, 0x4c, 0xfd, 0x37, 0xd3, 0x38, 0x80, 4213863ef31SBob Pearson 0xfb, 0xde, 0xa6, 0x24, 0x1e, 0xc8, 0xca, 0x7f, 4223863ef31SBob Pearson 0x3a, 0x93, 0xd8, 0x8b, 0x18, 0x13, 0xb2, 0xe5, 4233863ef31SBob Pearson 0xe4, 0x93, 0x05, 0x53, 0x4f, 0x84, 0x66, 0xa7, 4243863ef31SBob Pearson 0x58, 0x5c, 0x7b, 0x86, 0x52, 0x6d, 0x0d, 0xce, 4253863ef31SBob Pearson 0xa4, 0x30, 0x7d, 0xb6, 0x18, 0x9f, 0xeb, 0xff, 4263863ef31SBob Pearson 0x22, 0xbb, 0x72, 0x29, 0xb9, 0x44, 0x0b, 0x48, 4273863ef31SBob Pearson 0x1e, 0x84, 0x71, 0x81, 0xe3, 0x6d, 0x73, 0x26, 4283863ef31SBob Pearson 0x92, 0xb4, 0x4d, 0x2a, 0x29, 0xb8, 0x1f, 0x72, 4293863ef31SBob Pearson 0xed, 0xd0, 0xe1, 0x64, 0x77, 0xea, 0x8e, 0x88, 4303863ef31SBob Pearson 0x0f, 0xef, 0x3f, 0xb1, 0x3b, 0xad, 0xf9, 0xc9, 4313863ef31SBob Pearson 0x8b, 0xd0, 0xac, 0xc6, 0xcc, 0xa9, 0x40, 0xcc, 4323863ef31SBob Pearson 0x76, 0xf6, 0x3b, 0x53, 0xb5, 0x88, 0xcb, 0xc8, 4333863ef31SBob Pearson 0x37, 0xf1, 0xa2, 0xba, 0x23, 0x15, 0x99, 0x09, 4343863ef31SBob Pearson 0xcc, 0xe7, 0x7a, 0x3b, 0x37, 0xf7, 0x58, 0xc8, 4353863ef31SBob Pearson 0x46, 0x8c, 0x2b, 0x2f, 0x4e, 0x0e, 0xa6, 0x5c, 4363863ef31SBob Pearson 0xea, 0x85, 0x55, 0xba, 0x02, 0x0e, 0x0e, 0x48, 4373863ef31SBob Pearson 0xbc, 0xe1, 0xb1, 0x01, 0x35, 0x79, 0x13, 0x3d, 4383863ef31SBob Pearson 0x1b, 0xc0, 0x53, 0x68, 0x11, 0xe7, 0x95, 0x0f, 4393863ef31SBob Pearson 0x9d, 0x3f, 0x4c, 0x47, 0x7b, 0x4d, 0x1c, 0xae, 4403863ef31SBob Pearson 0x50, 0x9b, 0xcb, 0xdd, 0x05, 0x8d, 0x9a, 0x97, 4413863ef31SBob Pearson 0xfd, 0x8c, 0xef, 0x0c, 0x1d, 0x67, 0x73, 0xa8, 4423863ef31SBob Pearson 0x28, 0x36, 0xd5, 0xb6, 0x92, 0x33, 0x40, 0x75, 4433863ef31SBob Pearson 0x0b, 0x51, 0xc3, 0x64, 0xba, 0x1d, 0xc2, 0xcc, 4443863ef31SBob Pearson 0xee, 0x7d, 0x54, 0x0f, 0x27, 0x69, 0xa7, 0x27, 4453863ef31SBob Pearson 0x63, 0x30, 0x29, 0xd9, 0xc8, 0x84, 0xd8, 0xdf, 4463863ef31SBob Pearson 0x9f, 0x68, 0x8d, 0x04, 0xca, 0xa6, 0xc5, 0xc7, 4473863ef31SBob Pearson 0x7a, 0x5c, 0xc8, 0xd1, 0xcb, 0x4a, 0xec, 0xd0, 4483863ef31SBob Pearson 0xd8, 0x20, 0x69, 0xc5, 0x17, 0xcd, 0x78, 0xc8, 4493863ef31SBob Pearson 0x75, 0x23, 0x30, 0x69, 0xc9, 0xd4, 0xea, 0x5c, 4503863ef31SBob Pearson 0x4f, 0x6b, 0x86, 0x3f, 0x8b, 0xfe, 0xee, 0x44, 4513863ef31SBob Pearson 0xc9, 0x7c, 0xb7, 0xdd, 0x3e, 0xe5, 0xec, 0x54, 4523863ef31SBob Pearson 0x03, 0x3e, 0xaa, 0x82, 0xc6, 0xdf, 0xb2, 0x38, 4533863ef31SBob Pearson 0x0e, 0x5d, 0xb3, 0x88, 0xd9, 0xd3, 0x69, 0x5f, 4543863ef31SBob Pearson 0x8f, 0x70, 0x8a, 0x7e, 0x11, 0xd9, 0x1e, 0x7b, 4553863ef31SBob Pearson 0x38, 0xf1, 0x42, 0x1a, 0xc0, 0x35, 0xf5, 0xc7, 4563863ef31SBob Pearson 0x36, 0x85, 0xf5, 0xf7, 0xb8, 0x7e, 0xc7, 0xef, 4573863ef31SBob Pearson 0x18, 0xf1, 0x63, 0xd6, 0x7a, 0xc6, 0xc9, 0x0e, 4583863ef31SBob Pearson 0x4d, 0x69, 0x4f, 0x84, 0xef, 0x26, 0x41, 0x0c, 4593863ef31SBob Pearson 0xec, 0xc7, 0xe0, 0x7e, 0x3c, 0x67, 0x01, 0x4c, 4603863ef31SBob Pearson 0x62, 0x1a, 0x20, 0x6f, 0xee, 0x47, 0x4d, 0xc0, 4613863ef31SBob Pearson 0x99, 0x13, 0x8d, 0x91, 0x4a, 0x26, 0xd4, 0x37, 4623863ef31SBob Pearson 0x28, 0x90, 0x58, 0x75, 0x66, 0x2b, 0x0a, 0xdf, 4633863ef31SBob Pearson 0xda, 0xee, 0x92, 0x25, 0x90, 0x62, 0x39, 0x9e, 4643863ef31SBob Pearson 0x44, 0x98, 0xad, 0xc1, 0x88, 0xed, 0xe4, 0xb4, 4653863ef31SBob Pearson 0xaf, 0xf5, 0x8c, 0x9b, 0x48, 0x4d, 0x56, 0x60, 4663863ef31SBob Pearson 0x97, 0x0f, 0x61, 0x59, 0x9e, 0xa6, 0x27, 0xfe, 4673863ef31SBob Pearson 0xc1, 0x91, 0x15, 0x38, 0xb8, 0x0f, 0xae, 0x61, 4683863ef31SBob Pearson 0x7d, 0x26, 0x13, 0x5a, 0x73, 0xff, 0x1c, 0xa3, 4693863ef31SBob Pearson 0x61, 0x04, 0x58, 0x48, 0x55, 0x44, 0x11, 0xfe, 4703863ef31SBob Pearson 0x15, 0xca, 0xc3, 0xbd, 0xca, 0xc5, 0xb4, 0x40, 4713863ef31SBob Pearson 0x5d, 0x1b, 0x7f, 0x39, 0xb5, 0x9c, 0x35, 0xec, 4723863ef31SBob Pearson 0x61, 0x15, 0x32, 0x32, 0xb8, 0x4e, 0x40, 0x9f, 4733863ef31SBob Pearson 0x17, 0x1f, 0x0a, 0x4d, 0xa9, 0x91, 0xef, 0xb7, 4743863ef31SBob Pearson 0xb0, 0xeb, 0xc2, 0x83, 0x9a, 0x6c, 0xd2, 0x79, 4753863ef31SBob Pearson 0x43, 0x78, 0x5e, 0x2f, 0xe5, 0xdd, 0x1a, 0x3c, 4763863ef31SBob Pearson 0x45, 0xab, 0x29, 0x40, 0x3a, 0x37, 0x5b, 0x6f, 4773863ef31SBob Pearson 0xd7, 0xfc, 0x48, 0x64, 0x3c, 0x49, 0xfb, 0x21, 4783863ef31SBob Pearson 0xbe, 0xc3, 0xff, 0x07, 0xfb, 0x17, 0xe9, 0xc9, 4793863ef31SBob Pearson 0x0c, 0x4c, 0x5c, 0x15, 0x9e, 0x8e, 0x22, 0x30, 4803863ef31SBob Pearson 0x0a, 0xde, 0x48, 0x7f, 0xdb, 0x0d, 0xd1, 0x2b, 4813863ef31SBob Pearson 0x87, 0x38, 0x9e, 0xcc, 0x5a, 0x01, 0x16, 0xee, 4823863ef31SBob Pearson 0x75, 0x49, 0x0d, 0x30, 0x01, 0x34, 0x6a, 0xb6, 4833863ef31SBob Pearson 0x9a, 0x5a, 0x2a, 0xec, 0xbb, 0x48, 0xac, 0xd3, 4843863ef31SBob Pearson 0x77, 0x83, 0xd8, 0x08, 0x86, 0x4f, 0x48, 0x09, 4853863ef31SBob Pearson 0x29, 0x41, 0x79, 0xa1, 0x03, 0x12, 0xc4, 0xcd, 4863863ef31SBob Pearson 0x90, 0x55, 0x47, 0x66, 0x74, 0x9a, 0xcc, 0x4f, 4873863ef31SBob Pearson 0x35, 0x8c, 0xd6, 0x98, 0xef, 0xeb, 0x45, 0xb9, 4883863ef31SBob Pearson 0x9a, 0x26, 0x2f, 0x39, 0xa5, 0x70, 0x6d, 0xfc, 4893863ef31SBob Pearson 0xb4, 0x51, 0xee, 0xf4, 0x9c, 0xe7, 0x38, 0x59, 4903863ef31SBob Pearson 0xad, 0xf4, 0xbc, 0x46, 0xff, 0x46, 0x8e, 0x60, 4913863ef31SBob Pearson 0x9c, 0xa3, 0x60, 0x1d, 0xf8, 0x26, 0x72, 0xf5, 4923863ef31SBob Pearson 0x72, 0x9d, 0x68, 0x80, 0x04, 0xf6, 0x0b, 0xa1, 4933863ef31SBob Pearson 0x0a, 0xd5, 0xa7, 0x82, 0x3a, 0x3e, 0x47, 0xa8, 4943863ef31SBob Pearson 0x5a, 0xde, 0x59, 0x4f, 0x7b, 0x07, 0xb3, 0xe9, 4953863ef31SBob Pearson 0x24, 0x19, 0x3d, 0x34, 0x05, 0xec, 0xf1, 0xab, 4963863ef31SBob Pearson 0x6e, 0x64, 0x8f, 0xd3, 0xe6, 0x41, 0x86, 0x80, 4973863ef31SBob Pearson 0x70, 0xe3, 0x8d, 0x60, 0x9c, 0x34, 0x25, 0x01, 4983863ef31SBob Pearson 0x07, 0x4d, 0x19, 0x41, 0x4e, 0x3d, 0x5c, 0x7e, 4993863ef31SBob Pearson 0xa8, 0xf5, 0xcc, 0xd5, 0x7b, 0xe2, 0x7d, 0x3d, 5003863ef31SBob Pearson 0x49, 0x86, 0x7d, 0x07, 0xb7, 0x10, 0xe3, 0x35, 5013863ef31SBob Pearson 0xb8, 0x84, 0x6d, 0x76, 0xab, 0x17, 0xc6, 0x38, 5023863ef31SBob Pearson 0xb4, 0xd3, 0x28, 0x57, 0xad, 0xd3, 0x88, 0x5a, 5033863ef31SBob Pearson 0xda, 0xea, 0xc8, 0x94, 0xcc, 0x37, 0x19, 0xac, 5043863ef31SBob Pearson 0x9c, 0x9f, 0x4b, 0x00, 0x15, 0xc0, 0xc8, 0xca, 5053863ef31SBob Pearson 0x1f, 0x15, 0xaa, 0xe0, 0xdb, 0xf9, 0x2f, 0x57, 5063863ef31SBob Pearson 0x1b, 0x24, 0xc7, 0x6f, 0x76, 0x29, 0xfb, 0xed, 5073863ef31SBob Pearson 0x25, 0x0d, 0xc0, 0xfe, 0xbd, 0x5a, 0xbf, 0x20, 5083863ef31SBob Pearson 0x08, 0x51, 0x05, 0xec, 0x71, 0xa3, 0xbf, 0xef, 5093863ef31SBob Pearson 0x5e, 0x99, 0x75, 0xdb, 0x3c, 0x5f, 0x9a, 0x8c, 5103863ef31SBob Pearson 0xbb, 0x19, 0x5c, 0x0e, 0x93, 0x19, 0xf8, 0x6a, 5113863ef31SBob Pearson 0xbc, 0xf2, 0x12, 0x54, 0x2f, 0xcb, 0x28, 0x64, 5123863ef31SBob Pearson 0x88, 0xb3, 0x92, 0x0d, 0x96, 0xd1, 0xa6, 0xe4, 5133863ef31SBob Pearson 0x1f, 0xf1, 0x4d, 0xa4, 0xab, 0x1c, 0xee, 0x54, 5143863ef31SBob Pearson 0xf2, 0xad, 0x29, 0x6d, 0x32, 0x37, 0xb2, 0x16, 5153863ef31SBob Pearson 0x77, 0x5c, 0xdc, 0x2e, 0x54, 0xec, 0x75, 0x26, 5163863ef31SBob Pearson 0xc6, 0x36, 0xd9, 0x17, 0x2c, 0xf1, 0x7a, 0xdc, 5173863ef31SBob Pearson 0x4b, 0xf1, 0xe2, 0xd9, 0x95, 0xba, 0xac, 0x87, 5183863ef31SBob Pearson 0xc1, 0xf3, 0x8e, 0x58, 0x08, 0xd8, 0x87, 0x60, 5193863ef31SBob Pearson 0xc9, 0xee, 0x6a, 0xde, 0xa4, 0xd2, 0xfc, 0x0d, 5203863ef31SBob Pearson 0xe5, 0x36, 0xc4, 0x5c, 0x52, 0xb3, 0x07, 0x54, 5213863ef31SBob Pearson 0x65, 0x24, 0xc1, 0xb1, 0xd1, 0xb1, 0x53, 0x13, 5223863ef31SBob Pearson 0x31, 0x79, 0x7f, 0x05, 0x76, 0xeb, 0x37, 0x59, 5233863ef31SBob Pearson 0x15, 0x2b, 0xd1, 0x3f, 0xac, 0x08, 0x97, 0xeb, 5243863ef31SBob Pearson 0x91, 0x98, 0xdf, 0x6c, 0x09, 0x0d, 0x04, 0x9f, 5253863ef31SBob Pearson 0xdc, 0x3b, 0x0e, 0x60, 0x68, 0x47, 0x23, 0x15, 5263863ef31SBob Pearson 0x16, 0xc6, 0x0b, 0x35, 0xf8, 0x77, 0xa2, 0x78, 5273863ef31SBob Pearson 0x50, 0xd4, 0x64, 0x22, 0x33, 0xff, 0xfb, 0x93, 5283863ef31SBob Pearson 0x71, 0x46, 0x50, 0x39, 0x1b, 0x9c, 0xea, 0x4e, 5293863ef31SBob Pearson 0x8d, 0x0c, 0x37, 0xe5, 0x5c, 0x51, 0x3a, 0x31, 5303863ef31SBob Pearson 0xb2, 0x85, 0x84, 0x3f, 0x41, 0xee, 0xa2, 0xc1, 5313863ef31SBob Pearson 0xc6, 0x13, 0x3b, 0x54, 0x28, 0xd2, 0x18, 0x37, 5323863ef31SBob Pearson 0xcc, 0x46, 0x9f, 0x6a, 0x91, 0x3d, 0x5a, 0x15, 5333863ef31SBob Pearson 0x3c, 0x89, 0xa3, 0x61, 0x06, 0x7d, 0x2e, 0x78, 5343863ef31SBob Pearson 0xbe, 0x7d, 0x40, 0xba, 0x2f, 0x95, 0xb1, 0x2f, 5353863ef31SBob Pearson 0x87, 0x3b, 0x8a, 0xbe, 0x6a, 0xf4, 0xc2, 0x31, 5363863ef31SBob Pearson 0x74, 0xee, 0x91, 0xe0, 0x23, 0xaa, 0x5d, 0x7f, 5373863ef31SBob Pearson 0xdd, 0xf0, 0x44, 0x8c, 0x0b, 0x59, 0x2b, 0xfc, 5383863ef31SBob Pearson 0x48, 0x3a, 0xdf, 0x07, 0x05, 0x38, 0x6c, 0xc9, 5393863ef31SBob Pearson 0xeb, 0x18, 0x24, 0x68, 0x8d, 0x58, 0x98, 0xd3, 5403863ef31SBob Pearson 0x31, 0xa3, 0xe4, 0x70, 0x59, 0xb1, 0x21, 0xbe, 5413863ef31SBob Pearson 0x7e, 0x65, 0x7d, 0xb8, 0x04, 0xab, 0xf6, 0xe4, 5423863ef31SBob Pearson 0xd7, 0xda, 0xec, 0x09, 0x8f, 0xda, 0x6d, 0x24, 5433863ef31SBob Pearson 0x07, 0xcc, 0x29, 0x17, 0x05, 0x78, 0x1a, 0xc1, 5443863ef31SBob Pearson 0xb1, 0xce, 0xfc, 0xaa, 0x2d, 0xe7, 0xcc, 0x85, 5453863ef31SBob Pearson 0x84, 0x84, 0x03, 0x2a, 0x0c, 0x3f, 0xa9, 0xf8, 5463863ef31SBob Pearson 0xfd, 0x84, 0x53, 0x59, 0x5c, 0xf0, 0xd4, 0x09, 5473863ef31SBob Pearson 0xf0, 0xd2, 0x6c, 0x32, 0x03, 0xb0, 0xa0, 0x8c, 5483863ef31SBob Pearson 0x52, 0xeb, 0x23, 0x91, 0x88, 0x43, 0x13, 0x46, 5493863ef31SBob Pearson 0xf6, 0x1e, 0xb4, 0x1b, 0xf5, 0x8e, 0x3a, 0xb5, 5503863ef31SBob Pearson 0x3d, 0x00, 0xf6, 0xe5, 0x08, 0x3d, 0x5f, 0x39, 5513863ef31SBob Pearson 0xd3, 0x21, 0x69, 0xbc, 0x03, 0x22, 0x3a, 0xd2, 5523863ef31SBob Pearson 0x5c, 0x84, 0xf8, 0x15, 0xc4, 0x80, 0x0b, 0xbc, 5533863ef31SBob Pearson 0x29, 0x3c, 0xf3, 0x95, 0x98, 0xcd, 0x8f, 0x35, 5543863ef31SBob Pearson 0xbc, 0xa5, 0x3e, 0xfc, 0xd4, 0x13, 0x9e, 0xde, 5553863ef31SBob Pearson 0x4f, 0xce, 0x71, 0x9d, 0x09, 0xad, 0xf2, 0x80, 5563863ef31SBob Pearson 0x6b, 0x65, 0x7f, 0x03, 0x00, 0x14, 0x7c, 0x15, 5573863ef31SBob Pearson 0x85, 0x40, 0x6d, 0x70, 0xea, 0xdc, 0xb3, 0x63, 5583863ef31SBob Pearson 0x35, 0x4f, 0x4d, 0xe0, 0xd9, 0xd5, 0x3c, 0x58, 5593863ef31SBob Pearson 0x56, 0x23, 0x80, 0xe2, 0x36, 0xdd, 0x75, 0x1d, 5603863ef31SBob Pearson 0x94, 0x11, 0x41, 0x8e, 0xe0, 0x81, 0x8e, 0xcf, 5613863ef31SBob Pearson 0xe0, 0xe5, 0xf6, 0xde, 0xd1, 0xe7, 0x04, 0x12, 5623863ef31SBob Pearson 0x79, 0x92, 0x2b, 0x71, 0x2a, 0x79, 0x8b, 0x7c, 5633863ef31SBob Pearson 0x44, 0x79, 0x16, 0x30, 0x4e, 0xf4, 0xf6, 0x9b, 5643863ef31SBob Pearson 0xb7, 0x40, 0xa3, 0x5a, 0xa7, 0x69, 0x3e, 0xc1, 5653863ef31SBob Pearson 0x3a, 0x04, 0xd0, 0x88, 0xa0, 0x3b, 0xdd, 0xc6, 5663863ef31SBob Pearson 0x9e, 0x7e, 0x1e, 0x1e, 0x8f, 0x44, 0xf7, 0x73, 5673863ef31SBob Pearson 0x67, 0x1e, 0x1a, 0x78, 0xfa, 0x62, 0xf4, 0xa9, 5683863ef31SBob Pearson 0xa8, 0xc6, 0x5b, 0xb8, 0xfa, 0x06, 0x7d, 0x5e, 5693863ef31SBob Pearson 0x38, 0x1c, 0x9a, 0x39, 0xe9, 0x39, 0x98, 0x22, 5703863ef31SBob Pearson 0x0b, 0xa7, 0xac, 0x0b, 0xf3, 0xbc, 0xf1, 0xeb, 5713863ef31SBob Pearson 0x8c, 0x81, 0xe3, 0x48, 0x8a, 0xed, 0x42, 0xc2, 5723863ef31SBob Pearson 0x38, 0xcf, 0x3e, 0xda, 0xd2, 0x89, 0x8d, 0x9c, 5733863ef31SBob Pearson 0x53, 0xb5, 0x2f, 0x41, 0x01, 0x26, 0x84, 0x9c, 5743863ef31SBob Pearson 0xa3, 0x56, 0xf6, 0x49, 0xc7, 0xd4, 0x9f, 0x93, 5753863ef31SBob Pearson 0x1b, 0x96, 0x49, 0x5e, 0xad, 0xb3, 0x84, 0x1f, 5763863ef31SBob Pearson 0x3c, 0xa4, 0xe0, 0x9b, 0xd1, 0x90, 0xbc, 0x38, 5773863ef31SBob Pearson 0x6c, 0xdd, 0x95, 0x4d, 0x9d, 0xb1, 0x71, 0x57, 5783863ef31SBob Pearson 0x2d, 0x34, 0xe8, 0xb8, 0x42, 0xc7, 0x99, 0x03, 5793863ef31SBob Pearson 0xc7, 0x07, 0x30, 0x65, 0x91, 0x55, 0xd5, 0x90, 5803863ef31SBob Pearson 0x70, 0x97, 0x37, 0x68, 0xd4, 0x11, 0xf9, 0xe8, 5813863ef31SBob Pearson 0xce, 0xec, 0xdc, 0x34, 0xd5, 0xd3, 0xb7, 0xc4, 5823863ef31SBob Pearson 0xb8, 0x97, 0x05, 0x92, 0xad, 0xf8, 0xe2, 0x36, 5833863ef31SBob Pearson 0x64, 0x41, 0xc9, 0xc5, 0x41, 0x77, 0x52, 0xd7, 5843863ef31SBob Pearson 0x2c, 0xa5, 0x24, 0x2f, 0xd9, 0x34, 0x0b, 0x47, 5853863ef31SBob Pearson 0x35, 0xa7, 0x28, 0x8b, 0xc5, 0xcd, 0xe9, 0x46, 5863863ef31SBob Pearson 0xac, 0x39, 0x94, 0x3c, 0x10, 0xc6, 0x29, 0x73, 5873863ef31SBob Pearson 0x0e, 0x0e, 0x5d, 0xe0, 0x71, 0x03, 0x8a, 0x72, 5883863ef31SBob Pearson 0x0e, 0x26, 0xb0, 0x7d, 0x84, 0xed, 0x95, 0x23, 5893863ef31SBob Pearson 0x49, 0x5a, 0x45, 0x83, 0x45, 0x60, 0x11, 0x4a, 5903863ef31SBob Pearson 0x46, 0x31, 0xd4, 0xd8, 0x16, 0x54, 0x98, 0x58, 5913863ef31SBob Pearson 0xed, 0x6d, 0xcc, 0x5d, 0xd6, 0x50, 0x61, 0x9f, 5923863ef31SBob Pearson 0x9d, 0xc5, 0x3e, 0x9d, 0x32, 0x47, 0xde, 0x96, 5933863ef31SBob Pearson 0xe1, 0x5d, 0xd8, 0xf8, 0xb4, 0x69, 0x6f, 0xb9, 5943863ef31SBob Pearson 0x15, 0x90, 0x57, 0x7a, 0xf6, 0xad, 0xb0, 0x5b, 5953863ef31SBob Pearson 0xf5, 0xa6, 0x36, 0x94, 0xfd, 0x84, 0xce, 0x1c, 5963863ef31SBob Pearson 0x0f, 0x4b, 0xd0, 0xc2, 0x5b, 0x6b, 0x56, 0xef, 5973863ef31SBob Pearson 0x73, 0x93, 0x0b, 0xc3, 0xee, 0xd9, 0xcf, 0xd3, 5983863ef31SBob Pearson 0xa4, 0x22, 0x58, 0xcd, 0x50, 0x6e, 0x65, 0xf4, 5993863ef31SBob Pearson 0xe9, 0xb7, 0x71, 0xaf, 0x4b, 0xb3, 0xb6, 0x2f, 6003863ef31SBob Pearson 0x0f, 0x0e, 0x3b, 0xc9, 0x85, 0x14, 0xf5, 0x17, 6013863ef31SBob Pearson 0xe8, 0x7a, 0x3a, 0xbf, 0x5f, 0x5e, 0xf8, 0x18, 6023863ef31SBob Pearson 0x48, 0xa6, 0x72, 0xab, 0x06, 0x95, 0xe9, 0xc8, 6033863ef31SBob Pearson 0xa7, 0xf4, 0x32, 0x44, 0x04, 0x0c, 0x84, 0x98, 6043863ef31SBob Pearson 0x73, 0xe3, 0x89, 0x8d, 0x5f, 0x7e, 0x4a, 0x42, 6053863ef31SBob Pearson 0x8f, 0xc5, 0x28, 0xb1, 0x82, 0xef, 0x1c, 0x97, 6063863ef31SBob Pearson 0x31, 0x3b, 0x4d, 0xe0, 0x0e, 0x10, 0x10, 0x97, 6073863ef31SBob Pearson 0x93, 0x49, 0x78, 0x2f, 0x0d, 0x86, 0x8b, 0xa1, 6083863ef31SBob Pearson 0x53, 0xa9, 0x81, 0x20, 0x79, 0xe7, 0x07, 0x77, 6093863ef31SBob Pearson 0xb6, 0xac, 0x5e, 0xd2, 0x05, 0xcd, 0xe9, 0xdb, 6103863ef31SBob Pearson 0x8a, 0x94, 0x82, 0x8a, 0x23, 0xb9, 0x3d, 0x1c, 6113863ef31SBob Pearson 0xa9, 0x7d, 0x72, 0x4a, 0xed, 0x33, 0xa3, 0xdb, 6123863ef31SBob Pearson 0x21, 0xa7, 0x86, 0x33, 0x45, 0xa5, 0xaa, 0x56, 6133863ef31SBob Pearson 0x45, 0xb5, 0x83, 0x29, 0x40, 0x47, 0x79, 0x04, 6143863ef31SBob Pearson 0x6e, 0xb9, 0x95, 0xd0, 0x81, 0x77, 0x2d, 0x48, 6153863ef31SBob Pearson 0x1e, 0xfe, 0xc3, 0xc2, 0x1e, 0xe5, 0xf2, 0xbe, 6163863ef31SBob Pearson 0xfd, 0x3b, 0x94, 0x9f, 0xc4, 0xc4, 0x26, 0x9d, 6173863ef31SBob Pearson 0xe4, 0x66, 0x1e, 0x19, 0xee, 0x6c, 0x79, 0x97, 6183863ef31SBob Pearson 0x11, 0x31, 0x4b, 0x0d, 0x01, 0xcb, 0xde, 0xa8, 6193863ef31SBob Pearson 0xf6, 0x6d, 0x7c, 0x39, 0x46, 0x4e, 0x7e, 0x3f, 6203863ef31SBob Pearson 0x94, 0x17, 0xdf, 0xa1, 0x7d, 0xd9, 0x1c, 0x8e, 6213863ef31SBob Pearson 0xbc, 0x7d, 0x33, 0x7d, 0xe3, 0x12, 0x40, 0xca, 6223863ef31SBob Pearson 0xab, 0x37, 0x11, 0x46, 0xd4, 0xae, 0xef, 0x44, 6233863ef31SBob Pearson 0xa2, 0xb3, 0x6a, 0x66, 0x0e, 0x0c, 0x90, 0x7f, 6243863ef31SBob Pearson 0xdf, 0x5c, 0x66, 0x5f, 0xf2, 0x94, 0x9f, 0xa6, 6253863ef31SBob Pearson 0x73, 0x4f, 0xeb, 0x0d, 0xad, 0xbf, 0xc0, 0x63, 6263863ef31SBob Pearson 0x5c, 0xdc, 0x46, 0x51, 0xe8, 0x8e, 0x90, 0x19, 6273863ef31SBob Pearson 0xa8, 0xa4, 0x3c, 0x91, 0x79, 0xfa, 0x7e, 0x58, 6283863ef31SBob Pearson 0x85, 0x13, 0x55, 0xc5, 0x19, 0x82, 0x37, 0x1b, 6293863ef31SBob Pearson 0x0a, 0x02, 0x1f, 0x99, 0x6b, 0x18, 0xf1, 0x28, 6303863ef31SBob Pearson 0x08, 0xa2, 0x73, 0xb8, 0x0f, 0x2e, 0xcd, 0xbf, 6313863ef31SBob Pearson 0xf3, 0x86, 0x7f, 0xea, 0xef, 0xd0, 0xbb, 0xa6, 6323863ef31SBob Pearson 0x21, 0xdf, 0x49, 0x73, 0x51, 0xcc, 0x36, 0xd3, 6333863ef31SBob Pearson 0x3e, 0xa0, 0xf8, 0x44, 0xdf, 0xd3, 0xa6, 0xbe, 6343863ef31SBob Pearson 0x8a, 0xd4, 0x57, 0xdd, 0x72, 0x94, 0x61, 0x0f, 6353863ef31SBob Pearson 0x82, 0xd1, 0x07, 0xb8, 0x7c, 0x18, 0x83, 0xdf, 6363863ef31SBob Pearson 0x3a, 0xe5, 0x50, 0x6a, 0x82, 0x20, 0xac, 0xa9, 6373863ef31SBob Pearson 0xa8, 0xff, 0xd9, 0xf3, 0x77, 0x33, 0x5a, 0x9e, 6383863ef31SBob Pearson 0x7f, 0x6d, 0xfe, 0x5d, 0x33, 0x41, 0x42, 0xe7, 6393863ef31SBob Pearson 0x6c, 0x19, 0xe0, 0x44, 0x8a, 0x15, 0xf6, 0x70, 6403863ef31SBob Pearson 0x98, 0xb7, 0x68, 0x4d, 0xfa, 0x97, 0x39, 0xb0, 6413863ef31SBob Pearson 0x8e, 0xe8, 0x84, 0x8b, 0x75, 0x30, 0xb7, 0x7d, 6423863ef31SBob Pearson 0x92, 0x69, 0x20, 0x9c, 0x81, 0xfb, 0x4b, 0xf4, 6433863ef31SBob Pearson 0x01, 0x50, 0xeb, 0xce, 0x0c, 0x1c, 0x6c, 0xb5, 6443863ef31SBob Pearson 0x4a, 0xd7, 0x27, 0x0c, 0xce, 0xbb, 0xe5, 0x85, 6453863ef31SBob Pearson 0xf0, 0xb6, 0xee, 0xd5, 0x70, 0xdd, 0x3b, 0xfc, 6463863ef31SBob Pearson 0xd4, 0x99, 0xf1, 0x33, 0xdd, 0x8b, 0xc4, 0x2f, 6473863ef31SBob Pearson 0xae, 0xab, 0x74, 0x96, 0x32, 0xc7, 0x4c, 0x56, 6483863ef31SBob Pearson 0x3c, 0x89, 0x0f, 0x96, 0x0b, 0x42, 0xc0, 0xcb, 6493863ef31SBob Pearson 0xee, 0x0f, 0x0b, 0x8c, 0xfb, 0x7e, 0x47, 0x7b, 6503863ef31SBob Pearson 0x64, 0x48, 0xfd, 0xb2, 0x00, 0x80, 0x89, 0xa5, 6513863ef31SBob Pearson 0x13, 0x55, 0x62, 0xfc, 0x8f, 0xe2, 0x42, 0x03, 6523863ef31SBob Pearson 0xb7, 0x4e, 0x2a, 0x79, 0xb4, 0x82, 0xea, 0x23, 6533863ef31SBob Pearson 0x49, 0xda, 0xaf, 0x52, 0x63, 0x1e, 0x60, 0x03, 6543863ef31SBob Pearson 0x89, 0x06, 0x44, 0x46, 0x08, 0xc3, 0xc4, 0x87, 6553863ef31SBob Pearson 0x70, 0x2e, 0xda, 0x94, 0xad, 0x6b, 0xe0, 0xe4, 6563863ef31SBob Pearson 0xd1, 0x8a, 0x06, 0xc2, 0xa8, 0xc0, 0xa7, 0x43, 6573863ef31SBob Pearson 0x3c, 0x47, 0x52, 0x0e, 0xc3, 0x77, 0x81, 0x11, 6583863ef31SBob Pearson 0x67, 0x0e, 0xa0, 0x70, 0x04, 0x47, 0x29, 0x40, 6593863ef31SBob Pearson 0x86, 0x0d, 0x34, 0x56, 0xa7, 0xc9, 0x35, 0x59, 6603863ef31SBob Pearson 0x68, 0xdc, 0x93, 0x81, 0x70, 0xee, 0x86, 0xd9, 6613863ef31SBob Pearson 0x80, 0x06, 0x40, 0x4f, 0x1a, 0x0d, 0x40, 0x30, 6623863ef31SBob Pearson 0x0b, 0xcb, 0x96, 0x47, 0xc1, 0xb7, 0x52, 0xfd, 6633863ef31SBob Pearson 0x56, 0xe0, 0x72, 0x4b, 0xfb, 0xbd, 0x92, 0x45, 6643863ef31SBob Pearson 0x61, 0x71, 0xc2, 0x33, 0x11, 0xbf, 0x52, 0x83, 6653863ef31SBob Pearson 0x79, 0x26, 0xe0, 0x49, 0x6b, 0xb7, 0x05, 0x8b, 6663863ef31SBob Pearson 0xe8, 0x0e, 0x87, 0x31, 0xd7, 0x9d, 0x8a, 0xf5, 6673863ef31SBob Pearson 0xc0, 0x5f, 0x2e, 0x58, 0x4a, 0xdb, 0x11, 0xb3, 6683863ef31SBob Pearson 0x6c, 0x30, 0x2a, 0x46, 0x19, 0xe3, 0x27, 0x84, 6693863ef31SBob Pearson 0x1f, 0x63, 0x6e, 0xf6, 0x57, 0xc7, 0xc9, 0xd8, 6703863ef31SBob Pearson 0x5e, 0xba, 0xb3, 0x87, 0xd5, 0x83, 0x26, 0x34, 6713863ef31SBob Pearson 0x21, 0x9e, 0x65, 0xde, 0x42, 0xd3, 0xbe, 0x7b, 6723863ef31SBob Pearson 0xbc, 0x91, 0x71, 0x44, 0x4d, 0x99, 0x3b, 0x31, 6733863ef31SBob Pearson 0xe5, 0x3f, 0x11, 0x4e, 0x7f, 0x13, 0x51, 0x3b, 6743863ef31SBob Pearson 0xae, 0x79, 0xc9, 0xd3, 0x81, 0x8e, 0x25, 0x40, 6753863ef31SBob Pearson 0x10, 0xfc, 0x07, 0x1e, 0xf9, 0x7b, 0x9a, 0x4b, 6763863ef31SBob Pearson 0x6c, 0xe3, 0xb3, 0xad, 0x1a, 0x0a, 0xdd, 0x9e, 6773863ef31SBob Pearson 0x59, 0x0c, 0xa2, 0xcd, 0xae, 0x48, 0x4a, 0x38, 6783863ef31SBob Pearson 0x5b, 0x47, 0x41, 0x94, 0x65, 0x6b, 0xbb, 0xeb, 6793863ef31SBob Pearson 0x5b, 0xe3, 0xaf, 0x07, 0x5b, 0xd4, 0x4a, 0xa2, 6803863ef31SBob Pearson 0xc9, 0x5d, 0x2f, 0x64, 0x03, 0xd7, 0x3a, 0x2c, 6813863ef31SBob Pearson 0x6e, 0xce, 0x76, 0x95, 0xb4, 0xb3, 0xc0, 0xf1, 6823863ef31SBob Pearson 0xe2, 0x45, 0x73, 0x7a, 0x5c, 0xab, 0xc1, 0xfc, 6833863ef31SBob Pearson 0x02, 0x8d, 0x81, 0x29, 0xb3, 0xac, 0x07, 0xec, 6843863ef31SBob Pearson 0x40, 0x7d, 0x45, 0xd9, 0x7a, 0x59, 0xee, 0x34, 6853863ef31SBob Pearson 0xf0, 0xe9, 0xd5, 0x7b, 0x96, 0xb1, 0x3d, 0x95, 6863863ef31SBob Pearson 0xcc, 0x86, 0xb5, 0xb6, 0x04, 0x2d, 0xb5, 0x92, 6873863ef31SBob Pearson 0x7e, 0x76, 0xf4, 0x06, 0xa9, 0xa3, 0x12, 0x0f, 6883863ef31SBob Pearson 0xb1, 0xaf, 0x26, 0xba, 0x7c, 0xfc, 0x7e, 0x1c, 6893863ef31SBob Pearson 0xbc, 0x2c, 0x49, 0x97, 0x53, 0x60, 0x13, 0x0b, 6903863ef31SBob Pearson 0xa6, 0x61, 0x83, 0x89, 0x42, 0xd4, 0x17, 0x0c, 6913863ef31SBob Pearson 0x6c, 0x26, 0x52, 0xc3, 0xb3, 0xd4, 0x67, 0xf5, 6923863ef31SBob Pearson 0xe3, 0x04, 0xb7, 0xf4, 0xcb, 0x80, 0xb8, 0xcb, 6933863ef31SBob Pearson 0x77, 0x56, 0x3e, 0xaa, 0x57, 0x54, 0xee, 0xb4, 6943863ef31SBob Pearson 0x2c, 0x67, 0xcf, 0xf2, 0xdc, 0xbe, 0x55, 0xf9, 6953863ef31SBob Pearson 0x43, 0x1f, 0x6e, 0x22, 0x97, 0x67, 0x7f, 0xc4, 6963863ef31SBob Pearson 0xef, 0xb1, 0x26, 0x31, 0x1e, 0x27, 0xdf, 0x41, 6973863ef31SBob Pearson 0x80, 0x47, 0x6c, 0xe2, 0xfa, 0xa9, 0x8c, 0x2a, 6983863ef31SBob Pearson 0xf6, 0xf2, 0xab, 0xf0, 0x15, 0xda, 0x6c, 0xc8, 6993863ef31SBob Pearson 0xfe, 0xb5, 0x23, 0xde, 0xa9, 0x05, 0x3f, 0x06, 7003863ef31SBob Pearson 0x54, 0x4c, 0xcd, 0xe1, 0xab, 0xfc, 0x0e, 0x62, 7013863ef31SBob Pearson 0x33, 0x31, 0x73, 0x2c, 0x76, 0xcb, 0xb4, 0x47, 7023863ef31SBob Pearson 0x1e, 0x20, 0xad, 0xd8, 0xf2, 0x31, 0xdd, 0xc4, 7033863ef31SBob Pearson 0x8b, 0x0c, 0x77, 0xbe, 0xe1, 0x8b, 0x26, 0x00, 7043863ef31SBob Pearson 0x02, 0x58, 0xd6, 0x8d, 0xef, 0xad, 0x74, 0x67, 7053863ef31SBob Pearson 0xab, 0x3f, 0xef, 0xcb, 0x6f, 0xb0, 0xcc, 0x81, 7063863ef31SBob Pearson 0x44, 0x4c, 0xaf, 0xe9, 0x49, 0x4f, 0xdb, 0xa0, 7073863ef31SBob Pearson 0x25, 0xa4, 0xf0, 0x89, 0xf1, 0xbe, 0xd8, 0x10, 7083863ef31SBob Pearson 0xff, 0xb1, 0x3b, 0x4b, 0xfa, 0x98, 0xf5, 0x79, 7093863ef31SBob Pearson 0x6d, 0x1e, 0x69, 0x4d, 0x57, 0xb1, 0xc8, 0x19, 7103863ef31SBob Pearson 0x1b, 0xbd, 0x1e, 0x8c, 0x84, 0xb7, 0x7b, 0xe8, 7113863ef31SBob Pearson 0xd2, 0x2d, 0x09, 0x41, 0x41, 0x37, 0x3d, 0xb1, 7123863ef31SBob Pearson 0x6f, 0x26, 0x5d, 0x71, 0x16, 0x3d, 0xb7, 0x83, 7133863ef31SBob Pearson 0x27, 0x2c, 0xa7, 0xb6, 0x50, 0xbd, 0x91, 0x86, 7143863ef31SBob Pearson 0xab, 0x24, 0xa1, 0x38, 0xfd, 0xea, 0x71, 0x55, 7153863ef31SBob Pearson 0x7e, 0x9a, 0x07, 0x77, 0x4b, 0xfa, 0x61, 0x66, 7163863ef31SBob Pearson 0x20, 0x1e, 0x28, 0x95, 0x18, 0x1b, 0xa4, 0xa0, 7173863ef31SBob Pearson 0xfd, 0xc0, 0x89, 0x72, 0x43, 0xd9, 0x3b, 0x49, 7183863ef31SBob Pearson 0x5a, 0x3f, 0x9d, 0xbf, 0xdb, 0xb4, 0x46, 0xea, 7193863ef31SBob Pearson 0x42, 0x01, 0x77, 0x23, 0x68, 0x95, 0xb6, 0x24, 7203863ef31SBob Pearson 0xb3, 0xa8, 0x6c, 0x28, 0x3b, 0x11, 0x40, 0x7e, 7213863ef31SBob Pearson 0x18, 0x65, 0x6d, 0xd8, 0x24, 0x42, 0x7d, 0x88, 7223863ef31SBob Pearson 0xc0, 0x52, 0xd9, 0x05, 0xe4, 0x95, 0x90, 0x87, 7233863ef31SBob Pearson 0x8c, 0xf4, 0xd0, 0x6b, 0xb9, 0x83, 0x99, 0x34, 7243863ef31SBob Pearson 0x6d, 0xfe, 0x54, 0x40, 0x94, 0x52, 0x21, 0x4f, 7253863ef31SBob Pearson 0x14, 0x25, 0xc5, 0xd6, 0x5e, 0x95, 0xdc, 0x0a, 7263863ef31SBob Pearson 0x2b, 0x89, 0x20, 0x11, 0x84, 0x48, 0xd6, 0x3a, 7273863ef31SBob Pearson 0xcd, 0x5c, 0x24, 0xad, 0x62, 0xe3, 0xb1, 0x93, 7283863ef31SBob Pearson 0x25, 0x8d, 0xcd, 0x7e, 0xfc, 0x27, 0xa3, 0x37, 7293863ef31SBob Pearson 0xfd, 0x84, 0xfc, 0x1b, 0xb2, 0xf1, 0x27, 0x38, 7303863ef31SBob Pearson 0x5a, 0xb7, 0xfc, 0xf2, 0xfa, 0x95, 0x66, 0xd4, 7313863ef31SBob Pearson 0xfb, 0xba, 0xa7, 0xd7, 0xa3, 0x72, 0x69, 0x48, 7323863ef31SBob Pearson 0x48, 0x8c, 0xeb, 0x28, 0x89, 0xfe, 0x33, 0x65, 7333863ef31SBob Pearson 0x5a, 0x36, 0x01, 0x7e, 0x06, 0x79, 0x0a, 0x09, 7343863ef31SBob Pearson 0x3b, 0x74, 0x11, 0x9a, 0x6e, 0xbf, 0xd4, 0x9e, 7353863ef31SBob Pearson 0x58, 0x90, 0x49, 0x4f, 0x4d, 0x08, 0xd4, 0xe5, 7363863ef31SBob Pearson 0x4a, 0x09, 0x21, 0xef, 0x8b, 0xb8, 0x74, 0x3b, 7373863ef31SBob Pearson 0x91, 0xdd, 0x36, 0x85, 0x60, 0x2d, 0xfa, 0xd4, 7383863ef31SBob Pearson 0x45, 0x7b, 0x45, 0x53, 0xf5, 0x47, 0x87, 0x7e, 7393863ef31SBob Pearson 0xa6, 0x37, 0xc8, 0x78, 0x7a, 0x68, 0x9d, 0x8d, 7403863ef31SBob Pearson 0x65, 0x2c, 0x0e, 0x91, 0x5c, 0xa2, 0x60, 0xf0, 7413863ef31SBob Pearson 0x8e, 0x3f, 0xe9, 0x1a, 0xcd, 0xaa, 0xe7, 0xd5, 7423863ef31SBob Pearson 0x77, 0x18, 0xaf, 0xc9, 0xbc, 0x18, 0xea, 0x48, 7433863ef31SBob Pearson 0x1b, 0xfb, 0x22, 0x48, 0x70, 0x16, 0x29, 0x9e, 7443863ef31SBob Pearson 0x5b, 0xc1, 0x2c, 0x66, 0x23, 0xbc, 0xf0, 0x1f, 7453863ef31SBob Pearson 0xef, 0xaf, 0xe4, 0xd6, 0x04, 0x19, 0x82, 0x7a, 7463863ef31SBob Pearson 0x0b, 0xba, 0x4b, 0x46, 0xb1, 0x6a, 0x85, 0x5d, 7473863ef31SBob Pearson 0xb4, 0x73, 0xd6, 0x21, 0xa1, 0x71, 0x60, 0x14, 7483863ef31SBob Pearson 0xee, 0x0a, 0x77, 0xc4, 0x66, 0x2e, 0xf9, 0x69, 7493863ef31SBob Pearson 0x30, 0xaf, 0x41, 0x0b, 0xc8, 0x83, 0x3c, 0x53, 7503863ef31SBob Pearson 0x99, 0x19, 0x27, 0x46, 0xf7, 0x41, 0x6e, 0x56, 7513863ef31SBob Pearson 0xdc, 0x94, 0x28, 0x67, 0x4e, 0xb7, 0x25, 0x48, 7523863ef31SBob Pearson 0x8a, 0xc2, 0xe0, 0x60, 0x96, 0xcc, 0x18, 0xf4, 7533863ef31SBob Pearson 0x84, 0xdd, 0xa7, 0x5e, 0x3e, 0x05, 0x0b, 0x26, 7543863ef31SBob Pearson 0x26, 0xb2, 0x5c, 0x1f, 0x57, 0x1a, 0x04, 0x7e, 7553863ef31SBob Pearson 0x6a, 0xe3, 0x2f, 0xb4, 0x35, 0xb6, 0x38, 0x40, 7563863ef31SBob Pearson 0x40, 0xcd, 0x6f, 0x87, 0x2e, 0xef, 0xa3, 0xd7, 7573863ef31SBob Pearson 0xa9, 0xc2, 0xe8, 0x0d, 0x27, 0xdf, 0x44, 0x62, 7583863ef31SBob Pearson 0x99, 0xa0, 0xfc, 0xcf, 0x81, 0x78, 0xcb, 0xfe, 7593863ef31SBob Pearson 0xe5, 0xa0, 0x03, 0x4e, 0x6c, 0xd7, 0xf4, 0xaf, 7603863ef31SBob Pearson 0x7a, 0xbb, 0x61, 0x82, 0xfe, 0x71, 0x89, 0xb2, 7613863ef31SBob Pearson 0x22, 0x7c, 0x8e, 0x83, 0x04, 0xce, 0xf6, 0x5d, 7623863ef31SBob Pearson 0x84, 0x8f, 0x95, 0x6a, 0x7f, 0xad, 0xfd, 0x32, 7633863ef31SBob Pearson 0x9c, 0x5e, 0xe4, 0x9c, 0x89, 0x60, 0x54, 0xaa, 7643863ef31SBob Pearson 0x96, 0x72, 0xd2, 0xd7, 0x36, 0x85, 0xa9, 0x45, 7653863ef31SBob Pearson 0xd2, 0x2a, 0xa1, 0x81, 0x49, 0x6f, 0x7e, 0x04, 7663863ef31SBob Pearson 0xfa, 0xe2, 0xfe, 0x90, 0x26, 0x77, 0x5a, 0x33, 7673863ef31SBob Pearson 0xb8, 0x04, 0x9a, 0x7a, 0xe6, 0x4c, 0x4f, 0xad, 7683863ef31SBob Pearson 0x72, 0x96, 0x08, 0x28, 0x58, 0x13, 0xf8, 0xc4, 7693863ef31SBob Pearson 0x1c, 0xf0, 0xc3, 0x45, 0x95, 0x49, 0x20, 0x8c, 7703863ef31SBob Pearson 0x9f, 0x39, 0x70, 0xe1, 0x77, 0xfe, 0xd5, 0x4b, 7713863ef31SBob Pearson 0xaf, 0x86, 0xda, 0xef, 0x22, 0x06, 0x83, 0x36, 7723863ef31SBob Pearson 0x29, 0x12, 0x11, 0x40, 0xbc, 0x3b, 0x86, 0xaa, 7733863ef31SBob Pearson 0xaa, 0x65, 0x60, 0xc3, 0x80, 0xca, 0xed, 0xa9, 7743863ef31SBob Pearson 0xf3, 0xb0, 0x79, 0x96, 0xa2, 0x55, 0x27, 0x28, 7753863ef31SBob Pearson 0x55, 0x73, 0x26, 0xa5, 0x50, 0xea, 0x92, 0x4b, 7763863ef31SBob Pearson 0x3c, 0x5c, 0x82, 0x33, 0xf0, 0x01, 0x3f, 0x03, 7773863ef31SBob Pearson 0xc1, 0x08, 0x05, 0xbf, 0x98, 0xf4, 0x9b, 0x6d, 7783863ef31SBob Pearson 0xa5, 0xa8, 0xb4, 0x82, 0x0c, 0x06, 0xfa, 0xff, 7793863ef31SBob Pearson 0x2d, 0x08, 0xf3, 0x05, 0x4f, 0x57, 0x2a, 0x39, 7803863ef31SBob Pearson 0xd4, 0x83, 0x0d, 0x75, 0x51, 0xd8, 0x5b, 0x1b, 7813863ef31SBob Pearson 0xd3, 0x51, 0x5a, 0x32, 0x2a, 0x9b, 0x32, 0xb2, 7823863ef31SBob Pearson 0xf2, 0xa4, 0x96, 0x12, 0xf2, 0xae, 0x40, 0x34, 7833863ef31SBob Pearson 0x67, 0xa8, 0xf5, 0x44, 0xd5, 0x35, 0x53, 0xfe, 7843863ef31SBob Pearson 0xa3, 0x60, 0x96, 0x63, 0x0f, 0x1f, 0x6e, 0xb0, 7853863ef31SBob Pearson 0x5a, 0x42, 0xa6, 0xfc, 0x51, 0x0b, 0x60, 0x27, 7863863ef31SBob Pearson 0xbc, 0x06, 0x71, 0xed, 0x65, 0x5b, 0x23, 0x86, 7873863ef31SBob Pearson 0x4a, 0x07, 0x3b, 0x22, 0x07, 0x46, 0xe6, 0x90, 7883863ef31SBob Pearson 0x3e, 0xf3, 0x25, 0x50, 0x1b, 0x4c, 0x7f, 0x03, 7893863ef31SBob Pearson 0x08, 0xa8, 0x36, 0x6b, 0x87, 0xe5, 0xe3, 0xdb, 7903863ef31SBob Pearson 0x9a, 0x38, 0x83, 0xff, 0x9f, 0x1a, 0x9f, 0x57, 7913863ef31SBob Pearson 0xa4, 0x2a, 0xf6, 0x37, 0xbc, 0x1a, 0xff, 0xc9, 7923863ef31SBob Pearson 0x1e, 0x35, 0x0c, 0xc3, 0x7c, 0xa3, 0xb2, 0xe5, 7933863ef31SBob Pearson 0xd2, 0xc6, 0xb4, 0x57, 0x47, 0xe4, 0x32, 0x16, 7943863ef31SBob Pearson 0x6d, 0xa9, 0xae, 0x64, 0xe6, 0x2d, 0x8d, 0xc5, 7953863ef31SBob Pearson 0x8d, 0x50, 0x8e, 0xe8, 0x1a, 0x22, 0x34, 0x2a, 7963863ef31SBob Pearson 0xd9, 0xeb, 0x51, 0x90, 0x4a, 0xb1, 0x41, 0x7d, 7973863ef31SBob Pearson 0x64, 0xf9, 0xb9, 0x0d, 0xf6, 0x23, 0x33, 0xb0, 7983863ef31SBob Pearson 0x33, 0xf4, 0xf7, 0x3f, 0x27, 0x84, 0xc6, 0x0f, 7993863ef31SBob Pearson 0x54, 0xa5, 0xc0, 0x2e, 0xec, 0x0b, 0x3a, 0x48, 8003863ef31SBob Pearson 0x6e, 0x80, 0x35, 0x81, 0x43, 0x9b, 0x90, 0xb1, 8013863ef31SBob Pearson 0xd0, 0x2b, 0xea, 0x21, 0xdc, 0xda, 0x5b, 0x09, 8023863ef31SBob Pearson 0xf4, 0xcc, 0x10, 0xb4, 0xc7, 0xfe, 0x79, 0x51, 8033863ef31SBob Pearson 0xc3, 0xc5, 0xac, 0x88, 0x74, 0x84, 0x0b, 0x4b, 8043863ef31SBob Pearson 0xca, 0x79, 0x16, 0x29, 0xfb, 0x69, 0x54, 0xdf, 8053863ef31SBob Pearson 0x41, 0x7e, 0xe9, 0xc7, 0x8e, 0xea, 0xa5, 0xfe, 8063863ef31SBob Pearson 0xfc, 0x76, 0x0e, 0x90, 0xc4, 0x92, 0x38, 0xad, 8073863ef31SBob Pearson 0x7b, 0x48, 0xe6, 0x6e, 0xf7, 0x21, 0xfd, 0x4e, 8083863ef31SBob Pearson 0x93, 0x0a, 0x7b, 0x41, 0x83, 0x68, 0xfb, 0x57, 8093863ef31SBob Pearson 0x51, 0x76, 0x34, 0xa9, 0x6c, 0x00, 0xaa, 0x4f, 8103863ef31SBob Pearson 0x66, 0x65, 0x98, 0x4a, 0x4f, 0xa3, 0xa0, 0xef, 8113863ef31SBob Pearson 0x69, 0x3f, 0xe3, 0x1c, 0x92, 0x8c, 0xfd, 0xd8, 8123863ef31SBob Pearson 0xe8, 0xde, 0x7c, 0x7f, 0x3e, 0x84, 0x8e, 0x69, 8133863ef31SBob Pearson 0x3c, 0xf1, 0xf2, 0x05, 0x46, 0xdc, 0x2f, 0x9d, 8143863ef31SBob Pearson 0x5e, 0x6e, 0x4c, 0xfb, 0xb5, 0x99, 0x2a, 0x59, 8153863ef31SBob Pearson 0x63, 0xc1, 0x34, 0xbc, 0x57, 0xc0, 0x0d, 0xb9, 8163863ef31SBob Pearson 0x61, 0x25, 0xf3, 0x33, 0x23, 0x51, 0xb6, 0x0d, 8173863ef31SBob Pearson 0x07, 0xa6, 0xab, 0x94, 0x4a, 0xb7, 0x2a, 0xea, 8183863ef31SBob Pearson 0xee, 0xac, 0xa3, 0xc3, 0x04, 0x8b, 0x0e, 0x56, 8193863ef31SBob Pearson 0xfe, 0x44, 0xa7, 0x39, 0xe2, 0xed, 0xed, 0xb4, 8203863ef31SBob Pearson 0x22, 0x2b, 0xac, 0x12, 0x32, 0x28, 0x91, 0xd8, 8213863ef31SBob Pearson 0xa5, 0xab, 0xff, 0x5f, 0xe0, 0x4b, 0xda, 0x78, 8223863ef31SBob Pearson 0x17, 0xda, 0xf1, 0x01, 0x5b, 0xcd, 0xe2, 0x5f, 8233863ef31SBob Pearson 0x50, 0x45, 0x73, 0x2b, 0xe4, 0x76, 0x77, 0xf4, 8243863ef31SBob Pearson 0x64, 0x1d, 0x43, 0xfb, 0x84, 0x7a, 0xea, 0x91, 8253863ef31SBob Pearson 0xae, 0xf9, 0x9e, 0xb7, 0xb4, 0xb0, 0x91, 0x5f, 8263863ef31SBob Pearson 0x16, 0x35, 0x9a, 0x11, 0xb8, 0xc7, 0xc1, 0x8c, 8273863ef31SBob Pearson 0xc6, 0x10, 0x8d, 0x2f, 0x63, 0x4a, 0xa7, 0x57, 8283863ef31SBob Pearson 0x3a, 0x51, 0xd6, 0x32, 0x2d, 0x64, 0x72, 0xd4, 8293863ef31SBob Pearson 0x66, 0xdc, 0x10, 0xa6, 0x67, 0xd6, 0x04, 0x23, 8303863ef31SBob Pearson 0x9d, 0x0a, 0x11, 0x77, 0xdd, 0x37, 0x94, 0x17, 8313863ef31SBob Pearson 0x3c, 0xbf, 0x8b, 0x65, 0xb0, 0x2e, 0x5e, 0x66, 8323863ef31SBob Pearson 0x47, 0x64, 0xac, 0xdd, 0xf0, 0x84, 0xfd, 0x39, 8333863ef31SBob Pearson 0xfa, 0x15, 0x5d, 0xef, 0xae, 0xca, 0xc1, 0x36, 8343863ef31SBob Pearson 0xa7, 0x5c, 0xbf, 0xc7, 0x08, 0xc2, 0x66, 0x00, 8353863ef31SBob Pearson 0x74, 0x74, 0x4e, 0x27, 0x3f, 0x55, 0x8a, 0xb7, 8363863ef31SBob Pearson 0x38, 0x66, 0x83, 0x6d, 0xcf, 0x99, 0x9e, 0x60, 8373863ef31SBob Pearson 0x8f, 0xdd, 0x2e, 0x62, 0x22, 0x0e, 0xef, 0x0c, 8383863ef31SBob Pearson 0x98, 0xa7, 0x85, 0x74, 0x3b, 0x9d, 0xec, 0x9e, 8393863ef31SBob Pearson 0xa9, 0x19, 0x72, 0xa5, 0x7f, 0x2c, 0x39, 0xb7, 8403863ef31SBob Pearson 0x7d, 0xb7, 0xf1, 0x12, 0x65, 0x27, 0x4b, 0x5a, 8413863ef31SBob Pearson 0xde, 0x17, 0xfe, 0xad, 0x44, 0xf3, 0x20, 0x4d, 8423863ef31SBob Pearson 0xfd, 0xe4, 0x1f, 0xb5, 0x81, 0xb0, 0x36, 0x37, 8433863ef31SBob Pearson 0x08, 0x6f, 0xc3, 0x0c, 0xe9, 0x85, 0x98, 0x82, 8443863ef31SBob Pearson 0xa9, 0x62, 0x0c, 0xc4, 0x97, 0xc0, 0x50, 0xc8, 8453863ef31SBob Pearson 0xa7, 0x3c, 0x50, 0x9f, 0x43, 0xb9, 0xcd, 0x5e, 8463863ef31SBob Pearson 0x4d, 0xfa, 0x1c, 0x4b, 0x0b, 0xa9, 0x98, 0x85, 8473863ef31SBob Pearson 0x38, 0x92, 0xac, 0x8d, 0xe4, 0xad, 0x9b, 0x98, 8483863ef31SBob Pearson 0xab, 0xd9, 0x38, 0xac, 0x62, 0x52, 0xa3, 0x22, 8493863ef31SBob Pearson 0x63, 0x0f, 0xbf, 0x95, 0x48, 0xdf, 0x69, 0xe7, 8503863ef31SBob Pearson 0x8b, 0x33, 0xd5, 0xb2, 0xbd, 0x05, 0x49, 0x49, 8513863ef31SBob Pearson 0x9d, 0x57, 0x73, 0x19, 0x33, 0xae, 0xfa, 0x33, 8523863ef31SBob Pearson 0xf1, 0x19, 0xa8, 0x80, 0xce, 0x04, 0x9f, 0xbc, 8533863ef31SBob Pearson 0x1d, 0x65, 0x82, 0x1b, 0xe5, 0x3a, 0x51, 0xc8, 8543863ef31SBob Pearson 0x1c, 0x21, 0xe3, 0x5d, 0xf3, 0x7d, 0x9b, 0x2f, 8553863ef31SBob Pearson 0x2c, 0x1d, 0x4a, 0x7f, 0x9b, 0x68, 0x35, 0xa3, 8563863ef31SBob Pearson 0xb2, 0x50, 0xf7, 0x62, 0x79, 0xcd, 0xf4, 0x98, 8573863ef31SBob Pearson 0x4f, 0xe5, 0x63, 0x7c, 0x3e, 0x45, 0x31, 0x8c, 8583863ef31SBob Pearson 0x16, 0xa0, 0x12, 0xc8, 0x58, 0xce, 0x39, 0xa6, 8593863ef31SBob Pearson 0xbc, 0x54, 0xdb, 0xc5, 0xe0, 0xd5, 0xba, 0xbc, 8603863ef31SBob Pearson 0xb9, 0x04, 0xf4, 0x8d, 0xe8, 0x2f, 0x15, 0x9d, 8613863ef31SBob Pearson }; 8621da177e4SLinus Torvalds 8633863ef31SBob Pearson /* 100 test cases */ 8643863ef31SBob Pearson static struct crc_test { 8653863ef31SBob Pearson u32 crc; /* random starting crc */ 8663863ef31SBob Pearson u32 start; /* random 6 bit offset in buf */ 8673863ef31SBob Pearson u32 length; /* random 11 bit length of test */ 8683863ef31SBob Pearson u32 crc_le; /* expected crc32_le result */ 8693863ef31SBob Pearson u32 crc_be; /* expected crc32_be result */ 870577eba9eSDarrick J. Wong u32 crc32c_le; /* expected crc32c_le result */ 8713863ef31SBob Pearson } test[] = 8721da177e4SLinus Torvalds { 873d921e049SDaniel Borkmann {0x674bf11d, 0x00000038, 0x00000542, 0x0af6d466, 0xd8b6e4c1, 0xf6e93d6c}, 874d921e049SDaniel Borkmann {0x35c672c6, 0x0000003a, 0x000001aa, 0xc6d3dfba, 0x28aaf3ad, 0x0fe92aca}, 875d921e049SDaniel Borkmann {0x496da28e, 0x00000039, 0x000005af, 0xd933660f, 0x5d57e81f, 0x52e1ebb8}, 876d921e049SDaniel Borkmann {0x09a9b90e, 0x00000027, 0x000001f8, 0xb45fe007, 0xf45fca9a, 0x0798af9a}, 877d921e049SDaniel Borkmann {0xdc97e5a9, 0x00000025, 0x000003b6, 0xf81a3562, 0xe0126ba2, 0x18eb3152}, 878d921e049SDaniel Borkmann {0x47c58900, 0x0000000a, 0x000000b9, 0x8e58eccf, 0xf3afc793, 0xd00d08c7}, 879d921e049SDaniel Borkmann {0x292561e8, 0x0000000c, 0x00000403, 0xa2ba8aaf, 0x0b797aed, 0x8ba966bc}, 880d921e049SDaniel Borkmann {0x415037f6, 0x00000003, 0x00000676, 0xa17d52e8, 0x7f0fdf35, 0x11d694a2}, 881d921e049SDaniel Borkmann {0x3466e707, 0x00000026, 0x00000042, 0x258319be, 0x75c484a2, 0x6ab3208d}, 882d921e049SDaniel Borkmann {0xafd1281b, 0x00000023, 0x000002ee, 0x4428eaf8, 0x06c7ad10, 0xba4603c5}, 883d921e049SDaniel Borkmann {0xd3857b18, 0x00000028, 0x000004a2, 0x5c430821, 0xb062b7cb, 0xe6071c6f}, 884d921e049SDaniel Borkmann {0x1d825a8f, 0x0000002b, 0x0000050b, 0xd2c45f0c, 0xd68634e0, 0x179ec30a}, 885d921e049SDaniel Borkmann {0x5033e3bc, 0x0000000b, 0x00000078, 0xa3ea4113, 0xac6d31fb, 0x0903beb8}, 886d921e049SDaniel Borkmann {0x94f1fb5e, 0x0000000f, 0x000003a2, 0xfbfc50b1, 0x3cfe50ed, 0x6a7cb4fa}, 887d921e049SDaniel Borkmann {0xc9a0fe14, 0x00000009, 0x00000473, 0x5fb61894, 0x87070591, 0xdb535801}, 888d921e049SDaniel Borkmann {0x88a034b1, 0x0000001c, 0x000005ad, 0xc1b16053, 0x46f95c67, 0x92bed597}, 889d921e049SDaniel Borkmann {0xf0f72239, 0x00000020, 0x0000026d, 0xa6fa58f3, 0xf8c2c1dd, 0x192a3f1b}, 890d921e049SDaniel Borkmann {0xcc20a5e3, 0x0000003b, 0x0000067a, 0x7740185a, 0x308b979a, 0xccbaec1a}, 891d921e049SDaniel Borkmann {0xce589c95, 0x0000002b, 0x00000641, 0xd055e987, 0x40aae25b, 0x7eabae4d}, 892d921e049SDaniel Borkmann {0x78edc885, 0x00000035, 0x000005be, 0xa39cb14b, 0x035b0d1f, 0x28c72982}, 893d921e049SDaniel Borkmann {0x9d40a377, 0x0000003b, 0x00000038, 0x1f47ccd2, 0x197fbc9d, 0xc3cd4d18}, 894d921e049SDaniel Borkmann {0x703d0e01, 0x0000003c, 0x000006f1, 0x88735e7c, 0xfed57c5a, 0xbca8f0e7}, 895d921e049SDaniel Borkmann {0x776bf505, 0x0000000f, 0x000005b2, 0x5cc4fc01, 0xf32efb97, 0x713f60b3}, 896d921e049SDaniel Borkmann {0x4a3e7854, 0x00000027, 0x000004b8, 0x8d923c82, 0x0cbfb4a2, 0xebd08fd5}, 897d921e049SDaniel Borkmann {0x209172dd, 0x0000003b, 0x00000356, 0xb89e9c2b, 0xd7868138, 0x64406c59}, 898d921e049SDaniel Borkmann {0x3ba4cc5b, 0x0000002f, 0x00000203, 0xe51601a9, 0x5b2a1032, 0x7421890e}, 899d921e049SDaniel Borkmann {0xfc62f297, 0x00000000, 0x00000079, 0x71a8e1a2, 0x5d88685f, 0xe9347603}, 900d921e049SDaniel Borkmann {0x64280b8b, 0x00000016, 0x000007ab, 0x0fa7a30c, 0xda3a455f, 0x1bef9060}, 901d921e049SDaniel Borkmann {0x97dd724b, 0x00000033, 0x000007ad, 0x5788b2f4, 0xd7326d32, 0x34720072}, 902d921e049SDaniel Borkmann {0x61394b52, 0x00000035, 0x00000571, 0xc66525f1, 0xcabe7fef, 0x48310f59}, 903d921e049SDaniel Borkmann {0x29b4faff, 0x00000024, 0x0000006e, 0xca13751e, 0x993648e0, 0x783a4213}, 904d921e049SDaniel Borkmann {0x29bfb1dc, 0x0000000b, 0x00000244, 0x436c43f7, 0x429f7a59, 0x9e8efd41}, 905d921e049SDaniel Borkmann {0x86ae934b, 0x00000035, 0x00000104, 0x0760ec93, 0x9cf7d0f4, 0xfc3d34a5}, 906d921e049SDaniel Borkmann {0xc4c1024e, 0x0000002e, 0x000006b1, 0x6516a3ec, 0x19321f9c, 0x17a52ae2}, 907d921e049SDaniel Borkmann {0x3287a80a, 0x00000026, 0x00000496, 0x0b257eb1, 0x754ebd51, 0x886d935a}, 908d921e049SDaniel Borkmann {0xa4db423e, 0x00000023, 0x0000045d, 0x9b3a66dc, 0x873e9f11, 0xeaaeaeb2}, 909d921e049SDaniel Borkmann {0x7a1078df, 0x00000015, 0x0000014a, 0x8c2484c5, 0x6a628659, 0x8e900a4b}, 910d921e049SDaniel Borkmann {0x6048bd5b, 0x00000006, 0x0000006a, 0x897e3559, 0xac9961af, 0xd74662b1}, 911d921e049SDaniel Borkmann {0xd8f9ea20, 0x0000003d, 0x00000277, 0x60eb905b, 0xed2aaf99, 0xd26752ba}, 912d921e049SDaniel Borkmann {0xea5ec3b4, 0x0000002a, 0x000004fe, 0x869965dc, 0x6c1f833b, 0x8b1fcd62}, 913d921e049SDaniel Borkmann {0x2dfb005d, 0x00000016, 0x00000345, 0x6a3b117e, 0xf05e8521, 0xf54342fe}, 914d921e049SDaniel Borkmann {0x5a214ade, 0x00000020, 0x000005b6, 0x467f70be, 0xcb22ccd3, 0x5b95b988}, 915d921e049SDaniel Borkmann {0xf0ab9cca, 0x00000032, 0x00000515, 0xed223df3, 0x7f3ef01d, 0x2e1176be}, 916d921e049SDaniel Borkmann {0x91b444f9, 0x0000002e, 0x000007f8, 0x84e9a983, 0x5676756f, 0x66120546}, 917d921e049SDaniel Borkmann {0x1b5d2ddb, 0x0000002e, 0x0000012c, 0xba638c4c, 0x3f42047b, 0xf256a5cc}, 918d921e049SDaniel Borkmann {0xd824d1bb, 0x0000003a, 0x000007b5, 0x6288653b, 0x3a3ebea0, 0x4af1dd69}, 919d921e049SDaniel Borkmann {0x0470180c, 0x00000034, 0x000001f0, 0x9d5b80d6, 0x3de08195, 0x56f0a04a}, 920d921e049SDaniel Borkmann {0xffaa3a3f, 0x00000036, 0x00000299, 0xf3a82ab8, 0x53e0c13d, 0x74f6b6b2}, 921d921e049SDaniel Borkmann {0x6406cfeb, 0x00000023, 0x00000600, 0xa920b8e8, 0xe4e2acf4, 0x085951fd}, 922d921e049SDaniel Borkmann {0xb24aaa38, 0x0000003e, 0x000004a1, 0x657cc328, 0x5077b2c3, 0xc65387eb}, 923d921e049SDaniel Borkmann {0x58b2ab7c, 0x00000039, 0x000002b4, 0x3a17ee7e, 0x9dcb3643, 0x1ca9257b}, 924d921e049SDaniel Borkmann {0x3db85970, 0x00000006, 0x000002b6, 0x95268b59, 0xb9812c10, 0xfd196d76}, 925d921e049SDaniel Borkmann {0x857830c5, 0x00000003, 0x00000590, 0x4ef439d5, 0xf042161d, 0x5ef88339}, 926d921e049SDaniel Borkmann {0xe1fcd978, 0x0000003e, 0x000007d8, 0xae8d8699, 0xce0a1ef5, 0x2c3714d9}, 927d921e049SDaniel Borkmann {0xb982a768, 0x00000016, 0x000006e0, 0x62fad3df, 0x5f8a067b, 0x58576548}, 928d921e049SDaniel Borkmann {0x1d581ce8, 0x0000001e, 0x0000058b, 0xf0f5da53, 0x26e39eee, 0xfd7c57de}, 929d921e049SDaniel Borkmann {0x2456719b, 0x00000025, 0x00000503, 0x4296ac64, 0xd50e4c14, 0xd5fedd59}, 930d921e049SDaniel Borkmann {0xfae6d8f2, 0x00000000, 0x0000055d, 0x057fdf2e, 0x2a31391a, 0x1cc3b17b}, 931d921e049SDaniel Borkmann {0xcba828e3, 0x00000039, 0x000002ce, 0xe3f22351, 0x8f00877b, 0x270eed73}, 932d921e049SDaniel Borkmann {0x13d25952, 0x0000000a, 0x0000072d, 0x76d4b4cc, 0x5eb67ec3, 0x91ecbb11}, 933d921e049SDaniel Borkmann {0x0342be3f, 0x00000015, 0x00000599, 0xec75d9f1, 0x9d4d2826, 0x05ed8d0c}, 934d921e049SDaniel Borkmann {0xeaa344e0, 0x00000014, 0x000004d8, 0x72a4c981, 0x2064ea06, 0x0b09ad5b}, 935d921e049SDaniel Borkmann {0xbbb52021, 0x0000003b, 0x00000272, 0x04af99fc, 0xaf042d35, 0xf8d511fb}, 936d921e049SDaniel Borkmann {0xb66384dc, 0x0000001d, 0x000007fc, 0xd7629116, 0x782bd801, 0x5ad832cc}, 937d921e049SDaniel Borkmann {0x616c01b6, 0x00000022, 0x000002c8, 0x5b1dab30, 0x783ce7d2, 0x1214d196}, 938d921e049SDaniel Borkmann {0xce2bdaad, 0x00000016, 0x0000062a, 0x932535c8, 0x3f02926d, 0x5747218a}, 939d921e049SDaniel Borkmann {0x00fe84d7, 0x00000005, 0x00000205, 0x850e50aa, 0x753d649c, 0xde8f14de}, 940d921e049SDaniel Borkmann {0xbebdcb4c, 0x00000006, 0x0000055d, 0xbeaa37a2, 0x2d8c9eba, 0x3563b7b9}, 941d921e049SDaniel Borkmann {0xd8b1a02a, 0x00000010, 0x00000387, 0x5017d2fc, 0x503541a5, 0x071475d0}, 942d921e049SDaniel Borkmann {0x3b96cad2, 0x00000036, 0x00000347, 0x1d2372ae, 0x926cd90b, 0x54c79d60}, 943d921e049SDaniel Borkmann {0xc94c1ed7, 0x00000005, 0x0000038b, 0x9e9fdb22, 0x144a9178, 0x4c53eee6}, 944d921e049SDaniel Borkmann {0x1aad454e, 0x00000025, 0x000002b2, 0xc3f6315c, 0x5c7a35b3, 0x10137a3c}, 945d921e049SDaniel Borkmann {0xa4fec9a6, 0x00000000, 0x000006d6, 0x90be5080, 0xa4107605, 0xaa9d6c73}, 946d921e049SDaniel Borkmann {0x1bbe71e2, 0x0000001f, 0x000002fd, 0x4e504c3b, 0x284ccaf1, 0xb63d23e7}, 947d921e049SDaniel Borkmann {0x4201c7e4, 0x00000002, 0x000002b7, 0x7822e3f9, 0x0cc912a9, 0x7f53e9cf}, 948d921e049SDaniel Borkmann {0x23fddc96, 0x00000003, 0x00000627, 0x8a385125, 0x07767e78, 0x13c1cd83}, 949d921e049SDaniel Borkmann {0xd82ba25c, 0x00000016, 0x0000063e, 0x98e4148a, 0x283330c9, 0x49ff5867}, 950d921e049SDaniel Borkmann {0x786f2032, 0x0000002d, 0x0000060f, 0xf201600a, 0xf561bfcd, 0x8467f211}, 951d921e049SDaniel Borkmann {0xfebe4e1f, 0x0000002a, 0x000004f2, 0x95e51961, 0xfd80dcab, 0x3f9683b2}, 952d921e049SDaniel Borkmann {0x1a6e0a39, 0x00000008, 0x00000672, 0x8af6c2a5, 0x78dd84cb, 0x76a3f874}, 953d921e049SDaniel Borkmann {0x56000ab8, 0x0000000e, 0x000000e5, 0x36bacb8f, 0x22ee1f77, 0x863b702f}, 954d921e049SDaniel Borkmann {0x4717fe0c, 0x00000000, 0x000006ec, 0x8439f342, 0x5c8e03da, 0xdc6c58ff}, 955d921e049SDaniel Borkmann {0xd5d5d68e, 0x0000003c, 0x000003a3, 0x46fff083, 0x177d1b39, 0x0622cc95}, 956d921e049SDaniel Borkmann {0xc25dd6c6, 0x00000024, 0x000006c0, 0x5ceb8eb4, 0x892b0d16, 0xe85605cd}, 957d921e049SDaniel Borkmann {0xe9b11300, 0x00000023, 0x00000683, 0x07a5d59a, 0x6c6a3208, 0x31da5f06}, 958d921e049SDaniel Borkmann {0x95cd285e, 0x00000001, 0x00000047, 0x7b3a4368, 0x0202c07e, 0xa1f2e784}, 959d921e049SDaniel Borkmann {0xd9245a25, 0x0000001e, 0x000003a6, 0xd33c1841, 0x1936c0d5, 0xb07cc616}, 960d921e049SDaniel Borkmann {0x103279db, 0x00000006, 0x0000039b, 0xca09b8a0, 0x77d62892, 0xbf943b6c}, 961d921e049SDaniel Borkmann {0x1cba3172, 0x00000027, 0x000001c8, 0xcb377194, 0xebe682db, 0x2c01af1c}, 962d921e049SDaniel Borkmann {0x8f613739, 0x0000000c, 0x000001df, 0xb4b0bc87, 0x7710bd43, 0x0fe5f56d}, 963d921e049SDaniel Borkmann {0x1c6aa90d, 0x0000001b, 0x0000053c, 0x70559245, 0xda7894ac, 0xf8943b2d}, 964d921e049SDaniel Borkmann {0xaabe5b93, 0x0000003d, 0x00000715, 0xcdbf42fa, 0x0c3b99e7, 0xe4d89272}, 965d921e049SDaniel Borkmann {0xf15dd038, 0x00000006, 0x000006db, 0x6e104aea, 0x8d5967f2, 0x7c2f6bbb}, 966d921e049SDaniel Borkmann {0x584dd49c, 0x00000020, 0x000007bc, 0x36b6cfd6, 0xad4e23b2, 0xabbf388b}, 967d921e049SDaniel Borkmann {0x5d8c9506, 0x00000020, 0x00000470, 0x4c62378e, 0x31d92640, 0x1dca1f4e}, 968d921e049SDaniel Borkmann {0xb80d17b0, 0x00000032, 0x00000346, 0x22a5bb88, 0x9a7ec89f, 0x5c170e23}, 969d921e049SDaniel Borkmann {0xdaf0592e, 0x00000023, 0x000007b0, 0x3cab3f99, 0x9b1fdd99, 0xc0e9d672}, 970d921e049SDaniel Borkmann {0x4793cc85, 0x0000000d, 0x00000706, 0xe82e04f6, 0xed3db6b7, 0xc18bdc86}, 971d921e049SDaniel Borkmann {0x82ebf64e, 0x00000009, 0x000007c3, 0x69d590a9, 0x9efa8499, 0xa874fcdd}, 972d921e049SDaniel Borkmann {0xb18a0319, 0x00000026, 0x000007db, 0x1cf98dcc, 0x8fa9ad6a, 0x9dc0bb48}, 9733863ef31SBob Pearson }; 9741da177e4SLinus Torvalds 9753863ef31SBob Pearson #include <linux/time.h> 9763863ef31SBob Pearson 977577eba9eSDarrick J. Wong static int __init crc32c_test(void) 978577eba9eSDarrick J. Wong { 979577eba9eSDarrick J. Wong int i; 980577eba9eSDarrick J. Wong int errors = 0; 981577eba9eSDarrick J. Wong int bytes = 0; 982577eba9eSDarrick J. Wong struct timespec start, stop; 983577eba9eSDarrick J. Wong u64 nsec; 984577eba9eSDarrick J. Wong unsigned long flags; 985577eba9eSDarrick J. Wong 986577eba9eSDarrick J. Wong /* keep static to prevent cache warming code from 987577eba9eSDarrick J. Wong * getting eliminated by the compiler */ 988577eba9eSDarrick J. Wong static u32 crc; 989577eba9eSDarrick J. Wong 990577eba9eSDarrick J. Wong /* pre-warm the cache */ 991577eba9eSDarrick J. Wong for (i = 0; i < 100; i++) { 992577eba9eSDarrick J. Wong bytes += 2*test[i].length; 993577eba9eSDarrick J. Wong 994577eba9eSDarrick J. Wong crc ^= __crc32c_le(test[i].crc, test_buf + 995577eba9eSDarrick J. Wong test[i].start, test[i].length); 996577eba9eSDarrick J. Wong } 997577eba9eSDarrick J. Wong 998577eba9eSDarrick J. Wong /* reduce OS noise */ 999577eba9eSDarrick J. Wong local_irq_save(flags); 1000577eba9eSDarrick J. Wong local_irq_disable(); 1001577eba9eSDarrick J. Wong 1002577eba9eSDarrick J. Wong getnstimeofday(&start); 1003577eba9eSDarrick J. Wong for (i = 0; i < 100; i++) { 1004577eba9eSDarrick J. Wong if (test[i].crc32c_le != __crc32c_le(test[i].crc, test_buf + 1005577eba9eSDarrick J. Wong test[i].start, test[i].length)) 1006577eba9eSDarrick J. Wong errors++; 1007577eba9eSDarrick J. Wong } 1008577eba9eSDarrick J. Wong getnstimeofday(&stop); 1009577eba9eSDarrick J. Wong 1010577eba9eSDarrick J. Wong local_irq_restore(flags); 1011577eba9eSDarrick J. Wong local_irq_enable(); 1012577eba9eSDarrick J. Wong 1013577eba9eSDarrick J. Wong nsec = stop.tv_nsec - start.tv_nsec + 1014577eba9eSDarrick J. Wong 1000000000 * (stop.tv_sec - start.tv_sec); 1015577eba9eSDarrick J. Wong 1016577eba9eSDarrick J. Wong pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS); 1017577eba9eSDarrick J. Wong 1018577eba9eSDarrick J. Wong if (errors) 1019577eba9eSDarrick J. Wong pr_warn("crc32c: %d self tests failed\n", errors); 1020577eba9eSDarrick J. Wong else { 1021577eba9eSDarrick J. Wong pr_info("crc32c: self tests passed, processed %d bytes in %lld nsec\n", 1022577eba9eSDarrick J. Wong bytes, nsec); 1023577eba9eSDarrick J. Wong } 1024577eba9eSDarrick J. Wong 1025577eba9eSDarrick J. Wong return 0; 1026577eba9eSDarrick J. Wong } 1027577eba9eSDarrick J. Wong 1028efba721fSDaniel Borkmann static int __init crc32c_combine_test(void) 1029efba721fSDaniel Borkmann { 1030efba721fSDaniel Borkmann int i, j; 1031efba721fSDaniel Borkmann int errors = 0, runs = 0; 1032efba721fSDaniel Borkmann 103316514839SDaniel Borkmann for (i = 0; i < 10; i++) { 1034efba721fSDaniel Borkmann u32 crc_full; 1035efba721fSDaniel Borkmann 1036efba721fSDaniel Borkmann crc_full = __crc32c_le(test[i].crc, test_buf + test[i].start, 1037efba721fSDaniel Borkmann test[i].length); 1038efba721fSDaniel Borkmann for (j = 0; j <= test[i].length; ++j) { 1039efba721fSDaniel Borkmann u32 crc1, crc2; 1040efba721fSDaniel Borkmann u32 len1 = j, len2 = test[i].length - j; 1041efba721fSDaniel Borkmann 1042efba721fSDaniel Borkmann crc1 = __crc32c_le(test[i].crc, test_buf + 1043efba721fSDaniel Borkmann test[i].start, len1); 1044efba721fSDaniel Borkmann crc2 = __crc32c_le(0, test_buf + test[i].start + 1045efba721fSDaniel Borkmann len1, len2); 1046efba721fSDaniel Borkmann 1047efba721fSDaniel Borkmann if (!(crc_full == __crc32c_le_combine(crc1, crc2, len2) && 1048efba721fSDaniel Borkmann crc_full == test[i].crc32c_le)) 1049efba721fSDaniel Borkmann errors++; 1050efba721fSDaniel Borkmann runs++; 1051cc0ac199SDaniel Borkmann cond_resched(); 1052efba721fSDaniel Borkmann } 1053efba721fSDaniel Borkmann } 1054efba721fSDaniel Borkmann 1055efba721fSDaniel Borkmann if (errors) 1056efba721fSDaniel Borkmann pr_warn("crc32c_combine: %d/%d self tests failed\n", errors, runs); 1057efba721fSDaniel Borkmann else 1058efba721fSDaniel Borkmann pr_info("crc32c_combine: %d self tests passed\n", runs); 1059efba721fSDaniel Borkmann 1060efba721fSDaniel Borkmann return 0; 1061efba721fSDaniel Borkmann } 1062efba721fSDaniel Borkmann 1063577eba9eSDarrick J. Wong static int __init crc32_test(void) 10641da177e4SLinus Torvalds { 10653863ef31SBob Pearson int i; 10663863ef31SBob Pearson int errors = 0; 10673863ef31SBob Pearson int bytes = 0; 10683863ef31SBob Pearson struct timespec start, stop; 10693863ef31SBob Pearson u64 nsec; 10703863ef31SBob Pearson unsigned long flags; 10713863ef31SBob Pearson 10723863ef31SBob Pearson /* keep static to prevent cache warming code from 10733863ef31SBob Pearson * getting eliminated by the compiler */ 10743863ef31SBob Pearson static u32 crc; 10753863ef31SBob Pearson 10763863ef31SBob Pearson /* pre-warm the cache */ 10773863ef31SBob Pearson for (i = 0; i < 100; i++) { 10783863ef31SBob Pearson bytes += 2*test[i].length; 10793863ef31SBob Pearson 10803863ef31SBob Pearson crc ^= crc32_le(test[i].crc, test_buf + 10813863ef31SBob Pearson test[i].start, test[i].length); 10823863ef31SBob Pearson 10833863ef31SBob Pearson crc ^= crc32_be(test[i].crc, test_buf + 10843863ef31SBob Pearson test[i].start, test[i].length); 10851da177e4SLinus Torvalds } 10861da177e4SLinus Torvalds 10873863ef31SBob Pearson /* reduce OS noise */ 10883863ef31SBob Pearson local_irq_save(flags); 10893863ef31SBob Pearson local_irq_disable(); 10901da177e4SLinus Torvalds 10913863ef31SBob Pearson getnstimeofday(&start); 10923863ef31SBob Pearson for (i = 0; i < 100; i++) { 10933863ef31SBob Pearson if (test[i].crc_le != crc32_le(test[i].crc, test_buf + 10943863ef31SBob Pearson test[i].start, test[i].length)) 10953863ef31SBob Pearson errors++; 10963863ef31SBob Pearson 10973863ef31SBob Pearson if (test[i].crc_be != crc32_be(test[i].crc, test_buf + 10983863ef31SBob Pearson test[i].start, test[i].length)) 10993863ef31SBob Pearson errors++; 11003863ef31SBob Pearson } 11013863ef31SBob Pearson getnstimeofday(&stop); 11023863ef31SBob Pearson 11033863ef31SBob Pearson local_irq_restore(flags); 11043863ef31SBob Pearson local_irq_enable(); 11053863ef31SBob Pearson 11063863ef31SBob Pearson nsec = stop.tv_nsec - start.tv_nsec + 11073863ef31SBob Pearson 1000000000 * (stop.tv_sec - start.tv_sec); 11083863ef31SBob Pearson 11093863ef31SBob Pearson pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n", 11103863ef31SBob Pearson CRC_LE_BITS, CRC_BE_BITS); 11113863ef31SBob Pearson 11123863ef31SBob Pearson if (errors) 11133863ef31SBob Pearson pr_warn("crc32: %d self tests failed\n", errors); 11143863ef31SBob Pearson else { 11153863ef31SBob Pearson pr_info("crc32: self tests passed, processed %d bytes in %lld nsec\n", 11163863ef31SBob Pearson bytes, nsec); 11171da177e4SLinus Torvalds } 11181da177e4SLinus Torvalds 11191da177e4SLinus Torvalds return 0; 11201da177e4SLinus Torvalds } 11211da177e4SLinus Torvalds 1122efba721fSDaniel Borkmann static int __init crc32_combine_test(void) 1123efba721fSDaniel Borkmann { 1124efba721fSDaniel Borkmann int i, j; 1125efba721fSDaniel Borkmann int errors = 0, runs = 0; 1126efba721fSDaniel Borkmann 112716514839SDaniel Borkmann for (i = 0; i < 10; i++) { 1128efba721fSDaniel Borkmann u32 crc_full; 1129efba721fSDaniel Borkmann 1130efba721fSDaniel Borkmann crc_full = crc32_le(test[i].crc, test_buf + test[i].start, 1131efba721fSDaniel Borkmann test[i].length); 1132efba721fSDaniel Borkmann for (j = 0; j <= test[i].length; ++j) { 1133efba721fSDaniel Borkmann u32 crc1, crc2; 1134efba721fSDaniel Borkmann u32 len1 = j, len2 = test[i].length - j; 1135efba721fSDaniel Borkmann 1136efba721fSDaniel Borkmann crc1 = crc32_le(test[i].crc, test_buf + 1137efba721fSDaniel Borkmann test[i].start, len1); 1138efba721fSDaniel Borkmann crc2 = crc32_le(0, test_buf + test[i].start + 1139efba721fSDaniel Borkmann len1, len2); 1140efba721fSDaniel Borkmann 1141efba721fSDaniel Borkmann if (!(crc_full == crc32_le_combine(crc1, crc2, len2) && 1142efba721fSDaniel Borkmann crc_full == test[i].crc_le)) 1143efba721fSDaniel Borkmann errors++; 1144efba721fSDaniel Borkmann runs++; 1145cc0ac199SDaniel Borkmann cond_resched(); 1146efba721fSDaniel Borkmann } 1147efba721fSDaniel Borkmann } 1148efba721fSDaniel Borkmann 1149efba721fSDaniel Borkmann if (errors) 1150efba721fSDaniel Borkmann pr_warn("crc32_combine: %d/%d self tests failed\n", errors, runs); 1151efba721fSDaniel Borkmann else 1152efba721fSDaniel Borkmann pr_info("crc32_combine: %d self tests passed\n", runs); 1153efba721fSDaniel Borkmann 1154efba721fSDaniel Borkmann return 0; 1155efba721fSDaniel Borkmann } 1156efba721fSDaniel Borkmann 1157577eba9eSDarrick J. Wong static int __init crc32test_init(void) 1158577eba9eSDarrick J. Wong { 1159577eba9eSDarrick J. Wong crc32_test(); 1160577eba9eSDarrick J. Wong crc32c_test(); 1161efba721fSDaniel Borkmann 1162efba721fSDaniel Borkmann crc32_combine_test(); 1163efba721fSDaniel Borkmann crc32c_combine_test(); 1164efba721fSDaniel Borkmann 1165577eba9eSDarrick J. Wong return 0; 1166577eba9eSDarrick J. Wong } 1167577eba9eSDarrick J. Wong 11683863ef31SBob Pearson static void __exit crc32_exit(void) 11693863ef31SBob Pearson { 11703863ef31SBob Pearson } 11713863ef31SBob Pearson 1172577eba9eSDarrick J. Wong module_init(crc32test_init); 11733863ef31SBob Pearson module_exit(crc32_exit); 11743863ef31SBob Pearson #endif /* CONFIG_CRC32_SELFTEST */ 1175