(calyx) avb: add calyx public key

Change-Id: I8549c8f42e7f58b0cc29de63a922de323c776e14
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/AndroidBoot.mk b/AndroidBoot.mk
index 7bf0170..475244f 100644
--- a/AndroidBoot.mk
+++ b/AndroidBoot.mk
@@ -84,6 +84,7 @@
 else
 	BOARD_BOOTLOADER_VERSION := unknown
 endif
+BOARD_BOOTLOADER_VERSION := $(BOARD_BOOTLOADER_VERSION)-calyx
 
 ifneq ($(TARGET_BOARD_TYPE),auto)
 	TARGET_BOARD_TYPE_AUTO := TARGET_BOARD_TYPE_AUTO=0
diff --git a/QcomModulePkg/Library/avb/OEMPublicKey.h b/QcomModulePkg/Library/avb/OEMPublicKey.h
index a0e7f52..7d83b85 100644
--- a/QcomModulePkg/Library/avb/OEMPublicKey.h
+++ b/QcomModulePkg/Library/avb/OEMPublicKey.h
@@ -101,4 +101,101 @@
 0xa2,0x61,0x2c,0xf9,0x6f,0xf4,0xf3,0xb7
 };
 
+static const char CalyxPublicKey[] = {
+	0x00, 0x00, 0x10, 0x00, 0xa8, 0x2f, 0x9b, 0x83, 0xb4, 0x6c, 0xe6,
+	0xa9, 0x5c, 0x04, 0x7a, 0xfd, 0x0c, 0xfc, 0xb8, 0xa3, 0xa2, 0x7d,
+	0x4a, 0x0c, 0xbd, 0x00, 0x4c, 0xff, 0xf9, 0xc7, 0xf7, 0x89, 0xae,
+	0x17, 0x32, 0x68, 0xbf, 0x46, 0xb4, 0x0b, 0x5e, 0xff, 0xe1, 0x50,
+	0x81, 0x5a, 0x1b, 0x5a, 0x01, 0x6b, 0xb2, 0x2f, 0xaa, 0xa4, 0x3d,
+	0x98, 0x8c, 0x2f, 0xf2, 0x62, 0x7b, 0x69, 0xe3, 0xed, 0xb0, 0x14,
+	0xf7, 0x09, 0x99, 0xa0, 0x6c, 0x87, 0xe2, 0xea, 0x82, 0xe0, 0xfe,
+	0x99, 0x95, 0x33, 0xd6, 0x8a, 0x8d, 0x27,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 0xdd, 0xe8, 0x5f,
+	0xb1, 0x13, 0x7e, 0x5c, 0xba, 0x23, 0x88, 0x6d, 0x01, 0x0d, 0xab,
+	0xc7, 0x73, 0x28, 0x13, 0x3a, 0x55, 0x55, 0xde, 0x9a, 0x00, 0xf2,
+	0x34, 0x2f, 0xfe, 0x0f, 0xb9, 0x29, 0x47, 0x01, 0x97, 0x28, 0xbb,
+	0xcb, 0x7a, 0x56, 0xf2, 0xd7, 0x24, 0xbd, 0xd5, 0xa9, 0xc9, 0x99,
+	0xa8, 0xa2, 0x55, 0x26, 0x55, 0x04, 0x06, 0x70, 0x1f
+};
+
 #endif /* __OEM_PUBLIC_KEY_H__ */
diff --git a/QcomModulePkg/Library/avb/libavb/avb_ops.c b/QcomModulePkg/Library/avb/libavb/avb_ops.c
index fd5c828..c56839d 100644
--- a/QcomModulePkg/Library/avb/libavb/avb_ops.c
+++ b/QcomModulePkg/Library/avb/libavb/avb_ops.c
@@ -352,6 +352,9 @@
 	} else if (PublicKeyLength == ARRAY_SIZE(OEMPublicKey) &&
 	           CompareMem(PublicKeyData, OEMPublicKey, PublicKeyLength) == 0) {
 		*OutIsTrusted = true;
+	} else if (PublicKeyLength == ARRAY_SIZE(CalyxPublicKey) &&
+	           CompareMem(PublicKeyData, CalyxPublicKey, PublicKeyLength) == 0) {
+		*OutIsTrusted = true;
 	} else {
 		*OutIsTrusted = false;
 		SetMem(UserData->PublicKey, ARRAY_SIZE(UserData->PublicKey), 0);
@@ -411,6 +414,9 @@
         } else if (PublicKeyLength == ARRAY_SIZE (OEMPublicKey) &&
 	           CompareMem(PublicKeyData, OEMPublicKey, PublicKeyLength) == 0) {
 		*OutIsTrusted = true;
+        } else if (PublicKeyLength == ARRAY_SIZE (CalyxPublicKey) &&
+	           CompareMem(PublicKeyData, CalyxPublicKey, PublicKeyLength) == 0) {
+		*OutIsTrusted = true;
 	} else {
 		*OutIsTrusted = false;
                 SetMem (UserData->PublicKey,