[GIT PULL] keys: Miscellaneous fixes/changes

2023-03-21 Thread David Howells
21 for you to fetch changes up to 3584c1dbfffdabf8e3dc1dd25748bb38dd01cd43: asymmetric_keys: log on fatal failures in PE/pkcs7 (2023-03-21 16:23:56 +) keyrings fixes ---------

Re: [PATCH v2] docs: Fix typo in comment

2022-07-25 Thread David Howells
Baoquan He wrote: > sed -i "s/the the /the /g" `git grep -l "the the "` You might want to clarify the first "the" with a preceding boundary marker. There are some English words ending in "the" that can be used as verbs, though I'm not sure you'd find any of them here - clothe for example. David

[PATCH 2/2] Fix kexec forbidding kernels signed with keys in the secondary keyring to boot

2018-08-16 Thread David Howells
NG to verify_pefile_signature(). Fixes: d3bfe84129f6 ("certs: Add a secondary system keyring that can be added to dynamically") Signed-off-by: Yannik Sembritzki Signed-off-by: David Howells cc: kexec@lists.infradead.org cc: keyri...@vger.kernel.org cc: linux-security-mod...@vger.kernel.org cc: sta...@

Re: [PATCH v3 03/10] kexec_file: factor out arch_kexec_kernel_*() from x86, powerpc

2017-09-25 Thread David Howells
AKASHI Takahiro wrote: > > > -static struct kexec_file_ops *kexec_file_loaders[] = { > > > +struct kexec_file_ops *kexec_file_loaders[] = { > > > &kexec_elf64_ops, > > > + NULL > > > }; const? David ___ kexec mailing list kexec@lists.infradead.org

Re: [PATCH v5 01/32] x86: Documentation for AMD Secure Memory Encryption (SME)

2017-04-20 Thread David Howells
Borislav Petkov wrote: > "Subject: [PATCH v5 01/32] x86: Add documentation for AMD Secure Memory > Encryption (SME)" Or: x86: Document AMD Secure Memory Encryption (SME) support David ___ kexec mailing list kexec@lists.infradead.org http://

Re: [PATCH 09/24] kexec_file: Disable at runtime if securelevel has been set

2017-04-10 Thread David Howells
Mimi Zohar wrote: > From an IMA perspective, either a file hash or signature are valid, > but for this usage it must be a signature. Not necessarily. If IMA can guarantee that a module is the same based on its hash rather than on a key, I would've thought that should be fine. David __

Re: [PATCH 09/24] kexec_file: Disable at runtime if securelevel has been set

2017-04-07 Thread David Howells
Mimi Zohar wrote: > > Okay, fair enough. I can stick in an OR with an IS_ENABLED on some IMA > > symbol. CONFIG_IMA_KEXEC maybe? And also require IMA be enabled? > > Not quite, since as Dave pointed out, IMA is policy driven. As a > policy is installed, we could set a flag. Does such a flag

Re: [PATCH 09/24] kexec_file: Disable at runtime if securelevel has been set

2017-04-07 Thread David Howells
Mimi Zohar wrote: > > > + if (!IS_ENABLED(CONFIG_KEXEC_VERIFY_SIG) && kernel_is_locked_down()) > > > + return -EPERM; > > > + > > > > > IMA can be used to verify file signatures too, based on the LSM hooks > in  kernel_read_file_from_fd().  CONFIG_KEXEC_VERIFY_SIG should not be > requi

Re: [PATCH 09/24] kexec_file: Disable at runtime if securelevel has been set

2017-04-07 Thread David Howells
Dave Young wrote: > > > > + /* Don't permit images to be loaded into trusted kernels if > > > > we're not > > > > +* going to verify the signature on them > > > > +*/ > > > > + if (!IS_ENABLED(CONFIG_KEXEC_VERIFY_SIG) && > > > > kernel_is_locked_down()) > > > > +

[PATCH 09/24] kexec_file: Disable at runtime if securelevel has been set

2017-04-05 Thread David Howells
igned-off-by: David Howells cc: kexec@lists.infradead.org --- kernel/kexec_file.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index b118735fea9d..f6937eecd1eb 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -268,6 +2

[PATCH 08/24] Copy secure_boot flag in boot params across kexec reboot

2017-04-05 Thread David Howells
secure_boot flag in original kernel. secure_boot flag in boot_params is set in EFI stub, but kexec bypasses the stub. Fixing this issue by copying secure_boot flag across kexec reboot. Signed-off-by: Dave Young Signed-off-by: David Howells cc: kexec@lists.infradead.org --- arch/x86/kernel

[PATCH 07/24] kexec: Disable at runtime if the kernel is locked down

2017-04-05 Thread David Howells
. Signed-off-by: Matthew Garrett Signed-off-by: David Howells cc: kexec@lists.infradead.org --- kernel/kexec.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/kernel/kexec.c b/kernel/kexec.c index 980936a90ee6..46de8e6b42f4 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -194,6

Re: [V2][PATCH 1/2] PKCS#7: Fix kernel panic when referring to the empty AuthorityKeyIdentifier

2016-07-17 Thread David Howells
Lans Zhang wrote: > Let me know if I need to add this comment to commit header. I've done that. David ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

[PATCH 2/3] pefile: Fix the failure of calculation for digest

2016-07-17 Thread David Howells
-off-by: Lans Zhang Tested-by: Dave Young Signed-off-by: David Howells Cc: Baoquan He Cc: Vivek Goyal cc: kexec@lists.infradead.org cc: linux-cry...@vger.kernel.org --- crypto/asymmetric_keys/mscode_parser.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto

[PATCH 1/3] PKCS#7: Fix panic when referring to the empty AKID when DEBUG defined

2016-07-17 Thread David Howells
24 4d 85 ff 0f [ 459.060535] RIP [] pkcs7_verify+0x72c/0x7f0 [ 459.063040] RSP [ 459.065456] CR2: [ 459.075998] ---[ end trace c15f0e897cda28dc ]--- Signed-off-by: Lans Zhang Signed-off-by: David Howells Cc: Dave Young Cc: Baoquan He Cc: Vivek Goyal cc: linux-cry...@vge

Re: [V2][PATCH 1/2] PKCS#7: Fix kernel panic when referring to the empty AuthorityKeyIdentifier

2016-07-15 Thread David Howells
Lans Zhang wrote: > This fix resolves the following kernel panic if the empty > AuthorityKeyIdentifier employed. It should be noted that this is only an issue if DEBUG is #defined at the top of pkcs7_verify.c as the crash happens in a pr_debug() statement. David ___

Re: [PATCH 2/2] pefile: Fix the failure of calculation for digest

2016-07-13 Thread David Howells
Lans Zhang wrote: > The commit e68503bd forgot to set digest_len and thus cause the following > error reported by kexec when launching a crash kernel: > "kexec_file_load failed: Bad message" You need to put the commit ID in a "Fixes:" line as per SubmittingPatches. David __

Re: [PATCH 1/2] PKCS#7: Fix kernel panic when referring to the empty AuthorityKeyIdentifier

2016-07-13 Thread David Howells
Lans Zhang wrote: > - } else { > - auth = sig->auth_ids[1]; > + } else if ((auth = sig->auth_ids[1])) { Better to say: } else if (auth) { auth = sig->auth_ids[1]; David ___ kexec ma

Re: [PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c

2015-09-17 Thread David Howells
Palmer Dabbelt wrote: > +#ifdef CONFIG_COMPAT > +/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ > +#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4, struct > compat_atm_iobuf) > +#endif I wonder if it would hurt to ditch the conditionals entirely. It only eats cpp n

Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c

2015-09-17 Thread David Howells
Arnd Bergmann wrote: > That seems unlikely to work, so I suspect it gets a different definition. > If it uses this definition and it does work, we can probably use > > #if defined(__KERNEL__) && defined(CONFIG_HAVE_MIXED_BREAKPOINTS_REGS) > > but that requires a comment explaining exactly why t

Re: [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus"

2015-09-17 Thread David Howells
Palmer Dabbelt wrote: > I tried to fix all the users of "struct elf_prstatus" that should now > be using "struct elf_fdpic_prstatus". The only testing I did here was > to build a Blackfin defconfig with "struct elf_prstatus" not defined, > and to build an x86 defconfig with "struct elf_fdpic_prs

Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace

2015-09-17 Thread David Howells
Josh Triplett wrote: > > Sure. And 0 is perfectly fine value for the flag. Like with MAP_FILE. > > Rephrasing: the flag should always exist with the correct value. > Whether the kernel handles it or not, the kernel *headers* shouldn't > change to match the kernel, not least of which because they

[PATCH] PKCS#7: issuer and subject are mandatory fields in the ASN.1

2014-07-31 Thread David Howells
issuer and subject are mandatory fields in the ASN.1 and so their existence needn't be tested for. They are guaranteed to end up with an empty string if the name material has nothing we can use (see x509_fabricate_name()). Reported-by: Dan Carpenter Signed-off-by: David Howells --- c

Re: [PATCH06/17] PKCS#7: Verify internal certificate chain

2014-07-10 Thread David Howells
valdis.kletni...@vt.edu wrote: > > Verify certificate chain in the X.509 certificates contained within the > > PKCS#7 message as far as possible. If any signature that we should be > > able to verify fails, we reject the whole lot. > > What happens if we see a signature that we shouldn't be able

Re: [PATCH 00/17] KEYS: PKCS#7 and PE file signature checking for kexec

2014-07-09 Thread David Howells
Borislav Petkov wrote: > let me see if I get this straight: > > this current submission is supposed to replace > > http://lkml.kernel.org/r/20140708131504.28621.61165.st...@warthog.procyon.org.uk Yes. It's an extension of that. Plus I did it wrong and managed to lose the actual first patch,

[PATCH06/17] PKCS#7: Verify internal certificate chain

2014-07-09 Thread David Howells
Verify certificate chain in the X.509 certificates contained within the PKCS#7 message as far as possible. If any signature that we should be able to verify fails, we reject the whole lot. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys

[PATCH 00/17] KEYS: PKCS#7 and PE file signature checking for kexec

2014-07-09 Thread David Howells
and are tagged with: keys-pefile-20140709 David --- David Howells (16): X.509: Add bits needed for PKCS#7 X.509: Export certificate parse and free functions PKCS#7: Implement a parser [RFC 2315] PKCS#7: Digest the data in a signed-data message PKCS#7: Find t

[PATCH12/17] pefile: Strip the wrapper off of the cert data block

2014-07-09 Thread David Howells
The certificate data block in a PE binary has a wrapper around the PKCS#7 signature we actually want to get at. Strip this off and check that we've got something that appears to be a PKCS#7 signature. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- c

[PATCH16/17] pefile: Digest the PE binary and compare to the PKCS#7 data

2014-07-09 Thread David Howells
Digest the signed parts of the PE binary, canonicalising the section table before we need it, and then compare the the resulting digest to the one in the PKCS#7 signed content. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys

[PATCH15/17] pefile: Handle pesign using the wrong OID

2014-07-09 Thread David Howells
The pesign utility had a bug where it was using OID_msIndividualSPKeyPurpose instead of OID_msPeImageDataObjId - so allow both OIDs. Signed-off-by: Vivek Goyal Acked-by: Vivek Goyal --- crypto/asymmetric_keys/mscode_parser.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) dif

[PATCH17/17] pefile: Validate PKCS#7 trust chain

2014-07-09 Thread David Howells
Validate the PKCS#7 trust chain against the contents of the system keyring. Signed-off-by: David Howells Acked-by: Vivek Goyal --- crypto/asymmetric_keys/verify_pefile.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/asymmetric_keys/verify_pefile.c b/crypto

[PATCH14/17] pefile: Parse the "Microsoft individual code signing" data blob

2014-07-09 Thread David Howells
The PKCS#7 certificate should contain a "Microsoft individual code signing" data blob as its signed content. This blob contains a digest of the signed content of the PE binary and the OID of the digest algorithm used (typically SHA256). Signed-off-by: David Howells Acked-by: V

[PATCH13/17] pefile: Parse the presumed PKCS#7 content of the certificate blob

2014-07-09 Thread David Howells
Parse the content of the certificate blob, presuming it to be PKCS#7 format. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/verify_pefile.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a

[PATCH11/17] pefile: Parse a PE binary to find a key and a signature contained therein

2014-07-09 Thread David Howells
Parse a PE binary to find a key and a signature contained therein. Later patches will check the signature and add the key if the signature checks out. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Kconfig |9 ++ crypto

[PATCH10/17] Provide PE binary definitions

2014-07-09 Thread David Howells
Provide some PE binary structural and constant definitions as taken from the pesign package sources. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- include/linux/pe.h | 448 1 file changed, 448 insertions

[PATCH08/17] PKCS#7: Provide a key type for testing PKCS#7

2014-07-09 Thread David Howells
-config key3.genkey \ -keyout key3.priv \ -out key3.x509 key3.genkey: @echo Generating X.509 key generation config @echo >$@ "[ req ]" @echo >>$@ "default_bits = 4096" @echo >>$@ "d

[PATCH03/17] PKCS#7: Implement a parser [RFC 2315]

2014-07-09 Thread David Howells
Implement a parser for a PKCS#7 signed-data message as described in part of RFC 2315. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Kconfig|9 + crypto/asymmetric_keys/Makefile | 13 + crypto/asymmetric_keys/pkcs7

[PATCH04/17] PKCS#7: Digest the data in a signed-data message

2014-07-09 Thread David Howells
Digest the data in a PKCS#7 signed-data message and attach to the public_key_signature struct contained in the pkcs7_message struct. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Makefile |3 - crypto/asymmetric_keys

[PATCH07/17] PKCS#7: Find intersection between PKCS#7 message and known, trusted keys

2014-07-09 Thread David Howells
Find the intersection between the X.509 certificate chain contained in a PKCS#7 message and a set of keys that we already know and trust. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Makefile |1 crypto/asymmetric_keys

[PATCH01/17] X.509: Add bits needed for PKCS#7

2014-07-09 Thread David Howells
PKCS#7 validation requires access to the serial number and the raw names in an X.509 certificate. Signed-off-by: David Howells Reviewed-by: Kees Cook Reviewed-by: Josh Boyer --- crypto/asymmetric_keys/x509.asn1 |2 +- crypto/asymmetric_keys/x509_cert_parser.c | 17

[PATCH09/17] KEYS: X.509: Fix a spelling mistake

2014-07-09 Thread David Howells
Signed-off-by: David Howells Acked-by: Vivek Goyal --- crypto/asymmetric_keys/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/asymmetric_keys/Kconfig b/crypto/asymmetric_keys/Kconfig index b6df198..14cac28 100644 --- a/crypto/asymmetric_keys/Kconfig +++ b

[PATCH05/17] PKCS#7: Find the right key in the PKCS#7 key list and verify the signature

2014-07-09 Thread David Howells
Find the appropriate key in the PKCS#7 key list and verify the signature with it. There may be several keys in there forming a chain. Any link in that chain or the root of that chain may be in our keyrings. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook

[PATCH02/17] X.509: Export certificate parse and free functions

2014-07-09 Thread David Howells
Export certificate parse and free functions for use by modules. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook Reviewed-by: Josh Boyer --- crypto/asymmetric_keys/x509_cert_parser.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/asymmetric_keys

[PATCH6/7] PKCS#7: Find intersection between PKCS#7 message and known, trusted keys

2014-07-08 Thread David Howells
Find the intersection between the X.509 certificate chain contained in a PKCS#7 message and a set of keys that we already know and trust. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Makefile |1 crypto/asymmetric_keys

[PATCH 0/7] KEYS: PKCS#7 asymmetric key parser

2014-07-08 Thread David Howells
nt into the key. They can be found on this branch also: http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-modsign.git/log/?h=pkcs7 and are tagged with: keys-pkcs7-20140708 David --- David Howells (7): X.509: Export certificate parse and free functions PKCS

[PATCH5/7] PKCS#7: Verify internal certificate chain

2014-07-08 Thread David Howells
Verify certificate chain in the X.509 certificates contained within the PKCS#7 message as far as possible. If any signature that we should be able to verify fails, we reject the whole lot. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys

[PATCH7/7] PKCS#7: Provide a key type for testing PKCS#7

2014-07-08 Thread David Howells
-config key3.genkey \ -keyout key3.priv \ -out key3.x509 key3.genkey: @echo Generating X.509 key generation config @echo >$@ "[ req ]" @echo >>$@ "default_bits = 4096" @echo >>$@ "d

[PATCH3/7] PKCS#7: Digest the data in a signed-data message

2014-07-08 Thread David Howells
Digest the data in a PKCS#7 signed-data message and attach to the public_key_signature struct contained in the pkcs7_message struct. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Makefile |3 - crypto/asymmetric_keys

[PATCH2/7] PKCS#7: Implement a parser [RFC 2315]

2014-07-08 Thread David Howells
Implement a parser for a PKCS#7 signed-data message as described in part of RFC 2315. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook --- crypto/asymmetric_keys/Kconfig|9 + crypto/asymmetric_keys/Makefile | 13 + crypto/asymmetric_keys/pkcs7

[PATCH4/7] PKCS#7: Find the right key in the PKCS#7 key list and verify the signature

2014-07-08 Thread David Howells
Find the appropriate key in the PKCS#7 key list and verify the signature with it. There may be several keys in there forming a chain. Any link in that chain or the root of that chain may be in our keyrings. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook

[PATCH1/7] X.509: Export certificate parse and free functions

2014-07-08 Thread David Howells
Export certificate parse and free functions for use by modules. Signed-off-by: David Howells Acked-by: Vivek Goyal Reviewed-by: Kees Cook Reviewed-by: Josh Boyer --- crypto/asymmetric_keys/x509_cert_parser.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/asymmetric_keys