Lines Matching refs:skreq

51 static void free_src_sglist(struct skcipher_request *skreq)  in free_src_sglist()  argument
53 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in free_src_sglist()
58 static void free_dst_sglist(struct skcipher_request *skreq) in free_dst_sglist() argument
60 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in free_dst_sglist()
67 struct skcipher_request *skreq = arg; in nitrox_skcipher_callback() local
69 free_src_sglist(skreq); in nitrox_skcipher_callback()
70 free_dst_sglist(skreq); in nitrox_skcipher_callback()
76 skcipher_request_complete(skreq, err); in nitrox_skcipher_callback()
81 struct skcipher_request *skreq = arg; in nitrox_cbc_cipher_callback() local
82 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in nitrox_cbc_cipher_callback()
83 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(skreq); in nitrox_cbc_cipher_callback()
85 unsigned int start = skreq->cryptlen - ivsize; in nitrox_cbc_cipher_callback()
93 scatterwalk_map_and_copy(skreq->iv, skreq->dst, start, ivsize, in nitrox_cbc_cipher_callback()
96 if (skreq->src != skreq->dst) { in nitrox_cbc_cipher_callback()
97 scatterwalk_map_and_copy(skreq->iv, skreq->src, start, in nitrox_cbc_cipher_callback()
100 memcpy(skreq->iv, nkreq->iv_out, ivsize); in nitrox_cbc_cipher_callback()
208 static int alloc_src_sglist(struct skcipher_request *skreq, int ivsize) in alloc_src_sglist() argument
210 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in alloc_src_sglist()
211 int nents = sg_nents(skreq->src) + 1; in alloc_src_sglist()
219 nitrox_creq_copy_iv(nkreq->src, skreq->iv, ivsize); in alloc_src_sglist()
220 nitrox_creq_set_src_sg(nkreq, nents, ivsize, skreq->src, in alloc_src_sglist()
221 skreq->cryptlen); in alloc_src_sglist()
226 static int alloc_dst_sglist(struct skcipher_request *skreq, int ivsize) in alloc_dst_sglist() argument
228 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in alloc_dst_sglist()
229 int nents = sg_nents(skreq->dst) + 3; in alloc_dst_sglist()
241 nitrox_creq_set_dst_sg(nkreq, nents, ivsize, skreq->dst, in alloc_dst_sglist()
242 skreq->cryptlen); in alloc_dst_sglist()
247 static int nitrox_skcipher_crypt(struct skcipher_request *skreq, bool enc) in nitrox_skcipher_crypt() argument
249 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(skreq); in nitrox_skcipher_crypt()
251 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in nitrox_skcipher_crypt()
257 creq->flags = skreq->base.flags; in nitrox_skcipher_crypt()
258 creq->gfp = (skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? in nitrox_skcipher_crypt()
266 creq->gph.param0 = cpu_to_be16(skreq->cryptlen); in nitrox_skcipher_crypt()
275 ret = alloc_src_sglist(skreq, ivsize); in nitrox_skcipher_crypt()
279 ret = alloc_dst_sglist(skreq, ivsize); in nitrox_skcipher_crypt()
281 free_src_sglist(skreq); in nitrox_skcipher_crypt()
287 skreq); in nitrox_skcipher_crypt()
290 static int nitrox_cbc_decrypt(struct skcipher_request *skreq) in nitrox_cbc_decrypt() argument
292 struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq); in nitrox_cbc_decrypt()
293 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(skreq); in nitrox_cbc_decrypt()
295 gfp_t flags = (skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? in nitrox_cbc_decrypt()
297 unsigned int start = skreq->cryptlen - ivsize; in nitrox_cbc_decrypt()
299 if (skreq->src != skreq->dst) in nitrox_cbc_decrypt()
300 return nitrox_skcipher_crypt(skreq, false); in nitrox_cbc_decrypt()
306 scatterwalk_map_and_copy(nkreq->iv_out, skreq->src, start, ivsize, 0); in nitrox_cbc_decrypt()
307 return nitrox_skcipher_crypt(skreq, false); in nitrox_cbc_decrypt()
310 static int nitrox_aes_encrypt(struct skcipher_request *skreq) in nitrox_aes_encrypt() argument
312 return nitrox_skcipher_crypt(skreq, true); in nitrox_aes_encrypt()
315 static int nitrox_aes_decrypt(struct skcipher_request *skreq) in nitrox_aes_decrypt() argument
317 return nitrox_skcipher_crypt(skreq, false); in nitrox_aes_decrypt()
327 static int nitrox_3des_encrypt(struct skcipher_request *skreq) in nitrox_3des_encrypt() argument
329 return nitrox_skcipher_crypt(skreq, true); in nitrox_3des_encrypt()
332 static int nitrox_3des_decrypt(struct skcipher_request *skreq) in nitrox_3des_decrypt() argument
334 return nitrox_skcipher_crypt(skreq, false); in nitrox_3des_decrypt()