Lines Matching refs:hdata
352 int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, in cryptodev_hash_init() argument
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()
386 ahash_request_set_callback(hdata->async.request, in cryptodev_hash_init()
388 cryptodev_complete, &hdata->async.result); in cryptodev_hash_init()
389 hdata->init = 1; in cryptodev_hash_init()
393 crypto_free_ahash(hdata->async.s); in cryptodev_hash_init()
397 void cryptodev_hash_deinit(struct hash_data *hdata) in cryptodev_hash_deinit() argument
399 if (hdata->init) { in cryptodev_hash_deinit()
400 ahash_request_free(hdata->async.request); in cryptodev_hash_deinit()
401 crypto_free_ahash(hdata->async.s); in cryptodev_hash_deinit()
402 hdata->init = 0; in cryptodev_hash_deinit()
406 int cryptodev_hash_reset(struct hash_data *hdata) in cryptodev_hash_reset() argument
410 ret = crypto_ahash_init(hdata->async.request); in cryptodev_hash_reset()
420 ssize_t cryptodev_hash_update(struct hash_data *hdata, in cryptodev_hash_update() argument
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()
433 int cryptodev_hash_final(struct hash_data *hdata, void *output) in cryptodev_hash_final() argument
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()