crypto: Add userspace report for compress type algorithms
authorSteffen Klassert <steffen.klassert@secunet.com>
Tue, 27 Sep 2011 05:48:48 +0000 (07:48 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Oct 2011 12:24:12 +0000 (14:24 +0200)
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

crypto/crypto_user.c

index 52459ae..748990f 100644 (file)
@@ -89,6 +89,21 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
+static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
+{
+       struct crypto_report_comp rcomp;
+
+       snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression");
+
+       NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS,
+               sizeof(struct crypto_report_comp), &rcomp);
+
+       return 0;
+
+nla_put_failure:
+       return -EMSGSIZE;
+}
+
 static int crypto_report_one(struct crypto_alg *alg,
                             struct crypto_user_alg *ualg, struct sk_buff *skb)
 {
@@ -127,6 +142,11 @@ static int crypto_report_one(struct crypto_alg *alg,
                        goto nla_put_failure;
 
                break;
+       case CRYPTO_ALG_TYPE_COMPRESS:
+               if (crypto_report_comp(skb, alg))
+                       goto nla_put_failure;
+
+               break;
        }
 
 out: