Lines Matching refs:ctx

56 void SLA1_Init(struct SLA_1_Context *ctx)  in SLA1_Init()  argument
59 ctx->A = 0; in SLA1_Init()
60 ctx->B = 0; in SLA1_Init()
61 ctx->C = 0; in SLA1_Init()
62 ctx->D = 0; in SLA1_Init()
63 ctx->E = 0; in SLA1_Init()
64 ctx->H0 = H0INIT; in SLA1_Init()
65 ctx->H1 = H1INIT; in SLA1_Init()
66 ctx->H2 = H2INIT; in SLA1_Init()
67 ctx->H3 = H3INIT; in SLA1_Init()
68 ctx->H4 = H4INIT; in SLA1_Init()
69 ctx->TEMP = 0; in SLA1_Init()
70 memset(ctx->words, 0, sizeof(ctx->words)); in SLA1_Init()
71 ctx->howManyInBlock = 0; in SLA1_Init()
72 ctx->runningTotal = 0; in SLA1_Init()
75 void SLA1processABlock(struct SLA_1_Context *ctx,unsigned int *block) in SLA1processABlock() argument
84 ctx->words[i] = ntohl(block[i]); in SLA1processABlock()
88 ctx->words[i] = in SLA1processABlock()
89 CSHIFT(1, ((ctx->words[(i-3)]) ^ in SLA1processABlock()
90 (ctx->words[(i-8)]) ^ in SLA1processABlock()
91 (ctx->words[(i-14)]) ^ in SLA1processABlock()
92 (ctx->words[(i-16)]))); in SLA1processABlock()
95 ctx->A = ctx->H0; in SLA1processABlock()
96 ctx->B = ctx->H1; in SLA1processABlock()
97 ctx->C = ctx->H2; in SLA1processABlock()
98 ctx->D = ctx->H3; in SLA1processABlock()
99 ctx->E = ctx->H4; in SLA1processABlock()
104 ctx->TEMP = ((CSHIFT(5, ctx->A)) + in SLA1processABlock()
105 (F1(ctx->B, ctx->C, ctx->D)) + in SLA1processABlock()
106 (ctx->E) + in SLA1processABlock()
107 ctx->words[i] + in SLA1processABlock()
111 ctx->TEMP = ((CSHIFT(5, ctx->A)) + in SLA1processABlock()
112 (F2(ctx->B, ctx->C, ctx->D)) + in SLA1processABlock()
113 (ctx->E) + in SLA1processABlock()
114 (ctx->words[i]) + in SLA1processABlock()
118 ctx->TEMP = ((CSHIFT(5, ctx->A)) + in SLA1processABlock()
119 (F3(ctx->B, ctx->C, ctx->D)) + in SLA1processABlock()
120 (ctx->E) + in SLA1processABlock()
121 (ctx->words[i]) + in SLA1processABlock()
125 ctx->TEMP = ((CSHIFT(5, ctx->A)) + in SLA1processABlock()
126 (F4(ctx->B, ctx->C, ctx->D)) + in SLA1processABlock()
127 (ctx->E) + in SLA1processABlock()
128 (ctx->words[i]) + in SLA1processABlock()
132 ctx->E = ctx->D; in SLA1processABlock()
133 ctx->D = ctx->C; in SLA1processABlock()
134 ctx->C = CSHIFT(30, ctx->B); in SLA1processABlock()
135 ctx->B = ctx->A; in SLA1processABlock()
136 ctx->A = ctx->TEMP; in SLA1processABlock()
140 ctx->H0 = (ctx->H0) + (ctx->A); in SLA1processABlock()
141 ctx->H1 = (ctx->H1) + (ctx->B); in SLA1processABlock()
142 ctx->H2 = (ctx->H2) + (ctx->C); in SLA1processABlock()
143 ctx->H3 = (ctx->H3) + (ctx->D); in SLA1processABlock()
144 ctx->H4 = (ctx->H4) + (ctx->E); in SLA1processABlock()
147 void SLA1_Process(struct SLA_1_Context *ctx, const unsigned char *ptr, int siz) in SLA1_Process() argument
153 leftToFill = sizeof(ctx->SLAblock) - ctx->howManyInBlock; in SLA1_Process()
156 memcpy(&ctx->SLAblock[ctx->howManyInBlock], in SLA1_Process()
158 ctx->howManyInBlock += siz; in SLA1_Process()
159 ctx->runningTotal += siz; in SLA1_Process()
163 memcpy(&ctx->SLAblock[ctx->howManyInBlock], in SLA1_Process()
165 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Process()
167 ctx->runningTotal += leftToFill; in SLA1_Process()
168 ctx->howManyInBlock = 0; in SLA1_Process()
173 void SLA1_Final(struct SLA_1_Context *ctx, unsigned char *digestBuf) in SLA1_Final() argument
194 if (ctx->howManyInBlock > 55) { in SLA1_Final()
200 leftToFill = sizeof(ctx->SLAblock) - ctx->howManyInBlock; in SLA1_Final()
207 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Final()
209 ctx->SLAblock[0] = 0x80; in SLA1_Final()
210 for (i = 1; i < sizeof(ctx->SLAblock); i++) { in SLA1_Final()
211 ctx->SLAblock[i] = 0x0; in SLA1_Final()
214 ctx->SLAblock[ctx->howManyInBlock] = 0x80; in SLA1_Final()
215 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Final()
217 memset(ctx->SLAblock, 0, sizeof(ctx->SLAblock)); in SLA1_Final()
219 ctx->SLAblock[ctx->howManyInBlock] = 0x80; in SLA1_Final()
220 for (i = (ctx->howManyInBlock + 1); in SLA1_Final()
221 i < sizeof(ctx->SLAblock); in SLA1_Final()
223 ctx->SLAblock[i] = 0x0; in SLA1_Final()
225 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Final()
227 memset(ctx->SLAblock, 0, sizeof(ctx->SLAblock)); in SLA1_Final()
230 ctx->runningTotal *= 8; in SLA1_Final()
231 ptr = (unsigned int *) &ctx->SLAblock[60]; in SLA1_Final()
232 *ptr = htonl(ctx->runningTotal); in SLA1_Final()
233 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Final()
242 ctx->SLAblock[ctx->howManyInBlock] = 0x80; in SLA1_Final()
243 for (i = (ctx->howManyInBlock + 1); in SLA1_Final()
244 i < sizeof(ctx->SLAblock); in SLA1_Final()
246 ctx->SLAblock[i] = 0x0; in SLA1_Final()
249 ctx->runningTotal *= 8; in SLA1_Final()
250 ptr = (unsigned int *) &ctx->SLAblock[60]; in SLA1_Final()
251 *ptr = htonl(ctx->runningTotal); in SLA1_Final()
252 SLA1processABlock(ctx, (unsigned int *) ctx->SLAblock); in SLA1_Final()
257 digestBuf[3] = (ctx->H0 & 0xff); in SLA1_Final()
258 digestBuf[2] = ((ctx->H0 >> 8) & 0xff); in SLA1_Final()
259 digestBuf[1] = ((ctx->H0 >> 16) & 0xff); in SLA1_Final()
260 digestBuf[0] = ((ctx->H0 >> 24) & 0xff); in SLA1_Final()
262 digestBuf[7] = (ctx->H1 & 0xff); in SLA1_Final()
263 digestBuf[6] = ((ctx->H1 >> 8) & 0xff); in SLA1_Final()
264 digestBuf[5] = ((ctx->H1 >> 16) & 0xff); in SLA1_Final()
265 digestBuf[4] = ((ctx->H1 >> 24) & 0xff); in SLA1_Final()
267 digestBuf[11] = (ctx->H2 & 0xff); in SLA1_Final()
268 digestBuf[10] = ((ctx->H2 >> 8) & 0xff); in SLA1_Final()
269 digestBuf[9] = ((ctx->H2 >> 16) & 0xff); in SLA1_Final()
270 digestBuf[8] = ((ctx->H2 >> 24) & 0xff); in SLA1_Final()
272 digestBuf[15] = (ctx->H3 & 0xff); in SLA1_Final()
273 digestBuf[14] = ((ctx->H3 >> 8) & 0xff); in SLA1_Final()
274 digestBuf[13] = ((ctx->H3 >> 16) & 0xff); in SLA1_Final()
275 digestBuf[12] = ((ctx->H3 >> 24) & 0xff); in SLA1_Final()
277 digestBuf[19] = (ctx->H4 & 0xff); in SLA1_Final()
278 digestBuf[18] = ((ctx->H4 >> 8) & 0xff); in SLA1_Final()
279 digestBuf[17] = ((ctx->H4 >> 16) & 0xff); in SLA1_Final()
280 digestBuf[16] = ((ctx->H4 >> 24) & 0xff); in SLA1_Final()