From: David Howells <dhowells@redhat.com>
To: keyrings@vger.kernel.org
Cc: dhowells@redhat.com, linux-security-module@vger.kernel.org,
zohar@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
tadeusz.struk@intel.com
Subject: [PATCH 8/8] X.509: Rename public_key* to software_pkey*
Date: Fri, 19 Feb 2016 17:19:06 +0000 [thread overview]
Message-ID: <20160219171906.17223.46859.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20160219171806.17223.91381.stgit@warthog.procyon.org.uk>
Rename symbols beginning with "public_key" to symbols beginning with
"software_pkey" to reflect that this is the software implementation private
data rather than the only possible asymmetric key subtype that does public
key handling.
Note that struct public_key_signature is left unrenamed as that's a more
general feature.
Signed-off-by: David Howells <dhowells@redhat.com>
---
crypto/asymmetric_keys/pkcs7_verify.c | 2 +
crypto/asymmetric_keys/software_pkey.c | 48 +++++++++++++++--------------
crypto/asymmetric_keys/software_pkey.h | 10 +++---
crypto/asymmetric_keys/x509_cert_parser.c | 4 +-
crypto/asymmetric_keys/x509_parser.h | 4 +-
crypto/asymmetric_keys/x509_public_key.c | 8 ++---
6 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
index 6aad267f19bb..3828e801e003 100644
--- a/crypto/asymmetric_keys/pkcs7_verify.c
+++ b/crypto/asymmetric_keys/pkcs7_verify.c
@@ -332,7 +332,7 @@ static int pkcs7_verify_one(struct pkcs7_message *pkcs7,
}
/* Verify the PKCS#7 binary against the key */
- ret = public_key_verify_signature(sinfo->signer->pub, &sinfo->sig);
+ ret = software_pkey_verify_signature(sinfo->signer->pub, &sinfo->sig);
if (ret < 0)
return ret;
diff --git a/crypto/asymmetric_keys/software_pkey.c b/crypto/asymmetric_keys/software_pkey.c
index 3024081026c1..8732a41b1001 100644
--- a/crypto/asymmetric_keys/software_pkey.c
+++ b/crypto/asymmetric_keys/software_pkey.c
@@ -27,10 +27,10 @@ MODULE_LICENSE("GPL");
/*
* Provide a part of a description of the key for /proc/keys.
*/
-static void public_key_describe(const struct key *asymmetric_key,
+static void software_pkey_describe(const struct key *asymmetric_key,
struct seq_file *m)
{
- struct public_key *key = asymmetric_key->payload.data[asym_crypto];
+ struct software_pkey *key = asymmetric_key->payload.data[asym_crypto];
if (key)
seq_printf(m, "%s.%s", key->id_type, key->pkey_algo);
@@ -39,24 +39,24 @@ static void public_key_describe(const struct key *asymmetric_key,
/*
* Destroy a public key algorithm key.
*/
-void public_key_destroy(void *payload)
+void software_pkey_destroy(void *payload)
{
- struct public_key *key = payload;
+ struct software_pkey *key = payload;
if (key)
kfree(key->key);
kfree(key);
}
-EXPORT_SYMBOL_GPL(public_key_destroy);
+EXPORT_SYMBOL_GPL(software_pkey_destroy);
-struct public_key_completion {
+struct software_pkey_completion {
struct completion completion;
int err;
};
-static void public_key_verify_done(struct crypto_async_request *req, int err)
+static void software_pkey_verify_done(struct crypto_async_request *req, int err)
{
- struct public_key_completion *compl = req->data;
+ struct software_pkey_completion *compl = req->data;
if (err == -EINPROGRESS)
return;
@@ -68,10 +68,10 @@ static void public_key_verify_done(struct crypto_async_request *req, int err)
/*
* Verify a signature using a public key.
*/
-int public_key_verify_signature(const struct public_key *pkey,
- const struct public_key_signature *sig)
+int software_pkey_verify_signature(const struct software_pkey *pkey,
+ const struct public_key_signature *sig)
{
- struct public_key_completion compl;
+ struct software_pkey_completion compl;
struct crypto_akcipher *tfm;
struct akcipher_request *req;
struct scatterlist sig_sg, digest_sg;
@@ -104,7 +104,7 @@ int public_key_verify_signature(const struct public_key *pkey,
init_completion(&compl.completion);
akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG |
CRYPTO_TFM_REQ_MAY_SLEEP,
- public_key_verify_done, &compl);
+ software_pkey_verify_done, &compl);
ret = crypto_akcipher_verify(req);
if (ret == -EINPROGRESS) {
@@ -119,24 +119,24 @@ error_free_tfm:
pr_devel("<==%s() = %d\n", __func__, ret);
return ret;
}
-EXPORT_SYMBOL_GPL(public_key_verify_signature);
+EXPORT_SYMBOL_GPL(software_pkey_verify_signature);
-static int public_key_verify_signature_2(const struct key *key,
- const struct public_key_signature *sig)
+static int software_pkey_verify_signature_2(const struct key *key,
+ const struct public_key_signature *sig)
{
- const struct public_key *pk = key->payload.data[asym_crypto];
- return public_key_verify_signature(pk, sig);
+ const struct software_pkey *pk = key->payload.data[asym_crypto];
+ return software_pkey_verify_signature(pk, sig);
}
/*
* Public key algorithm asymmetric key subtype
*/
-struct asymmetric_key_subtype public_key_subtype = {
+struct asymmetric_key_subtype software_pkey_subtype = {
.owner = THIS_MODULE,
- .name = "public_key",
- .name_len = sizeof("public_key") - 1,
- .describe = public_key_describe,
- .destroy = public_key_destroy,
- .verify_signature = public_key_verify_signature_2,
+ .name = "software_pkey",
+ .name_len = sizeof("software_pkey") - 1,
+ .describe = software_pkey_describe,
+ .destroy = software_pkey_destroy,
+ .verify_signature = software_pkey_verify_signature_2,
};
-EXPORT_SYMBOL_GPL(public_key_subtype);
+EXPORT_SYMBOL_GPL(software_pkey_subtype);
diff --git a/crypto/asymmetric_keys/software_pkey.h b/crypto/asymmetric_keys/software_pkey.h
index 06d6500e5825..696bce5daf08 100644
--- a/crypto/asymmetric_keys/software_pkey.h
+++ b/crypto/asymmetric_keys/software_pkey.h
@@ -11,7 +11,7 @@
#include <crypto/public_key.h>
-extern struct asymmetric_key_subtype public_key_subtype;
+extern struct asymmetric_key_subtype software_pkey_subtype;
/*
* Cryptographic data for the software public-key subtype of the asymmetric key
@@ -20,14 +20,14 @@ extern struct asymmetric_key_subtype public_key_subtype;
* Note that this may include private part of the key as well as the public
* part.
*/
-struct public_key {
+struct software_pkey {
void *key;
u32 keylen;
const char *id_type;
const char *pkey_algo;
};
-extern void public_key_destroy(void *payload);
+extern void software_pkey_destroy(void *payload);
-extern int public_key_verify_signature(const struct public_key *pkey,
- const struct public_key_signature *sig);
+extern int software_pkey_verify_signature(const struct software_pkey *pkey,
+ const struct public_key_signature *sig);
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index a008a945aa82..9cc629261fee 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -47,7 +47,7 @@ struct x509_parse_context {
void x509_free_certificate(struct x509_certificate *cert)
{
if (cert) {
- public_key_destroy(cert->pub);
+ software_pkey_destroy(cert->pub);
kfree(cert->issuer);
kfree(cert->subject);
kfree(cert->id);
@@ -75,7 +75,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
cert = kzalloc(sizeof(struct x509_certificate), GFP_KERNEL);
if (!cert)
goto error_no_cert;
- cert->pub = kzalloc(sizeof(struct public_key), GFP_KERNEL);
+ cert->pub = kzalloc(sizeof(struct software_pkey), GFP_KERNEL);
if (!cert->pub)
goto error_no_ctx;
ctx = kzalloc(sizeof(struct x509_parse_context), GFP_KERNEL);
diff --git a/crypto/asymmetric_keys/x509_parser.h b/crypto/asymmetric_keys/x509_parser.h
index dbeed6018e63..f9fe7c8b2002 100644
--- a/crypto/asymmetric_keys/x509_parser.h
+++ b/crypto/asymmetric_keys/x509_parser.h
@@ -16,7 +16,7 @@
struct x509_certificate {
struct x509_certificate *next;
struct x509_certificate *signer; /* Certificate that signed this one */
- struct public_key *pub; /* Public key details */
+ struct software_pkey *pub; /* Public key details */
struct public_key_signature sig; /* Signature parameters */
char *issuer; /* Name of certificate issuer */
char *subject; /* Name of certificate subject */
@@ -58,5 +58,5 @@ extern int x509_decode_time(time64_t *_t, size_t hdrlen,
* x509_public_key.c
*/
extern int x509_get_sig_params(struct x509_certificate *cert);
-extern int x509_check_signature(const struct public_key *pub,
+extern int x509_check_signature(const struct software_pkey *pub,
struct x509_certificate *cert);
diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
index 0896f784cfda..55fdefc12069 100644
--- a/crypto/asymmetric_keys/x509_public_key.c
+++ b/crypto/asymmetric_keys/x509_public_key.c
@@ -220,7 +220,7 @@ EXPORT_SYMBOL_GPL(x509_get_sig_params);
/*
* Check the signature on a certificate using the provided public key
*/
-int x509_check_signature(const struct public_key *pub,
+int x509_check_signature(const struct software_pkey *pub,
struct x509_certificate *cert)
{
int ret;
@@ -231,7 +231,7 @@ int x509_check_signature(const struct public_key *pub,
if (ret < 0)
return ret;
- ret = public_key_verify_signature(pub, &cert->sig);
+ ret = software_pkey_verify_signature(pub, &cert->sig);
if (ret == -ENOPKG)
cert->unsupported_crypto = true;
pr_debug("Cert Verification: %d\n", ret);
@@ -350,8 +350,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
kids->id[1] = cert->skid;
/* We're pinning the module by being linked against it */
- __module_get(public_key_subtype.owner);
- prep->payload.data[asym_subtype] = &public_key_subtype;
+ __module_get(software_pkey_subtype.owner);
+ prep->payload.data[asym_subtype] = &software_pkey_subtype;
prep->payload.data[asym_key_ids] = kids;
prep->payload.data[asym_crypto] = cert->pub;
prep->description = desc;
next prev parent reply other threads:[~2016-02-19 17:20 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 17:18 [PATCH 0/8] X.509: Software public key subtype changes David Howells
2016-02-19 17:18 ` [PATCH 1/8] crypto: KEYS: convert public key and digsig asym to the akcipher api David Howells
2016-02-19 17:18 ` [PATCH 2/8] integrity: convert digsig to " David Howells
2016-02-19 17:18 ` [PATCH 3/8] crypto: public_key: remove MPIs from public_key_signature struct David Howells
2016-02-19 17:18 ` [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer David Howells
2016-02-22 19:59 ` Tadeusz Struk
2016-02-22 22:28 ` David Howells
2016-02-22 23:35 ` Tadeusz Struk
2016-02-23 0:01 ` Andrew Zaborowski
2016-02-23 10:53 ` David Howells
2016-02-24 17:12 ` [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey Tadeusz Struk
2016-02-24 17:12 ` [PATCH 1/2] crypto: Add hash param to pkcs1pad Tadeusz Struk
2016-02-24 17:12 ` [PATCH 2/2] crypto: remove padding logic from rsa.c Tadeusz Struk
2016-02-27 18:40 ` Herbert Xu
2016-02-28 3:20 ` Tadeusz Struk
2016-02-26 14:00 ` David Howells
2016-02-26 15:02 ` David Howells
2016-02-24 17:28 ` [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey David Howells
2016-02-23 10:55 ` [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer David Howells
2016-02-23 11:25 ` Andrew Zaborowski
2016-02-26 11:42 ` David Howells
2016-02-24 5:04 ` Mimi Zohar
2016-02-24 5:59 ` Mimi Zohar
2016-02-29 15:37 ` David Howells
2016-02-19 17:18 ` [PATCH 5/8] X.509: Make algo identifiers text instead of enum David Howells
2016-02-19 17:18 ` [PATCH 6/8] X.509: Make the public_key asymmetric key type internal data private David Howells
2016-02-19 17:18 ` [PATCH 7/8] X.509: Rename public_key.c to software_pkey.c David Howells
2016-02-19 17:19 ` David Howells [this message]
2016-02-22 18:57 ` [PATCH 0/8] X.509: Software public key subtype changes Mimi Zohar
2016-02-22 19:59 ` Tadeusz Struk
2016-02-22 22:29 ` David Howells
2016-02-23 0:03 ` Mimi Zohar
2016-02-23 10:16 ` David Howells
2016-02-23 12:28 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160219171906.17223.46859.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=tadeusz.struk@intel.com \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).