summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-04-24 11:06:06 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-24 11:06:06 -0700
commit363c7d2e0823a8b0616bdaec4c65c1221e5550ee (patch)
tree8d892b4aedee75c9e9e8a27331c912bbda04a6e4
parentdf4801ad225b6ba2db85f7ea88f56be3b0bb81e9 (diff)
parent82e18e9abf5d237509ee643f1ad7cc85ebcc4440 (diff)
Merge "avb: Update rollback index when Multislot is disabled"
-rw-r--r--QcomModulePkg/Library/avb/VerifiedBoot.c1
-rw-r--r--QcomModulePkg/Library/avb/libavb/avb_ops.c24
-rw-r--r--QcomModulePkg/Library/avb/libavb/avb_ops.h1
3 files changed, 21 insertions, 5 deletions
diff --git a/QcomModulePkg/Library/avb/VerifiedBoot.c b/QcomModulePkg/Library/avb/VerifiedBoot.c
index 8a097489a1..bfbb66e02a 100644
--- a/QcomModulePkg/Library/avb/VerifiedBoot.c
+++ b/QcomModulePkg/Library/avb/VerifiedBoot.c
@@ -679,6 +679,7 @@ LoadImageAndAuthVB2 (BootInfo *Info)
Status = EFI_OUT_OF_RESOURCES;
goto out;
}
+ UserData->IsMultiSlot = Info->MultiSlotBoot;
if (Info->MultiSlotBoot) {
UnicodeStrToAsciiStr (Info->Pname, PnameAscii);
diff --git a/QcomModulePkg/Library/avb/libavb/avb_ops.c b/QcomModulePkg/Library/avb/libavb/avb_ops.c
index 1c18cd4186..fb4a13a2bc 100644
--- a/QcomModulePkg/Library/avb/libavb/avb_ops.c
+++ b/QcomModulePkg/Library/avb/libavb/avb_ops.c
@@ -444,12 +444,29 @@ AvbIOResult
AvbWriteRollbackIndex(AvbOps *Ops, size_t RollbackIndexLocation, uint64_t RollbackIndex)
{
EFI_STATUS Status = EFI_SUCCESS;
+ BOOLEAN UpdateRollbackIndex = FALSE;
+ AvbOpsUserData *UserData = NULL;
DEBUG((EFI_D_VERBOSE,
"WriteRollbackIndex Location %d, RollbackIndex %d\n",
RollbackIndexLocation, RollbackIndex));
- /* Update rollback if the current slot is bootable */
- if (IsCurrentSlotBootable()) {
+
+ UserData = (AvbOpsUserData *)Ops->user_data;
+ if (UserData->IsMultiSlot) {
+ /* Update rollback if the current slot is bootable */
+ if (IsCurrentSlotBootable ()) {
+ UpdateRollbackIndex = TRUE;
+ } else {
+ UpdateRollbackIndex = FALSE;
+ DEBUG ((EFI_D_WARN, "Not updating rollback"
+ "index as current slot is unbootable\n"));
+ }
+ } else {
+ /* When Multislot is disabled, always update*/
+ UpdateRollbackIndex = TRUE;
+ }
+
+ if (UpdateRollbackIndex == TRUE) {
DEBUG((EFI_D_INFO,
"Updating rollback index %d, for location %d\n",
RollbackIndex, RollbackIndexLocation));
@@ -458,9 +475,6 @@ AvbWriteRollbackIndex(AvbOps *Ops, size_t RollbackIndexLocation, uint64_t Rollba
DEBUG((EFI_D_ERROR, "ReadRollbackIndex failed! %r\n", Status));
return AVB_IO_RESULT_ERROR_IO;
}
- } else {
- DEBUG((EFI_D_WARN, "Not updating rollback index as current "
- "slot is unbootable\n"));
}
return AVB_IO_RESULT_OK;
}
diff --git a/QcomModulePkg/Library/avb/libavb/avb_ops.h b/QcomModulePkg/Library/avb/libavb/avb_ops.h
index 25bc655315..5114800b86 100644
--- a/QcomModulePkg/Library/avb/libavb/avb_ops.h
+++ b/QcomModulePkg/Library/avb/libavb/avb_ops.h
@@ -224,6 +224,7 @@ struct AvbOps {
typedef struct {
BOOLEAN IsUserKey;
+ BOOLEAN IsMultiSlot;
UINTN PublicKeyLen;
CHAR8 PublicKey[MAX_USER_KEY_SIZE];
} AvbOpsUserData;