Linux Kernel
3.7.1
|
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/bitops.h>
#include <linux/cryptohash.h>
#include <asm/unaligned.h>
Go to the source code of this file.
Macros | |
#define | setW(x, val) (W(x) = (val)) |
#define | W(x) (array[(x)&15]) |
#define | SHA_SRC(t) get_unaligned_be32((__u32 *)data + t) |
#define | SHA_MIX(t) rol32(W(t+13) ^ W(t+8) ^ W(t+2) ^ W(t), 1) |
#define | SHA_ROUND(t, input, fn, constant, A, B, C, D, E) |
#define | T_0_15(t, A, B, C, D, E) SHA_ROUND(t, SHA_SRC, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E ) |
#define | T_16_19(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E ) |
#define | T_20_39(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0x6ed9eba1, A, B, C, D, E ) |
#define | T_40_59(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc, A, B, C, D, E ) |
#define | T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0xca62c1d6, A, B, C, D, E ) |
Functions | |
void | sha_transform (__u32 *digest, const char *data, __u32 *array) |
EXPORT_SYMBOL (sha_transform) | |
void | sha_init (__u32 *buf) |
EXPORT_SYMBOL | ( | sha_transform | ) |
sha_transform - single block SHA1 transform
: 160 bit digest to update : 512 bits of data to hash : 16 words of workspace (see note)
This function generates a SHA1 digest for a single 512-bit block. Be warned, it does not handle padding and message digest, do not confuse it with the full FIPS 180-1 digest algorithm for variable length messages.
Note: If the hash is security sensitive, the caller should be sure to clear the workspace. This is left to the caller to avoid unnecessary clears between chained hashing operations.