summaryrefslogtreecommitdiffstats
path: root/include/crypto/gf128mul.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-02-14 16:43:27 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2017-03-09 05:34:14 -0500
commit63be5b53b6d15f7706ad21e9801dae5b723e8340 (patch)
tree15c06f53c7629d91010e4f3f66830d44f565d220 /include/crypto/gf128mul.h
parent28b62b1458685d8f68f67d9b2d511bf8fa32b746 (diff)
crypto: gf128mul - fix some comments
Fix incorrect references to GF(128) instead of GF(2^128), as these are two entirely different fields, and fix a few other incorrect comments. Cc: Alex Cope <alexcope@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/gf128mul.h')
-rw-r--r--include/crypto/gf128mul.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h
index 592d47e565a8..9662c4538873 100644
--- a/include/crypto/gf128mul.h
+++ b/include/crypto/gf128mul.h
@@ -43,7 +43,7 @@
43 --------------------------------------------------------------------------- 43 ---------------------------------------------------------------------------
44 Issue Date: 31/01/2006 44 Issue Date: 31/01/2006
45 45
46 An implementation of field multiplication in Galois Field GF(128) 46 An implementation of field multiplication in Galois Field GF(2^128)
47*/ 47*/
48 48
49#ifndef _CRYPTO_GF128MUL_H 49#ifndef _CRYPTO_GF128MUL_H
@@ -65,7 +65,7 @@
65 * are left and the lsb's are right. char b[16] is an array and b[0] is 65 * are left and the lsb's are right. char b[16] is an array and b[0] is
66 * the first octet. 66 * the first octet.
67 * 67 *
68 * 80000000 00000000 00000000 00000000 .... 00000000 00000000 00000000 68 * 10000000 00000000 00000000 00000000 .... 00000000 00000000 00000000
69 * b[0] b[1] b[2] b[3] b[13] b[14] b[15] 69 * b[0] b[1] b[2] b[3] b[13] b[14] b[15]
70 * 70 *
71 * Every bit is a coefficient of some power of X. We can store the bits 71 * Every bit is a coefficient of some power of X. We can store the bits
@@ -85,15 +85,17 @@
85 * Both of the above formats are easy to implement on big-endian 85 * Both of the above formats are easy to implement on big-endian
86 * machines. 86 * machines.
87 * 87 *
88 * EME (which is patent encumbered) uses the ble format (bits are stored 88 * XTS and EME (the latter of which is patent encumbered) use the ble
89 * in big endian order and the bytes in little endian). The above buffer 89 * format (bits are stored in big endian order and the bytes in little
90 * represents X^7 in this case and the primitive polynomial is b[0] = 0x87. 90 * endian). The above buffer represents X^7 in this case and the
91 * primitive polynomial is b[0] = 0x87.
91 * 92 *
92 * The common machine word-size is smaller than 128 bits, so to make 93 * The common machine word-size is smaller than 128 bits, so to make
93 * an efficient implementation we must split into machine word sizes. 94 * an efficient implementation we must split into machine word sizes.
94 * This file uses one 32bit for the moment. Machine endianness comes into 95 * This implementation uses 64-bit words for the moment. Machine
95 * play. The lle format in relation to machine endianness is discussed 96 * endianness comes into play. The lle format in relation to machine
96 * below by the original author of gf128mul Dr Brian Gladman. 97 * endianness is discussed below by the original author of gf128mul Dr
98 * Brian Gladman.
97 * 99 *
98 * Let's look at the bbe and ble format on a little endian machine. 100 * Let's look at the bbe and ble format on a little endian machine.
99 * 101 *
@@ -127,10 +129,10 @@
127 * machines this will automatically aligned to wordsize and on a 64-bit 129 * machines this will automatically aligned to wordsize and on a 64-bit
128 * machine also. 130 * machine also.
129 */ 131 */
130/* Multiply a GF128 field element by x. Field elements are held in arrays 132/* Multiply a GF(2^128) field element by x. Field elements are
131 of bytes in which field bits 8n..8n + 7 are held in byte[n], with lower 133 held in arrays of bytes in which field bits 8n..8n + 7 are held in
132 indexed bits placed in the more numerically significant bit positions 134 byte[n], with lower indexed bits placed in the more numerically
133 within bytes. 135 significant bit positions within bytes.
134 136
135 On little endian machines the bit indexes translate into the bit 137 On little endian machines the bit indexes translate into the bit
136 positions within four 32-bit words in the following way 138 positions within four 32-bit words in the following way