diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2015-06-16 10:30:55 -0700 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-17 17:03:14 +0800 |
commit | 3c339ab83fc09d9d91fb7e8b4a60e8ddc91de417 (patch) | |
tree | b9e262f57e0acad14b05b0545dfd5c690f78f356 /crypto/crypto_user.c | |
parent | c2b7b20aedfa10de3634877c3e4b7bc9a7d6461e (diff) | |
download | lwn-3c339ab83fc09d9d91fb7e8b4a60e8ddc91de417.tar.gz lwn-3c339ab83fc09d9d91fb7e8b4a60e8ddc91de417.zip |
crypto: akcipher - add PKE API
Add Public Key Encryption API.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Made CRYPTO_AKCIPHER invisible like other type config options.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/crypto_user.c')
-rw-r--r-- | crypto/crypto_user.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 41dfe762b7fb..11dbd5a81c72 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -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: |