Skip to content

Commit

Permalink
crypto: ccree - use std api sg_zero_buffer
Browse files Browse the repository at this point in the history
Replace internal cc_zero_sgl() with kernel API of the same function
sg_zero_buffer().

Signed-off-by: Gilad Ben-Yossef <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
gby authored and herbertx committed Aug 9, 2019
1 parent 7a4be6c commit e88b27c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
3 changes: 2 additions & 1 deletion drivers/crypto/ccree/cc_aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ static void cc_aead_complete(struct device *dev, void *cc_req, int err)
/* In case of payload authentication failure, MUST NOT
* revealed the decrypted message --> zero its memory.
*/
cc_zero_sgl(areq->dst, areq->cryptlen);
sg_zero_buffer(areq->dst, sg_nents(areq->dst),
areq->cryptlen, 0);
err = -EBADMSG;
}
/*ENCRYPT*/
Expand Down
21 changes: 0 additions & 21 deletions drivers/crypto/ccree/cc_buffer_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,6 @@ static unsigned int cc_get_sgl_nents(struct device *dev,
return nents;
}

/**
* cc_zero_sgl() - Zero scatter scatter list data.
*
* @sgl:
*/
void cc_zero_sgl(struct scatterlist *sgl, u32 data_len)
{
struct scatterlist *current_sg = sgl;
int sg_index = 0;

while (sg_index <= data_len) {
if (!current_sg) {
/* reached the end of the sgl --> just return back */
return;
}
memset(sg_virt(current_sg), 0, current_sg->length);
sg_index += current_sg->length;
current_sg = sg_next(current_sg);
}
}

/**
* cc_copy_sg_portion() - Copy scatter list data,
* from to_skip to end, to dest and vice versa
Expand Down
2 changes: 0 additions & 2 deletions drivers/crypto/ccree/cc_buffer_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,4 @@ void cc_unmap_hash_request(struct device *dev, void *ctx,
void cc_copy_sg_portion(struct device *dev, u8 *dest, struct scatterlist *sg,
u32 to_skip, u32 end, enum cc_sg_cpy_direct direct);

void cc_zero_sgl(struct scatterlist *sgl, u32 data_len);

#endif /*__BUFFER_MGR_H__*/

0 comments on commit e88b27c

Please sign in to comment.