From patchwork Tue Sep 3 16:43:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 172867 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp99042ily; Tue, 3 Sep 2019 09:43:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqySNV54ccZ6/TtmKk4xiNNE1eBVYovujzAFJ/+ElLPeMTv+JqCLTpfdmc+bt6NKL4o9FgeR X-Received: by 2002:a63:e70f:: with SMTP id b15mr31059389pgi.152.1567529036722; Tue, 03 Sep 2019 09:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567529036; cv=none; d=google.com; s=arc-20160816; b=cWXSJoBhYLObn9qiuLpBCWrhThv+lIwHr/B+tW8sdiy5UVuwgF1/Onn19rqIUgqId+ 7m3sCK+u400Gucg6qPRTjJv7vE8P3YRjnd0KErHm5oE4sdw/mmJLs1QcwsFLmYhTHVnX KUfpR3ffFWl6/e0KK6a9rjQbd5TXZ5NiHoWrxxTYTkPkwzX2HA7ZjXLP/YYQtH/TGNr3 iiXhpA9GF9Mz+kZM1wdIXs9yrR6j3vgUN7i+M0giuFVYMeeRQ9eIFOq0pMvDRMNpVcP6 KW9/6pUh7bcR/uPyULKXz2m4N9MRqKn6sYz4j3AjLm55HcDfQ6nYK1wKq6l/hiDWS0yM Wbiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=pASuIHos0NrmENDZ2qsaTQ78g3KIF/aki90Q37gkm4s=; b=ekAeCYgxkiKa2A2I9ZdH/gbq01rY3Cufz9zblwb3akP0dAyWR3JuvUHG9KHa6egc/i DIvJ83WLzyLJQ7gWy18Ca5uzT8hIv5nibjPemf2NEuOcw8EuK/eoBwdJ5CgaSjQQ4f0O 3TBI8k9oGAfBf6FibE8CRdBNRKC+kfpaXzsxAIvUm8tzQSe2V2PDR8ReIY1Cupi5IZwt aZHOzXT3V7U6M/oduzit64xKL39bLARggKF0tWyHDckXOmmUGrTxGJpM2ENXAde5XKKM 6TwwQGTqQhO6MIJ7CcZfBgY3Js9IgNZjUXnM5rp0kDrutW7PPBoehYNeH0kaWvIAsbo8 h90w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VwfQIv3n; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si14716735pgs.87.2019.09.03.09.43.56; Tue, 03 Sep 2019 09:43:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VwfQIv3n; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730103AbfICQn4 (ORCPT + 3 others); Tue, 3 Sep 2019 12:43:56 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35233 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728854AbfICQnz (ORCPT ); Tue, 3 Sep 2019 12:43:55 -0400 Received: by mail-pg1-f196.google.com with SMTP id n4so9462501pgv.2 for ; Tue, 03 Sep 2019 09:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pASuIHos0NrmENDZ2qsaTQ78g3KIF/aki90Q37gkm4s=; b=VwfQIv3n1+0mlkY5Im5NOS6y6VwYlW+pVg6UmlywFKZtFItpUJeig3EXyYYJ4gYNAf fGyVMFVtTKJs0FtpW71ypblZTRG8FEJKujnOxMjVhzZpWSO6CB3umOfNAj4jiHFat4Kx 6hIBRYPEusst4yKt8vFjlddE97wTbdbaoCbQrjsm9hwX6RD7l+nMOXGJgwZuH0Rz18xP QyyJ33rpF1NNnPaVjal3uowUw7ULy1D5PPW+XIHK7nGVL8kJBbyUgKKkJYBcPX5kclGH SS82P3CeF2QJtWcC3j914qeel4g+GA4zOeq49wwnhn3FvibDM1LNVqdniCr66ha/7BFM FPHg== 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:in-reply-to :references; bh=pASuIHos0NrmENDZ2qsaTQ78g3KIF/aki90Q37gkm4s=; b=g57fd3Bnii2P/5SWPHnejKvOH6oIm+xuDd4VbAzH7acQgwP5q50VYCNA+0aUJODBOh Uyp2Y8acCoRPiKDPY1QT1ko1fPi3zVkZoVnnHBAV9gfrCr0AMwAzel4Q1LCWPKUHkp34 KiIslBaUMUOq89ljHg+O9V5G5WLa1OLfgtYkd1pnMF0W0ZF69KbghcUuodiZjtCfdDs0 6K7Iz66tdvvqlyvy8ZpzA1eqSxNqLkzr6Up8JcnfeBa9yPNe1C9PLp8lxghzYaps49y9 BcVHQDlc1XG9IM7kqVwnkcvRziU+QhPd6b2SnQtHlWH0aR6sZA1lMu0VPthZFh8kXWj2 a+kw== X-Gm-Message-State: APjAAAW5O3N4lZ5UrDqHb0jVdsPiESpD91K1dfw4iOgJZbfm+9AouHcr H8rcr4FDrOMqFXPaY4Bf0/Zm3uxZkKv+itfF X-Received: by 2002:a63:6ec1:: with SMTP id j184mr31086603pgc.232.1567529034711; Tue, 03 Sep 2019 09:43:54 -0700 (PDT) Received: from e111045-lin.nice.arm.com ([104.133.8.102]) by smtp.gmail.com with ESMTPSA id b126sm20311847pfb.110.2019.09.03.09.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:43:53 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v2 08/17] crypto: skcipher - add the ability to abort a skcipher walk Date: Tue, 3 Sep 2019 09:43:30 -0700 Message-Id: <20190903164339.27984-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903164339.27984-1-ard.biesheuvel@linaro.org> References: <20190903164339.27984-1-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org After starting a skcipher walk, the only way to ensure that all resources it has tied up are released is to complete it. In some cases, it will be useful to be able to abort a walk cleanly after it has started, so add this ability to the skcipher walk API. Signed-off-by: Ard Biesheuvel --- include/crypto/internal/skcipher.h | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index d68faa5759ad..734b6f7081b8 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h @@ -148,6 +148,11 @@ int skcipher_walk_aead_decrypt(struct skcipher_walk *walk, struct aead_request *req, bool atomic); void skcipher_walk_complete(struct skcipher_walk *walk, int err); +static inline void skcipher_walk_abort(struct skcipher_walk *walk) +{ + skcipher_walk_done(walk, -ECANCELED); +} + static inline void ablkcipher_request_complete(struct ablkcipher_request *req, int err) {