Thread (4 messages) 4 messages, 1 author, 2018-10-09

Re: [PATCH 1/2] crypto: streebog - add Streebog hash function

From: Vitaly Chikunov <hidden>
Date: 2018-10-09 06:57:24
Also in: lkml

On Sun, Oct 07, 2018 at 12:41:10PM +0300, Vitaly Chikunov wrote:
quoted hunk ↗ jump to hunk
Add GOST/IETF Streebog hash function (GOST R 34.11-2012, RFC 6986)
generic hash transformation.

Signed-off-by: Vitaly Chikunov <redacted>
---
 crypto/Kconfig            |   12 +
 crypto/Makefile           |    1 +
 crypto/streebog_generic.c | 1142 +++++++++++++++++++++++++++++++++++++++++++++
 include/crypto/streebog.h |   34 ++
 4 files changed, 1189 insertions(+)
 create mode 100644 crypto/streebog_generic.c
 create mode 100644 include/crypto/streebog.h
diff --git a/crypto/streebog_generic.c b/crypto/streebog_generic.c
--- /dev/null
+++ b/crypto/streebog_generic.c
@@ -0,0 +1,1142 @@
quoted
...
+static inline void add512(const struct streebog_uint512 *x,
+			  const struct streebog_uint512 *y,
+			  struct streebog_uint512 *r)
+{
+	u64 carry = 0;
+	int i;
+
+	for (i = 0; i < 8; i++) {
+		const u64 left = le64_to_cpu(x->qword[i]);
+		u64 sum;
+
+		sum = left + le64_to_cpu(y->qword[i]) + carry;
+		if (sum != left)
+			carry = (sum < left);
+		r->qword[i] = sum;
Last assignment should be: r->qword[i] = cpu_to_le64(sum).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help