From patchwork Tue Feb 25 07:34:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 25233 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D4B2520543 for ; Tue, 25 Feb 2014 07:34:32 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id to1sf55303ieb.3 for ; Mon, 24 Feb 2014 23:34:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=AlAKC6W65B5pGRdiz7+LR7bigaS5OW+GSMtBx7rLxI8=; b=eln+xIWFaBZmxksdk1joqSAMpnlc8gBbl9vHZGBKAsYMB637L7srhvRXuETaVj9vY6 aIQCDZGX2d9nEPmggmffBAs2X78lq1YJY7Af7yU6anJCXtDJNC0GVKt/0U2KEGlpFklh UqQa6XBI4ph/hU8dOIvvzhvoPslDqvsFv1wC7Q+51Ev95E1a0gxFs98e+FvRrjZAEkxC xG1ieL5RRaUrcX62fnyfa4ZCJwkpWIj/JNnI22ZtBDZYnz1nSkWr51JZdTEHXSzpdlF5 LXgsbqSvmupyJmGoY5ddflXa/El4oPKYgCCX+3MUNLfArvVDV/u8rsqgCcQJA8s0O0Ck z2OQ== X-Gm-Message-State: ALoCoQkmBJeHiHIhrQEEE7mnVJn/p8VEj+fvDK++mjDq8X9W/Rtj637QncXaYc838S6nYJxYoqLj X-Received: by 10.182.216.200 with SMTP id os8mr28321obc.0.1393313671753; Mon, 24 Feb 2014 23:34:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.246 with SMTP id e109ls1010898qga.89.gmail; Mon, 24 Feb 2014 23:34:31 -0800 (PST) X-Received: by 10.52.99.227 with SMTP id et3mr17503vdb.53.1393313671654; Mon, 24 Feb 2014 23:34:31 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id sl9si6614306veb.21.2014.02.24.23.34.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Feb 2014 23:34:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id c14so16734vea.0 for ; Mon, 24 Feb 2014 23:34:31 -0800 (PST) X-Received: by 10.52.23.68 with SMTP id k4mr2651vdf.24.1393313671569; Mon, 24 Feb 2014 23:34:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp118404vcz; Mon, 24 Feb 2014 23:34:31 -0800 (PST) X-Received: by 10.68.184.66 with SMTP id es2mr4829151pbc.19.1393313670739; Mon, 24 Feb 2014 23:34:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xe9si19507411pab.344.2014.02.24.23.34.29; Mon, 24 Feb 2014 23:34:29 -0800 (PST) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750735AbaBYHe2 (ORCPT + 1 other); Tue, 25 Feb 2014 02:34:28 -0500 Received: from mail-we0-f175.google.com ([74.125.82.175]:62799 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbaBYHe1 (ORCPT ); Tue, 25 Feb 2014 02:34:27 -0500 Received: by mail-we0-f175.google.com with SMTP id q59so16612wes.6 for ; Mon, 24 Feb 2014 23:34:26 -0800 (PST) X-Received: by 10.180.108.199 with SMTP id hm7mr17901283wib.1.1393313666664; Mon, 24 Feb 2014 23:34:26 -0800 (PST) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id h9sm48393186wjz.16.2014.02.24.23.34.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Feb 2014 23:34:26 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: Ard Biesheuvel Subject: [RFC PATCH v2 1/3] crypto: update generic ECB's driver_name to 'ecb_generic' Date: Tue, 25 Feb 2014 08:34:18 +0100 Message-Id: <1393313660-5258-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393313660-5258-1-git-send-email-ard.biesheuvel@linaro.org> References: <1393313660-5258-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As ECB could potentially be wrapped by other chaining modes to operate on larger chunks of data in parallel, we would like to distinguish between the generic ECB and accelerated implementations of ECB, as using the former will not result in any speedup. Therefore, update the driver name of generic ECB to 'ecb_generic(%s)'. Signed-off-by: Ard Biesheuvel --- crypto/ecb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crypto/ecb.c b/crypto/ecb.c index 935cfef4aa84..46a6a61fbcb9 100644 --- a/crypto/ecb.c +++ b/crypto/ecb.c @@ -134,6 +134,12 @@ static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb) if (IS_ERR(inst)) goto out_put_alg; + err = -ENAMETOOLONG; + if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, + "ecb_generic(%s)", alg->cra_driver_name) + >= CRYPTO_MAX_ALG_NAME) + goto out_err; + inst->alg.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER; inst->alg.cra_priority = alg->cra_priority; inst->alg.cra_blocksize = alg->cra_blocksize; @@ -155,6 +161,12 @@ static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb) out_put_alg: crypto_mod_put(alg); return inst; + +out_err: + crypto_drop_spawn(crypto_instance_ctx(inst)); + kfree(inst); + crypto_mod_put(alg); + return ERR_PTR(err); } static void crypto_ecb_free(struct crypto_instance *inst)