Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:d
1 // SPDX-License-Identifier: GPL-2.0
12 * Copyright (c) Andrew Tridgell 1997-1998.
32 x &= 0xFFFFFFFF; in lshift()
33 return ((x << s) & 0xFFFFFFFF) | (x >> (32 - s)); in lshift()
51 #define ROUND1(a,b,c,d,k,s) (a = lshift(a + F(b,c,d) + k, s)) argument
52 #define ROUND2(a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (u32)0x5A827999,s)) argument
53 #define ROUND3(a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (u32)0x6ED9EBA1,s)) argument
57 u32 a, b, c, d; in md4_transform() local
59 a = hash[0]; in md4_transform()
62 d = hash[3]; in md4_transform()
64 ROUND1(a, b, c, d, in[0], 3); in md4_transform()
65 ROUND1(d, a, b, c, in[1], 7); in md4_transform()
66 ROUND1(c, d, a, b, in[2], 11); in md4_transform()
67 ROUND1(b, c, d, a, in[3], 19); in md4_transform()
68 ROUND1(a, b, c, d, in[4], 3); in md4_transform()
69 ROUND1(d, a, b, c, in[5], 7); in md4_transform()
70 ROUND1(c, d, a, b, in[6], 11); in md4_transform()
71 ROUND1(b, c, d, a, in[7], 19); in md4_transform()
72 ROUND1(a, b, c, d, in[8], 3); in md4_transform()
73 ROUND1(d, a, b, c, in[9], 7); in md4_transform()
74 ROUND1(c, d, a, b, in[10], 11); in md4_transform()
75 ROUND1(b, c, d, a, in[11], 19); in md4_transform()
76 ROUND1(a, b, c, d, in[12], 3); in md4_transform()
77 ROUND1(d, a, b, c, in[13], 7); in md4_transform()
78 ROUND1(c, d, a, b, in[14], 11); in md4_transform()
79 ROUND1(b, c, d, a, in[15], 19); in md4_transform()
81 ROUND2(a, b, c, d, in[0], 3); in md4_transform()
82 ROUND2(d, a, b, c, in[4], 5); in md4_transform()
83 ROUND2(c, d, a, b, in[8], 9); in md4_transform()
84 ROUND2(b, c, d, a, in[12], 13); in md4_transform()
85 ROUND2(a, b, c, d, in[1], 3); in md4_transform()
86 ROUND2(d, a, b, c, in[5], 5); in md4_transform()
87 ROUND2(c, d, a, b, in[9], 9); in md4_transform()
88 ROUND2(b, c, d, a, in[13], 13); in md4_transform()
89 ROUND2(a, b, c, d, in[2], 3); in md4_transform()
90 ROUND2(d, a, b, c, in[6], 5); in md4_transform()
91 ROUND2(c, d, a, b, in[10], 9); in md4_transform()
92 ROUND2(b, c, d, a, in[14], 13); in md4_transform()
93 ROUND2(a, b, c, d, in[3], 3); in md4_transform()
94 ROUND2(d, a, b, c, in[7], 5); in md4_transform()
95 ROUND2(c, d, a, b, in[11], 9); in md4_transform()
96 ROUND2(b, c, d, a, in[15], 13); in md4_transform()
98 ROUND3(a, b, c, d, in[0], 3); in md4_transform()
99 ROUND3(d, a, b, c, in[8], 9); in md4_transform()
100 ROUND3(c, d, a, b, in[4], 11); in md4_transform()
101 ROUND3(b, c, d, a, in[12], 15); in md4_transform()
102 ROUND3(a, b, c, d, in[2], 3); in md4_transform()
103 ROUND3(d, a, b, c, in[10], 9); in md4_transform()
104 ROUND3(c, d, a, b, in[6], 11); in md4_transform()
105 ROUND3(b, c, d, a, in[14], 15); in md4_transform()
106 ROUND3(a, b, c, d, in[1], 3); in md4_transform()
107 ROUND3(d, a, b, c, in[9], 9); in md4_transform()
108 ROUND3(c, d, a, b, in[5], 11); in md4_transform()
109 ROUND3(b, c, d, a, in[13], 15); in md4_transform()
110 ROUND3(a, b, c, d, in[3], 3); in md4_transform()
111 ROUND3(d, a, b, c, in[11], 9); in md4_transform()
112 ROUND3(c, d, a, b, in[7], 11); in md4_transform()
113 ROUND3(b, c, d, a, in[15], 15); in md4_transform()
115 hash[0] += a; in md4_transform()
118 hash[3] += d; in md4_transform()
123 le32_to_cpu_array(ctx->block, ARRAY_SIZE(ctx->block)); in md4_transform_helper()
124 md4_transform(ctx->hash, ctx->block); in md4_transform_helper()
129 memset(mctx, 0, sizeof(struct md4_ctx)); in cifs_md4_init()
130 mctx->hash[0] = 0x67452301; in cifs_md4_init()
131 mctx->hash[1] = 0xefcdab89; in cifs_md4_init()
132 mctx->hash[2] = 0x98badcfe; in cifs_md4_init()
133 mctx->hash[3] = 0x10325476; in cifs_md4_init()
134 mctx->byte_count = 0; in cifs_md4_init()
136 return 0; in cifs_md4_init()
142 const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f); in cifs_md4_update()
144 mctx->byte_count += len; in cifs_md4_update()
147 memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), in cifs_md4_update()
149 return 0; in cifs_md4_update()
152 memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), in cifs_md4_update()
157 len -= avail; in cifs_md4_update()
159 while (len >= sizeof(mctx->block)) { in cifs_md4_update()
160 memcpy(mctx->block, data, sizeof(mctx->block)); in cifs_md4_update()
162 data += sizeof(mctx->block); in cifs_md4_update()
163 len -= sizeof(mctx->block); in cifs_md4_update()
166 memcpy(mctx->block, data, len); in cifs_md4_update()
168 return 0; in cifs_md4_update()
174 const unsigned int offset = mctx->byte_count & 0x3f; in cifs_md4_final()
175 char *p = (char *)mctx->block + offset; in cifs_md4_final()
176 int padding = 56 - (offset + 1); in cifs_md4_final()
178 *p++ = 0x80; in cifs_md4_final()
179 if (padding < 0) { in cifs_md4_final()
180 memset(p, 0x00, padding + sizeof(u64)); in cifs_md4_final()
182 p = (char *)mctx->block; in cifs_md4_final()
186 memset(p, 0, padding); in cifs_md4_final()
187 mctx->block[14] = mctx->byte_count << 3; in cifs_md4_final()
188 mctx->block[15] = mctx->byte_count >> 29; in cifs_md4_final()
189 le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - in cifs_md4_final()
191 md4_transform(mctx->hash, mctx->block); in cifs_md4_final()
192 cpu_to_le32_array(mctx->hash, ARRAY_SIZE(mctx->hash)); in cifs_md4_final()
193 memcpy(out, mctx->hash, sizeof(mctx->hash)); in cifs_md4_final()
194 memset(mctx, 0, sizeof(*mctx)); in cifs_md4_final()
196 return 0; in cifs_md4_final()