Are you sure? I think ASN1 decoding errors can cause a -1 which is 
absolutely an Invalidsignature. Might be good to check the error code in a 
bit more detail though.


On 1 May 2014 17:39:21 Mohammed Attia <notifications@github.com> wrote:

> > +        self._dsa_cdata = self._backend._dsa_cdata_from_public_key(
> > +            self._public_key)
> > +        self._dsa_cdata = self._backend._ffi.gc(self._dsa_cdata,
> > +                                                self._backend._lib.DSA_free)
> > +
> > +        data_to_verify = self._hash_ctx.finalize()
> > +        self._hash_ctx = None
> > +
> > +        res = self._backend._lib.DSA_verify(
> > +            0, data_to_verify, len(data_to_verify), self._signature,
> > +            len(self._signature), self._dsa_cdata)
> > +
> > +        if res != 1:
> > +            errors = self._backend._consume_errors()
> > +            assert errors
> > +            raise InvalidSignature
>
> I originally treated them as different cases but recently changed it to a a 
> singular check, but you're right, they shouldn't be treated the same way.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/pyca/cryptography/pull/982/files#r12194651