summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorHarsh Jain <harsh@chelsio.com>2017-10-08 13:37:20 +0530
committerHerbert Xu <herbert@gondor.apana.org.au>2017-11-03 21:50:43 +0800
commitacfc587810bea08fdd62c9d5ed7cefe8be874a4f (patch)
tree88558523d44cdb6b56f37e0e19633a8fc5960466 /crypto
parent40cdbe1a1bd989b608f86dbdc5e83c6ba777961b (diff)
crypto: gf128mul - The x8_ble multiplication functions
It multiply GF(2^128) elements in the ble format. It will be used by chelsio driver to speed up gf multiplication. Signed-off-by: Harsh Jain <harsh@chelsio.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/gf128mul.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c
index dc012129c063..24e601954c7a 100644
--- a/crypto/gf128mul.c
+++ b/crypto/gf128mul.c
@@ -156,6 +156,19 @@ static void gf128mul_x8_bbe(be128 *x)
x->b = cpu_to_be64((b << 8) ^ _tt);
}
+void gf128mul_x8_ble(le128 *r, const le128 *x)
+{
+ u64 a = le64_to_cpu(x->a);
+ u64 b = le64_to_cpu(x->b);
+
+ /* equivalent to gf128mul_table_be[b >> 63] (see crypto/gf128mul.c): */
+ u64 _tt = gf128mul_table_be[a >> 56];
+
+ r->a = cpu_to_le64((a << 8) | (b >> 56));
+ r->b = cpu_to_le64((b << 8) ^ _tt);
+}
+EXPORT_SYMBOL(gf128mul_x8_ble);
+
void gf128mul_lle(be128 *r, const be128 *b)
{
be128 p[8];