зеркало из https://github.com/github/putty.git
Fix potential security problems in random number generator
[originally from svn r190]
This commit is contained in:
Родитель
4e889024e3
Коммит
5aab53ce52
10
sshrand.c
10
sshrand.c
|
@ -52,8 +52,8 @@ void random_add_noise(void *noise, int length) {
|
|||
pool.incomingpos = 0;
|
||||
}
|
||||
|
||||
memcpy(pool.incomingb, p, length);
|
||||
pool.incomingpos = length;
|
||||
memcpy(pool.incomingb + pool_incomingpos, p, length);
|
||||
pool.incomingpos += length;
|
||||
}
|
||||
|
||||
void random_stir(void) {
|
||||
|
@ -121,7 +121,7 @@ void random_stir(void) {
|
|||
* there'll be some extra bizarreness there.
|
||||
*/
|
||||
SHATransform(digest, block);
|
||||
memcpy(digest, pool.incoming, sizeof(digest));
|
||||
memcpy(pool.incoming, digest, sizeof(digest));
|
||||
|
||||
pool.poolpos = sizeof(pool.incoming);
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ static void random_add_heavynoise(void *noise, int length) {
|
|||
pool.poolpos = 0;
|
||||
}
|
||||
|
||||
memcpy(pool.pool, p, length);
|
||||
pool.poolpos = length;
|
||||
memcpy(pool.pool + pool.poolpos, p, length);
|
||||
pool.poolpos += length;
|
||||
}
|
||||
|
||||
void random_init(void) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче