Lines Matching refs:req
170 static int hctr2_hash_tweak(struct skcipher_request *req) in hctr2_hash_tweak() argument
172 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in hctr2_hash_tweak()
174 struct hctr2_request_ctx *rctx = skcipher_request_ctx(req); in hctr2_hash_tweak()
177 bool has_remainder = req->cryptlen % POLYVAL_BLOCK_SIZE; in hctr2_hash_tweak()
183 err = crypto_shash_update(hash_desc, req->iv, TWEAK_SIZE); in hctr2_hash_tweak()
192 static int hctr2_hash_message(struct skcipher_request *req, in hctr2_hash_message() argument
197 struct hctr2_request_ctx *rctx = skcipher_request_ctx(req); in hctr2_hash_message()
199 const unsigned int bulk_len = req->cryptlen - BLOCKCIPHER_BLOCK_SIZE; in hctr2_hash_message()
229 static int hctr2_finish(struct skcipher_request *req) in hctr2_finish() argument
231 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in hctr2_finish()
233 struct hctr2_request_ctx *rctx = skcipher_request_ctx(req); in hctr2_finish()
244 err = hctr2_hash_message(req, rctx->bulk_part_dst, digest); in hctr2_finish()
250 scatterwalk_map_and_copy(rctx->first_block, req->dst, in hctr2_finish()
257 struct skcipher_request *req = data; in hctr2_xctr_done() local
260 err = hctr2_finish(req); in hctr2_xctr_done()
262 skcipher_request_complete(req, err); in hctr2_xctr_done()
265 static int hctr2_crypt(struct skcipher_request *req, bool enc) in hctr2_crypt() argument
267 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in hctr2_crypt()
269 struct hctr2_request_ctx *rctx = skcipher_request_ctx(req); in hctr2_crypt()
271 int bulk_len = req->cryptlen - BLOCKCIPHER_BLOCK_SIZE; in hctr2_crypt()
275 if (req->cryptlen < BLOCKCIPHER_BLOCK_SIZE) in hctr2_crypt()
279 scatterwalk_map_and_copy(rctx->first_block, req->src, in hctr2_crypt()
283 rctx->bulk_part_src = scatterwalk_ffwd(rctx->sg_src, req->src, in hctr2_crypt()
285 rctx->bulk_part_dst = scatterwalk_ffwd(rctx->sg_dst, req->dst, in hctr2_crypt()
290 err = hctr2_hash_tweak(req); in hctr2_crypt()
293 err = hctr2_hash_message(req, rctx->bulk_part_src, digest); in hctr2_crypt()
318 req->base.flags, in hctr2_crypt()
319 hctr2_xctr_done, req); in hctr2_crypt()
321 hctr2_finish(req); in hctr2_crypt()
324 static int hctr2_encrypt(struct skcipher_request *req) in hctr2_encrypt() argument
326 return hctr2_crypt(req, true); in hctr2_encrypt()
329 static int hctr2_decrypt(struct skcipher_request *req) in hctr2_decrypt() argument
331 return hctr2_crypt(req, false); in hctr2_decrypt()