函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:aes_expandkey - Expands the AES key as described in FIPS-197*@ctx: The location where the computed key will be stored.*@in_key: The supplied key.*@key_len: The length of the supplied key.* Returns 0 on success

函数原型:int aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key, unsigned int key_len)

返回类型:int

参数:

类型参数名称
struct crypto_aes_ctx *ctx
const u8 *in_key
unsigned intkey_len
188  kwords等于key_lensizeof(u32)
192  err等于validate key length for AES algorithms
193  如果err则返回:err
196  key_length等于key_len
198 i小于kwords循环key_enc[i]等于get_unaligned_le32(in_key + i * sizeof(u32))
201 i小于10循环
202  rki等于key_encikwords
203  rko等于rkikwords
205  rko[0]等于r32 - rotate a 32-bit value right*@word: value to rotate*@shift: bits to roll按位异或rc按位异或rki[0]
206  rko[1]等于rko[0]按位异或rki[1]
207  rko[2]等于rko[1]按位异或rki[2]
208  rko[3]等于rko[2]按位异或rki[3]
210  如果key_len恒等于AES_KEYSIZE_192
211  如果i大于等于7则退出
213  rko[4]等于rko[3]按位异或rki[4]
214  rko[5]等于rko[4]按位异或rki[5]
215  否则如果key_len恒等于AES_KEYSIZE_256
216  如果i大于等于6则退出
218  rko[4]等于subw(rko[3])按位异或rki[4]
219  rko[5]等于rko[4]按位异或rki[5]
220  rko[6]等于rko[5]按位异或rki[6]
221  rko[7]等于rko[6]按位异或rki[7]
231  key_dec[0]等于key_enc[key_len + 24]
232  key_dec[1]等于key_enc[key_len + 25]
233  key_dec[2]等于key_enc[key_len + 26]
234  key_dec[3]等于key_enc[key_len + 27]
236 j大于0循环
237  key_dec[i]等于inv_mix_columns(key_enc[j])
238  key_dec[i + 1]等于inv_mix_columns(key_enc[j + 1])
239  key_dec[i + 2]等于inv_mix_columns(key_enc[j + 2])
240  key_dec[i + 3]等于inv_mix_columns(key_enc[j + 3])
243  key_dec[i]等于key_enc[0]
244  key_dec[i + 1]等于key_enc[1]
245  key_dec[i + 2]等于key_enc[2]
246  key_dec[i + 3]等于key_enc[3]
248  返回:0