I'm currently trying to apply an update over the stock android recovery. I created the zip contents and my own keys for the android build but it failes with a signature verification error. I have now found this piece of code in the bootable/recovery/verifier.cpp
#define FOOTER_SIZE 6
if (fseek(f, -FOOTER_SIZE, SEEK_END) != 0) {
LOGE("failed to seek in %s (%s)\n", path, strerror(errno));
fclose(f);
return VERIFY_FAILURE;
}
unsigned char footer[FOOTER_SIZE];
if (fread(footer, 1, FOOTER_SIZE, f) != FOOTER_SIZE) {
LOGE("failed to read footer from %s (%s)\n", path, strerror(errno));
fclose(f);
return VERIFY_FAILURE;
}
if (footer[2] != 0xff || footer[3] != 0xff) {
LOGE("failed check of footer bytes 2 & 3 match 0xff");
fclose(f);
return VERIFY_FAILURE;
}
Which expects the 4th and 3rd last byte in the zip to be 0xff
. The verification failes at this point. If I open the zip with a HexEditor I can see that both bytes are not 0xff
.
If I open a zip from the /bootable/recovery/testdata/otasigned*.zip
I can see that they are 0xff
.
I signed the zip with following command: jdk1.6.0_35/bin/java -jar Android/prebuilts/sdk/tools/lib/signapk.jar Android/build/target/product/security/testkey.x509.pem Android/build/target/product/security/testkey.pk8 testupdate.zip update.zip
wich adds some certificate data in the META-INF
folder.
I couldn't find any information that theese bytes have to be oxff
on the zip spec either.
What is going wrong here?
PS: Of course i could disable signature verification, but I want this feature (only working, not failing ;) )