Go to the documentation of this file.
8 #include <linux/kernel.h>
9 #include <linux/export.h>
10 #include <linux/bitops.h>
12 #include <asm/unaligned.h>
37 #define setW(x, val) (*(volatile __u32 *)&W(x) = (val))
38 #elif defined(CONFIG_ARM)
39 #define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0)
41 #define setW(x, val) (W(x) = (val))
45 #define W(x) (array[(x)&15])
51 #define SHA_SRC(t) get_unaligned_be32((__u32 *)data + t)
52 #define SHA_MIX(t) rol32(W(t+13) ^ W(t+8) ^ W(t+2) ^ W(t), 1)
54 #define SHA_ROUND(t, input, fn, constant, A, B, C, D, E) do { \
55 __u32 TEMP = input(t); setW(t, TEMP); \
56 E += TEMP + rol32(A,5) + (fn) + (constant); \
57 B = ror32(B, 2); } while (0)
59 #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 )
60 #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 )
61 #define T_20_39(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0x6ed9eba1, A, B, C, D, E )
62 #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 )
63 #define T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0xca62c1d6, A, B, C, D, E )
100 T_0_15( 8, C, D, E, A, B);
101 T_0_15( 9, B, C, D, E, A);
102 T_0_15(10, A, B, C, D, E);
103 T_0_15(11, E, A, B, C, D);
104 T_0_15(12, D, E, A, B, C);
105 T_0_15(13, C, D, E, A, B);
106 T_0_15(14, B, C, D, E, A);
107 T_0_15(15, A, B, C, D, E);