1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-07 06:22:47 -05:00

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]
This commit is contained in:
Simon Tatham
2013-07-19 17:44:58 +00:00
parent 407fd7b9ab
commit 8966f7c1ea
2 changed files with 103 additions and 0 deletions

View File

@ -28,6 +28,21 @@ void SHATransform(word32 * digest, word32 * block)
word32 a, b, c, d, e;
int t;
#ifdef RANDOM_DIAGNOSTICS
{
extern int random_diagnostics;
if (random_diagnostics) {
int i;
printf("SHATransform:");
for (i = 0; i < 5; i++)
printf(" %08x", digest[i]);
printf(" +");
for (i = 0; i < 16; i++)
printf(" %08x", block[i]);
}
}
#endif
for (t = 0; t < 16; t++)
w[t] = block[t];
@ -83,6 +98,19 @@ void SHATransform(word32 * digest, word32 * block)
digest[2] += c;
digest[3] += d;
digest[4] += e;
#ifdef RANDOM_DIAGNOSTICS
{
extern int random_diagnostics;
if (random_diagnostics) {
int i;
printf(" =");
for (i = 0; i < 5; i++)
printf(" %08x", digest[i]);
printf("\n");
}
}
#endif
}
/* ----------------------------------------------------------------------