1 /* 1 2 * Cryptographic API. 3 * 4 * T10 Data Integrity Field CRC16 Crypto Trans 5 * 6 * Copyright (c) 2007 Oracle Corporation. All 7 * Written by Martin K. Petersen <martin.peter 8 * Copyright (C) 2013 Intel Corporation 9 * Author: Tim Chen <tim.c.chen@linux.intel.co 10 * 11 * This program is free software; you can redi 12 * under the terms of the GNU General Public L 13 * Software Foundation; either version 2 of th 14 * any later version. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMIT 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR P 19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTH 20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER L 21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARIS 22 * CONNECTION WITH THE SOFTWARE OR THE USE OR 23 * SOFTWARE. 24 * 25 */ 26 27 #include <linux/crc-t10dif.h> 28 #include <linux/module.h> 29 #include <linux/kernel.h> 30 31 /* Table generated using the following polynom 32 * x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 33 * gt: 0x8bb7 34 */ 35 static const __u16 t10_dif_crc_table[256] = { 36 0x0000, 0x8BB7, 0x9CD9, 0x176E, 0xB205 37 0xEFBD, 0x640A, 0x7364, 0xF8D3, 0x5DB8 38 0x54CD, 0xDF7A, 0xC814, 0x43A3, 0xE6C8 39 0xBB70, 0x30C7, 0x27A9, 0xAC1E, 0x0975 40 0xA99A, 0x222D, 0x3543, 0xBEF4, 0x1B9F 41 0x4627, 0xCD90, 0xDAFE, 0x5149, 0xF422 42 0xFD57, 0x76E0, 0x618E, 0xEA39, 0x4F52 43 0x12EA, 0x995D, 0x8E33, 0x0584, 0xA0EF 44 0xD883, 0x5334, 0x445A, 0xCFED, 0x6A86 45 0x373E, 0xBC89, 0xABE7, 0x2050, 0x853B 46 0x8C4E, 0x07F9, 0x1097, 0x9B20, 0x3E4B 47 0x63F3, 0xE844, 0xFF2A, 0x749D, 0xD1F6 48 0x7119, 0xFAAE, 0xEDC0, 0x6677, 0xC31C 49 0x9EA4, 0x1513, 0x027D, 0x89CA, 0x2CA1 50 0x25D4, 0xAE63, 0xB90D, 0x32BA, 0x97D1 51 0xCA69, 0x41DE, 0x56B0, 0xDD07, 0x786C 52 0x3AB1, 0xB106, 0xA668, 0x2DDF, 0x88B4 53 0xD50C, 0x5EBB, 0x49D5, 0xC262, 0x6709 54 0x6E7C, 0xE5CB, 0xF2A5, 0x7912, 0xDC79 55 0x81C1, 0x0A76, 0x1D18, 0x96AF, 0x33C4 56 0x932B, 0x189C, 0x0FF2, 0x8445, 0x212E 57 0x7C96, 0xF721, 0xE04F, 0x6BF8, 0xCE93 58 0xC7E6, 0x4C51, 0x5B3F, 0xD088, 0x75E3 59 0x285B, 0xA3EC, 0xB482, 0x3F35, 0x9A5E 60 0xE232, 0x6985, 0x7EEB, 0xF55C, 0x5037 61 0x0D8F, 0x8638, 0x9156, 0x1AE1, 0xBF8A 62 0xB6FF, 0x3D48, 0x2A26, 0xA191, 0x04FA 63 0x5942, 0xD2F5, 0xC59B, 0x4E2C, 0xEB47 64 0x4BA8, 0xC01F, 0xD771, 0x5CC6, 0xF9AD 65 0xA415, 0x2FA2, 0x38CC, 0xB37B, 0x1610 66 0x1F65, 0x94D2, 0x83BC, 0x080B, 0xAD60 67 0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD 68 }; 69 70 __u16 crc_t10dif_generic(__u16 crc, const unsi 71 { 72 unsigned int i; 73 74 for (i = 0 ; i < len ; i++) 75 crc = (crc << 8) ^ t10_dif_crc 76 77 return crc; 78 } 79 EXPORT_SYMBOL(crc_t10dif_generic); 80 81 MODULE_DESCRIPTION("T10 DIF CRC calculation co 82 MODULE_LICENSE("GPL"); 83
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.