BootSignature.java
pull/14/head
cfig 7 years ago
parent b7784719a4
commit 8f704a817c

@ -72,6 +72,11 @@ public class BootSignature extends ASN1Object
private PublicKey publicKey;
private static final int FORMAT_VERSION = 1;
/**
* Offset of recovery DTBO length in a boot image header of version greater than
* or equal to 1.
*/
private static final int BOOT_IMAGE_HEADER_V1_RECOVERY_DTBO_SIZE_OFFSET = 1632;
/**
* Initializes the object for signing an image file
@ -209,6 +214,22 @@ public class BootSignature extends ASN1Object
+ ((ramdskSize + pageSize - 1) / pageSize) * pageSize
+ ((secondSize + pageSize - 1) / pageSize) * pageSize;
int headerVersion = image.getInt(); // boot image header version
if (headerVersion > 0) {
image.position(BOOT_IMAGE_HEADER_V1_RECOVERY_DTBO_SIZE_OFFSET);
int recoveryDtboLength = image.getInt();
length += ((recoveryDtboLength + pageSize - 1) / pageSize) * pageSize;
image.getLong(); // recovery_dtbo address
if (headerVersion == 1) {
int headerSize = image.getInt();
if (image.position() != headerSize) {
throw new IllegalArgumentException(
"Invalid image header: invalid header length");
}
}
}
length = ((length + pageSize - 1) / pageSize) * pageSize;
if (length <= 0) {

Loading…
Cancel
Save