There is a function ERR_get_state()/ERR_remove_state() definied in
err.h that should provide thread safe contexts. But I never
used threads thus I'm unsure wether this works as expected...

It seems that you must check the 2 files in the threads
subdir. But then you will find a lot of #if 0 :-(

Bodo Moeller schrieb:
> 
> The ERR library must either
> 
>   -  define a constant telling the user how much space has to be
>      provided for char errstring[SOME_LEN] in a call
>      ERR_error_string(e, errstring),

impossible since the user can add arbitrary error strings
itself. You then need to trim the string to a defined length in
err.c::ERR_error_string() (perhaps use snprintf instead of sprintf
and calculate remaining bytes? Or instead of defining SOME_LEN 
add a 3rd argument that tells the length of the buffer?)
 
> or
> 
>   -  ERR_error_string needs an additional parameter so that the caller
>      can tell it how much space has actually been reserved.
> 
> Using errstring = ERR_error_string(e, NULL) uses static memory and
> thus can fail for applications that use threads.
> 
> Maybe someone who has looked into the automatic generation of error
> definitions can suggest the most convenient way to add a definition
> ERR_ERROR_STRING_BUFSIZE, or whatever we should call it ...

I suggest to add a function ERR_error_string_len(e) that
returns the number of chars (including trailing zero) that
are necessary to hold the whole error string.
It could be a modified of ERR_error_string()

-- 
Holger Reif                  Tel.: +49 361 74707-0
SmartRing GmbH               Fax.: +49 361 7470720
Europaplatz 5             [EMAIL PROTECTED]
D-99091 Erfurt                    WWW.SmartRing.de
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]
  • err.h Bodo Moeller
    • Holger Reif

Reply via email to