Lines Matching defs:desc
71 static int shash_update_unaligned(struct shash_desc *desc, const u8 *data,
74 struct crypto_shash *tfm = desc->tfm;
88 err = shash->update(desc, buf, unaligned_len);
92 shash->update(desc, data + unaligned_len, len - unaligned_len);
95 int crypto_shash_update(struct shash_desc *desc, const u8 *data,
98 struct crypto_shash *tfm = desc->tfm;
103 return shash_update_unaligned(desc, data, len);
105 return shash->update(desc, data, len);
109 static int shash_final_unaligned(struct shash_desc *desc, u8 *out)
111 struct crypto_shash *tfm = desc->tfm;
120 err = shash->final(desc, buf);
131 int crypto_shash_final(struct shash_desc *desc, u8 *out)
133 struct crypto_shash *tfm = desc->tfm;
138 return shash_final_unaligned(desc, out);
140 return shash->final(desc, out);
144 static int shash_finup_unaligned(struct shash_desc *desc, const u8 *data,
147 return crypto_shash_update(desc, data, len) ?:
148 crypto_shash_final(desc, out);
151 int crypto_shash_finup(struct shash_desc *desc, const u8 *data,
154 struct crypto_shash *tfm = desc->tfm;
159 return shash_finup_unaligned(desc, data, len, out);
161 return shash->finup(desc, data, len, out);
165 static int shash_digest_unaligned(struct shash_desc *desc, const u8 *data,
168 return crypto_shash_init(desc) ?:
169 crypto_shash_finup(desc, data, len, out);
172 int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
175 struct crypto_shash *tfm = desc->tfm;
180 return shash_digest_unaligned(desc, data, len, out);
182 return shash->digest(desc, data, len, out);
186 static int shash_default_export(struct shash_desc *desc, void *out)
188 memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm));
192 static int shash_default_import(struct shash_desc *desc, const void *in)
194 memcpy(shash_desc_ctx(desc), in, crypto_shash_descsize(desc->tfm));
209 struct shash_desc *desc = ahash_request_ctx(req);
211 desc->tfm = *ctx;
212 desc->flags = req->base.flags;
214 return crypto_shash_init(desc);
217 int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc)
224 nbytes = crypto_shash_update(desc, walk.data, nbytes);
240 int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc)
247 return crypto_shash_final(desc, req->result);
251 crypto_shash_finup(desc, walk.data, nbytes,
253 crypto_shash_update(desc, walk.data, nbytes);
264 struct shash_desc *desc = ahash_request_ctx(req);
266 desc->tfm = *ctx;
267 desc->flags = req->base.flags;
269 return shash_ahash_finup(req, desc);
272 int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
283 err = crypto_shash_digest(desc, data + offset, nbytes,
286 crypto_yield(desc->flags);
288 err = crypto_shash_init(desc) ?:
289 shash_ahash_finup(req, desc);
298 struct shash_desc *desc = ahash_request_ctx(req);
300 desc->tfm = *ctx;
301 desc->flags = req->base.flags;
303 return shash_ahash_digest(req, desc);
365 struct shash_desc *desc = *descp;
367 return crypto_shash_setkey(desc->tfm, key, keylen);
373 struct shash_desc *desc = *descp;
375 desc->flags = hdesc->flags;
377 return crypto_shash_init(desc);
384 struct shash_desc *desc = *descp;
390 nbytes = crypto_shash_update(desc, walk.data, nbytes);
410 struct shash_desc *desc = *descp;
413 desc->flags = hdesc->flags;
416 err = crypto_shash_digest(desc, data + offset, nbytes, out);
418 crypto_yield(desc->flags);
439 struct shash_desc *desc = *descp;
441 crypto_free_shash(desc->tfm);
442 kzfree(desc);
452 struct shash_desc *desc;
463 desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(shash),
465 if (!desc) {
470 *descp = desc;
471 desc->tfm = shash;