Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:chacha20poly1305_selftest

Proto:bool __init chacha20poly1305_selftest(void)

Type:bool

Parameter:Nothing

7250  enum{MAXIMUM_TEST_BUFFER_LEN = 1UL << 12}
7252  u8 * computed_output = NULL, * heap_src = NULL
7254  success = true
7256  heap_src = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL)
7257  computed_output = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL)
7258  If Not heap_src || Not computed_output Then
7259  pr_err("chacha20poly1305 self-test malloc: FAIL\n")
7260  success = false
7261  Go to out
7264  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(chacha20poly1305_enc_vectors) cycle
7265  memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN)
7266  chacha20poly1305_selftest_encrypt(computed_output, input, ilen, assoc, alen, nonce, nlen, key)
7278  pr_err("chacha20poly1305 encryption self-test %zu: FAIL\n", i + 1)
7280  success = false
7284  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(chacha20poly1305_enc_vectors) cycle
7285  If nlen != 8 Then Continue
7287  No 3D Now!(heap_src, input, ilen)
7289  sg_init_one - Initialize a single entry sg list*@sg: SG entry*@buf: Virtual address for IO*@buflen: IO length
7291  chacha20poly1305_encrypt_sg_inplace( & sg_src, ilen, assoc, alen, get_unaligned_le64(nonce), key)
7301  pr_err("chacha20poly1305 sg encryption self-test %zu: FAIL\n", i + 1)
7303  success = false
7307  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(chacha20poly1305_dec_vectors) cycle
7308  memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN)
7309  ret = chacha20poly1305_decrypt(computed_output, input, ilen, assoc, alen, get_unaligned_le64(nonce), key)
7322  pr_err("chacha20poly1305 decryption self-test %zu: FAIL\n", i + 1)
7324  success = false
7328  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(chacha20poly1305_dec_vectors) cycle
7329  No 3D Now!(heap_src, input, ilen)
7331  sg_init_one - Initialize a single entry sg list*@sg: SG entry*@buf: Virtual address for IO*@buflen: IO length
7333  ret = chacha20poly1305_decrypt_sg_inplace( & sg_src, ilen, assoc, alen, get_unaligned_le64(nonce), key)
7344  pr_err("chacha20poly1305 sg decryption self-test %zu: FAIL\n", i + 1)
7346  success = false
7350  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(xchacha20poly1305_enc_vectors) cycle
7351  memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN)
7352  xchacha20poly1305_encrypt(computed_output, input, ilen, assoc, alen, nonce, key)
7363  pr_err("xchacha20poly1305 encryption self-test %zu: FAIL\n", i + 1)
7365  success = false
7368  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(xchacha20poly1305_dec_vectors) cycle
7369  memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN)
7370  ret = xchacha20poly1305_decrypt(computed_output, input, ilen, assoc, alen, nonce, key)
7383  pr_err("xchacha20poly1305 decryption self-test %zu: FAIL\n", i + 1)
7385  success = false
7389  out :
7390  kfree(heap_src)
7391  kfree(computed_output)
7392  Return success
Caller
NameDescribe
mod_init