Skip to content

Commit

Permalink
X.509: use crypto_shash_digest()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Biggers authored and David Howells committed Dec 8, 2017
1 parent 72f9a07 commit aa33003
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions crypto/asymmetric_keys/x509_public_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit aa33003

Please sign in to comment.