0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/export.h>
0010 #include <linux/kernel.h>
0011 #include <linux/sched.h>
0012 #include <linux/cred.h>
0013 #include <linux/err.h>
0014 #include <linux/slab.h>
0015 #include "../integrity.h"
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 void __init add_to_platform_keyring(const char *source, const void *data,
0027 size_t len)
0028 {
0029 key_perm_t perm;
0030 int rc;
0031
0032 perm = (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW;
0033
0034 rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source, data, len,
0035 perm);
0036 if (rc)
0037 pr_info("Error adding keys to platform keyring %s\n", source);
0038 }
0039
0040
0041
0042
0043 static __init int platform_keyring_init(void)
0044 {
0045 int rc;
0046
0047 rc = integrity_init_keyring(INTEGRITY_KEYRING_PLATFORM);
0048 if (rc)
0049 return rc;
0050
0051 pr_notice("Platform Keyring initialized\n");
0052 return 0;
0053 }
0054
0055
0056
0057
0058 device_initcall(platform_keyring_init);