crypto: hash - add zero length message hash for shax and md5

Some crypto drivers cannot process empty data message and return a
precalculated hash for md5/sha1/sha224/sha256.

This patch add thoses precalculated hash in include/crypto.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
LABBE Corentin 2015-12-17 13:45:39 +01:00 committed by Herbert Xu
parent 51d77dddff
commit 0c4c78de04
5 changed files with 37 additions and 0 deletions

View file

@ -13,6 +13,8 @@
#define MD5_H2 0x98badcfeUL
#define MD5_H3 0x10325476UL
extern const u8 md5_zero_message_hash[MD5_DIGEST_SIZE];
struct md5_state {
u32 hash[MD5_HASH_WORDS];
u32 block[MD5_BLOCK_WORDS];

View file

@ -64,6 +64,12 @@
#define SHA512_H6 0x1f83d9abfb41bd6bULL
#define SHA512_H7 0x5be0cd19137e2179ULL
extern const u8 sha1_zero_message_hash[SHA1_DIGEST_SIZE];
extern const u8 sha224_zero_message_hash[SHA224_DIGEST_SIZE];
extern const u8 sha256_zero_message_hash[SHA256_DIGEST_SIZE];
struct sha1_state {
u32 state[SHA1_DIGEST_SIZE / 4];
u64 count;