linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/7] ima: get rid of hard dependency on SHA-1
@ 2025-03-13 17:33 Nicolai Stange
  2025-03-13 17:33 ` [RFC PATCH v1 1/7] ima: don't expose runtime_measurements for unsupported hashes Nicolai Stange
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Nicolai Stange @ 2025-03-13 17:33 UTC (permalink / raw)
  To: Mimi Zohar, Roberto Sassu, Dmitry Kasatkin
  Cc: Eric Snowberg, linux-integrity, linux-security-module,
	linux-kernel, Nicolai Stange

Hi all,

if no SHA-1 implementation was available to the kernel, IMA init would
currently fail, rendering the whole subsystem unusable.

This patch series is an attempt to make SHA-1 availability non-mandatory
for IMA. The main motivation is that NIST announced to sunset SHA-1 by
2030 ([1]), whereby any attempt to instantiate it when booted in FIPS mode
would have to be made to fail with -ENOENT. As this does potentially have
an impact on lifetimes for FIPS certifications issued today, distros might
be interested in disabling SHA-1 downstream soon already.

Anyway, making IMA to work without a SHA-1 implementation available is not
so straightforward, mainly due to that established scheme to substitute
padded SHA-1 template hashes for PCR banks with unmapped/unavailable algos.
There is some userspace around expecting that existing behavior, e.g. the
ima_measurement command from ([2]), and breaking that in certain scenarios
is inevitable.

I tried to make it the least painful possible, and I think I arrived at
a not completely unreasonable solution in the end, but wouldn't be too
surprised if you had a different stance on that. So I would be curious
about your feedback on whether this is a route worth pursuing any further.
FWIW, the most controversial parts are probably
 - [1/7] ima: don't expose runtime_measurements for unsupported hashes
 - [6/7] ima: invalidate unsupported PCR banks once at first use

Note that I haven't tested this series thoroughly yet -- for the time being
I only ran a couple of brief smoke tests in a VM w/o a TPM  (w/ and w/o
SHA-1 disabled of course).

Many thanks!

Nicolai

[1] https://www.nist.gov/news-events/news/2022/12/nist-retires-sha-1-cryptographic-algorithm
[2] https://github.com/linux-integrity/ima-evm-utils.git

Nicolai Stange (7):
  ima: don't expose runtime_measurements for unsupported hashes
  ima: always create runtime_measurements sysfs file for ima_hash
  ima: move INVALID_PCR() to ima.h
  ima: track the set of PCRs ever extended
  tpm: enable bank selection for PCR extend
  ima: invalidate unsupported PCR banks once at first use
  ima: make SHA1 non-mandatory

 drivers/char/tpm/tpm-interface.c      | 29 +++++++++-
 drivers/char/tpm/tpm.h                |  3 +-
 drivers/char/tpm/tpm2-cmd.c           | 29 +++++++++-
 include/linux/tpm.h                   |  3 +
 security/integrity/ima/Kconfig        | 14 +++++
 security/integrity/ima/ima.h          |  9 +++
 security/integrity/ima/ima_crypto.c   | 83 ++++++++++++++++-----------
 security/integrity/ima/ima_fs.c       | 41 +++++++------
 security/integrity/ima/ima_policy.c   |  5 +-
 security/integrity/ima/ima_queue.c    | 26 ++++++++-
 security/integrity/ima/ima_template.c |  7 +++
 11 files changed, 190 insertions(+), 59 deletions(-)

-- 
2.47.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-03-23 14:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 17:33 [RFC PATCH v1 0/7] ima: get rid of hard dependency on SHA-1 Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 1/7] ima: don't expose runtime_measurements for unsupported hashes Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 2/7] ima: always create runtime_measurements sysfs file for ima_hash Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 3/7] ima: move INVALID_PCR() to ima.h Nicolai Stange
2025-03-18  1:57   ` Mimi Zohar
2025-03-13 17:33 ` [RFC PATCH v1 4/7] ima: track the set of PCRs ever extended Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 5/7] tpm: enable bank selection for PCR extend Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 6/7] ima: invalidate unsupported PCR banks once at first use Nicolai Stange
2025-03-18  1:46   ` Mimi Zohar
2025-03-18 10:26     ` Nicolai Stange
2025-03-18 14:32       ` Mimi Zohar
2025-03-18 15:55         ` Nicolai Stange
2025-03-18 20:49           ` Mimi Zohar
2025-03-23 14:21             ` Nicolai Stange
2025-03-13 17:33 ` [RFC PATCH v1 7/7] ima: make SHA1 non-mandatory Nicolai Stange
2025-03-18 11:00 ` [RFC PATCH v1 0/7] ima: get rid of hard dependency on SHA-1 Roberto Sassu
2025-03-18 11:54   ` Nicolai Stange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).