Re: [PATCH v12 00/11] Appended signatures support for IMA appraisal

2019-08-26 Thread Thiago Jung Bauermann
Hello Jordan, Jordan Hand writes: > On 6/27/19 7:19 PM, Thiago Jung Bauermann wrote: >> On the OpenPOWER platform, secure boot and trusted boot are being >> implemented using IMA for taking measurements and verifying signatures. >> Since the kernel image on Power ser

Re: [PATCH v12 01/11] MODSIGN: Export module signature definitions

2019-07-23 Thread Thiago Jung Bauermann
Hello Philipp, Philipp Rudo writes: > Hi Thiago, > > On Thu, 04 Jul 2019 15:57:34 -0300 > Thiago Jung Bauermann wrote: > >> Hello Philipp, >> >> Philipp Rudo writes: >> >> > Hi Thiago, >> > >> > >>

Re: [PATCH v12 01/11] MODSIGN: Export module signature definitions

2019-07-04 Thread Thiago Jung Bauermann
Hello Philipp, Philipp Rudo writes: > Hi Thiago, > > > On Thu, 04 Jul 2019 03:42:57 -0300 > Thiago Jung Bauermann wrote: > >> Jessica Yu writes: >> >> > +++ Thiago Jung Bauermann [27/06/19 23:19 -0300]: >> >>IMA will use the modul

Re: [PATCH v12 00/11] Appended signatures support for IMA appraisal

2019-07-03 Thread Thiago Jung Bauermann
Mimi Zohar writes: > On Thu, 2019-06-27 at 23:19 -0300, Thiago Jung Bauermann wrote: >> Hello, >> >> This version is essentially identical to the last one. >> >> It is only a rebase on top of today's linux-integrity/next-queued-testing, >> pro

Re: [PATCH v12 01/11] MODSIGN: Export module signature definitions

2019-07-03 Thread Thiago Jung Bauermann
Jessica Yu writes: > +++ Thiago Jung Bauermann [27/06/19 23:19 -0300]: >>IMA will use the module_signature format for append signatures, so export >>the relevant definitions and factor out the code which verifies that the >>appended signature trailer is valid

[PATCH v12 09/11] ima: Define ima-modsig template

2019-06-27 Thread Thiago Jung Bauermann
s as well as the ones from the "ima-sig" descriptor. Change ima_store_measurement() to accept a struct modsig * argument so that it can be passed along to the templates via struct ima_event_data. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mim

[PATCH v12 06/11] ima: Factor xattr_verify() out of ima_appraise_measurement()

2019-06-27 Thread Thiago Jung Bauermann
they're now pointers), and fixing the style of a block comment to appease checkpatch. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_appraise.c | 141 +++--- 1 file changed, 81 insertions(+), 60 dele

[PATCH v12 07/11] ima: Implement support for module-style appended signatures

2019-06-27 Thread Thiago Jung Bauermann
yring. Because modsig verification needs to convert from an integrity keyring id to the keyring itself, add an integrity_keyring_from_id() function in digsig.c so that integrity_modsig_verify() can use it. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/dig

[PATCH v12 11/11] ima: Allow template= option for appraise rules as well

2019-06-27 Thread Thiago Jung Bauermann
It's useful being able to specify a different IMA template on appraise policy rules, so allow it. Signed-off-by: Thiago Jung Bauermann Suggested-by: Mimi Zohar --- security/integrity/ima/ima_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/integrit

[PATCH v12 05/11] ima: Add modsig appraise_type option for module-style appended signatures

2019-06-27 Thread Thiago Jung Bauermann
signature stored in the extended attribute or an appended signature. For now, the rule above will behave exactly the same as if appraise_type=imasig was specified. The actual modsig implementation will be introduced separately. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann

[PATCH v12 10/11] ima: Store the measurement again when appraising a modsig

2019-06-27 Thread Thiago Jung Bauermann
at situation and store an additional measurement with the modsig. This is done by adding an IMA_MEASURE action flag if we read a modsig and the IMA template contains a modsig field. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 1 + securit

[PATCH v12 02/11] PKCS#7: Refactor verify_pkcs7_signature()

2019-06-27 Thread Thiago Jung Bauermann
IMA will need to verify a PKCS#7 signature which has already been parsed. For this reason, factor out the code which does that from verify_pkcs7_signature() into a new function which takes a struct pkcs7_message instead of a data buffer. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi

[PATCH v12 01/11] MODSIGN: Export module signature definitions

2019-06-27 Thread Thiago Jung Bauermann
() without having to depend on either CONFIG_MODULE_SIG or CONFIG_MODULES. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 44 + init/Kconfig | 6

[PATCH v12 08/11] ima: Collect modsig

2019-06-27 Thread Thiago Jung Bauermann
Obtain the modsig and calculate its corresponding hash in ima_collect_measurement(). Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 8 - security/integrity/ima/ima_api.c | 5 ++- security/integrity/ima/ima_appraise.c | 2 +- security/integrity/ima

[PATCH v12 03/11] PKCS#7: Introduce pkcs7_get_digest()

2019-06-27 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v12 00/11] Appended signatures support for IMA appraisal

2019-06-27 Thread Thiago Jung Bauermann
rialize_data() since their callers already performs that check. - Moved check_current_template_modsig() to this patch, previously was in "ima: Store the measurement again when appraising a modsig". - Patch "ima: Store the measurement again when appraising a modsig&qu

[PATCH v12 04/11] integrity: Select CONFIG_KEYS instead of depending on it

2019-06-27 Thread Thiago Jung Bauermann
This avoids a dependency cycle in soon-to-be-introduced CONFIG_IMA_APPRAISE_MODSIG: it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi

Re: [PATCH v11 02/13] PKCS#7: Refactor verify_pkcs7_signature()

2019-06-24 Thread Thiago Jung Bauermann
Hello David, AFAIK Mimi is happy with this patch set, but I still need acks from maintainers of other subsystems that my changes touch before she can accept it. Are this patch and the next one ("PKCS#7: Introduce pkcs7_get_digest()") OK from your PoV? -- Thiago Jung Bauermann

Re: [PATCH v11 01/13] MODSIGN: Export module signature definitions

2019-06-24 Thread Thiago Jung Bauermann
Hello Jessica, AFAIK Mimi is happy with this patch set, but I still need acks from maintainers of other subsystems that my changes touch before she can accept it. Is this patch OK from your PoV? -- Thiago Jung Bauermann IBM Linux Technology Center Thiago Jung Bauermann writes: > IMA w

[PATCH v11 12/13] ima: Store the measurement again when appraising a modsig

2019-06-10 Thread Thiago Jung Bauermann
at situation and store an additional measurement with the modsig. This is done by adding an IMA_MEASURE action flag if we read a modsig and the IMA template contains a modsig field. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 1 + securit

[PATCH v11 13/13] ima: Allow template= option for appraise rules as well

2019-06-10 Thread Thiago Jung Bauermann
It's useful being able to specify a different IMA template on appraise policy rules, so allow it. Signed-off-by: Thiago Jung Bauermann Suggested-by: Mimi Zohar --- security/integrity/ima/ima_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/integrit

[PATCH v11 11/13] ima: Define ima-modsig template

2019-06-10 Thread Thiago Jung Bauermann
s as well as the ones from the "ima-sig" descriptor. Change ima_store_measurement() to accept a struct modsig * argument so that it can be passed along to the templates via struct ima_event_data. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mim

[PATCH v11 10/13] ima: Collect modsig

2019-06-10 Thread Thiago Jung Bauermann
Obtain the modsig and calculate its corresponding hash in ima_collect_measurement(). Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 8 - security/integrity/ima/ima_api.c | 5 ++- security/integrity/ima/ima_appraise.c | 2 +- security/integrity/ima

[PATCH v11 09/13] ima: Implement support for module-style appended signatures

2019-06-10 Thread Thiago Jung Bauermann
yring. Because modsig verification needs to convert from an integrity keyring id to the keyring itself, add an integrity_keyring_from_id() function in digsig.c so that integrity_modsig_verify() can use it. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/dig

[PATCH v11 08/13] ima: Factor xattr_verify() out of ima_appraise_measurement()

2019-06-10 Thread Thiago Jung Bauermann
they're now pointers), and fixing the style of a block comment to appease checkpatch. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_appraise.c | 141 +++--- 1 file changed, 81 insertions(+), 60 dele

[PATCH v11 05/13] integrity: Select CONFIG_KEYS instead of depending on it

2019-06-10 Thread Thiago Jung Bauermann
This avoids a dependency cycle in soon-to-be-introduced CONFIG_IMA_APPRAISE_MODSIG: it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi

[PATCH v11 07/13] ima: Add modsig appraise_type option for module-style appended signatures

2019-06-10 Thread Thiago Jung Bauermann
signature stored in the extended attribute or an appended signature. For now, the rule above will behave exactly the same as if appraise_type=imasig was specified. The actual modsig implementation will be introduced separately. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann

[PATCH v11 03/13] PKCS#7: Introduce pkcs7_get_digest()

2019-06-10 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v11 04/13] integrity: Introduce struct evm_xattr

2019-06-10 Thread Thiago Jung Bauermann
ost places the array doesn't hold a digest. A separate struct evm_xattr is introduced, with the original definition of evm_ima_xattr_data to be used in the places that actually expect that definition, specifically the EVM HMAC code. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v11 06/13] ima: Use designated initializers for struct ima_event_data

2019-06-10 Thread Thiago Jung Bauermann
all struct initializations. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar --- security/integrity/ima/ima_api.c | 13 + security/integrity/ima/ima_init.c | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima/ima_api.c b

[PATCH v11 02/13] PKCS#7: Refactor verify_pkcs7_signature()

2019-06-10 Thread Thiago Jung Bauermann
IMA will need to verify a PKCS#7 signature which has already been parsed. For this reason, factor out the code which does that from verify_pkcs7_signature() into a new function which takes a struct pkcs7_message instead of a data buffer. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi

[PATCH v11 00/13] Appended signatures support for IMA appraisal

2019-06-10 Thread Thiago Jung Bauermann
data() since their callers already performs that check. - Moved check_current_template_modsig() to this patch, previously was in "ima: Store the measurement again when appraising a modsig". - Patch "ima: Store the measurement again when appraising a modsig" - Renam

[PATCH v11 01/13] MODSIGN: Export module signature definitions

2019-06-10 Thread Thiago Jung Bauermann
() without having to depend on either CONFIG_MODULE_SIG or CONFIG_MODULES. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 44 + init/Kconfig | 6

Re: [PATCH v10 09/12] ima: Implement support for module-style appended signatures

2019-05-28 Thread Thiago Jung Bauermann
Mimi Zohar writes: > Hi Thiago, > > On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote: >> >> @@ -326,6 +356,10 @@ int ima_appraise_measurement(enum ima_hooks func, >> case INTEGRITY_UNKNOWN: >> break; >> case INTEGRITY_NOXATTRS:/* No EVM pr

Re: [PATCH v10 09/12] ima: Implement support for module-style appended signatures

2019-05-28 Thread Thiago Jung Bauermann
rc = mod_check_sig(sig, buf_len, func_tokens[func]); And in mod_check_sig(): pr_err("%s: Module is not signed with expected PKCS#7 message\n", name); If you think it's not worth it to expose func_tokens, I can make ima_read_modsig() pass a more generic const string such as "IMA modsig" for example. > Other than this, the patch looks good. Nice! -- Thiago Jung Bauermann IBM Linux Technology Center

Re: [PATCH v10 12/12] ima: Store the measurement again when appraising a modsig

2019-05-28 Thread Thiago Jung Bauermann
Mimi Zohar writes: > Hi Thiago, > > On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote: >> If the IMA template contains the "modsig" or "d-modsig" field, then the >> modsig should be added to the measurement list when the file is appraised

Re: [PATCH v10 11/12] ima: Define ima-modsig template

2019-05-28 Thread Thiago Jung Bauermann
Mimi Zohar writes: > On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote: >> Define new "d-modsig" template field which holds the digest that is >> expected to match the one contained in the modsig, and also new "modsig" >> template fiel

Re: [PATCH v10 01/12] MODSIGN: Export module signature definitions

2019-05-28 Thread Thiago Jung Bauermann
Mimi Zohar writes: > On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote: >> IMA will use the module_signature format for append signatures, so export >> the relevant definitions and factor out the code which verifies that the >> appended signature trailer

Re: [PATCH v5 10/10] integrity: support EC-RDSA signatures for asymmetric_verify

2019-02-25 Thread Thiago Jung Bauermann
= "raw"; > + } else { > + pks.pkey_algo = "rsa"; > + pks.encoding = "pkcs1"; > + } > pks.digest = (u8 *)data; > pks.digest_size = datalen; > pks.s = hdr->sig; -- Thiago Jung Bauermann IBM Linux Technology Center

[PATCH v9 01/14] MODSIGN: Export module signature definitions

2018-12-12 Thread Thiago Jung Bauermann
() without having to depend on CONFIG_MODULE_SIG. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 47 ++ init/Kconfig | 6 ++- kernel/Makefile

[PATCH v9 08/14] ima: Introduce is_signed()

2018-12-12 Thread Thiago Jung Bauermann
With the introduction of another IMA signature type (modsig), some places will need to check for both of them. It is cleaner to do that if there's a helper function to tell whether an xattr_value represents an IMA signature. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Baue

[PATCH v9 14/14] ima: Store the measurement again when appraising a modsig

2018-12-12 Thread Thiago Jung Bauermann
nal measurement with the modsig. This is done by defining the appraise subaction flag IMA_READ_MEASURE and testing for it in process_measurement(). Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_

[PATCH v9 04/14] integrity: Introduce struct evm_xattr

2018-12-12 Thread Thiago Jung Bauermann
ost places the array doesn't hold a digest. A separate struct evm_xattr is introduced, with the original definition of evm_ima_xattr_data to be used in the places that actually expect that definition, specifically the EVM HMAC code. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v9 09/14] ima: Export func_tokens

2018-12-12 Thread Thiago Jung Bauermann
ima_read_modsig() will need it so that it can show an error message. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h| 2 ++ security/integrity/ima/ima_policy.c | 12 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima

[PATCH v9 11/14] ima: Implement support for module-style appended signatures

2018-12-12 Thread Thiago Jung Bauermann
nable building the sign-file tool when CONFIG_IMA_APPRAISE_MODSIG is enabled, so that the user can sign files using this format. Signed-off-by: Thiago Jung Bauermann --- scripts/Makefile | 4 +- security/integrity/digsig.c | 3 + security/integrity/ima/Kc

[PATCH v9 05/14] integrity: Introduce integrity_keyring_from_id()

2018-12-12 Thread Thiago Jung Bauermann
IMA will need to obtain the keyring used to verify file signatures so that it can verify the module-style signature appended to files. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig.c| 28 +--- security/integrity

[PATCH v9 13/14] ima: Write modsig to the measurement list

2018-12-12 Thread Thiago Jung Bauermann
Add modsig support to the "sig" template field, allowing the the contents of the modsig to be included in the measurement list. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 7 +++ security/integrity/ima/im

[PATCH v9 12/14] ima: Add new "d-sig" template field

2018-12-12 Thread Thiago Jung Bauermann
Define new "d-sig" template field which holds the digest that is expected to match the one contained in the modsig. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- Documentation/security/IMA-templates.rst | 5 security/integrity/ima/ima.h

[PATCH v9 10/14] ima: Add modsig appraise_type option for module-style appended signatures

2018-12-12 Thread Thiago Jung Bauermann
signature stored in the extended attribute or an appended signature. For now, the rule above will behave exactly the same as if appraise_type=imasig was specified. The actual modsig implementation will be introduced separately. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann

[PATCH v9 07/14] integrity: Select CONFIG_KEYS instead of depending on it

2018-12-12 Thread Thiago Jung Bauermann
This avoids a dependency cycle in soon-to-be-introduced CONFIG_IMA_APPRAISE_MODSIG: it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi

[PATCH v9 06/14] integrity: Introduce asymmetric_sig_has_known_key()

2018-12-12 Thread Thiago Jung Bauermann
function. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig_asymmetric.c | 44 +++--- security/integrity/integrity.h | 8 + 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/security/integrity

[PATCH v9 00/14] Appended signatures support for IMA appraisal

2018-12-12 Thread Thiago Jung Bauermann
te modsig to the measurement list" - Moved some functions from patch "ima: Add functions to read and verify a modsig signature" into this patch. - Moved code related to d-sig support to new patch. - Patch "ima: Store the measurement again when appraisi

[PATCH v9 03/14] PKCS#7: Introduce pkcs7_get_digest()

2018-12-12 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v9 02/14] PKCS#7: Refactor verify_pkcs7_signature() and add pkcs7_get_message_sig()

2018-12-12 Thread Thiago Jung Bauermann
message, so add pkcs7_get_message_sig(). Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: David Howells Cc: David Woodhouse Cc: Herbert Xu Cc: "David S. Miller" --- certs/system_keyring.c| 61 --- crypto/asymmetric_keys/pkcs

Re: [PATCH v8 00/14] Appended signatures support for IMA appraisal

2018-12-04 Thread Thiago Jung Bauermann
Hello James, Thanks for you interest in these patches. James Morris writes: > On Fri, 16 Nov 2018, Thiago Jung Bauermann wrote: > >> On the OpenPOWER platform, secure boot and trusted boot are being >> implemented using IMA for taking measurements and verifying signat

[PATCH v8 13/14] ima: Write modsig to the measurement list

2018-11-16 Thread Thiago Jung Bauermann
Add modsig support to the "sig" template field, allowing the the contents of the modsig to be included in the measurement list. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 7 +++ security/integrity/ima/im

[PATCH v8 14/14] ima: Store the measurement again when appraising a modsig

2018-11-16 Thread Thiago Jung Bauermann
nal measurement with the modsig. This is done by defining the appraise subaction flag IMA_READ_MEASURE and testing for it in process_measurement(). Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_

[PATCH v8 12/14] ima: Add new "d-sig" template field

2018-11-16 Thread Thiago Jung Bauermann
Define new "d-sig" template field which holds the digest that is expected to match the one contained in the modsig. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- Documentation/security/IMA-templates.rst | 5 security/integrity/ima/ima.h

[PATCH v8 10/14] ima: Add modsig appraise_type option for module-style appended signatures

2018-11-16 Thread Thiago Jung Bauermann
signature stored in the extended attribute or an appended signature. For now, the rule above will behave exactly the same as if appraise_type=imasig was specified. The actual modsig implementation will be introduced separately. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann

[PATCH v8 11/14] ima: Implement support for module-style appended signatures

2018-11-16 Thread Thiago Jung Bauermann
ff-by: Thiago Jung Bauermann --- security/integrity/ima/Kconfig| 3 + security/integrity/ima/ima.h | 36 ++- security/integrity/ima/ima_appraise.c | 65 ++-- security/integrity/ima/ima_main.c | 17 ++- security/integrity/ima/ima_modsig.c

[PATCH v8 08/14] ima: Introduce is_signed()

2018-11-16 Thread Thiago Jung Bauermann
With the introduction of another IMA signature type (modsig), some places will need to check for both of them. It is cleaner to do that if there's a helper function to tell whether an xattr_value represents an IMA signature. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Baue

[PATCH v8 09/14] ima: Export func_tokens

2018-11-16 Thread Thiago Jung Bauermann
ima_read_modsig() will need it so that it can show an error message. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h| 2 ++ security/integrity/ima/ima_policy.c | 12 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima

[PATCH v8 07/14] integrity: Select CONFIG_KEYS instead of depending on it

2018-11-16 Thread Thiago Jung Bauermann
This avoids a dependency cycle in soon-to-be-introduced CONFIG_IMA_APPRAISE_MODSIG: it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi

[PATCH v8 06/14] integrity: Introduce asymmetric_sig_has_known_key()

2018-11-16 Thread Thiago Jung Bauermann
function. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig_asymmetric.c | 44 +++--- security/integrity/integrity.h | 8 + 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/security/integrity

[PATCH v8 05/14] integrity: Introduce integrity_keyring_from_id()

2018-11-16 Thread Thiago Jung Bauermann
IMA will need to obtain the keyring used to verify file signatures so that it can verify the module-style signature appended to files. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig.c| 28 +--- security/integrity

[PATCH v8 04/14] integrity: Introduce struct evm_xattr

2018-11-16 Thread Thiago Jung Bauermann
ost places the array doesn't hold a digest. A separate struct evm_xattr is introduced, with the original definition of evm_ima_xattr_data to be used in the places that actually expect that definition. Signed-off-by: Thiago Jung Bauermann --- security/integrity/evm/evm_main.c | 8 +++

[PATCH v8 02/14] PKCS#7: Refactor verify_pkcs7_signature() and add pkcs7_get_message_sig()

2018-11-16 Thread Thiago Jung Bauermann
message, so add pkcs7_get_message_sig(). Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: David Howells Cc: David Woodhouse Cc: Herbert Xu Cc: "David S. Miller" --- certs/system_keyring.c| 61 --- crypto/asymmetric_keys/pkcs

[PATCH v8 03/14] PKCS#7: Introduce pkcs7_get_digest()

2018-11-16 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v8 01/14] MODSIGN: Export module signature definitions

2018-11-16 Thread Thiago Jung Bauermann
() without having to depend on CONFIG_MODULE_SIG. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 47 ++ init/Kconfig | 6 ++- kernel/Makefile

[PATCH v8 00/14] Appended signatures support for IMA appraisal

2018-11-16 Thread Thiago Jung Bauermann
f dealing with xattr errors in case the modsig verification fails. With this, process_xattr_error isn't needed anymore. - Patch "ima: Write modsig to the measurement list" - Split from patch "ima: Support module-style appended signatures for appraisal". - Adde

[PATCH v7 02/14] PKCS#7: Refactor verify_pkcs7_signature() and add pkcs7_get_message_sig()

2018-05-22 Thread Thiago Jung Bauermann
message, so add pkcs7_get_message_sig(). Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: David Howells Cc: David Woodhouse Cc: Herbert Xu Cc: "David S. Miller" --- certs/system_keyring.c| 61 ++- crypto/asymm

[PATCH v7 06/14] integrity: Introduce asymmetric_sig_has_known_key()

2018-05-22 Thread Thiago Jung Bauermann
function. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig_asymmetric.c | 44 +- security/integrity/integrity.h | 8 +++ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/security/integrity

[PATCH v7 07/14] integrity: Select CONFIG_KEYS instead of depending on it

2018-05-22 Thread Thiago Jung Bauermann
This avoids a dependency cycle in soon-to-be-introduced CONFIG_IMA_APPRAISE_MODSIG: it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi

[PATCH v7 09/14] ima: Export func_tokens

2018-05-22 Thread Thiago Jung Bauermann
ima_read_modsig() will need it so that it can show an error message. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h| 2 ++ security/integrity/ima/ima_policy.c | 12 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima

[PATCH v7 10/14] ima: Add modsig appraise_type option for module-style appended signatures

2018-05-22 Thread Thiago Jung Bauermann
signature stored in the extended attribute or an appended signature. For now, the rule above will behave exactly the same as if appraise_type=imasig was specified. The actual modsig implementation will be introduced separately. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann

[PATCH v7 08/14] ima: Introduce is_signed()

2018-05-22 Thread Thiago Jung Bauermann
With the introduction of another IMA signature type (modsig), some places will need to check for both of them. It is cleaner to do that if there's a helper function to tell whether an xattr_value represents an IMA signature. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Baue

[PATCH v7 12/14] ima: Add new "d-sig" template field

2018-05-22 Thread Thiago Jung Bauermann
Define new "d-sig" template field which holds the digest that is expected to match the one contained in the modsig. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- Documentation/security/IMA-templates.rst | 5 + security/integrity/ima/ima.h

[PATCH v7 14/14] ima: Store the measurement again when appraising a modsig

2018-05-22 Thread Thiago Jung Bauermann
nal measurement with the modsig. This is done by defining the appraise subaction flag IMA_READ_MEASURE and testing for it in process_measurement(). Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_

[PATCH v7 11/14] ima: Implement support for module-style appended signatures

2018-05-22 Thread Thiago Jung Bauermann
-off-by: Thiago Jung Bauermann --- security/integrity/ima/Kconfig| 3 + security/integrity/ima/ima.h | 36 - security/integrity/ima/ima_appraise.c | 64 +-- security/integrity/ima/ima_main.c | 17 +++- security/integrity/ima/ima_modsig.c | 145

[PATCH v7 13/14] ima: Write modsig to the measurement list

2018-05-22 Thread Thiago Jung Bauermann
Add modsig support to the "sig" template field, allowing the the contents of the modsig to be included in the measurement list. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 7 +++ security/integrity/ima/im

[PATCH v7 05/14] integrity: Introduce integrity_keyring_from_id()

2018-05-22 Thread Thiago Jung Bauermann
IMA will need to obtain the keyring used to verify file signatures so that it can verify the module-style signature appended to files. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Mimi Zohar --- security/integrity/digsig.c| 28 +--- security/integrity

[PATCH v7 03/14] PKCS#7: Introduce pkcs7_get_digest()

2018-05-22 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar

[PATCH v7 00/14] Appended signatures support for IMA appraisal

2018-05-22 Thread Thiago Jung Bauermann
s xattr_value to evm_verifyxattr() unless xattr_value is a modsig. - Patch "ima: Write modsig to the measurement list" - Since now we determine whether we'll use an xattr sig or a modsig at the time they are read, there's no need to store a measurement again in the m

[PATCH v7 04/14] integrity: Introduce struct evm_xattr

2018-05-22 Thread Thiago Jung Bauermann
ost places the array doesn't hold a digest. A separate struct evm_xattr is introduced, with the original definition of evm_ima_xattr_data to be used in the places that actually expect that definition. Signed-off-by: Thiago Jung Bauermann --- security/integrity/evm/evm_crypto.c | 4

[PATCH v7 01/14] MODSIGN: Export module signature definitions

2018-05-22 Thread Thiago Jung Bauermann
() without having to depend on CONFIG_MODULE_SIG. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 44 +++ init/Kconfig | 6 +++- kernel/Makefile

Re: [PATCH v6 00/12] Appended signatures support for IMA appraisal

2018-03-16 Thread Thiago Jung Bauermann
Thiago Jung Bauermann writes: > Now the modsig is only ignored if it references a signature that is not > present in IMA's keyring (or if there's a parsing error, obviously). If the The above should read "Now the modsig is only ignored if it references a *key* that is

[PATCH v6 04/12] ima: Introduce is_ima_sig()

2018-03-16 Thread Thiago Jung Bauermann
With the introduction of another IMA signature type (modsig), some places will need to check for both of them. It is cleaner to do that if there's a helper function to tell whether an xattr_value represents an IMA signature. Suggested-by: Mimi Zohar Signed-off-by: Thiago Jung Baue

[PATCH v6 03/12] PKCS#7: Introduce pkcs7_get_digest()

2018-03-16 Thread Thiago Jung Bauermann
work. Verifying that sinfo->sig->digest isn't NULL is sufficient because both places which allocate sinfo->sig (pkcs7_parse_message() and pkcs7_note_signed_info()) use kzalloc() so sig->digest is always initialized to zero. Signed-off-by: Thiago Jung Bauermann Cc: David Howells Cc: He

[PATCH v6 01/12] MODSIGN: Export module signature definitions

2018-03-16 Thread Thiago Jung Bauermann
() without having to depend on CONFIG_MODULE_SIG. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Mimi Zohar Cc: Jessica Yu --- include/linux/module.h | 3 -- include/linux/module_signature.h | 44 +++ init/Kconfig | 6 +++- kernel/Makefile

[PATCH v6 00/12] Appended signatures support for IMA appraisal

2018-03-16 Thread Thiago Jung Bauermann
g of ima_read_xattr return value into process_xattr_error in ima_appraise_measurement so that it can be used if the modsig verification fails. - Pass NULL xattr_value to evm_verifyxattr even in the case of xattr signature in ima_appraise_measurement (suggested by Mimi Zohar). - Use switch stat

[PATCH v6 05/12] integrity: Introduce integrity_keyring_from_id()

2018-03-16 Thread Thiago Jung Bauermann
IMA will need to obtain the keyring used to verify file signatures so that it can verify the module-style signature appended to files. Signed-off-by: Thiago Jung Bauermann --- security/integrity/digsig.c| 28 +--- security/integrity/integrity.h | 6 ++ 2 files

[PATCH v6 07/12] integrity: Select CONFIG_KEYS instead of depending on it

2018-03-16 Thread Thiago Jung Bauermann
This avoids a dependency cycle in CONFIG_IMA_APPRAISE_MODSIG (introduced by a later patch in this series): it will select CONFIG_MODULE_SIG_FORMAT which in turn selects CONFIG_KEYS. Kconfig then complains that CONFIG_INTEGRITY_SIGNATURE depends on CONFIG_KEYS. Signed-off-by: Thiago Jung Bauermann

[PATCH v6 11/12] ima: Implement support for module-style appended signatures

2018-03-16 Thread Thiago Jung Bauermann
signature. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h | 11 +++- security/integrity/ima/ima_appraise.c | 53 +++ security/integrity/ima/ima_main.c | 21 +++--- 3 files changed, 74 insertions(+), 11 deletions

[PATCH v6 12/12] ima: Write modsig to the measurement list

2018-03-16 Thread Thiago Jung Bauermann
igned-off-by: Thiago Jung Bauermann --- Documentation/security/IMA-templates.rst | 5 security/integrity/ima/ima_template.c | 4 ++- security/integrity/ima/ima_template_lib.c | 47 +-- security/integrity/ima/ima_template_lib.h | 2 ++ 4 files changed,

[PATCH v6 09/12] ima: Add modsig appraise_type option for module-style appended signatures

2018-03-16 Thread Thiago Jung Bauermann
ew file mode 100644 index ..d8ea811b6f74 --- /dev/null +++ b/security/integrity/ima/ima_modsig.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * IMA support for appraising module-style appended signatures. + * + * Copyright (C) 2018 IBM Corporation + * + * Author: + * Thiago J

[PATCH v6 08/12] ima: Export func_tokens

2018-03-16 Thread Thiago Jung Bauermann
ima_read_modsig() will need it so that it can show an error message. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima.h| 2 ++ security/integrity/ima/ima_policy.c | 12 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima

[PATCH v6 06/12] integrity: Introduce asymmetric_sig_has_known_key()

2018-03-16 Thread Thiago Jung Bauermann
function. Signed-off-by: Thiago Jung Bauermann --- security/integrity/digsig_asymmetric.c | 44 +- security/integrity/integrity.h | 8 +++ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/security/integrity/digsig_asymmetric.c b/security

[PATCH v6 10/12] ima: Add functions to read and verify a modsig signature

2018-03-16 Thread Thiago Jung Bauermann
This is the code needed by IMA-appraise to work with modsig signatures. It will be used by the next two patches. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/Kconfig | 3 + security/integrity/ima/ima.h| 41 security/integrity/ima/ima_modsig.c | 181

[PATCH v6 02/12] PKCS#7: Introduce pkcs7_get_message_sig() and verify_pkcs7_message_sig()

2018-03-16 Thread Thiago Jung Bauermann
verify_pkcs7_signature() takes. Signed-off-by: Thiago Jung Bauermann Cc: David Howells Cc: David Woodhouse Cc: Herbert Xu Cc: "David S. Miller" --- certs/system_keyring.c| 61 ++- crypto/asymmetric_keys/pkcs7_parser.c | 16 + incl

Re: [PATCH v5 12/18] MODSIGN: Export module signature definitions

2017-10-26 Thread Thiago Jung Bauermann
Mimi Zohar writes: > On Tue, 2017-10-17 at 22:53 -0200, Thiago Jung Bauermann wrote: >> IMA will use the module_signature format for append signatures, so export >> the relevant definitions and factor out the code which verifies that the >> appended signature trailer

  1   2   >