Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Common values for SHA-1 algorithms
0004  */
0005 
0006 #ifndef _CRYPTO_SHA1_H
0007 #define _CRYPTO_SHA1_H
0008 
0009 #include <linux/types.h>
0010 
0011 #define SHA1_DIGEST_SIZE        20
0012 #define SHA1_BLOCK_SIZE         64
0013 
0014 #define SHA1_H0     0x67452301UL
0015 #define SHA1_H1     0xefcdab89UL
0016 #define SHA1_H2     0x98badcfeUL
0017 #define SHA1_H3     0x10325476UL
0018 #define SHA1_H4     0xc3d2e1f0UL
0019 
0020 extern const u8 sha1_zero_message_hash[SHA1_DIGEST_SIZE];
0021 
0022 struct sha1_state {
0023     u32 state[SHA1_DIGEST_SIZE / 4];
0024     u64 count;
0025     u8 buffer[SHA1_BLOCK_SIZE];
0026 };
0027 
0028 struct shash_desc;
0029 
0030 extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
0031                   unsigned int len);
0032 
0033 extern int crypto_sha1_finup(struct shash_desc *desc, const u8 *data,
0034                  unsigned int len, u8 *hash);
0035 
0036 /*
0037  * An implementation of SHA-1's compression function.  Don't use in new code!
0038  * You shouldn't be using SHA-1, and even if you *have* to use SHA-1, this isn't
0039  * the correct way to hash something with SHA-1 (use crypto_shash instead).
0040  */
0041 #define SHA1_DIGEST_WORDS   (SHA1_DIGEST_SIZE / 4)
0042 #define SHA1_WORKSPACE_WORDS    16
0043 void sha1_init(__u32 *buf);
0044 void sha1_transform(__u32 *digest, const char *data, __u32 *W);
0045 
0046 #endif /* _CRYPTO_SHA1_H */