Lines Matching refs:op
20 struct sun4i_tfm_ctx *op = crypto_tfm_ctx(tfm); in sun4i_hash_crainit() local
25 memset(op, 0, sizeof(struct sun4i_tfm_ctx)); in sun4i_hash_crainit()
28 op->ss = algt->ss; in sun4i_hash_crainit()
30 err = pm_runtime_get_sync(op->ss->dev); in sun4i_hash_crainit()
41 struct sun4i_tfm_ctx *op = crypto_tfm_ctx(tfm); in sun4i_hash_craexit() local
43 pm_runtime_put(op->ss->dev); in sun4i_hash_craexit()
49 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_init() local
54 memset(op, 0, sizeof(struct sun4i_req_ctx)); in sun4i_hash_init()
57 op->mode = algt->mode; in sun4i_hash_init()
64 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_export_md5() local
68 octx->byte_count = op->byte_count + op->len; in sun4i_hash_export_md5()
70 memcpy(octx->block, op->buf, op->len); in sun4i_hash_export_md5()
72 if (op->byte_count) { in sun4i_hash_export_md5()
74 octx->hash[i] = op->hash[i]; in sun4i_hash_export_md5()
87 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_import_md5() local
93 op->byte_count = ictx->byte_count & ~0x3F; in sun4i_hash_import_md5()
94 op->len = ictx->byte_count & 0x3F; in sun4i_hash_import_md5()
96 memcpy(op->buf, ictx->block, op->len); in sun4i_hash_import_md5()
99 op->hash[i] = ictx->hash[i]; in sun4i_hash_import_md5()
106 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_export_sha1() local
110 octx->count = op->byte_count + op->len; in sun4i_hash_export_sha1()
112 memcpy(octx->buffer, op->buf, op->len); in sun4i_hash_export_sha1()
114 if (op->byte_count) { in sun4i_hash_export_sha1()
116 octx->state[i] = op->hash[i]; in sun4i_hash_export_sha1()
130 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_import_sha1() local
136 op->byte_count = ictx->count & ~0x3F; in sun4i_hash_import_sha1()
137 op->len = ictx->count & 0x3F; in sun4i_hash_import_sha1()
139 memcpy(op->buf, ictx->buffer, op->len); in sun4i_hash_import_sha1()
142 op->hash[i] = ictx->state[i]; in sun4i_hash_import_sha1()
192 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash() local
204 op->byte_count, areq->nbytes, op->mode, in sun4i_hash()
205 op->len, op->hash[0]); in sun4i_hash()
207 if (unlikely(!areq->nbytes) && !(op->flags & SS_HASH_FINAL)) in sun4i_hash()
211 if (unlikely(areq->nbytes > UINT_MAX - op->len)) { in sun4i_hash()
216 if (op->len + areq->nbytes < 64 && !(op->flags & SS_HASH_FINAL)) { in sun4i_hash()
219 op->buf + op->len, areq->nbytes, 0); in sun4i_hash()
220 op->len += copied; in sun4i_hash()
230 if (op->byte_count) { in sun4i_hash()
233 writel(op->hash[i], ss->base + SS_IV0 + i * 4); in sun4i_hash()
236 writel(op->mode | SS_ENABLED | ivmode, ss->base + SS_CTL); in sun4i_hash()
238 if (!(op->flags & SS_HASH_UPDATE)) in sun4i_hash()
242 if (!(op->flags & SS_HASH_FINAL)) { in sun4i_hash()
243 end = ((areq->nbytes + op->len) / 64) * 64 - op->len; in sun4i_hash()
256 end = ((areq->nbytes + op->len) / 4) * 4 - op->len; in sun4i_hash()
266 if (i == 1 && !op->len && areq->nbytes) in sun4i_hash()
281 if (op->len || (mi.length - in_i) < 4) { in sun4i_hash()
287 while (op->len < 64 && i < end) { in sun4i_hash()
289 in_r = min(end - i, 64 - op->len); in sun4i_hash()
291 memcpy(op->buf + op->len, mi.addr + in_i, in_r); in sun4i_hash()
292 op->len += in_r; in sun4i_hash()
300 if (op->len > 3 && !(op->len % 4)) { in sun4i_hash()
302 writesl(ss->base + SS_RXFIFO, op->buf, in sun4i_hash()
303 op->len / 4); in sun4i_hash()
304 op->byte_count += op->len; in sun4i_hash()
305 op->len = 0; in sun4i_hash()
315 op->byte_count += todo * 4; in sun4i_hash()
335 while (i < areq->nbytes && in_i < mi.length && op->len < 64) { in sun4i_hash()
337 in_r = min(areq->nbytes - i, 64 - op->len); in sun4i_hash()
339 memcpy(op->buf + op->len, mi.addr + in_i, in_r); in sun4i_hash()
340 op->len += in_r; in sun4i_hash()
357 if (op->flags & SS_HASH_FINAL) in sun4i_hash()
360 writel(op->mode | SS_ENABLED | SS_DATA_END, ss->base + SS_CTL); in sun4i_hash()
384 op->hash[i] = readl(ss->base + SS_MD0 + i * 4); in sun4i_hash()
403 if (op->len) { in sun4i_hash()
404 nwait = op->len / 4; in sun4i_hash()
406 writesl(ss->base + SS_RXFIFO, op->buf, nwait); in sun4i_hash()
407 op->byte_count += 4 * nwait; in sun4i_hash()
410 nbw = op->len - 4 * nwait; in sun4i_hash()
412 wb = le32_to_cpup((__le32 *)(op->buf + nwait * 4)); in sun4i_hash()
415 op->byte_count += nbw; in sun4i_hash()
429 fill = 64 - (op->byte_count % 64); in sun4i_hash()
439 if (op->mode == SS_OP_SHA1) { in sun4i_hash()
441 *bits = cpu_to_be64(op->byte_count << 3); in sun4i_hash()
445 *bits = cpu_to_le64(op->byte_count << 3); in sun4i_hash()
451 writel(op->mode | SS_ENABLED | SS_DATA_END, ss->base + SS_CTL); in sun4i_hash()
481 if (op->mode == SS_OP_SHA1) { in sun4i_hash()
504 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_final() local
506 op->flags = SS_HASH_FINAL; in sun4i_hash_final()
512 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_update() local
514 op->flags = SS_HASH_UPDATE; in sun4i_hash_update()
521 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_finup() local
523 op->flags = SS_HASH_UPDATE | SS_HASH_FINAL; in sun4i_hash_finup()
531 struct sun4i_req_ctx *op = ahash_request_ctx(areq); in sun4i_hash_digest() local
537 op->flags = SS_HASH_UPDATE | SS_HASH_FINAL; in sun4i_hash_digest()