Lines Matching refs:req_ctx

1090 	struct artpec6_crypto_request_context *req_ctx = NULL;  in artpec6_crypto_encrypt()  local
1094 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_encrypt()
1100 req_ctx->decrypt = 0; in artpec6_crypto_encrypt()
1115 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_encrypt()
1124 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_encrypt()
1128 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_encrypt()
1136 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_decrypt() local
1139 req_ctx = skcipher_request_ctx(req); in artpec6_crypto_decrypt()
1145 req_ctx->decrypt = 1; in artpec6_crypto_decrypt()
1161 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_decrypt()
1169 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_decrypt()
1173 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_decrypt()
1265 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_encrypt() local
1267 req_ctx->decrypt = false; in artpec6_crypto_aead_encrypt()
1268 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_aead_encrypt()
1276 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1280 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1286 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_decrypt() local
1288 req_ctx->decrypt = true; in artpec6_crypto_aead_decrypt()
1292 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_aead_decrypt()
1301 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1305 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1311 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(areq); in artpec6_crypto_prepare_hash() local
1316 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_hash()
1327 if (req_ctx->hash_flags & HASH_FLAG_HMAC) { in artpec6_crypto_prepare_hash()
1329 req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1332 req_ctx->key_md = FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1337 memcpy(req_ctx->key_buffer, ctx->hmac_key, in artpec6_crypto_prepare_hash()
1339 memset(req_ctx->key_buffer + ctx->hmac_key_length, 0, in artpec6_crypto_prepare_hash()
1343 (void *)&req_ctx->key_md, in artpec6_crypto_prepare_hash()
1344 sizeof(req_ctx->key_md), false, false); in artpec6_crypto_prepare_hash()
1349 req_ctx->key_buffer, blocksize, in artpec6_crypto_prepare_hash()
1355 if (!(req_ctx->hash_flags & HASH_FLAG_INIT_CTX)) { in artpec6_crypto_prepare_hash()
1364 req_ctx->hash_md &= ~A6_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1365 req_ctx->hash_md |= FIELD_PREP(A6_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1368 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1369 req_ctx->hash_md |= A6_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1371 req_ctx->hash_md &= ~A7_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1372 req_ctx->hash_md |= FIELD_PREP(A7_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1375 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1376 req_ctx->hash_md |= A7_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1381 (void *)&req_ctx->hash_md, in artpec6_crypto_prepare_hash()
1382 sizeof(req_ctx->hash_md), false, false); in artpec6_crypto_prepare_hash()
1392 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1399 if (req_ctx->hash_flags & HASH_FLAG_UPDATE) { in artpec6_crypto_prepare_hash()
1401 size_t total_bytes = areq->nbytes + req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1406 if (req_ctx->partial_bytes && ready_bytes) { in artpec6_crypto_prepare_hash()
1411 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1412 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1413 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1416 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1417 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1423 done_bytes += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1424 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1440 req_ctx->partial_buffer + in artpec6_crypto_prepare_hash()
1441 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1444 req_ctx->partial_bytes += sg_rem; in artpec6_crypto_prepare_hash()
1447 req_ctx->digcnt += ready_bytes; in artpec6_crypto_prepare_hash()
1448 req_ctx->hash_flags &= ~(HASH_FLAG_UPDATE); in artpec6_crypto_prepare_hash()
1452 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) { in artpec6_crypto_prepare_hash()
1458 oper = FIELD_GET(A6_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1460 oper = FIELD_GET(A7_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1463 if (req_ctx->partial_bytes) { in artpec6_crypto_prepare_hash()
1464 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1465 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1466 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1468 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1469 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1474 req_ctx->digcnt += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1475 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1478 if (req_ctx->hash_flags & HASH_FLAG_HMAC) in artpec6_crypto_prepare_hash()
1479 digest_bits = 8 * (req_ctx->digcnt + blocksize); in artpec6_crypto_prepare_hash()
1481 digest_bits = 8 * req_ctx->digcnt; in artpec6_crypto_prepare_hash()
1484 hash_pad_len = create_hash_pad(oper, req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1485 req_ctx->digcnt, digest_bits); in artpec6_crypto_prepare_hash()
1487 req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1490 req_ctx->digcnt = 0; in artpec6_crypto_prepare_hash()
1508 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1515 req_ctx->hash_flags &= ~(HASH_FLAG_INIT_CTX | HASH_FLAG_UPDATE | in artpec6_crypto_prepare_hash()
1670 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_prepare_crypto() local
1680 req_ctx = skcipher_request_ctx(areq); in artpec6_crypto_prepare_crypto()
1681 common = &req_ctx->common; in artpec6_crypto_prepare_crypto()
1700 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_crypto()
1727 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1732 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1742 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1745 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1747 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1757 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1758 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1761 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1763 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1764 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1767 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1771 &req_ctx->cipher_md, in artpec6_crypto_prepare_crypto()
1772 sizeof(req_ctx->cipher_md), in artpec6_crypto_prepare_crypto()
1837 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_prepare_aead() local
1839 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_aead()
1864 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_aead()
1881 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1883 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1885 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1886 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1888 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1890 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1892 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1893 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1897 (void *) &req_ctx->cipher_md, in artpec6_crypto_prepare_aead()
1898 sizeof(req_ctx->cipher_md), false, in artpec6_crypto_prepare_aead()
1909 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1913 req_ctx->hw_ctx.aad_length_bits = in artpec6_crypto_prepare_aead()
1916 req_ctx->hw_ctx.text_length_bits = in artpec6_crypto_prepare_aead()
1919 memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher)); in artpec6_crypto_prepare_aead()
1921 memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4); in artpec6_crypto_prepare_aead()
1923 ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx, in artpec6_crypto_prepare_aead()
1974 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
2005 if (req_ctx->decrypt) { in artpec6_crypto_prepare_aead()
2007 req_ctx->decryption_tag, AES_BLOCK_SIZE, false); in artpec6_crypto_prepare_aead()
2191 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_complete_aead() local
2193 if (req_ctx->decrypt) { in artpec6_crypto_complete_aead()
2204 if (crypto_memneq(req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2211 req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2266 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_init_hash() local
2269 memset(req_ctx, 0, sizeof(*req_ctx)); in artpec6_crypto_init_hash()
2271 req_ctx->hash_flags = HASH_FLAG_INIT_CTX; in artpec6_crypto_init_hash()
2273 req_ctx->hash_flags |= (HASH_FLAG_HMAC | HASH_FLAG_UPDATE_KEY); in artpec6_crypto_init_hash()
2288 req_ctx->hash_md = FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2290 req_ctx->hash_md = FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_init_hash()
2297 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_prepare_submit_hash() local
2300 if (!req_ctx->common.dma) { in artpec6_crypto_prepare_submit_hash()
2301 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_prepare_submit_hash()
2313 ret = artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2321 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_prepare_submit_hash()
2330 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_final() local
2332 req_ctx->hash_flags |= HASH_FLAG_FINALIZE; in artpec6_crypto_hash_final()
2339 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hash_update() local
2341 req_ctx->hash_flags |= HASH_FLAG_UPDATE; in artpec6_crypto_hash_update()
2353 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha1_digest() local
2357 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha1_digest()
2369 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_sha256_digest() local
2372 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_sha256_digest()
2384 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha256_digest() local
2387 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha256_digest()