NTCP2 remove unused code

This commit is contained in:
zzz
2018-08-23 15:27:05 +00:00
parent cc2056d4cf
commit 1453527382
2 changed files with 0 additions and 53 deletions

View File

@ -75,34 +75,6 @@ public final class ChaChaCore {
return (key[offset] & 0xFF) | ((key[offset + 1] & 0xFF) << 8) | ((key[offset + 2] & 0xFF) << 16) | ((key[offset + 3] & 0xFF) << 24);
}
/**
* Initializes a ChaCha20 block with a 128-bit key.
*
* @param output The output block, which must consist of at
* least 16 words.
* @param key The buffer containing the key.
* @param offset Offset of the key in the buffer.
*/
public static void initKey128(int[] output, byte[] key, int offset)
{
output[0] = char4('e', 'x', 'p', 'a');
output[1] = char4('n', 'd', ' ', '1');
output[2] = char4('6', '-', 'b', 'y');
output[3] = char4('t', 'e', ' ', 'k');
output[4] = fromLittleEndian(key, offset);
output[5] = fromLittleEndian(key, offset + 4);
output[6] = fromLittleEndian(key, offset + 8);
output[7] = fromLittleEndian(key, offset + 12);
output[8] = output[4];
output[9] = output[5];
output[10] = output[6];
output[11] = output[7];
output[12] = 0;
output[13] = 0;
output[14] = 0;
output[15] = 0;
}
/**
* Initializes a ChaCha20 block with a 256-bit key.
*

View File

@ -39,18 +39,13 @@ public class HandshakeState implements Destroyable {
private final boolean isInitiator;
private DHState localKeyPair;
private DHState localEphemeral;
private DHState localHybrid;
private DHState remotePublicKey;
private DHState remoteEphemeral;
private DHState remoteHybrid;
private DHState fixedEphemeral;
private DHState fixedHybrid;
private int action;
private final int requirements;
private int patternIndex;
// not supported
private static final byte[] preSharedKey = null;
// not supported
private static final byte[] prologue = null;
/**
@ -369,10 +364,6 @@ public class HandshakeState implements Destroyable {
symmetric.mixPublicKey(localKeyPair);
if ((requirements & FALLBACK_PREMSG) != 0) {
symmetric.mixPublicKey(remoteEphemeral);
if (remoteHybrid != null)
symmetric.mixPublicKey(remoteHybrid);
if (preSharedKey != null)
symmetric.mixPublicKeyIntoCK(remoteEphemeral);
}
if ((requirements & REMOTE_PREMSG) != 0)
symmetric.mixPublicKey(remotePublicKey);
@ -381,10 +372,6 @@ public class HandshakeState implements Destroyable {
symmetric.mixPublicKey(remotePublicKey);
if ((requirements & FALLBACK_PREMSG) != 0) {
symmetric.mixPublicKey(localEphemeral);
if (localHybrid != null)
symmetric.mixPublicKey(localHybrid);
if (preSharedKey != null)
symmetric.mixPublicKeyIntoCK(localEphemeral);
}
if ((requirements & LOCAL_PREMSG) != 0)
symmetric.mixPublicKey(localKeyPair);
@ -511,8 +498,6 @@ public class HandshakeState implements Destroyable {
// If the protocol is using pre-shared keys, then also mix
// the local ephemeral key into the chaining key.
if (preSharedKey != null)
symmetric.mixKey(message, messagePosn, len);
messagePosn += len;
}
break;
@ -664,8 +649,6 @@ public class HandshakeState implements Destroyable {
// If the protocol is using pre-shared keys, then also mix
// the remote ephemeral key into the chaining key.
if (preSharedKey != null)
symmetric.mixKey(message, messageOffset, len);
messageOffset += len;
}
break;
@ -815,20 +798,12 @@ public class HandshakeState implements Destroyable {
localKeyPair.destroy();
if (localEphemeral != null)
localEphemeral.destroy();
if (localHybrid != null)
localHybrid.destroy();
if (remotePublicKey != null)
remotePublicKey.destroy();
if (remoteEphemeral != null)
remoteEphemeral.destroy();
if (remoteHybrid != null)
remoteHybrid.destroy();
if (fixedEphemeral != null)
fixedEphemeral.destroy();
if (fixedHybrid != null)
fixedHybrid.destroy();
if (preSharedKey != null)
Noise.destroy(preSharedKey);
if (prologue != null)
Noise.destroy(prologue);
}