python-evic icon indicating copy to clipboard operation
python-evic copied to clipboard

Better verification

Open ReservedField opened this issue 9 years ago • 1 comments

I was implementing verification for evic-sdk binaries and I found out that the verification in python-evic is not fully compliant with the original updater. This is not some high priority issue, just a heads up.

First, the official updater checks for "Joyetech APROM" as a sequence of bytes (no null terminator required), just like python-evic does. But the string needs to start at least 26 bytes from the end of the file (i.e. there must be at least 25 bytes after the 'J'). The second check, that python-evic also does, is for the device string ("E052" for the eVic VTC Mini). This must start at least 9 bytes from the end of the file.

Immediately after the device string there are three bytes. Let's call them, in order, A, B and C. Those encode the hardware version A.BC (e.g. 01 02 03 -> 1.23). This is the maximum hardware version supported by the firmware and is checked to be greater than or equal to the device hardware version. It makes sense since the display driver defaults to SSD1306, so newer hardware versions with SSD1327 would not work with older firmwares.

In my opinion the at-least-X-bytes-from-end thing is not really important, but the hardware version verification could be nice to have.

ReservedField avatar Jan 04 '16 23:01 ReservedField

I added the hardware version check in cc462c43e9. I'll think about the other changes and see if they would offer some benefit.

Ban3 avatar Jan 06 '16 01:01 Ban3