mirror of https://gitee.com/openkylin/linux.git
crypto: sha512_generic - add a sha512 0-length pre-computed hash
This patch adds the sha512 pre-computed 0-length hash so that device drivers can use it when an hardware engine does not support computing a hash from a 0 length input. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
25bc955103
commit
30c217ef64
|
@ -23,6 +23,18 @@
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
|
const u8 sha512_zero_message_hash[SHA512_DIGEST_SIZE] = {
|
||||||
|
0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd,
|
||||||
|
0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07,
|
||||||
|
0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc,
|
||||||
|
0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce,
|
||||||
|
0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0,
|
||||||
|
0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f,
|
||||||
|
0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81,
|
||||||
|
0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e
|
||||||
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(sha512_zero_message_hash);
|
||||||
|
|
||||||
static inline u64 Ch(u64 x, u64 y, u64 z)
|
static inline u64 Ch(u64 x, u64 y, u64 z)
|
||||||
{
|
{
|
||||||
return z ^ (x & (y ^ z));
|
return z ^ (x & (y ^ z));
|
||||||
|
|
|
@ -71,6 +71,8 @@ extern const u8 sha224_zero_message_hash[SHA224_DIGEST_SIZE];
|
||||||
|
|
||||||
extern const u8 sha256_zero_message_hash[SHA256_DIGEST_SIZE];
|
extern const u8 sha256_zero_message_hash[SHA256_DIGEST_SIZE];
|
||||||
|
|
||||||
|
extern const u8 sha512_zero_message_hash[SHA512_DIGEST_SIZE];
|
||||||
|
|
||||||
struct sha1_state {
|
struct sha1_state {
|
||||||
u32 state[SHA1_DIGEST_SIZE / 4];
|
u32 state[SHA1_DIGEST_SIZE / 4];
|
||||||
u64 count;
|
u64 count;
|
||||||
|
|
Loading…
Reference in New Issue