Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\crypto\blake2s-selftest.c Create Date:2022-07-28 06:44:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:blake2s_selftest

Proto:bool __init blake2s_selftest(void)

Type:bool

Parameter:Nothing

572  bool success = true
575  key[0] = key[1] = 1
576  When i < size of key cycle key[i] = key[i - 2] + key[i - 1]
579  When i < size of buf cycle buf[i] = i
582  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(lake2s_testvecs[] generated with the program below (using libb2-dev and* libssl-dev [OpenSSL])* #include ) cycle
583  outlen = 1 + i % BLAKE2S_HASH_SIZE
584  keylen = 13 * i % (BLAKE2S_KEY_SIZE + 1)
586  blake2s(hash, buf, key + BLAKE2S_KEY_SIZE - keylen, outlen, i, keylen)
589  pr_err("blake2s self-test %d: FAIL\n", i + 1)
590  success = false
593  If Not keylen Then blake2s_init( & state, outlen)
595  Else blake2s_init_key( & state, outlen, key + BLAKE2S_KEY_SIZE - keylen, keylen)
600  blake2s_update( & state, buf, l)
601  blake2s_update( & state, buf + l, i - l)
602  blake2s_final( & state, hash)
604  pr_err("blake2s init/update/final self-test %d: FAIL\n", i + 1)
606  success = false
610  If success Then
611  blake2s256_hmac(hash, buf, key, size of buf , size of key )
612  success &= Not memcmp(hash, blake2s_hmac_testvecs[0], BLAKE2S_HASH_SIZE)
614  blake2s256_hmac(hash, key, buf, size of key , size of buf )
615  success &= Not memcmp(hash, blake2s_hmac_testvecs[1], BLAKE2S_HASH_SIZE)
617  If Not success Then pr_err("blake2s256_hmac self-test: FAIL\n")
621  Return success
Caller
NameDescribe
mod_init