@@ -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);
@@ -2,6 +2,8 @@
#define _CRYPTO_COMPRESS_H
#include <linux/crypto.h>
+#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);
@@ -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
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> --- crypto/testmgr.c | 2 ++ include/crypto/compress.h | 8 ++++++++ include/linux/crypto.h | 6 ++++++ 3 files changed, 16 insertions(+)