Lines Matching refs:req_ctx

1093 	struct artpec6_crypto_request_context *req_ctx = NULL;  in artpec6_crypto_encrypt()  local
1097 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_encrypt()
1103 req_ctx->decrypt = 0; in artpec6_crypto_encrypt()
1118 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_encrypt()
1127 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_encrypt()
1131 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_encrypt()
1139 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_decrypt() local
1142 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_decrypt()
1148 req_ctx->decrypt = 1; in artpec6_crypto_decrypt()
1164 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_decrypt()
1172 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_decrypt()
1176 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_decrypt()
1270 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_encrypt() local
1272 req_ctx->decrypt = false; in artpec6_crypto_aead_encrypt()
1273 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_aead_encrypt()
1281 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1285 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1291 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_decrypt() local
1293 req_ctx->decrypt = true; in artpec6_crypto_aead_decrypt()
1297 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_aead_decrypt()
1306 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1310 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1316 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(areq); in artpec6_crypto_prepare_hash() local
1322 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_hash()
1333 if (req_ctx->hash_flags & HASH_FLAG_HMAC) { in artpec6_crypto_prepare_hash()
1335 req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1338 req_ctx->key_md = FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1343 memcpy(req_ctx->key_buffer, ctx->hmac_key, in artpec6_crypto_prepare_hash()
1345 memset(req_ctx->key_buffer + ctx->hmac_key_length, 0, in artpec6_crypto_prepare_hash()
1349 (void *)&req_ctx->key_md, in artpec6_crypto_prepare_hash()
1350 sizeof(req_ctx->key_md), false, false); in artpec6_crypto_prepare_hash()
1355 req_ctx->key_buffer, blocksize, in artpec6_crypto_prepare_hash()
1361 if (!(req_ctx->hash_flags & HASH_FLAG_INIT_CTX)) { in artpec6_crypto_prepare_hash()
1370 req_ctx->hash_md &= ~A6_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1371 req_ctx->hash_md |= FIELD_PREP(A6_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1374 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1375 req_ctx->hash_md |= A6_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1377 req_ctx->hash_md &= ~A7_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1378 req_ctx->hash_md |= FIELD_PREP(A7_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1381 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1382 req_ctx->hash_md |= A7_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1387 (void *)&req_ctx->hash_md, in artpec6_crypto_prepare_hash()
1388 sizeof(req_ctx->hash_md), false, false); in artpec6_crypto_prepare_hash()
1398 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1405 if (req_ctx->hash_flags & HASH_FLAG_UPDATE) { in artpec6_crypto_prepare_hash()
1407 size_t total_bytes = areq->nbytes + req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1412 if (req_ctx->partial_bytes && ready_bytes) { in artpec6_crypto_prepare_hash()
1417 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1418 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1419 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1422 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1423 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1429 done_bytes += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1430 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1446 req_ctx->partial_buffer + in artpec6_crypto_prepare_hash()
1447 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1450 req_ctx->partial_bytes += sg_rem; in artpec6_crypto_prepare_hash()
1453 req_ctx->digcnt += ready_bytes; in artpec6_crypto_prepare_hash()
1454 req_ctx->hash_flags &= ~(HASH_FLAG_UPDATE); in artpec6_crypto_prepare_hash()
1458 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) { in artpec6_crypto_prepare_hash()
1465 oper = FIELD_GET(A6_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1467 oper = FIELD_GET(A7_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1470 if (req_ctx->partial_bytes) { in artpec6_crypto_prepare_hash()
1471 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1472 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1473 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1475 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1476 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1481 req_ctx->digcnt += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1482 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1485 if (req_ctx->hash_flags & HASH_FLAG_HMAC) in artpec6_crypto_prepare_hash()
1486 digest_bits = 8 * (req_ctx->digcnt + blocksize); in artpec6_crypto_prepare_hash()
1488 digest_bits = 8 * req_ctx->digcnt; in artpec6_crypto_prepare_hash()
1491 hash_pad_len = create_hash_pad(oper, req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1492 req_ctx->digcnt, digest_bits); in artpec6_crypto_prepare_hash()
1494 req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1497 req_ctx->digcnt = 0; in artpec6_crypto_prepare_hash()
1512 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1524 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1531 req_ctx->hash_flags &= ~(HASH_FLAG_INIT_CTX | HASH_FLAG_UPDATE | in artpec6_crypto_prepare_hash()
1687 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_prepare_crypto() local
1697 req_ctx = skcipher_request_ctx(areq); in artpec6_crypto_prepare_crypto()
1698 common = &req_ctx->common; in artpec6_crypto_prepare_crypto()
1717 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_crypto()
1744 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1749 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1759 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1762 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1764 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1774 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1775 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1778 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1780 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1781 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1784 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1788 &req_ctx->cipher_md, in artpec6_crypto_prepare_crypto()
1789 sizeof(req_ctx->cipher_md), in artpec6_crypto_prepare_crypto()
1854 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_prepare_aead() local
1856 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_aead()
1881 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_aead()
1898 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1900 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1902 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1903 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1905 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1907 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1909 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1910 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1914 (void *) &req_ctx->cipher_md, in artpec6_crypto_prepare_aead()
1915 sizeof(req_ctx->cipher_md), false, in artpec6_crypto_prepare_aead()
1926 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1930 req_ctx->hw_ctx.aad_length_bits = in artpec6_crypto_prepare_aead()
1933 req_ctx->hw_ctx.text_length_bits = in artpec6_crypto_prepare_aead()
1936 memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher)); in artpec6_crypto_prepare_aead()
1938 memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4); in artpec6_crypto_prepare_aead()
1940 ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx, in artpec6_crypto_prepare_aead()
1991 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
2023 if (req_ctx->decrypt) { in artpec6_crypto_prepare_aead()
2025 req_ctx->decryption_tag, count, false); in artpec6_crypto_prepare_aead()
2174 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_complete_aead() local
2176 if (req_ctx->decrypt) { in artpec6_crypto_complete_aead()
2186 if (memcmp(req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2193 req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2254 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_init_hash() local
2257 memset(req_ctx, 0, sizeof(*req_ctx)); in artpec6_crypto_init_hash()
2259 req_ctx->hash_flags = HASH_FLAG_INIT_CTX; in artpec6_crypto_init_hash()
2261 req_ctx->hash_flags |= (HASH_FLAG_HMAC | HASH_FLAG_UPDATE_KEY); in artpec6_crypto_init_hash()
2283 req_ctx->hash_md = FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2285 req_ctx->hash_md = FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2292 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_prepare_submit_hash() local
2295 if (!req_ctx->common.dma) { in artpec6_crypto_prepare_submit_hash()
2296 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_prepare_submit_hash()
2308 ret = artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2316 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2325 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_final() local
2327 req_ctx->hash_flags |= HASH_FLAG_FINALIZE; in artpec6_crypto_hash_final()
2334 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_update() local
2336 req_ctx->hash_flags |= HASH_FLAG_UPDATE; in artpec6_crypto_hash_update()
2348 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha1_digest() local
2352 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha1_digest()
2364 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha256_digest() local
2367 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha256_digest()
2380 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha384_digest() local
2383 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha384_digest()
2395 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha512_digest() local
2398 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha512_digest()
2421 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha256_digest() local
2424 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha256_digest()
2432 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha384_digest() local
2435 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha384_digest()
2442 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha512_digest() local
2445 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha512_digest()