Thread (23 messages) 23 messages, 3 authors, 2021-12-07
STALE1656d

[PATCH 3/9] crypto, null: Implement zbufsize()

From: Kees Cook <hidden>
Date: 2018-08-02 21:51:28
Also in: lkml
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help