forked from Minki/linux
crypto: streebog - add Streebog hash function
Add GOST/IETF Streebog hash function (GOST R 34.11-2012, RFC 6986) generic hash transformation. Cc: linux-integrity@vger.kernel.org Signed-off-by: Vitaly Chikunov <vt@altlinux.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d65ddecbea
commit
fe18957e8e
@ -939,6 +939,18 @@ config CRYPTO_SM3
|
||||
http://www.oscca.gov.cn/UpFile/20101222141857786.pdf
|
||||
https://datatracker.ietf.org/doc/html/draft-shen-sm3-hash
|
||||
|
||||
config CRYPTO_STREEBOG
|
||||
tristate "Streebog Hash Function"
|
||||
select CRYPTO_HASH
|
||||
help
|
||||
Streebog Hash Function (GOST R 34.11-2012, RFC 6986) is one of the Russian
|
||||
cryptographic standard algorithms (called GOST algorithms).
|
||||
This setting enables two hash algorithms with 256 and 512 bits output.
|
||||
|
||||
References:
|
||||
https://tc26.ru/upload/iblock/fed/feddbb4d26b685903faa2ba11aea43f6.pdf
|
||||
https://tools.ietf.org/html/rfc6986
|
||||
|
||||
config CRYPTO_TGR192
|
||||
tristate "Tiger digest algorithms"
|
||||
select CRYPTO_HASH
|
||||
|
@ -71,6 +71,7 @@ obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
|
||||
obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
|
||||
obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o
|
||||
obj-$(CONFIG_CRYPTO_SM3) += sm3_generic.o
|
||||
obj-$(CONFIG_CRYPTO_STREEBOG) += streebog_generic.o
|
||||
obj-$(CONFIG_CRYPTO_WP512) += wp512.o
|
||||
CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
|
||||
obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
|
||||
|
1140
crypto/streebog_generic.c
Normal file
1140
crypto/streebog_generic.c
Normal file
File diff suppressed because it is too large
Load Diff
34
include/crypto/streebog.h
Normal file
34
include/crypto/streebog.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */
|
||||
/*
|
||||
* Copyright (c) 2013 Alexey Degtyarev <alexey@renatasystems.org>
|
||||
* Copyright (c) 2018 Vitaly Chikunov <vt@altlinux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*/
|
||||
|
||||
#ifndef _CRYPTO_STREEBOG_H_
|
||||
#define _CRYPTO_STREEBOG_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define STREEBOG256_DIGEST_SIZE 32
|
||||
#define STREEBOG512_DIGEST_SIZE 64
|
||||
#define STREEBOG_BLOCK_SIZE 64
|
||||
|
||||
struct streebog_uint512 {
|
||||
u64 qword[8];
|
||||
};
|
||||
|
||||
struct streebog_state {
|
||||
u8 buffer[STREEBOG_BLOCK_SIZE];
|
||||
struct streebog_uint512 hash;
|
||||
struct streebog_uint512 h;
|
||||
struct streebog_uint512 N;
|
||||
struct streebog_uint512 Sigma;
|
||||
size_t fillsize;
|
||||
};
|
||||
|
||||
#endif /* !_CRYPTO_STREEBOG_H_ */
|
Loading…
Reference in New Issue
Block a user