platform: msm_shared: Validate the decrypted signature

For a successful boot image authentication, the RSA decrypt api returns the
size of ASN1 encoded signature (PKCS#1 magic + sha256), compare the size
returned by RSA decrypt API with size of ASN1 if they match the signature is
valid otherwise fail with an error. This check avoids vulnerability due to
trailing data placed at the end of digest.

Change-Id: Ib7077efce6369a253b09a0def8e53d035ee345b8
2 files changed