X.509: use crypto_shash_digest()
authorEric Biggers <[email protected]>
Fri, 8 Dec 2017 15:13:29 +0000 (15:13 +0000)
committerDavid Howells <[email protected]>
Fri, 8 Dec 2017 15:13:29 +0000 (15:13 +0000)
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 <[email protected]>
Signed-off-by: David Howells <[email protected]>
crypto/asymmetric_keys/x509_public_key.c

index c9013582c026748a10b09eeb09d5c71f0571ea7a..e67fd29fbd115b5ff1a56dbe2e16aa56d98a54b5 100644 (file)
@@ -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;