Not sure which I prefer, but repeating the same checks seems bad.


On Sat, Apr 19, 2014 at 10:30 AM, Paul Kehrer <notifications@github.com>wrote:

> In cryptography/hazmat/backends/openssl/backend.py:
>
> > @@ -842,9 +842,19 @@ def _finalize_pkey_ctx(self, evp_pkey, pkey_size, evp_md):
> >              errors = self._backend._consume_errors()
> >              assert errors[0].lib == self._backend._lib.ERR_LIB_RSA
> >              assert (errors[0].reason ==
> > -                    self._backend._lib.RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE)
> > -            raise ValueError("Salt length too long for key size. Try using "
> > -                             "MAX_LENGTH instead.")
> > +                    self._backend._lib.RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE or
> > +                    errors[0].reason ==
> > +                    self._backend._lib.RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY)
>
> That's true. I could remove this assert in favor of the reason assert
> below if you'd prefer.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pyca/cryptography/pull/840/files#r11794728>
> .
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084