Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bootutil: ecdsa P-256: Fix handling of sizes
The ECDSA signature is written as two DER-encoded INTEGERS. Although the values are always 256 bits, the encoding ends up being variable length, because the encoding is signed, and therefore needs an extra zero byte to keep the number positive. This means that the length can vary by up to two bytes. The 'newt' tool handles this for signature by allowing space for the largest encoding, and padding with one or two zeros. However, the bootutil image check code insists that the length is exact, resulting in a decoding error on about 3/4 signatures. Fix this by only verifying that we have at least enough payload to hold the signature. There are later checks that will fail if the integers themselves are too large.
- Loading branch information