aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 12:21:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 12:21:36 -0400
commitf4f27d0028aabce57e44c16c2fdefccd6310d2f3 (patch)
tree09f25601316d22b64165c19042da51c101bde3c4 /include/crypto
parent2600a46ee0ed57c0e0a382c2a37ebac64d374d20 (diff)
parentb937190c40de0f6f07f592042e3097b16c6b0130 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "Highlights: - A new LSM, "LoadPin", from Kees Cook is added, which allows forcing of modules and firmware to be loaded from a specific device (this is from ChromeOS, where the device as a whole is verified cryptographically via dm-verity). This is disabled by default but can be configured to be enabled by default (don't do this if you don't know what you're doing). - Keys: allow authentication data to be stored in an asymmetric key. Lots of general fixes and updates. - SELinux: add restrictions for loading of kernel modules via finit_module(). Distinguish non-init user namespace capability checks. Apply execstack check on thread stacks" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (48 commits) LSM: LoadPin: provide enablement CONFIG Yama: use atomic allocations when reporting seccomp: Fix comment typo ima: add support for creating files using the mknodat syscall ima: fix ima_inode_post_setattr vfs: forbid write access when reading a file into memory fs: fix over-zealous use of "const" selinux: apply execstack check on thread stacks selinux: distinguish non-init user namespace capability checks LSM: LoadPin for kernel file loading restrictions fs: define a string representation of the kernel_read_file_id enumeration Yama: consolidate error reporting string_helpers: add kstrdup_quotable_file string_helpers: add kstrdup_quotable_cmdline string_helpers: add kstrdup_quotable selinux: check ss_initialized before revalidating an inode label selinux: delay inode label lookup as long as possible selinux: don't revalidate an inode's label when explicitly setting it selinux: Change bool variable name to index. KEYS: Add KEYCTL_DH_COMPUTE command ...
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/pkcs7.h6
-rw-r--r--include/crypto/public_key.h33
2 files changed, 15 insertions, 24 deletions
diff --git a/include/crypto/pkcs7.h b/include/crypto/pkcs7.h
index 441aff9b5aa7..583f199400a3 100644
--- a/include/crypto/pkcs7.h
+++ b/include/crypto/pkcs7.h
@@ -12,6 +12,7 @@
12#ifndef _CRYPTO_PKCS7_H 12#ifndef _CRYPTO_PKCS7_H
13#define _CRYPTO_PKCS7_H 13#define _CRYPTO_PKCS7_H
14 14
15#include <linux/verification.h>
15#include <crypto/public_key.h> 16#include <crypto/public_key.h>
16 17
17struct key; 18struct key;
@@ -26,14 +27,13 @@ extern void pkcs7_free_message(struct pkcs7_message *pkcs7);
26 27
27extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7, 28extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7,
28 const void **_data, size_t *_datalen, 29 const void **_data, size_t *_datalen,
29 bool want_wrapper); 30 size_t *_headerlen);
30 31
31/* 32/*
32 * pkcs7_trust.c 33 * pkcs7_trust.c
33 */ 34 */
34extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7, 35extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7,
35 struct key *trust_keyring, 36 struct key *trust_keyring);
36 bool *_trusted);
37 37
38/* 38/*
39 * pkcs7_verify.c 39 * pkcs7_verify.c
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index aa730ea7faf8..882ca0e1e7a5 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -15,20 +15,6 @@
15#define _LINUX_PUBLIC_KEY_H 15#define _LINUX_PUBLIC_KEY_H
16 16
17/* 17/*
18 * The use to which an asymmetric key is being put.
19 */
20enum key_being_used_for {
21 VERIFYING_MODULE_SIGNATURE,
22 VERIFYING_FIRMWARE_SIGNATURE,
23 VERIFYING_KEXEC_PE_SIGNATURE,
24 VERIFYING_KEY_SIGNATURE,
25 VERIFYING_KEY_SELF_SIGNATURE,
26 VERIFYING_UNSPECIFIED_SIGNATURE,
27 NR__KEY_BEING_USED_FOR
28};
29extern const char *const key_being_used_for[NR__KEY_BEING_USED_FOR];
30
31/*
32 * Cryptographic data for the public-key subtype of the asymmetric key type. 18 * Cryptographic data for the public-key subtype of the asymmetric key type.
33 * 19 *
34 * Note that this may include private part of the key as well as the public 20 * Note that this may include private part of the key as well as the public
@@ -41,12 +27,13 @@ struct public_key {
41 const char *pkey_algo; 27 const char *pkey_algo;
42}; 28};
43 29
44extern void public_key_destroy(void *payload); 30extern void public_key_free(struct public_key *key);
45 31
46/* 32/*
47 * Public key cryptography signature data 33 * Public key cryptography signature data
48 */ 34 */
49struct public_key_signature { 35struct public_key_signature {
36 struct asymmetric_key_id *auth_ids[2];
50 u8 *s; /* Signature */ 37 u8 *s; /* Signature */
51 u32 s_size; /* Number of bytes in signature */ 38 u32 s_size; /* Number of bytes in signature */
52 u8 *digest; 39 u8 *digest;
@@ -55,17 +42,21 @@ struct public_key_signature {
55 const char *hash_algo; 42 const char *hash_algo;
56}; 43};
57 44
45extern void public_key_signature_free(struct public_key_signature *sig);
46
58extern struct asymmetric_key_subtype public_key_subtype; 47extern struct asymmetric_key_subtype public_key_subtype;
48
59struct key; 49struct key;
50struct key_type;
51union key_payload;
52
53extern int restrict_link_by_signature(struct key *trust_keyring,
54 const struct key_type *type,
55 const union key_payload *payload);
56
60extern int verify_signature(const struct key *key, 57extern int verify_signature(const struct key *key,
61 const struct public_key_signature *sig); 58 const struct public_key_signature *sig);
62 59
63struct asymmetric_key_id;
64extern struct key *x509_request_asymmetric_key(struct key *keyring,
65 const struct asymmetric_key_id *id,
66 const struct asymmetric_key_id *skid,
67 bool partial);
68
69int public_key_verify_signature(const struct public_key *pkey, 60int public_key_verify_signature(const struct public_key *pkey,
70 const struct public_key_signature *sig); 61 const struct public_key_signature *sig);
71 62