MCPcopy Create free account
hub / github.com/F-Stack/f-stack / blake2b_update

Function blake2b_update

freebsd/contrib/libb2/blake2b.c:358–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356
357
358int blake2b_update( blake2b_state *S, const uint8_t *in, size_t inlen )
359{
360 while( inlen > 0 )
361 {
362 uint32_t left = S->buflen;
363 uint32_t fill = 2 * BLAKE2B_BLOCKBYTES - left;
364
365 if( inlen > fill )
366 {
367 memcpy( S->buf + left, in, fill ); // Fill buffer
368 S->buflen += fill;
369 blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
370 blake2b_compress( S, S->buf ); // Compress
371 memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); // Shift buffer left
372 S->buflen -= BLAKE2B_BLOCKBYTES;
373 in += fill;
374 inlen -= fill;
375 }
376 else // inlen <= fill
377 {
378 memcpy( S->buf + left, in, inlen );
379 S->buflen += ( uint32_t ) inlen; // Be lazy, do not compress
380 in += inlen;
381 inlen -= inlen;
382 }
383 }
384
385 return 0;
386}
387
388
389int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen )

Callers 7

blake2bp_init_keyFunction · 0.70
blake2bp_updateFunction · 0.70
blake2bp_finalFunction · 0.70
blake2bpFunction · 0.70
blake2b_init_keyFunction · 0.70
blake2bFunction · 0.70
blake2b_applicatorFunction · 0.50

Calls 3

blake2b_compressFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected