Lines Matching refs:req_ctx
1089 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_encrypt() local
1093 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_encrypt()
1099 req_ctx->decrypt = 0; in artpec6_crypto_encrypt()
1114 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_encrypt()
1123 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_encrypt()
1127 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_encrypt()
1135 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_decrypt() local
1138 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_decrypt()
1144 req_ctx->decrypt = 1; in artpec6_crypto_decrypt()
1160 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_decrypt()
1168 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_decrypt()
1172 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_decrypt()
1266 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_encrypt() local
1268 req_ctx->decrypt = false; in artpec6_crypto_aead_encrypt()
1269 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_aead_encrypt()
1277 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1281 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1287 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_decrypt() local
1289 req_ctx->decrypt = true; in artpec6_crypto_aead_decrypt()
1293 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_aead_decrypt()
1302 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1306 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1312 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(areq); in artpec6_crypto_prepare_hash() local
1317 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_hash()
1328 if (req_ctx->hash_flags & HASH_FLAG_HMAC) { in artpec6_crypto_prepare_hash()
1330 req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1333 req_ctx->key_md = FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1338 memcpy(req_ctx->key_buffer, ctx->hmac_key, in artpec6_crypto_prepare_hash()
1340 memset(req_ctx->key_buffer + ctx->hmac_key_length, 0, in artpec6_crypto_prepare_hash()
1344 (void *)&req_ctx->key_md, in artpec6_crypto_prepare_hash()
1345 sizeof(req_ctx->key_md), false, false); in artpec6_crypto_prepare_hash()
1350 req_ctx->key_buffer, blocksize, in artpec6_crypto_prepare_hash()
1356 if (!(req_ctx->hash_flags & HASH_FLAG_INIT_CTX)) { in artpec6_crypto_prepare_hash()
1365 req_ctx->hash_md &= ~A6_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1366 req_ctx->hash_md |= FIELD_PREP(A6_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1369 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1370 req_ctx->hash_md |= A6_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1372 req_ctx->hash_md &= ~A7_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1373 req_ctx->hash_md |= FIELD_PREP(A7_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1376 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1377 req_ctx->hash_md |= A7_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1382 (void *)&req_ctx->hash_md, in artpec6_crypto_prepare_hash()
1383 sizeof(req_ctx->hash_md), false, false); in artpec6_crypto_prepare_hash()
1393 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1400 if (req_ctx->hash_flags & HASH_FLAG_UPDATE) { in artpec6_crypto_prepare_hash()
1402 size_t total_bytes = areq->nbytes + req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1407 if (req_ctx->partial_bytes && ready_bytes) { in artpec6_crypto_prepare_hash()
1412 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1413 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1414 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1417 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1418 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1424 done_bytes += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1425 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1441 req_ctx->partial_buffer + in artpec6_crypto_prepare_hash()
1442 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1445 req_ctx->partial_bytes += sg_rem; in artpec6_crypto_prepare_hash()
1448 req_ctx->digcnt += ready_bytes; in artpec6_crypto_prepare_hash()
1449 req_ctx->hash_flags &= ~(HASH_FLAG_UPDATE); in artpec6_crypto_prepare_hash()
1453 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) { in artpec6_crypto_prepare_hash()
1459 oper = FIELD_GET(A6_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1461 oper = FIELD_GET(A7_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1464 if (req_ctx->partial_bytes) { in artpec6_crypto_prepare_hash()
1465 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1466 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1467 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1469 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1470 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1475 req_ctx->digcnt += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1476 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1479 if (req_ctx->hash_flags & HASH_FLAG_HMAC) in artpec6_crypto_prepare_hash()
1480 digest_bits = 8 * (req_ctx->digcnt + blocksize); in artpec6_crypto_prepare_hash()
1482 digest_bits = 8 * req_ctx->digcnt; in artpec6_crypto_prepare_hash()
1485 hash_pad_len = create_hash_pad(oper, req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1486 req_ctx->digcnt, digest_bits); in artpec6_crypto_prepare_hash()
1488 req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1491 req_ctx->digcnt = 0; in artpec6_crypto_prepare_hash()
1509 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1516 req_ctx->hash_flags &= ~(HASH_FLAG_INIT_CTX | HASH_FLAG_UPDATE | in artpec6_crypto_prepare_hash()
1671 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_prepare_crypto() local
1681 req_ctx = skcipher_request_ctx(areq); in artpec6_crypto_prepare_crypto()
1682 common = &req_ctx->common; in artpec6_crypto_prepare_crypto()
1701 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_crypto()
1728 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1733 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1743 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1746 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1748 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1758 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1759 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1762 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1764 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1765 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1768 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1772 &req_ctx->cipher_md, in artpec6_crypto_prepare_crypto()
1773 sizeof(req_ctx->cipher_md), in artpec6_crypto_prepare_crypto()
1838 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_prepare_aead() local
1840 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_aead()
1865 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_aead()
1882 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1884 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1886 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1887 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1889 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1891 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1893 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1894 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1898 (void *) &req_ctx->cipher_md, in artpec6_crypto_prepare_aead()
1899 sizeof(req_ctx->cipher_md), false, in artpec6_crypto_prepare_aead()
1910 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1914 req_ctx->hw_ctx.aad_length_bits = in artpec6_crypto_prepare_aead()
1917 req_ctx->hw_ctx.text_length_bits = in artpec6_crypto_prepare_aead()
1920 memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher)); in artpec6_crypto_prepare_aead()
1922 memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4); in artpec6_crypto_prepare_aead()
1924 ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx, in artpec6_crypto_prepare_aead()
1975 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
2006 if (req_ctx->decrypt) { in artpec6_crypto_prepare_aead()
2008 req_ctx->decryption_tag, AES_BLOCK_SIZE, false); in artpec6_crypto_prepare_aead()
2192 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_complete_aead() local
2194 if (req_ctx->decrypt) { in artpec6_crypto_complete_aead()
2205 if (crypto_memneq(req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2212 req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2271 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_init_hash() local
2274 memset(req_ctx, 0, sizeof(*req_ctx)); in artpec6_crypto_init_hash()
2276 req_ctx->hash_flags = HASH_FLAG_INIT_CTX; in artpec6_crypto_init_hash()
2278 req_ctx->hash_flags |= (HASH_FLAG_HMAC | HASH_FLAG_UPDATE_KEY); in artpec6_crypto_init_hash()
2293 req_ctx->hash_md = FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2295 req_ctx->hash_md = FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2302 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_prepare_submit_hash() local
2305 if (!req_ctx->common.dma) { in artpec6_crypto_prepare_submit_hash()
2306 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_prepare_submit_hash()
2318 ret = artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2326 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2335 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_final() local
2337 req_ctx->hash_flags |= HASH_FLAG_FINALIZE; in artpec6_crypto_hash_final()
2344 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_update() local
2346 req_ctx->hash_flags |= HASH_FLAG_UPDATE; in artpec6_crypto_hash_update()
2358 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha1_digest() local
2362 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha1_digest()
2374 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha256_digest() local
2377 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha256_digest()
2389 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha256_digest() local
2392 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha256_digest()