···49495050Here's an example of how to use the API:51515252- #include <linux/crypto.h>5252+ #include <crypto/ahash.h>5353 #include <linux/err.h>5454 #include <linux/scatterlist.h>55555656 struct scatterlist sg[2];5757 char result[128];5858- struct crypto_hash *tfm;5959- struct hash_desc desc;5858+ struct crypto_ahash *tfm;5959+ struct ahash_request *req;60606161- tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);6161+ tfm = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC);6262 if (IS_ERR(tfm))6363 fail();64646565 /* ... set up the scatterlists ... */66666767- desc.tfm = tfm;6868- desc.flags = 0;6969-7070- if (crypto_hash_digest(&desc, sg, 2, result))6767+ req = ahash_request_alloc(tfm, GFP_ATOMIC);6868+ if (!req)7169 fail();7070+7171+ ahash_request_set_callback(req, 0, NULL, NULL);7272+ ahash_request_set_crypt(req, sg, result, 2);72737373- crypto_free_hash(tfm);7474+ if (crypto_ahash_digest(req))7575+ fail();7676+7777+ ahash_request_free(req);7878+ crypto_free_ahash(tfm);747975807681Many real examples are available in the regression test module (tcrypt.c).