| 346 | } |
| 347 | |
| 348 | int 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 |
nothing calls this directly
no test coverage detected