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

Function blake2s

freebsd/contrib/libb2/blake2s-ref.c:348–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348int blake2s( uint8_t *out, const void *in, const void *key, size_t outlen, size_t inlen, size_t keylen )
349{
350 blake2s_state S[1];
351
352 /* Verify parameters */
353 if ( NULL == in && inlen > 0 ) return -1;
354
355 if ( NULL == out ) return -1;
356
357 if ( NULL == key && keylen > 0 ) return -1;
358
359 if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
360
361 if( keylen > BLAKE2S_KEYBYTES ) return -1;
362
363 if( keylen > 0 )
364 {
365 if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
366 }
367 else
368 {
369 if( blake2s_init( S, outlen ) < 0 ) return -1;
370 }
371
372 if( blake2s_update( S, ( uint8_t * )in, inlen ) < 0) return -1;
373 return blake2s_final( S, out, outlen );
374}
375

Callers

nothing calls this directly

Calls 4

blake2s_init_keyFunction · 0.70
blake2s_initFunction · 0.70
blake2s_updateFunction · 0.70
blake2s_finalFunction · 0.70

Tested by

no test coverage detected