Lines Matching full:async
153 out->async.s = cryptodev_crypto_alloc_blkcipher(alg_name, 0, 0); in cryptodev_cipher_init()
154 if (unlikely(IS_ERR(out->async.s))) { in cryptodev_cipher_init()
156 return PTR_ERR(out->async.s); in cryptodev_cipher_init()
160 tfm = crypto_skcipher_tfm(out->async.s); in cryptodev_cipher_init()
177 alg = crypto_skcipher_alg(out->async.s); in cryptodev_cipher_init()
182 alg = crypto_ablkcipher_alg(out->async.s); in cryptodev_cipher_init()
191 out->blocksize = cryptodev_crypto_blkcipher_blocksize(out->async.s); in cryptodev_cipher_init()
192 out->ivsize = cryptodev_crypto_blkcipher_ivsize(out->async.s); in cryptodev_cipher_init()
193 out->alignmask = cryptodev_crypto_blkcipher_alignmask(out->async.s); in cryptodev_cipher_init()
195 ret = cryptodev_crypto_blkcipher_setkey(out->async.s, keyp, keylen); in cryptodev_cipher_init()
197 out->async.as = crypto_alloc_aead(alg_name, 0, 0); in cryptodev_cipher_init()
198 if (unlikely(IS_ERR(out->async.as))) { in cryptodev_cipher_init()
200 return PTR_ERR(out->async.as); in cryptodev_cipher_init()
203 out->blocksize = crypto_aead_blocksize(out->async.as); in cryptodev_cipher_init()
204 out->ivsize = crypto_aead_ivsize(out->async.as); in cryptodev_cipher_init()
205 out->alignmask = crypto_aead_alignmask(out->async.as); in cryptodev_cipher_init()
207 ret = crypto_aead_setkey(out->async.as, keyp, keylen); in cryptodev_cipher_init()
219 init_completion(&out->async.result.completion); in cryptodev_cipher_init()
222 out->async.request = cryptodev_blkcipher_request_alloc(out->async.s, GFP_KERNEL); in cryptodev_cipher_init()
223 if (unlikely(!out->async.request)) { in cryptodev_cipher_init()
224 derr(1, "error allocating async crypto request"); in cryptodev_cipher_init()
229 cryptodev_blkcipher_request_set_callback(out->async.request, in cryptodev_cipher_init()
231 cryptodev_complete, &out->async.result); in cryptodev_cipher_init()
233 out->async.arequest = aead_request_alloc(out->async.as, GFP_KERNEL); in cryptodev_cipher_init()
234 if (unlikely(!out->async.arequest)) { in cryptodev_cipher_init()
235 derr(1, "error allocating async crypto request"); in cryptodev_cipher_init()
240 aead_request_set_callback(out->async.arequest, in cryptodev_cipher_init()
242 cryptodev_complete, &out->async.result); in cryptodev_cipher_init()
249 cryptodev_blkcipher_request_free(out->async.request); in cryptodev_cipher_init()
250 cryptodev_crypto_free_blkcipher(out->async.s); in cryptodev_cipher_init()
252 if (out->async.arequest) in cryptodev_cipher_init()
253 aead_request_free(out->async.arequest); in cryptodev_cipher_init()
254 if (out->async.as) in cryptodev_cipher_init()
255 crypto_free_aead(out->async.as); in cryptodev_cipher_init()
265 cryptodev_blkcipher_request_free(cdata->async.request); in cryptodev_cipher_deinit()
266 cryptodev_crypto_free_blkcipher(cdata->async.s); in cryptodev_cipher_deinit()
268 if (cdata->async.arequest) in cryptodev_cipher_deinit()
269 aead_request_free(cdata->async.arequest); in cryptodev_cipher_deinit()
270 if (cdata->async.as) in cryptodev_cipher_deinit()
271 crypto_free_aead(cdata->async.as); in cryptodev_cipher_deinit()
293 derr(0, "error from async request: %d", cr->err); in waitfor()
311 reinit_completion(&cdata->async.result.completion); in cryptodev_cipher_encrypt()
314 cryptodev_blkcipher_request_set_crypt(cdata->async.request, in cryptodev_cipher_encrypt()
316 len, cdata->async.iv); in cryptodev_cipher_encrypt()
317 ret = cryptodev_crypto_blkcipher_encrypt(cdata->async.request); in cryptodev_cipher_encrypt()
319 aead_request_set_crypt(cdata->async.arequest, in cryptodev_cipher_encrypt()
321 len, cdata->async.iv); in cryptodev_cipher_encrypt()
322 ret = crypto_aead_encrypt(cdata->async.arequest); in cryptodev_cipher_encrypt()
325 return waitfor(&cdata->async.result, ret); in cryptodev_cipher_encrypt()
334 reinit_completion(&cdata->async.result.completion); in cryptodev_cipher_decrypt()
336 cryptodev_blkcipher_request_set_crypt(cdata->async.request, in cryptodev_cipher_decrypt()
338 len, cdata->async.iv); in cryptodev_cipher_decrypt()
339 ret = cryptodev_crypto_blkcipher_decrypt(cdata->async.request); in cryptodev_cipher_decrypt()
341 aead_request_set_crypt(cdata->async.arequest, in cryptodev_cipher_decrypt()
343 len, cdata->async.iv); in cryptodev_cipher_decrypt()
344 ret = crypto_aead_decrypt(cdata->async.arequest); in cryptodev_cipher_decrypt()
347 return waitfor(&cdata->async.result, ret); in cryptodev_cipher_decrypt()
357 hdata->async.s = crypto_alloc_ahash(alg_name, 0, 0); in cryptodev_hash_init()
358 if (unlikely(IS_ERR(hdata->async.s))) { in cryptodev_hash_init()
360 return PTR_ERR(hdata->async.s); in cryptodev_hash_init()
365 ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen); in cryptodev_hash_init()
374 hdata->digestsize = crypto_ahash_digestsize(hdata->async.s); in cryptodev_hash_init()
375 hdata->alignmask = crypto_ahash_alignmask(hdata->async.s); in cryptodev_hash_init()
377 init_completion(&hdata->async.result.completion); in cryptodev_hash_init()
379 hdata->async.request = ahash_request_alloc(hdata->async.s, GFP_KERNEL); in cryptodev_hash_init()
380 if (unlikely(!hdata->async.request)) { in cryptodev_hash_init()
381 derr(0, "error allocating async crypto request"); in cryptodev_hash_init()
386 ahash_request_set_callback(hdata->async.request, in cryptodev_hash_init()
388 cryptodev_complete, &hdata->async.result); in cryptodev_hash_init()
393 crypto_free_ahash(hdata->async.s); in cryptodev_hash_init()
400 ahash_request_free(hdata->async.request); in cryptodev_hash_deinit()
401 crypto_free_ahash(hdata->async.s); in cryptodev_hash_deinit()
410 ret = crypto_ahash_init(hdata->async.request); in cryptodev_hash_reset()
425 reinit_completion(&hdata->async.result.completion); in cryptodev_hash_update()
426 ahash_request_set_crypt(hdata->async.request, sg, NULL, len); in cryptodev_hash_update()
428 ret = crypto_ahash_update(hdata->async.request); in cryptodev_hash_update()
430 return waitfor(&hdata->async.result, ret); in cryptodev_hash_update()
437 reinit_completion(&hdata->async.result.completion); in cryptodev_hash_final()
438 ahash_request_set_crypt(hdata->async.request, NULL, output, 0); in cryptodev_hash_final()
440 ret = crypto_ahash_final(hdata->async.request); in cryptodev_hash_final()
442 return waitfor(&hdata->async.result, ret); in cryptodev_hash_final()
458 reinit_completion(&src->async.result.completion); in cryptodev_hash_copy()
460 statesize = crypto_ahash_statesize(src->async.s); in cryptodev_hash_copy()
470 ret = crypto_ahash_export(src->async.request, statedata); in cryptodev_hash_copy()
473 tfm = crypto_ahash_tfm(src->async.s); in cryptodev_hash_copy()
481 ret = crypto_ahash_import(dst->async.request, statedata); in cryptodev_hash_copy()
483 tfm = crypto_ahash_tfm(dst->async.s); in cryptodev_hash_copy()