Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-13 Thread Florian Weimer
* Andreas Metzler: we still seem have not been able to find a really working solution, this patch http://svn.debian.org/wsvn/pkg-exim4/exim/trunk/debian/patches/65_saverandomseed.dpatch?op=filerev=0sc=0 causes crashes in exim. IIRC, I have already posted this, but perhaps my wording was a

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-13 Thread Werner Koch
On Thu, 13 Mar 2008 09:32, [EMAIL PROTECTED] said: I don't think the seed file approach works for a forking daemon like Exim because you cannot guaranteed an undisturbed read/modify/write cycle on the seed file. Locking is out of the question, too, because It depends on how much entropy you

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-12 Thread Andreas Metzler
On 2008-03-11 Werner Koch [EMAIL PROTECTED] wrote: On Sat, 8 Mar 2008 09:48, [EMAIL PROTECTED] said: but it looks like the mere presence of gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE,filename) causes the crashes. That should be easy to debug: void _gcry_set_random_seed_file(

Bug#448775: [Pkg-gnutls-maint] Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-12 Thread Marc Haber
On Wed, Mar 12, 2008 at 08:20:44PM +0100, Andreas Metzler wrote: The exim daemon forks and closes stderr/out. Marc, can you try running exim in the foreground and check whether gcrypt throws an error (case GCRY_LOG_BUG: fputs(O j: , stderr); break;)? Yes, it does. $ sudo exim -bdf

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-11 Thread Werner Koch
On Sat, 8 Mar 2008 09:48, [EMAIL PROTECTED] said: but it looks like the mere presence of gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE,filename) causes the crashes. That should be easy to debug: void _gcry_set_random_seed_file( const char *name ) { if (seed_file_name) BUG ();

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-08 Thread Andreas Metzler
On 2008-01-31 Werner Koch [EMAIL PROTECTED] wrote: On Wed, 30 Jan 2008 19:20, [EMAIL PROTECTED] said: Any obvious breakage? Exim does not use any threading. I have not included an gcry_check_version(NULL) since I thought gcry_control() would fail as reliably as gcry_check_version() would, if

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-08 Thread Simon Josefsson
Andreas Metzler [EMAIL PROTECTED] writes: On 2008-01-31 Werner Koch [EMAIL PROTECTED] wrote: On Wed, 30 Jan 2008 19:20, [EMAIL PROTECTED] said: Any obvious breakage? Exim does not use any threading. I have not included an gcry_check_version(NULL) since I thought gcry_control() would fail as

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-03-08 Thread Andreas Metzler
On 2008-03-08 Simon Josefsson [EMAIL PROTECTED] wrote: Andreas Metzler [EMAIL PROTECTED] writes: [...] We have tried to isolate what actually breaks, by only applying parts of the patch (e.g setting up dthe seed file, but not updating it.), but it looks like the mere presence of

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-31 Thread Werner Koch
On Wed, 30 Jan 2008 19:20, [EMAIL PROTECTED] said: Any obvious breakage? Exim does not use any threading. I have not included an gcry_check_version(NULL) since I thought gcry_control() would fail as reliably as gcry_check_version() would, if gcrypt was Better insert a gcry_check_version

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-30 Thread Andreas Metzler
On 2008-01-08 Werner Koch [EMAIL PROTECTED] wrote: On Fri, 4 Jan 2008 17:01, [EMAIL PROTECTED] said: Right. So what should applications like exim do exactly? Is there My suggestion is: [...] Hello, which yields this stripped down version for exim: -- diff

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-09 Thread Marcus Brinkmann
At Tue, 08 Jan 2008 10:20:46 +0100, 'Werner Koch' wrote: On Fri, 4 Jan 2008 16:33, [EMAIL PROTECTED] said: plugin for pidgin: if another plugin (say, Jabber) uses gnutls, which initializes libgcrypt, and OTR also initializes libgcrypt (perhaps with custom allocation functions), you can

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Fri, 4 Jan 2008 17:01, [EMAIL PROTECTED] said: Right. So what should applications like exim do exactly? Is there My suggestion is: int main () { int rc; #ifdef WE_USE_PTHREADS rc = gcry_control (GCRYCTL_SET_THREAD_CBS, gcry_threads_pthread); if (rc) error

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Fri, 4 Jan 2008 16:33, [EMAIL PROTECTED] said: plugin for pidgin: if another plugin (say, Jabber) uses gnutls, which initializes libgcrypt, and OTR also initializes libgcrypt (perhaps with custom allocation functions), you can easily cause a crash. At least we have a way to test whether

Bug#343085: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: On Sat, 5 Jan 2008 14:17, [EMAIL PROTECTED] said: gnutls-serv reads 3000 times 120 bytes from /dev/urandom, yes, 360 kilobytes! Run gcry_control (GCRYCTL_DUMP_RANDOM_STATS); to get statistics about libgcrypt's RNG. How should I interpret the

Bug#343085: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Sat, 5 Jan 2008 14:17, [EMAIL PROTECTED] said: gnutls-serv reads 3000 times 120 bytes from /dev/urandom, yes, 360 kilobytes! Run gcry_control (GCRYCTL_DUMP_RANDOM_STATS); to get statistics about libgcrypt's RNG. Shalom-Salam, Werner -- Die Gedanken sind frei. Auschnahme

Bug#343085: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Tue, 8 Jan 2008 11:03, [EMAIL PROTECTED] said: random usage: poolsize=600 mixed=621 polls=3000/117 added=3588/370308 outmix=3 getlvl1=3/136 getlvl2=0/0 - The random pool has been mixed 621 times. - The slow random poll function has been called 3000 times to fill and update

Bug#343085: [patch] Re: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Tue, 8 Jan 2008 11:59, [EMAIL PROTECTED] said: Anyway there 3000 calls to /dev/urandom are far too many for an initial pool filling. I need to check this. Found it. The bug was introduced with libgcrypt 1.3.1. Here is a patch: 2008-01-08 Werner Koch [EMAIL PROTECTED] *

Bug#343085: [patch] Re: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: On Tue, 8 Jan 2008 11:59, [EMAIL PROTECTED] said: Anyway there 3000 calls to /dev/urandom are far too many for an initial pool filling. I need to check this. Found it. The bug was introduced with libgcrypt 1.3.1. Here is a patch: Thanks. Running

Bug#343085: [patch] Re: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-08 Thread Werner Koch
On Tue, 8 Jan 2008 17:16, [EMAIL PROTECTED] said: Still, 3kb per TLS connection is excessive, so I still recommend exim to set a libgcrypt seeds file to solve the problem. Yes, definitely. Salam-Shalom, Werner -- Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz. --

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-05 Thread Andreas Metzler
On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: Andreas Metzler [EMAIL PROTECTED] writes: [...] testing with a exim linked against OpenSSL I get *slightly* less entropy usage (235 vs 289 bits in the first testrun) when connecting with swaks (perl/OpenSSL). For my curiosity, what are

Bug#343085: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-05 Thread Guus Sliepen
On Fri, Jan 04, 2008 at 10:48:48AM +0100, Andreas Metzler wrote: When acting as a server gnutls pulls that much data from /dev/urandom that entropy available for /dev/random is down to its minimum safeguard. ((it is not possible to completely deplete /dev/random by reading from /dev/urandom

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-05 Thread Andreas Metzler
On 2008-01-04 Andreas Metzler [EMAIL PROTECTED] wrote: [...] Well, the basic patch for testing seems to be this one, basically identical to the skeleton you described. I gets down entropy-usage for a single STARTTLS to 300 bits from 3000. [...] Error checking, and having the file in

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Nikos Mavrogiannopoulos
On Jan 3, 2008 2:32 AM, Marc Haber [EMAIL PROTECTED] wrote: Hi, Debian Bug #343085, http://bugs.debian.org/343085 This is an example bug for the entropy issue which seems to be the most pressing issue with Exim4 and GnuTLS at the moment. Let me give you a little background: Exim4's

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Werner Koch
On Fri, 4 Jan 2008 13:35, [EMAIL PROTECTED] said: I think the daemon is there to help libgcrypt maintain randomness state between invocations of applications that use randomness from libgcrypt. Right. And it is still flagged as experimental because it lacks any fair distribution of random to

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Matthias Urlichs
Hi, Nikos Mavrogiannopoulos: However on the point. I still believe it is a kernel issue. A process should not be able to deplete randomness in a system. There's a trade-off between make /dev/urandom as random as possible (which requires mixing in random bits from hardware), and make

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Nikos Mavrogiannopoulos
A workaround might be to use the libgcrypt's random number process feature which uses a single server process to feed other processes with entropy (I've never worked with it so I don't know if it can be used in that case). This might solve this issue. Disagree. * /dev/(u)random is more

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Matthias Urlichs [EMAIL PROTECTED] writes: Hi, Nikos Mavrogiannopoulos: I don't understand these comments. The libgcrypt's generator can be used in a separate processes. It doesn't mean it gathers any entropy except for using /dev/urandom as usual. Ah, thanks for the correction. In

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Florian Weimer
* Simon Josefsson: Ok. Still, my main question is whether GnuTLS could utilize these hooks somehow. I guess we could have two functions: int gnutls_set_random_seed_file (const char *filename); int gnutls_update_random_seed (); The first function would have to be called before

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Matthias Urlichs
Hi, Nikos Mavrogiannopoulos: I don't understand these comments. The libgcrypt's generator can be used in a separate processes. It doesn't mean it gathers any entropy except for using /dev/urandom as usual. Ah, thanks for the correction. In that case, if it's as usual, why run the daemon in

Bug#343085: Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Werner Koch
On Fri, 4 Jan 2008 13:41, [EMAIL PROTECTED] said: We could consider doing something like that in gnutls too, to help applications avoid having to do it themselves. However, the documentation on UPDATE_SEED seems somewhat discouraging. I'm not sure Let's say this description is very

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: On Fri, 4 Jan 2008 13:35, [EMAIL PROTECTED] said: I think the daemon is there to help libgcrypt maintain randomness state between invocations of applications that use randomness from libgcrypt. Right. And it is still flagged as experimental because it

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: On Fri, 4 Jan 2008 13:41, [EMAIL PROTECTED] said: We could consider doing something like that in gnutls too, to help applications avoid having to do it themselves. However, the documentation on UPDATE_SEED seems somewhat discouraging. I'm not sure

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Ian Goldberg
On Fri, Jan 04, 2008 at 03:16:57PM +0100, Simon Josefsson wrote: There is also the problem if something other than gnutls has already initialized libgcrypt. This could happen if exim links to some other library that uses libgcrypt, for example, a LDAP or database library, which gets

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: On Fri, 4 Jan 2008 15:16, [EMAIL PROTECTED] said: int gnutls_set_random_seed_file (const char *filename); I don't think that is a good idea. gnutls does not provide the required thread hook function for libgcrypt and thus the appliaction needs to do

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Werner Koch
On Fri, 4 Jan 2008 15:16, [EMAIL PROTECTED] said: int gnutls_set_random_seed_file (const char *filename); I don't think that is a good idea. gnutls does not provide the required thread hook function for libgcrypt and thus the appliaction needs to do this. If you want these functions you

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Werner Koch
On Fri, 4 Jan 2008 15:39, [EMAIL PROTECTED] said: You mean the problem where one client requests a lot of randomness, which would hurt the randomness received by other clients? Right. Though the IPC mechanims allows for several concurrent requests, the hear of the RNG serializes everything.

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Werner Koch [EMAIL PROTECTED] writes: Another solution, how about to refuse to give out entropy to processes not listed in a world-readable but root-writable file /etc/libgcryptd.conf file? Well it is experimental and I had similar ideas. If I remember right I implemented the daemon thing

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Andreas Metzler
On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: [...] 2) To make exim link to and call libgcrypt's functions to read and update a random seed file instead? [...] For simplicity and non-experimentalness, I would recommend 2). I can assist in implementing this in exim, if that

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Andreas Metzler [EMAIL PROTECTED] writes: On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: [...] 2) To make exim link to and call libgcrypt's functions to read and update a random seed file instead? [...] For simplicity and non-experimentalness, I would recommend 2). I can

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Andreas Metzler
On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: Andreas Metzler [EMAIL PROTECTED] writes: On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: [...] 2) To make exim link to and call libgcrypt's functions to read and update a random seed file instead? [...] For

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Simon Josefsson
Andreas Metzler [EMAIL PROTECTED] writes: On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: Andreas Metzler [EMAIL PROTECTED] writes: On 2008-01-04 Simon Josefsson [EMAIL PROTECTED] wrote: [...] 2) To make exim link to and call libgcrypt's functions to read and update a

Bug#448775: Uses too much entropy (Debian Bug #343085)

2008-01-04 Thread Marc Haber
On Fri, Jan 04, 2008 at 08:40:44PM +0100, Simon Josefsson wrote: Interesting, 235/8=29.375 bytes. The minimum randomness needed per TLS session would be 28 bytes for client hello random_bytes plus 46 bytes for the PreMasterSecret (if RSA is used for key exchange). If openssl is using