Multiple calls to ERR_load_crypto_string()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple calls to ERR_load_crypto_string()

Fukuba, Yoshiki
Hi,

After multiple calls to ERR_load_crypto_string(),
we cannot get error message using ERR_error_string().

A short sample is as follows:

=====
#include <openssl/err.h>

int main()
{
    ERR_load_crypto_strings();
    printf("%s\n",ERR_error_string(101163138,NULL));
    ERR_free_strings();

    ERR_load_crypto_strings();
    printf("%s\n",ERR_error_string(101163138,NULL));

    return 0;
}
=====

This is a bug, isn't it?

Best regards,

Yoshiki FUKUBA





______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Multiple calls to ERR_load_crypto_string()

Nils Larsch
Fukuba, Yoshiki wrote:

> Hi,
>
> After multiple calls to ERR_load_crypto_string(),
> we cannot get error message using ERR_error_string().
>
> A short sample is as follows:
>
> =====
> #include <openssl/err.h>
>
> int main()
> {
>     ERR_load_crypto_strings();
>     printf("%s\n",ERR_error_string(101163138,NULL));
>     ERR_free_strings();
>
>     ERR_load_crypto_strings();
>     printf("%s\n",ERR_error_string(101163138,NULL));
>
>     return 0;
> }
> =====
>
> This is a bug, isn't it?

multiple calls to ERR_load_crypto_strings() are harmless
(well the function is not reentrant but that's not important
here) the problem is that you call ERR_free_strings() between
these two calls. ERR_load_crypto_strings() sets a static
status variable once it has been called so that every further
call to ERR_load_crypto_strings() does nothing and as
ERR_free_strings() doesn't clear this variable again further
calls to ERR_load_crypto_strings() do nothing ...

Cheers,
Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Multiple calls to ERR_load_crypto_string()

Kyle Hamilton
On 3/23/06, Nils Larsch <[hidden email]> wrote:
>
> multiple calls to ERR_load_crypto_strings() are harmless
> (well the function is not reentrant but that's not important
> here) the problem is that you call ERR_free_strings() between
> these two calls. ERR_load_crypto_strings() sets a static
> status variable once it has been called so that every further
> call to ERR_load_crypto_strings() does nothing and as
> ERR_free_strings() doesn't clear this variable again further
> calls to ERR_load_crypto_strings() do nothing ...

...which is a bug, as the state (strings loaded/strings unloaded) is
not properly updated.

-Kyle H
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]