This implements the worst-case compression size querying interface for
the "null" compression implementation (i.e. no change in size).

Signed-off-by: Kees Cook <keesc...@chromium.org>
---
 crypto/crypto_null.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c
index 20ff2c746e0b..d1b6107f8443 100644
--- a/crypto/crypto_null.c
+++ b/crypto/crypto_null.c
@@ -39,6 +39,13 @@ static int null_compress(struct crypto_tfm *tfm, const u8 
*src,
        return 0;
 }
 
+static int null_zbufsize(struct crypto_tfm *tfm, unsigned int slen,
+                        unsigned int *dlen)
+{
+       *dlen = slen;
+       return 0;
+}
+
 static int null_init(struct shash_desc *desc)
 {
        return 0;
@@ -146,7 +153,8 @@ static struct crypto_alg null_algs[3] = { {
        .cra_module             =       THIS_MODULE,
        .cra_u                  =       { .compress = {
        .coa_compress           =       null_compress,
-       .coa_decompress         =       null_compress } }
+       .coa_decompress         =       null_compress,
+       .coa_zbufsize           =       null_zbufsize } }
 } };
 
 MODULE_ALIAS_CRYPTO("compress_null");
-- 
2.17.1

Reply via email to