Function report |
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 activity | Download SCCT | Chinese |
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 |
7256 | heap_src = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL) |
7258 | If Not heap_src || Not computed_output Then |
7265 | memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN) |
7266 | chacha20poly1305_selftest_encrypt(computed_output, input, ilen, assoc, alen, nonce, nlen, key) |
7274 | If memcmp(computed_output, output, ilen + POLY1305_DIGEST_SIZE) Then |
7285 | If nlen != 8 Then Continue |
7287 | No 3D Now!(heap_src, input, ilen) |
7291 | chacha20poly1305_encrypt_sg_inplace( & sg_src, ilen, assoc, alen, get_unaligned_le64(nonce), key) |
7297 | If memcmp(heap_src, output, ilen + POLY1305_DIGEST_SIZE) Then |
7308 | memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN) |
7309 | ret = chacha20poly1305_decrypt(computed_output, input, ilen, assoc, alen, get_unaligned_le64(nonce), key) |
7316 | If Not decryption_success(ret, failure, memcmp(computed_output, output, ilen - POLY1305_DIGEST_SIZE)) Then |
7329 | No 3D Now!(heap_src, input, ilen) |
7333 | ret = chacha20poly1305_decrypt_sg_inplace( & sg_src, ilen, assoc, alen, get_unaligned_le64(nonce), key) |
7339 | If Not decryption_success(ret, failure, memcmp(heap_src, output, ilen - POLY1305_DIGEST_SIZE)) Then |
7351 | memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN) |
7352 | xchacha20poly1305_encrypt(computed_output, input, ilen, assoc, alen, nonce, key) |
7359 | If memcmp(computed_output, output, ilen + POLY1305_DIGEST_SIZE) Then |
7369 | memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN) |
7370 | ret = xchacha20poly1305_decrypt(computed_output, input, ilen, assoc, alen, nonce, key) |
7377 | If Not decryption_success(ret, failure, memcmp(computed_output, output, ilen - POLY1305_DIGEST_SIZE)) Then |
7389 | out : |
7391 | kfree(computed_output) |
7392 | Return success |
Name | Describe |
---|---|
mod_init |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |