summaryrefslogtreecommitdiffstats
path: root/crypto/asymmetric_keys/pkcs7_verify.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-12-08 16:13:28 +0100
committerDavid Howells <dhowells@redhat.com>2017-12-08 16:13:28 +0100
commita80745a6de51a651977a16ef81cba0126f9dd66f (patch)
tree8c06d3929fbf4f365a57a85100fecd576fd1d75c /crypto/asymmetric_keys/pkcs7_verify.c
parentpkcs7: fix check for self-signed certificate (diff)
downloadlinux-a80745a6de51a651977a16ef81cba0126f9dd66f.tar.xz
linux-a80745a6de51a651977a16ef81cba0126f9dd66f.zip
pkcs7: use crypto_shash_digest()
Use crypto_shash_digest() instead of crypto_shash_init() followed by crypto_shash_finup(). (For simplicity only; they are equivalent.) Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to '')
-rw-r--r--crypto/asymmetric_keys/pkcs7_verify.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
index 2d93d9eccb4d..255e84abdc69 100644
--- a/crypto/asymmetric_keys/pkcs7_verify.c
+++ b/crypto/asymmetric_keys/pkcs7_verify.c
@@ -59,11 +59,8 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7,
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
/* Digest the message [RFC2315 9.3] */
- ret = crypto_shash_init(desc);
- if (ret < 0)
- goto error;
- ret = crypto_shash_finup(desc, pkcs7->data, pkcs7->data_len,
- sig->digest);
+ ret = crypto_shash_digest(desc, pkcs7->data, pkcs7->data_len,
+ sig->digest);
if (ret < 0)
goto error;
pr_devel("MsgDigest = [%*ph]\n", 8, sig->digest);