Skip to content

Commit 9abc4e6

Browse files
committed
KEYS: Rename public key parameter name arrays
Rename the arrays of public key parameters (public key algorithm names, hash algorithm names and ID type names) so that the array name ends in "_name". Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Josh Boyer <jwboyer@redhat.com>
1 parent f36f8c7 commit 9abc4e6

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎crypto/asymmetric_keys/public_key.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
MODULE_LICENSE("GPL");
2424

25-
const char *const pkey_algo[PKEY_ALGO__LAST] = {
25+
const char *const pkey_algo_name[PKEY_ALGO__LAST] = {
2626
[PKEY_ALGO_DSA] = "DSA",
2727
[PKEY_ALGO_RSA] = "RSA",
2828
};
29-
EXPORT_SYMBOL_GPL(pkey_algo);
29+
EXPORT_SYMBOL_GPL(pkey_algo_name);
3030

31-
const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
31+
const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = {
3232
[PKEY_HASH_MD4] = "md4",
3333
[PKEY_HASH_MD5] = "md5",
3434
[PKEY_HASH_SHA1] = "sha1",
@@ -38,13 +38,13 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
3838
[PKEY_HASH_SHA512] = "sha512",
3939
[PKEY_HASH_SHA224] = "sha224",
4040
};
41-
EXPORT_SYMBOL_GPL(pkey_hash_algo);
41+
EXPORT_SYMBOL_GPL(pkey_hash_algo_name);
4242

43-
const char *const pkey_id_type[PKEY_ID_TYPE__LAST] = {
43+
const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST] = {
4444
[PKEY_ID_PGP] = "PGP",
4545
[PKEY_ID_X509] = "X509",
4646
};
47-
EXPORT_SYMBOL_GPL(pkey_id_type);
47+
EXPORT_SYMBOL_GPL(pkey_id_type_name);
4848

4949
/*
5050
* Provide a part of a description of the key for /proc/keys.
@@ -56,7 +56,7 @@ static void public_key_describe(const struct key *asymmetric_key,
5656

5757
if (key)
5858
seq_printf(m, "%s.%s",
59-
pkey_id_type[key->id_type], key->algo->name);
59+
pkey_id_type_name[key->id_type], key->algo->name);
6060
}
6161

6262
/*

‎crypto/asymmetric_keys/x509_public_key.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int x509_check_signature(const struct public_key *pub,
4949
/* Allocate the hashing algorithm we're going to need and find out how
5050
* big the hash operational data will be.
5151
*/
52-
tfm = crypto_alloc_shash(pkey_hash_algo[cert->sig_hash_algo], 0, 0);
52+
tfm = crypto_alloc_shash(pkey_hash_algo_name[cert->sig_hash_algo], 0, 0);
5353
if (IS_ERR(tfm))
5454
return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm);
5555

@@ -117,7 +117,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
117117

118118
pr_devel("Cert Issuer: %s\n", cert->issuer);
119119
pr_devel("Cert Subject: %s\n", cert->subject);
120-
pr_devel("Cert Key Algo: %s\n", pkey_algo[cert->pkey_algo]);
120+
pr_devel("Cert Key Algo: %s\n", pkey_algo_name[cert->pkey_algo]);
121121
pr_devel("Cert Valid From: %04ld-%02d-%02d %02d:%02d:%02d\n",
122122
cert->valid_from.tm_year + 1900, cert->valid_from.tm_mon + 1,
123123
cert->valid_from.tm_mday, cert->valid_from.tm_hour,
@@ -127,8 +127,8 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
127127
cert->valid_to.tm_mday, cert->valid_to.tm_hour,
128128
cert->valid_to.tm_min, cert->valid_to.tm_sec);
129129
pr_devel("Cert Signature: %s + %s\n",
130-
pkey_algo[cert->sig_pkey_algo],
131-
pkey_hash_algo[cert->sig_hash_algo]);
130+
pkey_algo_name[cert->sig_pkey_algo],
131+
pkey_hash_algo_name[cert->sig_hash_algo]);
132132

133133
if (!cert->fingerprint || !cert->authority) {
134134
pr_warn("Cert for '%s' must have SubjKeyId and AuthKeyId extensions\n",

‎include/crypto/public_key.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum pkey_algo {
2222
PKEY_ALGO__LAST
2323
};
2424

25-
extern const char *const pkey_algo[PKEY_ALGO__LAST];
25+
extern const char *const pkey_algo_name[PKEY_ALGO__LAST];
2626

2727
enum pkey_hash_algo {
2828
PKEY_HASH_MD4,
@@ -36,15 +36,15 @@ enum pkey_hash_algo {
3636
PKEY_HASH__LAST
3737
};
3838

39-
extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
39+
extern const char *const pkey_hash_algo_name[PKEY_HASH__LAST];
4040

4141
enum pkey_id_type {
4242
PKEY_ID_PGP, /* OpenPGP generated key ID */
4343
PKEY_ID_X509, /* X.509 arbitrary subjectKeyIdentifier */
4444
PKEY_ID_TYPE__LAST
4545
};
4646

47-
extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST];
47+
extern const char *const pkey_id_type_name[PKEY_ID_TYPE__LAST];
4848

4949
/*
5050
* Cryptographic data for the public-key subtype of the asymmetric key type.

‎kernel/module_signing.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static struct public_key_signature *mod_make_digest(enum pkey_hash_algo hash,
5454
/* Allocate the hashing algorithm we're going to need and find out how
5555
* big the hash operational data will be.
5656
*/
57-
tfm = crypto_alloc_shash(pkey_hash_algo[hash], 0, 0);
57+
tfm = crypto_alloc_shash(pkey_hash_algo_name[hash], 0, 0);
5858
if (IS_ERR(tfm))
5959
return (PTR_ERR(tfm) == -ENOENT) ? ERR_PTR(-ENOPKG) : ERR_CAST(tfm);
6060

@@ -217,7 +217,7 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen)
217217
return -ENOPKG;
218218

219219
if (ms.hash >= PKEY_HASH__LAST ||
220-
!pkey_hash_algo[ms.hash])
220+
!pkey_hash_algo_name[ms.hash])
221221
return -ENOPKG;
222222

223223
key = request_asymmetric_key(sig, ms.signer_len,

0 commit comments

Comments
 (0)