From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752931AbcADEs0 (ORCPT ); Sun, 3 Jan 2016 23:48:26 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 1.9.1