Don't treat a bare OCTETSTRING as DigestInfo in int_rsa_verify
authorMatt Caswell <matt@openssl.org>
Thu, 8 Oct 2015 12:36:10 +0000 (13:36 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 8 Oct 2015 13:17:08 +0000 (14:17 +0100)
commitec1f1255127c3987494978c9bf1c8f7ac9b093e4
treed7bef17a13f7d26ac946f462a9e9b73950475a09
parent363c8fd572b19aa085dad8da6d7a5dd89930bf54
Don't treat a bare OCTETSTRING as DigestInfo in int_rsa_verify

The function int_rsa_verify is an internal function used for verifying an
RSA signature. It takes an argument |dtype| which indicates the digest type
that was used. Dependant on that digest type the processing of the
signature data will vary. In particular if |dtype == NID_mdc2| and the
signature data is a bare OCTETSTRING then it is treated differently to the
default case where the signature data is treated as a DigestInfo (X509_SIG).

Due to a missing "else" keyword the logic actually correctly processes the
OCTETSTRING format signature first, and then attempts to continue and
process it as DigestInfo. This will invariably fail because we already know
that it is a bare OCTETSTRING.

This failure doesn't actualy make a real difference because it ends up at
the |err| label regardless and still returns a "success" result. This patch
just cleans things up to make it look a bit more sane.

RT#4076

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit dffe51091f412dcbc18f6641132f0b4f0def6bce)
crypto/rsa/rsa_sign.c