From 0906436e33bdd8dabf07d494e3d6d5184cc02246 Mon Sep 17 00:00:00 2001 From: Nikolay Morozov Date: Wed, 26 Feb 2020 12:38:27 +0300 Subject: cppcheck: The scope of the variable can be reduced. --- gost_keywrap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gost_keywrap.c') diff --git a/gost_keywrap.c b/gost_keywrap.c index 502a83c..a2134c2 100644 --- a/gost_keywrap.c +++ b/gost_keywrap.c @@ -23,16 +23,17 @@ void keyDiversifyCryptoPro(gost_ctx * ctx, const unsigned char *inputKey, const unsigned char *ukm, unsigned char *outputKey) { - - u4 k, s1, s2; - int i, j, mask; - unsigned char S[8]; + int i; memcpy(outputKey, inputKey, 32); for (i = 0; i < 8; i++) { + u4 s1 = 0; + u4 s2 = 0; + int j, mask; + unsigned char S[8]; /* Make array of integers from key */ /* Compute IV S */ - s1 = 0, s2 = 0; for (j = 0, mask = 1; j < 8; j++, mask <<= 1) { + u4 k; k = ((u4) outputKey[4 * j]) | (outputKey[4 * j + 1] << 8) | (outputKey[4 * j + 2] << 16) | (outputKey[4 * j + 3] << 24); if (mask & ukm[i]) { -- cgit v1.1