Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:aes_decrypt - Decrypt a single AES block*@ctx: Context struct containing the key schedule*@out: Buffer to store the plaintext*@in: Buffer containing the ciphertext

Proto:void aes_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in)

Type:void

Parameter:

TypeParameterName
const struct crypto_aes_ctx *ctx
u8 *out
const u8 *in
311  rkp = key_dec + 4
312  rounds = 6 + key_length / 4
313  u32 st0[4], st1[4]
316  st0[0] = key_dec[0] ^ get_unaligned_le32(in)
317  st0[1] = key_dec[1] ^ get_unaligned_le32(in + 4)
318  st0[2] = key_dec[2] ^ get_unaligned_le32(in + 8)
319  st0[3] = key_dec[3] ^ get_unaligned_le32(in + 12)
327  st0[0] ^= aes_inv_sbox[0] ^ aes_inv_sbox[64] ^ aes_inv_sbox[129] ^ aes_inv_sbox[200]
328  st0[1] ^= aes_inv_sbox[16] ^ aes_inv_sbox[83] ^ aes_inv_sbox[150] ^ aes_inv_sbox[212]
329  st0[2] ^= aes_inv_sbox[32] ^ aes_inv_sbox[96] ^ aes_inv_sbox[160] ^ aes_inv_sbox[236]
330  st0[3] ^= aes_inv_sbox[48] ^ aes_inv_sbox[112] ^ aes_inv_sbox[187] ^ aes_inv_sbox[247]
332  cycle
333  st1[0] = inv_mix_columns(inv_subshift(st0, 0)) ^ rkp[0]
334  st1[1] = inv_mix_columns(inv_subshift(st0, 1)) ^ rkp[1]
335  st1[2] = inv_mix_columns(inv_subshift(st0, 2)) ^ rkp[2]
336  st1[3] = inv_mix_columns(inv_subshift(st0, 3)) ^ rkp[3]
338  If round == rounds - 2 Then Break
341  st0[0] = inv_mix_columns(inv_subshift(st1, 0)) ^ rkp[4]
342  st0[1] = inv_mix_columns(inv_subshift(st1, 1)) ^ rkp[5]
343  st0[2] = inv_mix_columns(inv_subshift(st1, 2)) ^ rkp[6]
344  st0[3] = inv_mix_columns(inv_subshift(st1, 3)) ^ rkp[7]
347  put_unaligned_le32(inv_subshift(st1, 0) ^ rkp[4], out)
348  put_unaligned_le32(inv_subshift(st1, 1) ^ rkp[5], out + 4)
349  put_unaligned_le32(inv_subshift(st1, 2) ^ rkp[6], out + 8)
350  put_unaligned_le32(inv_subshift(st1, 3) ^ rkp[7], out + 12)