From patchwork Mon Nov 27 07:19:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10076003 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D504D6028E for ; Mon, 27 Nov 2017 07:21:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C74F227CF3 for ; Mon, 27 Nov 2017 07:21:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBEB528C8B; Mon, 27 Nov 2017 07:21:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68E982580E for ; Mon, 27 Nov 2017 07:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751790AbdK0HUx (ORCPT ); Mon, 27 Nov 2017 02:20:53 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:37249 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbdK0HUA (ORCPT ); Mon, 27 Nov 2017 02:20:00 -0500 Received: by mail-pg0-f66.google.com with SMTP id m4so8362345pgc.4; Sun, 26 Nov 2017 23:19:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZGhO43Gfi5DaAEzGqwbrclBNC7KPk4zYyV2vcoGLLQw=; b=Mr3iwxT1dg1IXoZINIJSc+NKBw8O0cycWkwffmrIFVXpSLyXfKjWMdwJagpRxce30e rWW3QNft8fklKdQa1etHIuJFX2WtdSKaXl7yY/Y0svUejhMrcFYov5xAXvxZ4fhpkhzR RnyWW0pODx9MXIL29fudDK2VauWxrnC968UnjuTxOGJ3QhPl0LBlh+KdqibByS2NiuFn TWlRkXyFVtpncwNXg+daBFLQQA7AReMBcNjD6a0RcRIihfYAy3YmnVIe5O02qBfyoidc s7w0NtJ7MrLpdBHOqG20XGKMd+8//ljr4zOtO3/1kTVe6ZKfxWWbfn6DMIKqblJEEHuy XWvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZGhO43Gfi5DaAEzGqwbrclBNC7KPk4zYyV2vcoGLLQw=; b=scmDHVFTC9pOkiuTr6hh0Jl9Tt7QBl5ihoDX8DvUO6x+KoQeR9NaqR4wnif1dJFwRY 3Xd95/DK3IXDTlRdQkg2DAS00WJpX7pBG+E5juw4J2NFGOSXZcAnkQUpqM9A0KiRKNrh nGQ3idkl/OtSo7LIt/l51HOWAQdULg3i0fCOS1NXmFLqRjI8xFLVPw2dfKdk2B5x+p1+ KwLKoAT5QxqkAfq5wbt23BhNJ6Po5T3+nflRq5yV3OK3VWXlqUwWsfgWLXJm9UOaNnxE utIFREFa7Xgy1AM1mmnZEoAKMRT9+ktmVOuN6Bc/3lV944g//JEiLSPYvnxc5fD1gsV5 KjcQ== X-Gm-Message-State: AJaThX4JSewv59XSdk8OVw+Z43nvhKR3jbdTXdunEgqCgI6UgnnK1yp2 2ZMxcMc8oYPBYGX0dgJ+FyOf4EUA X-Google-Smtp-Source: AGs4zMae8wz49ByrIFfv7iOG7XU/QmyDeh2Fy6IN55r+4kJ+Vw5xIKXGSOFHoMr0zynRGOyo/EF8gQ== X-Received: by 10.99.170.77 with SMTP id x13mr377510pgo.117.1511767199383; Sun, 26 Nov 2017 23:19:59 -0800 (PST) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id r1sm50669851pfe.99.2017.11.26.23.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Nov 2017 23:19:58 -0800 (PST) From: Eric Biggers To: keyrings@vger.kernel.org, David Howells Cc: linux-crypto@vger.kernel.org, Eric Biggers Subject: [PATCH] X.509: use crypto_shash_digest() Date: Sun, 26 Nov 2017 23:19:54 -0800 Message-Id: <20171127071954.26273-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers 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 --- crypto/asymmetric_keys/x509_public_key.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c index 9db20abe78a0..3b39c0659155 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;