From e973185be1cde262b53b75b340990e1d30125d2a Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 14 May 2017 11:57:48 +0000 Subject: [PATCH] Crypto: Initialize array earlier (ticket #1989) --- .../net/i2p/crypto/CryptixRijndael_Algorithm.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java b/core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java index 6dfa7df2f1..7ab861bd27 100644 --- a/core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java +++ b/core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java @@ -569,15 +569,19 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor int KC = k.length / 4; int[] tk; // new int[KC]; int i, j; - + // the return value + Object[] sessionKey; + if (keyData == null) { Ke = new int[ROUNDS + 1][BC]; Kd = new int[ROUNDS + 1][BC]; tk = new int[KC]; + sessionKey = new Object[] { Ke, Kd}; } else { Ke = keyData.Ke; Kd = keyData.Kd; tk = keyData.tk; + sessionKey = keyData.key; } // copy user material bytes into temporary ints @@ -636,14 +640,6 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor Kd[r][j] = _U1[(tt >>> 24) & 0xFF] ^ _U2[(tt >>> 16) & 0xFF] ^ _U3[(tt >>> 8) & 0xFF] ^ _U4[tt & 0xFF]; } } - // assemble the encryption (Ke) and decryption (Kd) round keys into - // one sessionKey object - Object[] sessionKey; - if (keyData == null) - sessionKey = new Object[] { Ke, Kd}; - else - sessionKey = keyData.key; - //if (_RDEBUG) trace(_OUT, "makeKey()"); return sessionKey; } -- GitLab