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()
1264 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_encrypt() local
1266 req_ctx->decrypt = false; in artpec6_crypto_aead_encrypt()
1267 ret = artpec6_crypto_common_init(&req_ctx->common, &req->base, in artpec6_crypto_aead_encrypt()
1275 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1279 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_encrypt()
1285 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(req); in artpec6_crypto_aead_decrypt() local
1287 req_ctx->decrypt = true; in artpec6_crypto_aead_decrypt()
1291 ret = artpec6_crypto_common_init(&req_ctx->common, in artpec6_crypto_aead_decrypt()
1300 artpec6_crypto_common_destroy(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1304 return artpec6_crypto_submit(&req_ctx->common); in artpec6_crypto_aead_decrypt()
1310 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(areq); in artpec6_crypto_prepare_hash() local
1315 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_hash()
1326 if (req_ctx->hash_flags & HASH_FLAG_HMAC) { in artpec6_crypto_prepare_hash()
1328 req_ctx->key_md = FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1331 req_ctx->key_md = FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_hash()
1336 memcpy(req_ctx->key_buffer, ctx->hmac_key, in artpec6_crypto_prepare_hash()
1338 memset(req_ctx->key_buffer + ctx->hmac_key_length, 0, in artpec6_crypto_prepare_hash()
1342 (void *)&req_ctx->key_md, in artpec6_crypto_prepare_hash()
1343 sizeof(req_ctx->key_md), false, false); in artpec6_crypto_prepare_hash()
1348 req_ctx->key_buffer, blocksize, in artpec6_crypto_prepare_hash()
1354 if (!(req_ctx->hash_flags & HASH_FLAG_INIT_CTX)) { in artpec6_crypto_prepare_hash()
1363 req_ctx->hash_md &= ~A6_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1364 req_ctx->hash_md |= FIELD_PREP(A6_CRY_MD_HASH_SEL_CTX, sel_ctx); in artpec6_crypto_prepare_hash()
1367 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) in artpec6_crypto_prepare_hash()
1368 req_ctx->hash_md |= A6_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1370 req_ctx->hash_md &= ~A7_CRY_MD_HASH_SEL_CTX; in artpec6_crypto_prepare_hash()
1371 req_ctx->hash_md |= FIELD_PREP(A7_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 |= A7_CRY_MD_HASH_HMAC_FIN; in artpec6_crypto_prepare_hash()
1380 (void *)&req_ctx->hash_md, in artpec6_crypto_prepare_hash()
1381 sizeof(req_ctx->hash_md), false, false); in artpec6_crypto_prepare_hash()
1391 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1398 if (req_ctx->hash_flags & HASH_FLAG_UPDATE) { in artpec6_crypto_prepare_hash()
1400 size_t total_bytes = areq->nbytes + req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1405 if (req_ctx->partial_bytes && ready_bytes) { in artpec6_crypto_prepare_hash()
1410 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1411 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1412 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1415 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1416 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1422 done_bytes += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1423 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1439 req_ctx->partial_buffer + in artpec6_crypto_prepare_hash()
1440 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1443 req_ctx->partial_bytes += sg_rem; in artpec6_crypto_prepare_hash()
1446 req_ctx->digcnt += ready_bytes; in artpec6_crypto_prepare_hash()
1447 req_ctx->hash_flags &= ~(HASH_FLAG_UPDATE); in artpec6_crypto_prepare_hash()
1451 if (req_ctx->hash_flags & HASH_FLAG_FINALIZE) { in artpec6_crypto_prepare_hash()
1457 oper = FIELD_GET(A6_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1459 oper = FIELD_GET(A7_CRY_MD_OPER, req_ctx->hash_md); in artpec6_crypto_prepare_hash()
1462 if (req_ctx->partial_bytes) { in artpec6_crypto_prepare_hash()
1463 memcpy(req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1464 req_ctx->partial_buffer, in artpec6_crypto_prepare_hash()
1465 req_ctx->partial_bytes); in artpec6_crypto_prepare_hash()
1467 req_ctx->partial_buffer_out, in artpec6_crypto_prepare_hash()
1468 req_ctx->partial_bytes, in artpec6_crypto_prepare_hash()
1473 req_ctx->digcnt += req_ctx->partial_bytes; in artpec6_crypto_prepare_hash()
1474 req_ctx->partial_bytes = 0; in artpec6_crypto_prepare_hash()
1477 if (req_ctx->hash_flags & HASH_FLAG_HMAC) in artpec6_crypto_prepare_hash()
1478 digest_bits = 8 * (req_ctx->digcnt + blocksize); in artpec6_crypto_prepare_hash()
1480 digest_bits = 8 * req_ctx->digcnt; in artpec6_crypto_prepare_hash()
1483 hash_pad_len = create_hash_pad(oper, req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1484 req_ctx->digcnt, digest_bits); in artpec6_crypto_prepare_hash()
1486 req_ctx->pad_buffer, in artpec6_crypto_prepare_hash()
1489 req_ctx->digcnt = 0; in artpec6_crypto_prepare_hash()
1507 req_ctx->digeststate, in artpec6_crypto_prepare_hash()
1514 req_ctx->hash_flags &= ~(HASH_FLAG_INIT_CTX | HASH_FLAG_UPDATE | in artpec6_crypto_prepare_hash()
1665 struct artpec6_crypto_request_context *req_ctx = NULL; in artpec6_crypto_prepare_crypto() local
1675 req_ctx = skcipher_request_ctx(areq); in artpec6_crypto_prepare_crypto()
1676 common = &req_ctx->common; in artpec6_crypto_prepare_crypto()
1695 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_crypto()
1722 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1727 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1737 cipher_decr = req_ctx->decrypt; in artpec6_crypto_prepare_crypto()
1740 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1742 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DSEQ; in artpec6_crypto_prepare_crypto()
1752 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1753 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1756 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1758 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, oper); in artpec6_crypto_prepare_crypto()
1759 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_crypto()
1762 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_crypto()
1766 &req_ctx->cipher_md, in artpec6_crypto_prepare_crypto()
1767 sizeof(req_ctx->cipher_md), in artpec6_crypto_prepare_crypto()
1832 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_prepare_aead() local
1834 struct artpec6_crypto_req_common *common = &req_ctx->common; in artpec6_crypto_prepare_aead()
1859 req_ctx->cipher_md = 0; in artpec6_crypto_prepare_aead()
1876 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1878 req_ctx->cipher_md |= FIELD_PREP(A6_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1880 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1881 req_ctx->cipher_md |= A6_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1883 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_OPER, in artpec6_crypto_prepare_aead()
1885 req_ctx->cipher_md |= FIELD_PREP(A7_CRY_MD_CIPHER_LEN, in artpec6_crypto_prepare_aead()
1887 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1888 req_ctx->cipher_md |= A7_CRY_MD_CIPHER_DECR; in artpec6_crypto_prepare_aead()
1892 (void *) &req_ctx->cipher_md, in artpec6_crypto_prepare_aead()
1893 sizeof(req_ctx->cipher_md), false, in artpec6_crypto_prepare_aead()
1904 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
1908 req_ctx->hw_ctx.aad_length_bits = in artpec6_crypto_prepare_aead()
1911 req_ctx->hw_ctx.text_length_bits = in artpec6_crypto_prepare_aead()
1914 memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher)); in artpec6_crypto_prepare_aead()
1916 memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4); in artpec6_crypto_prepare_aead()
1918 ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx, in artpec6_crypto_prepare_aead()
1969 if (req_ctx->decrypt) in artpec6_crypto_prepare_aead()
2000 if (req_ctx->decrypt) { in artpec6_crypto_prepare_aead()
2002 req_ctx->decryption_tag, AES_BLOCK_SIZE, false); in artpec6_crypto_prepare_aead()
2186 struct artpec6_crypto_aead_req_ctx *req_ctx = aead_request_ctx(areq); in artpec6_crypto_complete_aead() local
2188 if (req_ctx->decrypt) { in artpec6_crypto_complete_aead()
2199 if (crypto_memneq(req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2206 req_ctx->decryption_tag, in artpec6_crypto_complete_aead()
2261 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_init_hash() local
2264 memset(req_ctx, 0, sizeof(*req_ctx)); in artpec6_crypto_init_hash()
2266 req_ctx->hash_flags = HASH_FLAG_INIT_CTX; in artpec6_crypto_init_hash()
2268 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()
2379 struct artpec6_hash_request_context *req_ctx = ahash_request_ctx(req); in artpec6_crypto_hmac_sha256_digest() local
2382 req_ctx->hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE; in artpec6_crypto_hmac_sha256_digest()