[botan-devel] Fwd: AutoSeeded_RNG exception

smlu smlu at s5.net
Thu Dec 26 03:23:52 EST 2013


This fixed the problem, thanks for help
    Crt!

----- Izvorno sporočilo -----
Od: "Jack Lloyd" <lloyd at randombit.net>
Za: botan-devel at randombit.net
Poslano: sreda, 25. december 2013 23:24:16
Zadeva: Re: [botan-devel] Fwd:  AutoSeeded_RNG exception


I think the problem (at least in the code you sent) is here:

  inline void Init() {
         try { Botan::LibraryInitializer init("thread_safe=true"); }
             catch(std::exception& e) { throw e; /*insted of throwing I end program here*/ }

At the end of the try block, the state that was created is shut down.
Then when you create the AutoSeeded_RNG, the lazy init with default
settings is triggered in more than one thread with messy results.

If you want to start up the library inside a block, use
LibraryInitializer::initialize and deinitialize instead.
LibraryInitializer itself is just RAII for those two functions.

Hope this helps.

Cheers,
  Jack

On Wed, Dec 25, 2013 at 03:42:26PM +0100, smlu wrote:
> 
> 
> ----- Posredovano sporočilo -----
> Od: "anton" <smlu at s5.net>
> Za: lloyd at randombit.net
> Poslano: petek, 20. december 2013 11:50:51
> Zadeva: Re: [botan-devel] AutoSeeded_RNG exception
> 
> Hi,
> I am sending you an extract of code that produces the issue.
> Only for information I'm using MSVS Ultimate 2012. 
> 
> Best regards,
>           Crt
> 
> ----- Izvorno sporočilo -----
> Od: "Jack Lloyd" <lloyd at randombit.net>
> Za: "Botan development list" <botan-devel at randombit.net>
> Poslano: petek, 20. december 2013 03:24:10
> Zadeva: Re: [botan-devel] AutoSeeded_RNG exception
> 
> Hi,
> 
> This is definitely unexpected. Can you send code that reproduces the issue?
> Offlist is fine. I was unable to reproduce this.
> 
> Thanks,
>   Jack
> 
> 
> On Thu, Dec 19, 2013 at 05:55:22PM +0100, anton wrote:
> > Hi, 
> > I was wondering, if you could help me with my problem regarding to AutoSeeded_RNG class. I'm keep getting exception thrown saying 'Uninitialized in Library_State::algorithm_factory' when calling some method in my class from different threads. The method is for generating password salt and each time a new AutoSeeded_RNG object is created. First call to method works fine, but when another thread calls this method, an exception is thrown. I went through little debugging of botan library and I found out that somehow the global_lib_state object is set to zero on second attempt of creating AutoSeeded_RNG object. I have solved this temporarily by creating AutoSeeded_RNG private member of my class and for now it works fine.
> > I am using static amalgamation version of Botan 1.10.6. and library is initialized in main function with "thread_safe=true".
> > 
> > Thank you and best regards, Crt
> > _______________________________________________
> > botan-devel mailing list
> > botan-devel at randombit.net
> > http://lists.randombit.net/mailman/listinfo/botan-devel
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel


> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel

_______________________________________________
botan-devel mailing list
botan-devel at randombit.net
http://lists.randombit.net/mailman/listinfo/botan-devel


More information about the botan-devel mailing list