Lines Matching refs:state
34 static void sipround(struct siphash *state) { in sipround() argument
35 assert(state); in sipround()
37 state->v0 += state->v1; in sipround()
38 state->v1 = rotate_left(state->v1, 13); in sipround()
39 state->v1 ^= state->v0; in sipround()
40 state->v0 = rotate_left(state->v0, 32); in sipround()
41 state->v2 += state->v3; in sipround()
42 state->v3 = rotate_left(state->v3, 16); in sipround()
43 state->v3 ^= state->v2; in sipround()
44 state->v0 += state->v3; in sipround()
45 state->v3 = rotate_left(state->v3, 21); in sipround()
46 state->v3 ^= state->v0; in sipround()
47 state->v2 += state->v1; in sipround()
48 state->v1 = rotate_left(state->v1, 17); in sipround()
49 state->v1 ^= state->v2; in sipround()
50 state->v2 = rotate_left(state->v2, 32); in sipround()
53 void siphash24_init(struct siphash *state, const uint8_t k[static 16]) { in siphash24_init() argument
56 assert(state); in siphash24_init()
62 *state = (struct siphash) { in siphash24_init()
73 void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) { in siphash24_compress() argument
77 size_t left = state->inlen & 7; in siphash24_compress()
81 assert(state); in siphash24_compress()
84 state->inlen += inlen; in siphash24_compress()
89 state->padding |= ((uint64_t) *in) << (left * 8); in siphash24_compress()
96 … printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); in siphash24_compress()
97 … printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); in siphash24_compress()
98 … printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); in siphash24_compress()
99 … printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); in siphash24_compress()
100 …intf("(%3zu) compress padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint… in siphash24_compress()
103 state->v3 ^= state->padding; in siphash24_compress()
104 sipround(state); in siphash24_compress()
105 sipround(state); in siphash24_compress()
106 state->v0 ^= state->padding; in siphash24_compress()
108 state->padding = 0; in siphash24_compress()
111 end -= (state->inlen % sizeof(uint64_t)); in siphash24_compress()
116 … printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); in siphash24_compress()
117 … printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); in siphash24_compress()
118 … printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); in siphash24_compress()
119 … printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); in siphash24_compress()
120 … printf("(%3zu) compress %08x %08x\n", state->inlen, (uint32_t) (m >> 32), (uint32_t) m); in siphash24_compress()
122 state->v3 ^= m; in siphash24_compress()
123 sipround(state); in siphash24_compress()
124 sipround(state); in siphash24_compress()
125 state->v0 ^= m; in siphash24_compress()
128 left = state->inlen & 7; in siphash24_compress()
131 state->padding |= ((uint64_t) in[6]) << 48; in siphash24_compress()
134 state->padding |= ((uint64_t) in[5]) << 40; in siphash24_compress()
137 state->padding |= ((uint64_t) in[4]) << 32; in siphash24_compress()
140 state->padding |= ((uint64_t) in[3]) << 24; in siphash24_compress()
143 state->padding |= ((uint64_t) in[2]) << 16; in siphash24_compress()
146 state->padding |= ((uint64_t) in[1]) << 8; in siphash24_compress()
149 state->padding |= ((uint64_t) in[0]); in siphash24_compress()
156 uint64_t siphash24_finalize(struct siphash *state) { in siphash24_finalize() argument
159 assert(state); in siphash24_finalize()
161 b = state->padding | (((uint64_t) state->inlen) << 56); in siphash24_finalize()
164 … printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); in siphash24_finalize()
165 … printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); in siphash24_finalize()
166 … printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); in siphash24_finalize()
167 … printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); in siphash24_finalize()
168 …printf("(%3zu) padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t)… in siphash24_finalize()
171 state->v3 ^= b; in siphash24_finalize()
172 sipround(state); in siphash24_finalize()
173 sipround(state); in siphash24_finalize()
174 state->v0 ^= b; in siphash24_finalize()
177 … printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0); in siphash24_finalize()
178 … printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1); in siphash24_finalize()
179 … printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2); in siphash24_finalize()
180 … printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3); in siphash24_finalize()
182 state->v2 ^= 0xff; in siphash24_finalize()
184 sipround(state); in siphash24_finalize()
185 sipround(state); in siphash24_finalize()
186 sipround(state); in siphash24_finalize()
187 sipround(state); in siphash24_finalize()
189 return state->v0 ^ state->v1 ^ state->v2 ^ state->v3; in siphash24_finalize()
193 struct siphash state; in siphash24() local
198 siphash24_init(&state, k); in siphash24()
199 siphash24_compress(in, inlen, &state); in siphash24()
201 return siphash24_finalize(&state); in siphash24()