public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH 0/1] Anti rollback protection for FIT Images
Date: Tue,  1 Sep 2020 13:48:14 -0700	[thread overview]
Message-ID: <cover.1598373235.git.thiruan@linux.microsoft.com> (raw)

Anti rollback protection is required when there is a need to retire
previous versions of FIT images due to security flaws in them.
Currently U-Boot Verified boot does not have rollback protection to
protect against known security flaws.

This RFC introduces a proposal to add anti-rollback protection for
FIT images. This protection feature prevents U-Boot from accepting
an image if it has ever successfully loaded an image with a larger
anti-rollback version number.

Each sub-image node inside /images node has an
anti-rollback version number(arbvn) similar to rollback_index in
Android Verified Boot. This version number is part of signed data and
it is incremented as security flaws are discovered and fixed.
U-Boot stores the last seen arbvn for a given image type in platform
specific tamper-evident storage.

As part of signature verification, U-Boot enfroces arvbn based
protection if enabled. arvbn stored in secure storage is validated with
arbvn in the sub-image node. If the counter in the FIT image is lower than
the counter in platform secure storage, image validation has failed
i.e. verified boot failed. If both counters match or the image counter is
higher than that in the platform secure storage, the image validation is
successful. In the higher case, U-Boot stores the new counter in platform
secure storage.

Pseudo code is as follows:

ret = board_get_arbvn(type, &plat_arbvn);
...
if (image_arbvn < plat_arbvn) {
	return -EPERM;
} else if (image_arbvn > plat_arbvn) {
	ret = board_set_arbvn(type, image_arbvn);
	return ret;
} else {
	return 0;
}

The following board specific hooks are required to get/set arbvn
from platform specific tamper-evident storage.
int board_get_arbvn(uint8_t ih_type, uint32_t *arbvn);
int board_set_arbvn(uint8_t ih_type, uint32_t arbvn);

As an example, consider this FIT:
/ {
	images {
		kernel-1 {
			data = <data for kernel1>
			arbvn = <1>;
			hash-1 {
				algo = "sha1";
				value = <...kernel hash 1...>
			};
		};
		fdt-1 {
			data = <data for fdt1>;
			hash-1 {
				algo = "sha1";
				value = <...fdt hash 1...>
			};
		};
	};
	configurations {
		default = "conf-1";
		conf-1 {
			kernel = "kernel-1";
			fdt = "fdt-1";
			signature-1 {
				algo = "sha1,rsa2048";
				sign-images = "fdt", "kernel";
				value = <...conf 1 signature...>;
			};
		};
	};
};

In the above example, kernel-1 image has an arbvn of 1.
if plat_arbvn is 1, the system will boot with this FIT image.
if plat_arbvn is 2 or more, U-Boot will prevent the system from booting
with this FIT image.

Thirupathaiah Annapureddy (1):
  image: add anti rollback protection for FIT Images

 Kconfig                |  9 +++++
 common/image-fit-sig.c | 79 ++++++++++++++++++++++++++++++++++++++++++
 common/image-fit.c     | 24 +++++++++++++
 include/image.h        | 23 ++++++++++++
 4 files changed, 135 insertions(+)

-- 
2.25.2

             reply	other threads:[~2020-09-01 20:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 20:48 Thirupathaiah Annapureddy [this message]
2020-09-01 20:48 ` [RFC PATCH 1/1] image: add anti rollback protection for FIT Images Thirupathaiah Annapureddy
2020-09-07  1:43   ` Simon Glass
2020-09-15  6:18     ` Thirupathaiah Annapureddy
2020-09-15 13:40       ` Tom Rini
2020-09-15 19:46         ` Thirupathaiah Annapureddy
2020-09-15 21:18       ` Simon Glass
2020-09-02  7:58 ` [RFC PATCH 0/1] Anti " Rasmus Villemoes
2020-09-08  6:15   ` Rasmus Villemoes
2020-09-15  6:20     ` Thirupathaiah Annapureddy
2020-09-15  6:53       ` Rasmus Villemoes
2020-09-15  5:22   ` Thirupathaiah Annapureddy
2020-09-15  7:59     ` Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1598373235.git.thiruan@linux.microsoft.com \
    --to=thiruan@linux.microsoft.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox