函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\crypto\chacha20poly1305.c Create Date:2022-07-27 07:42:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:chacha20poly1305_crypt_sg_inplace

函数原型:static bool chacha20poly1305_crypt_sg_inplace(struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEY_SIZE], int encrypt)

返回类型:bool

参数:

类型参数名称
struct scatterlist *src
const size_tsrc_len
const u8 *ad
const size_tad_len
const u64nonce
const u8key
intencrypt
217  pad0等于page_address(ZERO_PAGE(0))
221  partial等于0
223  bool ret = true
225  union{struct{u32 k[(32 / sizeof(u32))];__le64 iv[2];}u8 block0[32];u8 chacha_stream[64];struct{u8 mac[2][16];}__le64 lens[2];}b((__aligned__(16))) __attribute__((__aligned__(16)))
238  如果WARN_ON(src_len > INT_MAX)则返回:false
241  chacha_load_key(k, key)
243  iv[0]等于0
244  iv[1]等于The following macros are to be defined by (nonce)
246  chacha_init(chacha_state, k, (u8 * )iv)
247  chacha20_crypt(chacha_state, block0, pad0, block0的长度)
248  poly1305_init( & poly1305_state, block0)
250  如果此条件成立可能性小(为编译器优化)(ad_len)则
251  poly1305_update( & poly1305_state, ad, ad_len)
252  如果ad_len按位与0xf则poly1305_update( & poly1305_state, pad0, 0x10 - (ad_len & 0xf))
256  flags等于lush back to phys on unmap
257  如果非preemptible()则flags或等于use kmap_atomic
260  开始映射迭代一个SG名单
262 sl大于0且sg_miter_next - proceed mapping iterator to the next mapping*@miter: sg mapping iter to proceed* Description:* Proceeds @miter to the next mapping. @miter should have been started* using sg_miter_start(). On successful return, @miter->page,循环
263  addr等于 pointer to the mapped area
264  length等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, sl, length of the mapped area )
266  如果非encryptpoly1305_update( & poly1305_state, addr, length)
273  partial等于partiall按位与CHACHA_BLOCK_SIZE减1
275  addr加等于l
276  length减等于l
280  l等于length
285  addr加等于l
286  length减等于l
293  partial等于length
296  如果encryptpoly1305_update( & poly1305_state, pointer to the mapped area , min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, sl, length of the mapped area ))
301  如果src_len按位与0xf则poly1305_update( & poly1305_state, pad0, 0x10 - (src_len & 0xf))
304  lens[0]等于The following macros are to be defined by (ad_len)
305  lens[1]等于The following macros are to be defined by (src_len)
306  poly1305_update( & poly1305_state, (u8 * )lens, lens的长度)
308  如果此条件成立可能性大(为编译器优化)(sl <= - POLY1305_DIGEST_SIZE)则
309  如果encrypt
312  ret = true
313  否则
321  sg_miter_stop - stop mapping iteration*@miter: sg mapping iter to be stopped* Description:* Stops mapping iterator @miter. @miter should have been started* using sg_miter_start(). A stopped iteration can be resumed by* calling sg_miter_next() on it
323  如果此条件成立可能性小(为编译器优化)(sl > - POLY1305_DIGEST_SIZE)则
324  poly1305_final( & poly1305_state, mac[1])
325  scatterwalk_map_and_copy(mac[encrypt], src, src_len, mac[1]的长度, encrypt)
327  ret等于encrypt或非rypto_memneq - Compare two areas of memory without leaking* timing information.*@a: One area of memory*@b: Another area of memory*@size: The size of the area.* Returns 0 when data is equal, 1 otherwise.
331  memzero_explicit - Fill a region of memory (e
332  memzero_explicit - Fill a region of memory (e
334  返回:ret
调用者
名称描述
chacha20poly1305_encrypt_sg_inplace
chacha20poly1305_decrypt_sg_inplace