lkml.org 
[lkml]   [2018]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] crypto: streebog - add Streebog hash function
On Sun, Oct 07, 2018 at 12:41:10PM +0300, Vitaly Chikunov wrote:
> Add GOST/IETF Streebog hash function (GOST R 34.11-2012, RFC 6986)
> generic hash transformation.
>
> Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
> ---
> 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 @@
>> ...
> +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).

\
 
 \ /
  Last update: 2018-10-09 08:57    [W:0.315 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site