• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7800-V1.0.2.28/package/px5g/src/library/

Lines Matching refs:ctx

76 void sha1_starts( sha1_context *ctx )
78 ctx->total[0] = 0;
79 ctx->total[1] = 0;
81 ctx->state[0] = 0x67452301;
82 ctx->state[1] = 0xEFCDAB89;
83 ctx->state[2] = 0x98BADCFE;
84 ctx->state[3] = 0x10325476;
85 ctx->state[4] = 0xC3D2E1F0;
88 static void sha1_process( sha1_context *ctx, unsigned char data[64] )
123 A = ctx->state[0];
124 B = ctx->state[1];
125 C = ctx->state[2];
126 D = ctx->state[3];
127 E = ctx->state[4];
237 ctx->state[0] += A;
238 ctx->state[1] += B;
239 ctx->state[2] += C;
240 ctx->state[3] += D;
241 ctx->state[4] += E;
247 void sha1_update( sha1_context *ctx, unsigned char *input, int ilen )
255 left = ctx->total[0] & 0x3F;
258 ctx->total[0] += ilen;
259 ctx->total[0] &= 0xFFFFFFFF;
261 if( ctx->total[0] < (unsigned long) ilen )
262 ctx->total[1]++;
266 memcpy( (void *) (ctx->buffer + left),
268 sha1_process( ctx, ctx->buffer );
276 sha1_process( ctx, input );
283 memcpy( (void *) (ctx->buffer + left),
299 void sha1_finish( sha1_context *ctx, unsigned char output[20] )
305 high = ( ctx->total[0] >> 29 )
306 | ( ctx->total[1] << 3 );
307 low = ( ctx->total[0] << 3 );
312 last = ctx->total[0] & 0x3F;
315 sha1_update( ctx, (unsigned char *) sha1_padding, padn );
316 sha1_update( ctx, msglen, 8 );
318 PUT_ULONG_BE( ctx->state[0], output, 0 );
319 PUT_ULONG_BE( ctx->state[1], output, 4 );
320 PUT_ULONG_BE( ctx->state[2], output, 8 );
321 PUT_ULONG_BE( ctx->state[3], output, 12 );
322 PUT_ULONG_BE( ctx->state[4], output, 16 );
330 sha1_context ctx;
332 sha1_starts( &ctx );
333 sha1_update( &ctx, input, ilen );
334 sha1_finish( &ctx, output );
336 memset( &ctx, 0, sizeof( sha1_context ) );
346 sha1_context ctx;
352 sha1_starts( &ctx );
355 sha1_update( &ctx, buf, (int) n );
357 sha1_finish( &ctx, output );
359 memset( &ctx, 0, sizeof( sha1_context ) );
374 void sha1_hmac_starts( sha1_context *ctx, unsigned char *key, int keylen )
386 memset( ctx->ipad, 0x36, 64 );
387 memset( ctx->opad, 0x5C, 64 );
391 ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
392 ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
395 sha1_starts( ctx );
396 sha1_update( ctx, ctx->ipad, 64 );
404 void sha1_hmac_update( sha1_context *ctx, unsigned char *input, int ilen )
406 sha1_update( ctx, input, ilen );
412 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] )
416 sha1_finish( ctx, tmpbuf );
417 sha1_starts( ctx );
418 sha1_update( ctx, ctx->opad, 64 );
419 sha1_update( ctx, tmpbuf, 20 );
420 sha1_finish( ctx, output );
432 sha1_context ctx;
434 sha1_hmac_starts( &ctx, key, keylen );
435 sha1_hmac_update( &ctx, input, ilen );
436 sha1_hmac_finish( &ctx, output );
438 memset( &ctx, 0, sizeof( sha1_context ) );
541 sha1_context ctx;
551 sha1_starts( &ctx );
558 sha1_update( &ctx, buf, buflen );
561 sha1_update( &ctx, sha1_test_buf[i],
564 sha1_finish( &ctx, sha1sum );
589 sha1_hmac_starts( &ctx, buf, buflen );
592 sha1_hmac_starts( &ctx, sha1_hmac_test_key[i],
595 sha1_hmac_update( &ctx, sha1_hmac_test_buf[i],
598 sha1_hmac_finish( &ctx, sha1sum );