That sounds super not-thread-safe :-/


On Sat, Feb 1, 2014 at 8:10 AM, Paul Kehrer <notifications@github.com>wrote:

> In cryptography/hazmat/backends/openssl/backend.py:
>
> > @@ -182,12 +182,24 @@ def _handle_error(self, mode):
> >          if not code and isinstance(mode, GCM):
> >              raise InvalidTag
> >          assert code != 0
> > +
> > +        try:
> > +            return self._handle_error_code(code)
> > +        finally:
> > +            # consume any remaining errors on the stack
> > +            while code != 0:
> > +                code = self._lib.ERR_get_error()
> > +
> > +    def _err_string(self, code):
> > +        err_buf = self._ffi.new("char[]", 1024)
> > +        self._lib.ERR_error_string_n(code, err_buf, 1024)
>
> What made you choose ERR_error_string_n? ERR_error_string will put the
> error in a static buffer and return the pointer if you pass a null for the
> buffer arg.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pyca/cryptography/pull/541/files#r9366058>
> .
>



-- 
"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