]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - crypto/crypto_user.c
crypto: akcipher - add PKE API
[mirror_ubuntu-artful-kernel.git] / crypto / crypto_user.c
index 41dfe762b7fbabd670522b8a408619a6c14cdb53..11dbd5a81c7203ba92d1132088c5789aec2b4a4a 100644 (file)
@@ -27,6 +27,7 @@
 #include <net/net_namespace.h>
 #include <crypto/internal/aead.h>
 #include <crypto/internal/skcipher.h>
+#include <crypto/akcipher.h>
 
 #include "internal.h"
 
@@ -110,6 +111,21 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
+static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg)
+{
+       struct crypto_report_akcipher rakcipher;
+
+       strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type));
+
+       if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER,
+                   sizeof(struct crypto_report_akcipher), &rakcipher))
+               goto nla_put_failure;
+       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)
 {
@@ -154,6 +170,12 @@ static int crypto_report_one(struct crypto_alg *alg,
                        goto nla_put_failure;
 
                break;
+
+       case CRYPTO_ALG_TYPE_AKCIPHER:
+               if (crypto_report_akcipher(skb, alg))
+                       goto nla_put_failure;
+
+               break;
        }
 
 out: