Граф коммитов

22 Коммитов

Автор SHA1 Сообщение Дата
Tim Kosse fa38307244 In random_add_noise, put the hashed noise into the pool, not the raw noise
random_add_noise calls SHATransform for every 64 octets of incoming noise,
yet instead of xor'ing the hashed noise into the pool it instead only xor'ed
20 octets of the raw noise in each iteration. This effectively reduced the
amount of new entropy entering the pool.
2016-12-29 11:18:03 +00:00
Ben Harris 1d20c1b396 Add FUZZING build option that disables the random number generator.
Starting up the random number generator is by far the slowest part of
plink's startup, and randomness is bad for fuzzing, so disabling it
should make fuzzing more effective.
2015-10-28 22:08:58 +00:00
Simon Tatham ab2ddd1772 random_ref() should always increment the reference count.
No current PuTTY utility was calling random_ref more than once per run
(ssh.c and the two main PuTTYgen programs call it once each), but if
one ever does (or if derived code does), it will want the reference
count to actually work sensibly.

[originally from svn r10049]
2013-10-09 18:38:35 +00:00
Simon Tatham 8966f7c1ea Add some conditionally-compilable diagnostics to the RNG. I got
briefly worried that it might not be doing what I thought it was
doing, but examining these diagnostics shows that it is after all, and
now I've written them it would be a shame not to keep them for future
use.

[originally from svn r9938]
2013-07-19 17:44:58 +00:00
Simon Tatham 311761e245 Run the random pool setup and teardown functions with random_active
nonzero rather than zero.

[originally from svn r9935]
2013-07-19 17:44:42 +00:00
Simon Tatham 33f485c1c3 It suddenly strikes me as probably a good idea to enforce that anyone
calling random_byte has previously called random_ref.

(I'm not aware of any current code getting this wrong! It just seems
to me to be the sort of thing you'd want to be really sure of.)

[originally from svn r9930]
2013-07-19 17:44:20 +00:00
Ben Harris d5836982e2 Two related changes to timing code:
First, make absolute times unsigned.  This means that it's safe to 
depend on their overflow behaviour (which is undefined for signed 
integers).  This requires a little extra care in handling comparisons, 
but I think I've correctly adjusted them all.

Second, functions registered with schedule_timer() are guaranteed to be 
called with precisely the time that was returned by schedule_timer().  
Thus, it's only necessary to check these values for equality rather than 
doing risky range checks, so do that.

The timing code still does lots that's undefined, unnecessary, or just
wrong, but this is a good start.

[originally from svn r9667]
2012-09-18 21:42:48 +00:00
Jacob Nevins 5ea11dfb3a Plug a few minor memory leaks, based on a patch by Sirp Potijk.
While I'm here, add an assertion in sshrand.c to catch mistakes in reference
counting.

[originally from svn r8846]
2010-01-17 16:20:45 +00:00
Simon Tatham 31133eb077 Owen's just pointed out that random_stir() is capable of recursion.
I'm sure I didn't mean that to happen! Added a lock to stop it.

[originally from svn r5166]
2005-01-22 14:51:29 +00:00
Simon Tatham 8c69ba0672 Loose end from timing shakeup: sshrand.c is now a client of
timing.c, and hence takes its own responsibility for calling
noise_regular() at regular intervals. Again, this means it will be
called consistently in _all_ the SSH-speaking tools, not just those
in which I remembered to call it!

[originally from svn r4913]
2004-11-27 19:56:38 +00:00
Simon Tatham 06e9857f89 random_init() should be called at most once during the running of
PuTTY, even if it's managing multiple sessions.

[originally from svn r4900]
2004-11-24 19:53:31 +00:00
Simon Tatham d36a4c3685 Introduced wrapper macros snew(), snewn() and sresize() for the
malloc functions, which automatically cast to the same type they're
allocating the size of. Should prevent any future errors involving
mallocing the size of the wrong structure type, and will also make
life easier if we ever need to turn the PuTTY core code from real C
into C++-friendly C. I haven't touched the Mac frontend in this
checkin because I couldn't compile or test it.

[originally from svn r3014]
2003-03-29 16:14:26 +00:00
Ben Harris 4296e6b786 random_stir() is unused outside this file. Make it static.
Include putty.h to get prototypes for random_init() and random_get_savedata().

[originally from svn r2482]
2003-01-05 23:30:48 +00:00
Simon Tatham a1125a8052 Improve robustness in random seed file handling.
[originally from svn r2200]
2002-11-07 20:01:04 +00:00
Simon Tatham dac0d45699 Ensure our network layer is properly cleaned up before PuTTY exits.
Specifically, we explicitly closesocket() all open sockets, which
appears to be necessary since otherwise Windows sends RST rather
than FIN. I'm _sure_ that's a Windows bug, but there we go.

[originally from svn r1574]
2002-03-06 20:13:22 +00:00
Simon Tatham 3730ada5ce Run entire source base through GNU indent to tidy up the varying
coding styles of the various contributors! Woohoo!

[originally from svn r1098]
2001-05-06 14:35:20 +00:00
Simon Tatham f9cf0d70b7 Reintroduce random_stir()
[originally from svn r763]
2000-10-25 06:59:25 +00:00
Simon Tatham 36156d858c Improved entropy gathering.
[originally from svn r750]
2000-10-23 15:20:05 +00:00
Simon Tatham 8d0bee8629 PuTTYgen initial version. Still to do are basic user-friendliness
features (prompt for passphrase twice, prompt before overwriting a
file, check the key file was actually saved OK), testing of the
generated keys to make sure I got the file format right, and support
for a variable key size. I think what's already here is basically
sound though.

[originally from svn r715]
2000-10-19 15:43:08 +00:00
Simon Tatham 3709407827 Small but highly unhelpful typo
[originally from svn r198]
1999-08-11 08:50:36 +00:00
Simon Tatham 5aab53ce52 Fix potential security problems in random number generator
[originally from svn r190]
1999-08-02 08:35:11 +00:00
Simon Tatham c74130d423 Initial checkin: beta 0.43
[originally from svn r11]
1999-01-08 13:02:13 +00:00