Lines Matching +full:up +full:- +full:counter
34 /* 256-bit Skein */
48 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein_256_Init()
51 { /* use pre-computed values, where available */ in Skein_256_Init()
53 case 256: memcpy(ctx->X,SKEIN_256_IV_256,sizeof(ctx->X)); break; in Skein_256_Init()
54 case 224: memcpy(ctx->X,SKEIN_256_IV_224,sizeof(ctx->X)); break; in Skein_256_Init()
55 case 160: memcpy(ctx->X,SKEIN_256_IV_160,sizeof(ctx->X)); break; in Skein_256_Init()
56 case 128: memcpy(ctx->X,SKEIN_256_IV_128,sizeof(ctx->X)); break; in Skein_256_Init()
66 memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ in Skein_256_Init()
69 memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ in Skein_256_Init()
73 /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ in Skein_256_Init()
74 /* Set up to process the data message portion of the hash (default) */ in Skein_256_Init()
94 /* compute the initial chaining values ctx->X[], based on key */ in Skein_256_InitExt()
97 memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ in Skein_256_InitExt()
99 else /* here to pre-process a key */ in Skein_256_InitExt()
101 Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); in Skein_256_InitExt()
102 /* do a mini-Init right here */ in Skein_256_InitExt()
103 ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ in Skein_256_InitExt()
105 memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ in Skein_256_InitExt()
108 memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ in Skein_256_InitExt()
113 ctx->X[i] = Skein_Swap64(ctx->X[i]); in Skein_256_InitExt()
118 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein_256_InitExt()
121 memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ in Skein_256_InitExt()
126 Skein_Show_Key(256,&ctx->h,key,keyBytes); in Skein_256_InitExt()
131 /* The chaining vars ctx->X are now initialized */ in Skein_256_InitExt()
132 /* Set up to process the data message portion of the hash (default) */ in Skein_256_InitExt()
133 ctx->h.bCnt = 0; /* buffer b[] starts out empty */ in Skein_256_InitExt()
145 …Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_256_Update()
148 if (msgByteCnt + ctx->h.bCnt > SKEIN_256_BLOCK_BYTES) in Skein_256_Update()
150 if (ctx->h.bCnt) /* finish up any buffered message data */ in Skein_256_Update()
152 n = SKEIN_256_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ in Skein_256_Update()
156 memcpy(&ctx->b[ctx->h.bCnt],msg,n); in Skein_256_Update()
157 msgByteCnt -= n; in Skein_256_Update()
159 ctx->h.bCnt += n; in Skein_256_Update()
161 Skein_assert(ctx->h.bCnt == SKEIN_256_BLOCK_BYTES); in Skein_256_Update()
162 Skein_256_Process_Block(ctx,ctx->b,1,SKEIN_256_BLOCK_BYTES); in Skein_256_Update()
163 ctx->h.bCnt = 0; in Skein_256_Update()
168 n = (msgByteCnt-1) / SKEIN_256_BLOCK_BYTES; /* number of full blocks to process */ in Skein_256_Update()
170 msgByteCnt -= n * SKEIN_256_BLOCK_BYTES; in Skein_256_Update()
173 Skein_assert(ctx->h.bCnt == 0); in Skein_256_Update()
179 Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES); in Skein_256_Update()
180 memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); in Skein_256_Update()
181 ctx->h.bCnt += msgByteCnt; in Skein_256_Update()
193 …Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_256_Final()
195 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein_256_Final()
196 if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein_256_Final()
197 memset(&ctx->b[ctx->h.bCnt],0,SKEIN_256_BLOCK_BYTES - ctx->h.bCnt); in Skein_256_Final()
199 Skein_256_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein_256_Final()
202 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein_256_Final()
204 /* run Threefish in "counter mode" to generate output */ in Skein_256_Final()
205 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein_256_Final()
206 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein_256_Final()
209 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein_256_Final()
211 Skein_256_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein_256_Final()
212 n = byteCnt - i*SKEIN_256_BLOCK_BYTES; /* number of output bytes left to go */ in Skein_256_Final()
215 …Skein_Put64_LSB_First(hashVal+i*SKEIN_256_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein_256_Final()
216 Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_256_BLOCK_BYTES); in Skein_256_Final()
217 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein_256_Final()
225 return ((u08b_t *) Skein_256_API_CodeSize) - in Skein_256_API_CodeSize()
231 /* 512-bit Skein */
245 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein_512_Init()
248 { /* use pre-computed values, where available */ in Skein_512_Init()
250 case 512: memcpy(ctx->X,SKEIN_512_IV_512,sizeof(ctx->X)); break; in Skein_512_Init()
251 case 384: memcpy(ctx->X,SKEIN_512_IV_384,sizeof(ctx->X)); break; in Skein_512_Init()
252 case 256: memcpy(ctx->X,SKEIN_512_IV_256,sizeof(ctx->X)); break; in Skein_512_Init()
253 case 224: memcpy(ctx->X,SKEIN_512_IV_224,sizeof(ctx->X)); break; in Skein_512_Init()
263 memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ in Skein_512_Init()
266 memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ in Skein_512_Init()
271 /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ in Skein_512_Init()
272 /* Set up to process the data message portion of the hash (default) */ in Skein_512_Init()
292 /* compute the initial chaining values ctx->X[], based on key */ in Skein_512_InitExt()
295 memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ in Skein_512_InitExt()
297 else /* here to pre-process a key */ in Skein_512_InitExt()
299 Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); in Skein_512_InitExt()
300 /* do a mini-Init right here */ in Skein_512_InitExt()
301 ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ in Skein_512_InitExt()
303 memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ in Skein_512_InitExt()
306 memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ in Skein_512_InitExt()
311 ctx->X[i] = Skein_Swap64(ctx->X[i]); in Skein_512_InitExt()
316 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein_512_InitExt()
319 memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ in Skein_512_InitExt()
324 Skein_Show_Key(512,&ctx->h,key,keyBytes); in Skein_512_InitExt()
329 /* The chaining vars ctx->X are now initialized */ in Skein_512_InitExt()
330 /* Set up to process the data message portion of the hash (default) */ in Skein_512_InitExt()
331 ctx->h.bCnt = 0; /* buffer b[] starts out empty */ in Skein_512_InitExt()
343 …Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_512_Update()
346 if (msgByteCnt + ctx->h.bCnt > SKEIN_512_BLOCK_BYTES) in Skein_512_Update()
348 if (ctx->h.bCnt) /* finish up any buffered message data */ in Skein_512_Update()
350 n = SKEIN_512_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ in Skein_512_Update()
354 memcpy(&ctx->b[ctx->h.bCnt],msg,n); in Skein_512_Update()
355 msgByteCnt -= n; in Skein_512_Update()
357 ctx->h.bCnt += n; in Skein_512_Update()
359 Skein_assert(ctx->h.bCnt == SKEIN_512_BLOCK_BYTES); in Skein_512_Update()
360 Skein_512_Process_Block(ctx,ctx->b,1,SKEIN_512_BLOCK_BYTES); in Skein_512_Update()
361 ctx->h.bCnt = 0; in Skein_512_Update()
366 n = (msgByteCnt-1) / SKEIN_512_BLOCK_BYTES; /* number of full blocks to process */ in Skein_512_Update()
368 msgByteCnt -= n * SKEIN_512_BLOCK_BYTES; in Skein_512_Update()
371 Skein_assert(ctx->h.bCnt == 0); in Skein_512_Update()
377 Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES); in Skein_512_Update()
378 memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); in Skein_512_Update()
379 ctx->h.bCnt += msgByteCnt; in Skein_512_Update()
391 …Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_512_Final()
393 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein_512_Final()
394 if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein_512_Final()
395 memset(&ctx->b[ctx->h.bCnt],0,SKEIN_512_BLOCK_BYTES - ctx->h.bCnt); in Skein_512_Final()
397 Skein_512_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein_512_Final()
400 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein_512_Final()
402 /* run Threefish in "counter mode" to generate output */ in Skein_512_Final()
403 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein_512_Final()
404 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein_512_Final()
407 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein_512_Final()
409 Skein_512_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein_512_Final()
410 n = byteCnt - i*SKEIN_512_BLOCK_BYTES; /* number of output bytes left to go */ in Skein_512_Final()
413 …Skein_Put64_LSB_First(hashVal+i*SKEIN_512_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein_512_Final()
414 Skein_Show_Final(512,&ctx->h,n,hashVal+i*SKEIN_512_BLOCK_BYTES); in Skein_512_Final()
415 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein_512_Final()
423 return ((u08b_t *) Skein_512_API_CodeSize) - in Skein_512_API_CodeSize()
429 /* 1024-bit Skein */
443 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein1024_Init()
446 { /* use pre-computed values, where available */ in Skein1024_Init()
448 case 512: memcpy(ctx->X,SKEIN1024_IV_512 ,sizeof(ctx->X)); break; in Skein1024_Init()
449 case 384: memcpy(ctx->X,SKEIN1024_IV_384 ,sizeof(ctx->X)); break; in Skein1024_Init()
450 case 1024: memcpy(ctx->X,SKEIN1024_IV_1024,sizeof(ctx->X)); break; in Skein1024_Init()
460 memset(&cfg.w[3],0,sizeof(cfg) - 3*sizeof(cfg.w[0])); /* zero pad config block */ in Skein1024_Init()
463 memset(ctx->X,0,sizeof(ctx->X)); /* zero the chaining variables */ in Skein1024_Init()
468 /* The chaining vars ctx->X are now initialized for the given hashBitLen. */ in Skein1024_Init()
469 /* Set up to process the data message portion of the hash (default) */ in Skein1024_Init()
489 /* compute the initial chaining values ctx->X[], based on key */ in Skein1024_InitExt()
492 memset(ctx->X,0,sizeof(ctx->X)); /* no key: use all zeroes as key for config block */ in Skein1024_InitExt()
494 else /* here to pre-process a key */ in Skein1024_InitExt()
496 Skein_assert(sizeof(cfg.b) >= sizeof(ctx->X)); in Skein1024_InitExt()
497 /* do a mini-Init right here */ in Skein1024_InitExt()
498 ctx->h.hashBitLen=8*sizeof(ctx->X); /* set output hash bit count = state size */ in Skein1024_InitExt()
500 memset(ctx->X,0,sizeof(ctx->X)); /* zero the initial chaining variables */ in Skein1024_InitExt()
503 memcpy(ctx->X,cfg.b,sizeof(cfg.b)); /* copy over into ctx->X[] */ in Skein1024_InitExt()
508 ctx->X[i] = Skein_Swap64(ctx->X[i]); in Skein1024_InitExt()
513 ctx->h.hashBitLen = hashBitLen; /* output hash bit count */ in Skein1024_InitExt()
516 memset(&cfg.w,0,sizeof(cfg.w)); /* pre-pad cfg.w[] with zeroes */ in Skein1024_InitExt()
521 Skein_Show_Key(1024,&ctx->h,key,keyBytes); in Skein1024_InitExt()
526 /* The chaining vars ctx->X are now initialized */ in Skein1024_InitExt()
527 /* Set up to process the data message portion of the hash (default) */ in Skein1024_InitExt()
528 ctx->h.bCnt = 0; /* buffer b[] starts out empty */ in Skein1024_InitExt()
540 …Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein1024_Update()
543 if (msgByteCnt + ctx->h.bCnt > SKEIN1024_BLOCK_BYTES) in Skein1024_Update()
545 if (ctx->h.bCnt) /* finish up any buffered message data */ in Skein1024_Update()
547 n = SKEIN1024_BLOCK_BYTES - ctx->h.bCnt; /* # bytes free in buffer b[] */ in Skein1024_Update()
551 memcpy(&ctx->b[ctx->h.bCnt],msg,n); in Skein1024_Update()
552 msgByteCnt -= n; in Skein1024_Update()
554 ctx->h.bCnt += n; in Skein1024_Update()
556 Skein_assert(ctx->h.bCnt == SKEIN1024_BLOCK_BYTES); in Skein1024_Update()
557 Skein1024_Process_Block(ctx,ctx->b,1,SKEIN1024_BLOCK_BYTES); in Skein1024_Update()
558 ctx->h.bCnt = 0; in Skein1024_Update()
563 n = (msgByteCnt-1) / SKEIN1024_BLOCK_BYTES; /* number of full blocks to process */ in Skein1024_Update()
565 msgByteCnt -= n * SKEIN1024_BLOCK_BYTES; in Skein1024_Update()
568 Skein_assert(ctx->h.bCnt == 0); in Skein1024_Update()
574 Skein_assert(msgByteCnt + ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES); in Skein1024_Update()
575 memcpy(&ctx->b[ctx->h.bCnt],msg,msgByteCnt); in Skein1024_Update()
576 ctx->h.bCnt += msgByteCnt; in Skein1024_Update()
588 …Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein1024_Final()
590 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein1024_Final()
591 if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein1024_Final()
592 memset(&ctx->b[ctx->h.bCnt],0,SKEIN1024_BLOCK_BYTES - ctx->h.bCnt); in Skein1024_Final()
594 Skein1024_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein1024_Final()
597 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein1024_Final()
599 /* run Threefish in "counter mode" to generate output */ in Skein1024_Final()
600 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein1024_Final()
601 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein1024_Final()
604 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein1024_Final()
606 Skein1024_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein1024_Final()
607 n = byteCnt - i*SKEIN1024_BLOCK_BYTES; /* number of output bytes left to go */ in Skein1024_Final()
610 …Skein_Put64_LSB_First(hashVal+i*SKEIN1024_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein1024_Final()
611 Skein_Show_Final(1024,&ctx->h,n,hashVal+i*SKEIN1024_BLOCK_BYTES); in Skein1024_Final()
612 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein1024_Final()
620 return ((u08b_t *) Skein1024_API_CodeSize) - in Skein1024_API_CodeSize()
632 …Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_256_Final_Pad()
634 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein_256_Final_Pad()
635 if (ctx->h.bCnt < SKEIN_256_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein_256_Final_Pad()
636 memset(&ctx->b[ctx->h.bCnt],0,SKEIN_256_BLOCK_BYTES - ctx->h.bCnt); in Skein_256_Final_Pad()
637 Skein_256_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein_256_Final_Pad()
639 Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN_256_BLOCK_BYTES); /* "output" the state bytes */ in Skein_256_Final_Pad()
648 …Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_512_Final_Pad()
650 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein_512_Final_Pad()
651 if (ctx->h.bCnt < SKEIN_512_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein_512_Final_Pad()
652 memset(&ctx->b[ctx->h.bCnt],0,SKEIN_512_BLOCK_BYTES - ctx->h.bCnt); in Skein_512_Final_Pad()
653 Skein_512_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein_512_Final_Pad()
655 Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN_512_BLOCK_BYTES); /* "output" the state bytes */ in Skein_512_Final_Pad()
664 …Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein1024_Final_Pad()
666 ctx->h.T[1] |= SKEIN_T1_FLAG_FINAL; /* tag as the final block */ in Skein1024_Final_Pad()
667 if (ctx->h.bCnt < SKEIN1024_BLOCK_BYTES) /* zero pad b[] if necessary */ in Skein1024_Final_Pad()
668 memset(&ctx->b[ctx->h.bCnt],0,SKEIN1024_BLOCK_BYTES - ctx->h.bCnt); in Skein1024_Final_Pad()
669 Skein1024_Process_Block(ctx,ctx->b,1,ctx->h.bCnt); /* process the final block */ in Skein1024_Final_Pad()
671 Skein_Put64_LSB_First(hashVal,ctx->X,SKEIN1024_BLOCK_BYTES); /* "output" the state bytes */ in Skein1024_Final_Pad()
683 …Skein_Assert(ctx->h.bCnt <= SKEIN_256_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_256_Output()
686 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein_256_Output()
688 /* run Threefish in "counter mode" to generate output */ in Skein_256_Output()
689 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein_256_Output()
690 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein_256_Output()
693 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein_256_Output()
695 Skein_256_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein_256_Output()
696 n = byteCnt - i*SKEIN_256_BLOCK_BYTES; /* number of output bytes left to go */ in Skein_256_Output()
699 …Skein_Put64_LSB_First(hashVal+i*SKEIN_256_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein_256_Output()
700 Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_256_BLOCK_BYTES); in Skein_256_Output()
701 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein_256_Output()
712 …Skein_Assert(ctx->h.bCnt <= SKEIN_512_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein_512_Output()
715 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein_512_Output()
717 /* run Threefish in "counter mode" to generate output */ in Skein_512_Output()
718 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein_512_Output()
719 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein_512_Output()
722 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein_512_Output()
724 Skein_512_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein_512_Output()
725 n = byteCnt - i*SKEIN_512_BLOCK_BYTES; /* number of output bytes left to go */ in Skein_512_Output()
728 …Skein_Put64_LSB_First(hashVal+i*SKEIN_512_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein_512_Output()
729 Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN_512_BLOCK_BYTES); in Skein_512_Output()
730 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein_512_Output()
741 …Skein_Assert(ctx->h.bCnt <= SKEIN1024_BLOCK_BYTES,SKEIN_FAIL); /* catch uninitialized context */ in Skein1024_Output()
744 byteCnt = (ctx->h.hashBitLen + 7) >> 3; /* total number of output bytes */ in Skein1024_Output()
746 /* run Threefish in "counter mode" to generate output */ in Skein1024_Output()
747 memset(ctx->b,0,sizeof(ctx->b)); /* zero out b[], so it can hold the counter */ in Skein1024_Output()
748 memcpy(X,ctx->X,sizeof(X)); /* keep a local copy of counter mode "key" */ in Skein1024_Output()
751 ((u64b_t *)ctx->b)[0]= Skein_Swap64((u64b_t) i); /* build the counter block */ in Skein1024_Output()
753 Skein1024_Process_Block(ctx,ctx->b,1,sizeof(u64b_t)); /* run "counter mode" */ in Skein1024_Output()
754 n = byteCnt - i*SKEIN1024_BLOCK_BYTES; /* number of output bytes left to go */ in Skein1024_Output()
757 …Skein_Put64_LSB_First(hashVal+i*SKEIN1024_BLOCK_BYTES,ctx->X,n); /* "output" the ctr mode bytes … in Skein1024_Output()
758 Skein_Show_Final(256,&ctx->h,n,hashVal+i*SKEIN1024_BLOCK_BYTES); in Skein1024_Output()
759 memcpy(ctx->X,X,sizeof(X)); /* restore the counter mode key for next time */ in Skein1024_Output()