Lines Matching refs:rk
104 static inline u32 sm4_round(u32 x0, u32 x1, u32 x2, u32 x3, u32 rk) in sm4_round() argument
106 return x0 ^ sm4_enc_sub(x1 ^ x2 ^ x3 ^ rk); in sm4_round()
122 u32 rk[4]; in sm4_expandkey() local
129 rk[0] = get_unaligned_be32(&key[0]) ^ fk[0]; in sm4_expandkey()
130 rk[1] = get_unaligned_be32(&key[1]) ^ fk[1]; in sm4_expandkey()
131 rk[2] = get_unaligned_be32(&key[2]) ^ fk[2]; in sm4_expandkey()
132 rk[3] = get_unaligned_be32(&key[3]) ^ fk[3]; in sm4_expandkey()
135 rk[0] ^= sm4_key_sub(rk[1] ^ rk[2] ^ rk[3] ^ ck[i + 0]); in sm4_expandkey()
136 rk[1] ^= sm4_key_sub(rk[2] ^ rk[3] ^ rk[0] ^ ck[i + 1]); in sm4_expandkey()
137 rk[2] ^= sm4_key_sub(rk[3] ^ rk[0] ^ rk[1] ^ ck[i + 2]); in sm4_expandkey()
138 rk[3] ^= sm4_key_sub(rk[0] ^ rk[1] ^ rk[2] ^ ck[i + 3]); in sm4_expandkey()
140 ctx->rkey_enc[i + 0] = rk[0]; in sm4_expandkey()
141 ctx->rkey_enc[i + 1] = rk[1]; in sm4_expandkey()
142 ctx->rkey_enc[i + 2] = rk[2]; in sm4_expandkey()
143 ctx->rkey_enc[i + 3] = rk[3]; in sm4_expandkey()
144 ctx->rkey_dec[31 - 0 - i] = rk[0]; in sm4_expandkey()
145 ctx->rkey_dec[31 - 1 - i] = rk[1]; in sm4_expandkey()
146 ctx->rkey_dec[31 - 2 - i] = rk[2]; in sm4_expandkey()
147 ctx->rkey_dec[31 - 3 - i] = rk[3]; in sm4_expandkey()
160 void sm4_crypt_block(const u32 *rk, u8 *out, const u8 *in) in sm4_crypt_block() argument
170 x[0] = sm4_round(x[0], x[1], x[2], x[3], rk[i + 0]); in sm4_crypt_block()
171 x[1] = sm4_round(x[1], x[2], x[3], x[0], rk[i + 1]); in sm4_crypt_block()
172 x[2] = sm4_round(x[2], x[3], x[0], x[1], rk[i + 2]); in sm4_crypt_block()
173 x[3] = sm4_round(x[3], x[0], x[1], x[2], rk[i + 3]); in sm4_crypt_block()