diff options
| author | James Morris <james.l.morris@oracle.com> | 2016-03-03 19:39:53 -0500 |
|---|---|---|
| committer | James Morris <james.l.morris@oracle.com> | 2016-03-03 19:39:53 -0500 |
| commit | 88a1b564a20e371e6be41b39b85673e9c1959491 (patch) | |
| tree | f70850f5242470d479711ddb816ac05f47b15642 /security | |
| parent | 5804602536649bccc907cbdd7e31b8797bdb6c45 (diff) | |
| parent | 4e8ae72a75aae285ec5b93518b9680da198afd0d (diff) | |
Merge tag 'keys-next-20160303' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next
Diffstat (limited to 'security')
| -rw-r--r-- | security/integrity/Kconfig | 2 | ||||
| -rw-r--r-- | security/integrity/digsig_asymmetric.c | 16 | ||||
| -rw-r--r-- | security/integrity/integrity.h | 2 | ||||
| -rw-r--r-- | security/keys/big_key.c | 15 | ||||
| -rw-r--r-- | security/keys/key.c | 2 |
5 files changed, 12 insertions, 25 deletions
diff --git a/security/integrity/Kconfig b/security/integrity/Kconfig index 21d756832b75..979be65d22c4 100644 --- a/security/integrity/Kconfig +++ b/security/integrity/Kconfig | |||
| @@ -36,6 +36,7 @@ config INTEGRITY_ASYMMETRIC_KEYS | |||
| 36 | select ASYMMETRIC_KEY_TYPE | 36 | select ASYMMETRIC_KEY_TYPE |
| 37 | select ASYMMETRIC_PUBLIC_KEY_SUBTYPE | 37 | select ASYMMETRIC_PUBLIC_KEY_SUBTYPE |
| 38 | select PUBLIC_KEY_ALGO_RSA | 38 | select PUBLIC_KEY_ALGO_RSA |
| 39 | select CRYPTO_RSA | ||
| 39 | select X509_CERTIFICATE_PARSER | 40 | select X509_CERTIFICATE_PARSER |
| 40 | help | 41 | help |
| 41 | This option enables digital signature verification using | 42 | This option enables digital signature verification using |
| @@ -45,7 +46,6 @@ config INTEGRITY_TRUSTED_KEYRING | |||
| 45 | bool "Require all keys on the integrity keyrings be signed" | 46 | bool "Require all keys on the integrity keyrings be signed" |
| 46 | depends on SYSTEM_TRUSTED_KEYRING | 47 | depends on SYSTEM_TRUSTED_KEYRING |
| 47 | depends on INTEGRITY_ASYMMETRIC_KEYS | 48 | depends on INTEGRITY_ASYMMETRIC_KEYS |
| 48 | select KEYS_DEBUG_PROC_KEYS | ||
| 49 | default y | 49 | default y |
| 50 | help | 50 | help |
| 51 | This option requires that all keys added to the .ima and | 51 | This option requires that all keys added to the .ima and |
diff --git a/security/integrity/digsig_asymmetric.c b/security/integrity/digsig_asymmetric.c index 5ade2a7517a6..80052ed8d467 100644 --- a/security/integrity/digsig_asymmetric.c +++ b/security/integrity/digsig_asymmetric.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/ratelimit.h> | 16 | #include <linux/ratelimit.h> |
| 17 | #include <linux/key-type.h> | 17 | #include <linux/key-type.h> |
| 18 | #include <crypto/public_key.h> | 18 | #include <crypto/public_key.h> |
| 19 | #include <crypto/hash_info.h> | ||
| 19 | #include <keys/asymmetric-type.h> | 20 | #include <keys/asymmetric-type.h> |
| 20 | #include <keys/system_keyring.h> | 21 | #include <keys/system_keyring.h> |
| 21 | 22 | ||
| @@ -94,7 +95,7 @@ int asymmetric_verify(struct key *keyring, const char *sig, | |||
| 94 | if (siglen != __be16_to_cpu(hdr->sig_size)) | 95 | if (siglen != __be16_to_cpu(hdr->sig_size)) |
| 95 | return -EBADMSG; | 96 | return -EBADMSG; |
| 96 | 97 | ||
| 97 | if (hdr->hash_algo >= PKEY_HASH__LAST) | 98 | if (hdr->hash_algo >= HASH_ALGO__LAST) |
| 98 | return -ENOPKG; | 99 | return -ENOPKG; |
| 99 | 100 | ||
| 100 | key = request_asymmetric_key(keyring, __be32_to_cpu(hdr->keyid)); | 101 | key = request_asymmetric_key(keyring, __be32_to_cpu(hdr->keyid)); |
| @@ -103,16 +104,13 @@ int asymmetric_verify(struct key *keyring, const char *sig, | |||
| 103 | 104 | ||
| 104 | memset(&pks, 0, sizeof(pks)); | 105 | memset(&pks, 0, sizeof(pks)); |
| 105 | 106 | ||
| 106 | pks.pkey_hash_algo = hdr->hash_algo; | 107 | pks.pkey_algo = "rsa"; |
| 108 | pks.hash_algo = hash_algo_name[hdr->hash_algo]; | ||
| 107 | pks.digest = (u8 *)data; | 109 | pks.digest = (u8 *)data; |
| 108 | pks.digest_size = datalen; | 110 | pks.digest_size = datalen; |
| 109 | pks.nr_mpi = 1; | 111 | pks.s = hdr->sig; |
| 110 | pks.rsa.s = mpi_read_raw_data(hdr->sig, siglen); | 112 | pks.s_size = siglen; |
| 111 | 113 | ret = verify_signature(key, &pks); | |
| 112 | if (pks.rsa.s) | ||
| 113 | ret = verify_signature(key, &pks); | ||
| 114 | |||
| 115 | mpi_free(pks.rsa.s); | ||
| 116 | key_put(key); | 114 | key_put(key); |
| 117 | pr_debug("%s() = %d\n", __func__, ret); | 115 | pr_debug("%s() = %d\n", __func__, ret); |
| 118 | return ret; | 116 | return ret; |
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index c7a111cc7d89..e08935cf343f 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h | |||
| @@ -90,7 +90,7 @@ struct ima_digest_data { | |||
| 90 | struct signature_v2_hdr { | 90 | struct signature_v2_hdr { |
| 91 | uint8_t type; /* xattr type */ | 91 | uint8_t type; /* xattr type */ |
| 92 | uint8_t version; /* signature format version */ | 92 | uint8_t version; /* signature format version */ |
| 93 | uint8_t hash_algo; /* Digest algorithm [enum pkey_hash_algo] */ | 93 | uint8_t hash_algo; /* Digest algorithm [enum hash_algo] */ |
| 94 | uint32_t keyid; /* IMA key identifier - not X509/PGP specific */ | 94 | uint32_t keyid; /* IMA key identifier - not X509/PGP specific */ |
| 95 | uint16_t sig_size; /* signature size */ | 95 | uint16_t sig_size; /* signature size */ |
| 96 | uint8_t sig[0]; /* signature payload */ | 96 | uint8_t sig[0]; /* signature payload */ |
diff --git a/security/keys/big_key.c b/security/keys/big_key.c index 907c1522ee46..c721e398893a 100644 --- a/security/keys/big_key.c +++ b/security/keys/big_key.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | * 2 of the Licence, or (at your option) any later version. | 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 14 | #include <linux/seq_file.h> | 13 | #include <linux/seq_file.h> |
| 15 | #include <linux/file.h> | 14 | #include <linux/file.h> |
| @@ -18,8 +17,6 @@ | |||
| 18 | #include <keys/user-type.h> | 17 | #include <keys/user-type.h> |
| 19 | #include <keys/big_key-type.h> | 18 | #include <keys/big_key-type.h> |
| 20 | 19 | ||
| 21 | MODULE_LICENSE("GPL"); | ||
| 22 | |||
| 23 | /* | 20 | /* |
| 24 | * Layout of key payload words. | 21 | * Layout of key payload words. |
| 25 | */ | 22 | */ |
| @@ -212,18 +209,8 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen) | |||
| 212 | return ret; | 209 | return ret; |
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | /* | ||
| 216 | * Module stuff | ||
| 217 | */ | ||
| 218 | static int __init big_key_init(void) | 212 | static int __init big_key_init(void) |
| 219 | { | 213 | { |
| 220 | return register_key_type(&key_type_big_key); | 214 | return register_key_type(&key_type_big_key); |
| 221 | } | 215 | } |
| 222 | 216 | device_initcall(big_key_init); | |
| 223 | static void __exit big_key_cleanup(void) | ||
| 224 | { | ||
| 225 | unregister_key_type(&key_type_big_key); | ||
| 226 | } | ||
| 227 | |||
| 228 | module_init(big_key_init); | ||
| 229 | module_exit(big_key_cleanup); | ||
diff --git a/security/keys/key.c b/security/keys/key.c index 09ef276c4bdc..b28755131687 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
| @@ -296,6 +296,8 @@ struct key *key_alloc(struct key_type *type, const char *desc, | |||
| 296 | key->flags |= 1 << KEY_FLAG_IN_QUOTA; | 296 | key->flags |= 1 << KEY_FLAG_IN_QUOTA; |
| 297 | if (flags & KEY_ALLOC_TRUSTED) | 297 | if (flags & KEY_ALLOC_TRUSTED) |
| 298 | key->flags |= 1 << KEY_FLAG_TRUSTED; | 298 | key->flags |= 1 << KEY_FLAG_TRUSTED; |
| 299 | if (flags & KEY_ALLOC_BUILT_IN) | ||
| 300 | key->flags |= 1 << KEY_FLAG_BUILTIN; | ||
| 299 | 301 | ||
| 300 | #ifdef KEY_DEBUGGING | 302 | #ifdef KEY_DEBUGGING |
| 301 | key->magic = KEY_DEBUG_MAGIC; | 303 | key->magic = KEY_DEBUG_MAGIC; |
