From patchwork Mon Jan 4 04:46:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 7945391 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87B059F1C0 for ; Mon, 4 Jan 2016 04:49:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5DED2022A for ; Mon, 4 Jan 2016 04:49:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C878120225 for ; Mon, 4 Jan 2016 04:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbcADEsQ (ORCPT ); Sun, 3 Jan 2016 23:48:16 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33733 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752714AbcADErh (ORCPT ); Sun, 3 Jan 2016 23:47:37 -0500 Received: by mail-pa0-f41.google.com with SMTP id cy9so191100152pac.0; Sun, 03 Jan 2016 20:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0BgbMv4aA8dN3cDAHUqTxSV7aum91G8IMTSG4k/9FGo=; b=gensP7S45mX/HUTLmWm6p4Q0sqwPmjl6vffzkuhBEF2zZg09usJ6YOjDJZFa4LrNH7 kSIpCKY1FXAsUA+F7lY7hXeSYWh04yxMvLBtXh9RIxZeRJbib41laxjw64Vsnp3KMF9N 0aWS1eLceLhIy6TyftFVOIDcEbCxBSQd0w7m1zCgLp8S/pFfb3Vb6zTijD1+EfYBwDMP gTC/gYyNzg89HwU6PcptkXPVPyFZ1/HuWX8JyE8cex2xv+MHymoqjqY6yuwIug79w7Z2 Y8F9m9bkHi0otNiqfqRg1DBUAYnvphAwQvyUig0TrHC1ZZnxG5KSMEzPeUxBSJ7Xuc0c ogAg== X-Received: by 10.66.139.166 with SMTP id qz6mr49805827pab.148.1451882856877; Sun, 03 Jan 2016 20:47:36 -0800 (PST) Received: from localhost.localdomain ([119.69.155.252]) by smtp.gmail.com with ESMTPSA id tu9sm122503374pac.0.2016.01.03.20.47.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jan 2016 20:47:35 -0800 (PST) From: Joonsoo Kim X-Google-Original-From: Joonsoo Kim To: Herbert Xu Cc: "David S. Miller" , Weigang Li , Sergey Senozhatsky , Minchan Kim , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Joonsoo Kim Subject: [PATCH RFC 6/7] crypto/compress: add algorithm type specific flag, DECOMP_NOCTX Date: Mon, 4 Jan 2016 13:46:57 +0900 Message-Id: <1451882819-2810-7-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451882819-2810-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1451882819-2810-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Joonsoo Kim --- crypto/testmgr.c | 2 ++ include/crypto/compress.h | 8 ++++++++ include/linux/crypto.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index bd0c639..acd7428 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1289,6 +1289,8 @@ static int test_comp(struct crypto_tfm *tfm, void *ctx, int type, break; case 1: + if (crypto_scomp_decomp_noctx(crypto_scomp_cast(tfm))) + ctx = NULL; ret = crypto_scomp_decompress(crypto_scomp_cast(tfm), dtemplate[i].input, ilen, result, &dlen, ctx); diff --git a/include/crypto/compress.h b/include/crypto/compress.h index f1e91c5..21c698e 100644 --- a/include/crypto/compress.h +++ b/include/crypto/compress.h @@ -2,6 +2,8 @@ #define _CRYPTO_COMPRESS_H #include +#define CRYPTO_ALG_SCOMPRESS_DECOMP_NOCTX CRYPTO_ALG_PRIVATE + struct crypto_scomp { struct crypto_tfm base; }; @@ -71,6 +73,12 @@ static inline int crypto_scomp_decompress(struct crypto_scomp *tfm, dst, dlen, ctx); } +static inline bool crypto_scomp_decomp_noctx(struct crypto_scomp *tfm) +{ + return crypto_scomp_tfm(tfm)->__crt_alg->cra_flags & + CRYPTO_ALG_SCOMPRESS_DECOMP_NOCTX; +} + extern int crypto_register_scomp(struct scomp_alg *alg); extern int crypto_unregister_scomp(struct scomp_alg *alg); diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 86baa61..a8a522c 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -104,6 +104,12 @@ #define CRYPTO_ALG_INTERNAL 0x00002000 /* + * Use this flag as type specific one. For example, it would be used + * to check if context is needed or not in CRYPTO_ALG_TYPE_SCOMPRESS. + */ +#define CRYPTO_ALG_PRIVATE 0x00004000 + +/* * Transform masks and values (for crt_flags). */ #define CRYPTO_TFM_REQ_MASK 0x000fff00