mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
crypto: rockchip: fix bug on iv update
1. rk_iv_copyback use dev->count as real data length. 2. drop rk_update_iv Change-Id: I14266a5872c125acea2cec9c6fb10e18ea9c4470 Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
This commit is contained in:
@@ -441,7 +441,7 @@ static void rk_iv_copyback(struct rk_crypto_info *dev)
|
||||
if (!IS_BC_DECRYPT(ctx->mode)) {
|
||||
if (dev->aligned) {
|
||||
memcpy(req->info, sg_virt(dev->sg_dst) +
|
||||
dev->sg_dst->length - ivsize, ivsize);
|
||||
dev->count - ivsize, ivsize);
|
||||
} else {
|
||||
memcpy(req->info, dev->addr_vir +
|
||||
dev->count - ivsize, ivsize);
|
||||
@@ -450,25 +450,6 @@ static void rk_iv_copyback(struct rk_crypto_info *dev)
|
||||
|
||||
}
|
||||
|
||||
static void rk_update_iv(struct rk_crypto_info *dev)
|
||||
{
|
||||
struct ablkcipher_request *req =
|
||||
ablkcipher_request_cast(dev->async_req);
|
||||
struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req);
|
||||
struct rk_cipher_ctx *ctx = crypto_ablkcipher_ctx(tfm);
|
||||
u32 ivsize = crypto_ablkcipher_ivsize(tfm);
|
||||
u8 *new_iv = NULL;
|
||||
|
||||
if (IS_BC_DECRYPT(ctx->mode)) {
|
||||
new_iv = ctx->iv;
|
||||
} else {
|
||||
new_iv = page_address(sg_page(dev->sg_dst)) +
|
||||
dev->sg_dst->offset + dev->sg_dst->length - ivsize;
|
||||
}
|
||||
|
||||
set_iv_reg(dev, new_iv, ivsize);
|
||||
}
|
||||
|
||||
/* return:
|
||||
* true some err was occurred
|
||||
* fault no err, continue
|
||||
@@ -490,7 +471,6 @@ static int rk_ablk_rx(struct rk_crypto_info *dev)
|
||||
}
|
||||
}
|
||||
if (dev->left_bytes) {
|
||||
rk_update_iv(dev);
|
||||
if (dev->aligned) {
|
||||
if (sg_is_last(dev->sg_src)) {
|
||||
dev_err(dev->dev, "[%s:%d] Lack of data\n",
|
||||
|
||||
Reference in New Issue
Block a user