summaryrefslogtreecommitdiffstats
path: root/crypto/sig.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2023-06-26 12:33:44 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2023-06-27 09:40:24 +0200
commit891ebfdfa3d08bf55ebec523c99bb68ac9c34cf7 (patch)
tree8f660671f3ce35b37a746dd3a624273b503389fa /crypto/sig.c
parentcrypto: akcipher - Set request tfm on sync path (diff)
downloadlinux-891ebfdfa3d08bf55ebec523c99bb68ac9c34cf7.tar.xz
linux-891ebfdfa3d08bf55ebec523c99bb68ac9c34cf7.zip
crypto: sig - Fix verify call
The dst SG list needs to be set to NULL for verify calls. Do this as otherwise the underlying algorithm may fail. Furthermore the digest needs to be copied just like the source. Fixes: 6cb8815f41a9 ("crypto: sig - Add interface for sign/verify") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/sig.c')
-rw-r--r--crypto/sig.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/sig.c b/crypto/sig.c
index d812555c88af..b48c18ec65cd 100644
--- a/crypto/sig.c
+++ b/crypto/sig.c
@@ -128,9 +128,7 @@ int crypto_sig_verify(struct crypto_sig *tfm,
if (err)
return err;
- sg_init_table(data.sg, 2);
- sg_set_buf(&data.sg[0], src, slen);
- sg_set_buf(&data.sg[1], digest, dlen);
+ memcpy(data.buf + slen, digest, dlen);
return crypto_akcipher_sync_post(&data,
crypto_akcipher_verify(data.req));