[v5,0/2] KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()

Message ID 20221227142740.2807136-1-roberto.sassu@huaweicloud.com
Headers
Series KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() |

Message

Roberto Sassu Dec. 27, 2022, 2:27 p.m. UTC
  From: Roberto Sassu <roberto.sassu@huawei.com>

Changelog:

v4:
 - Replace sg_init_table()/sg_set_buf() with sg_init_one() (suggested by
   Eric)

v3:

v2:
 - Add patch by Herbert to take only the needed bytes for a MPI from the
   scatterlist
 - Use only one scatterlist for signature and digest (suggested by Eric)
 - Rename key variable to buf (suggested by Eric)
 - Rename key_max_len variable to buf_len
 - Use size_t for the buf_len variable instead of u32

v1:
 - Unconditionally copy the signature and digest to the buffer to keep the
   code simple (suggested by Eric)

Herbert Xu (1):
  lib/mpi: Fix buffer overrun when SG is too long

Roberto Sassu (1):
  KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()

 crypto/asymmetric_keys/public_key.c | 38 ++++++++++++++++-------------
 lib/mpi/mpicoder.c                  |  3 ++-
 2 files changed, 23 insertions(+), 18 deletions(-)