1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include <linux/kernel.h>
7 int load_certificate_list(const u8 cert_list
[],
8 const unsigned long list_size
,
9 const struct key
*keyring
)
18 /* Each cert begins with an ASN.1 SEQUENCE tag and must be more
19 * than 256 bytes in size.
26 plen
= (p
[2] << 8) | p
[3];
31 key
= key_create_or_update(make_key_ref(keyring
, 1),
36 ((KEY_POS_ALL
& ~KEY_POS_SETATTR
) |
37 KEY_USR_VIEW
| KEY_USR_READ
),
38 KEY_ALLOC_NOT_IN_QUOTA
|
40 KEY_ALLOC_BYPASS_RESTRICTION
);
42 pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
45 pr_notice("Loaded X.509 cert '%s'\n",
46 key_ref_to_ptr(key
)->description
);
55 pr_err("Problem parsing in-kernel X.509 certificate list\n");