summaryrefslogtreecommitdiffstats
path: root/crypto/asymmetric_keys/x509_public_key.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-12-08 16:13:29 +0100
committerDavid Howells <dhowells@redhat.com>2017-12-08 16:13:29 +0100
commitaa3300362060525fe1a32de56df9578033530d98 (patch)
treefc00a8c9e989ef2d7b3a5444324f8e596c99aea9 /crypto/asymmetric_keys/x509_public_key.c
parentKEYS: be careful with error codes in public_key_verify_signature() (diff)
downloadlinux-aa3300362060525fe1a32de56df9578033530d98.tar.xz
linux-aa3300362060525fe1a32de56df9578033530d98.zip
X.509: 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 'crypto/asymmetric_keys/x509_public_key.c')
-rw-r--r--crypto/asymmetric_keys/x509_public_key.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
index c9013582c026..e67fd29fbd11 100644
--- a/crypto/asymmetric_keys/x509_public_key.c
+++ b/crypto/asymmetric_keys/x509_public_key.c
@@ -79,11 +79,7 @@ int x509_get_sig_params(struct x509_certificate *cert)
desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
- ret = crypto_shash_init(desc);
- if (ret < 0)
- goto error_2;
- might_sleep();
- ret = crypto_shash_finup(desc, cert->tbs, cert->tbs_size, sig->digest);
+ ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest);
if (ret < 0)
goto error_2;