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

Function blake2b_final

freebsd/contrib/libb2/blake2b.c:389–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387
388
389int blake2b_final( blake2b_state *S, uint8_t *out, size_t outlen )
390{
391 if(S->outlen != outlen) return -1;
392
393 if( S->buflen > BLAKE2B_BLOCKBYTES )
394 {
395 blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
396 blake2b_compress( S, S->buf );
397 S->buflen -= BLAKE2B_BLOCKBYTES;
398 memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
399 }
400
401 blake2b_increment_counter( S, S->buflen );
402 blake2b_set_lastblock( S );
403 memset( S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
404 blake2b_compress( S, S->buf );
405 memcpy( out, &S->h[0], outlen );
406 return 0;
407}
408
409
410int blake2b( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen )

Callers 4

blake2bp_finalFunction · 0.70
blake2bpFunction · 0.70
blake2bFunction · 0.70
blake2_cipher_processFunction · 0.50

Calls 5

memsetFunction · 0.85
blake2b_compressFunction · 0.70
blake2b_set_lastblockFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected