NTCP2: Remove debug code

This commit is contained in:
zzz
2018-08-02 11:48:55 +00:00
parent 2e85c2387c
commit 8fb7bd264f
4 changed files with 0 additions and 37 deletions

View File

@ -41,8 +41,6 @@ public class ChaChaPolyCipherState implements CipherState {
private final byte[] polyKey;
private long n;
private boolean haskey;
// I2P debug to be removed
private byte[] initialKey;
/**
* Constructs a new cipher state for the "ChaChaPoly" algorithm.
@ -82,9 +80,6 @@ public class ChaChaPolyCipherState implements CipherState {
@Override
public void initializeKey(byte[] key, int offset) {
// I2P debug to be removed
initialKey = new byte[32];
System.arraycopy(key, 0, initialKey, 0, 32);
ChaChaCore.initKey256(input, key, offset);
n = 0;
haskey = true;
@ -293,16 +288,6 @@ public class ChaChaPolyCipherState implements CipherState {
n = nonce;
}
/**
* I2P debug to be removed
* @return null if none yet
*/
public byte[] getKey() {
if (!haskey)
return null;
return initialKey;
}
/**
* I2P debug
*/
@ -312,13 +297,6 @@ public class ChaChaPolyCipherState implements CipherState {
buf.append(" Cipher State:\n" +
" nonce: ");
buf.append(n);
buf.append("\n" +
" init key: ");
// I2P debug to be removed
if (haskey)
buf.append(net.i2p.data.Base64.encode(initialKey));
else
buf.append("null");
buf.append("\n poly key: ");
if (haskey)
buf.append(net.i2p.data.Base64.encode(polyKey));

View File

@ -155,9 +155,4 @@ public interface CipherState extends Destroyable {
* value goes backwards then security may be compromised.
*/
void setNonce(long nonce);
/**
* I2P debug to be removed
*/
public byte[] getKey();
}

View File

@ -901,9 +901,6 @@ class InboundEstablishState extends EstablishBase implements NTCP2Payload.Payloa
CipherStatePair ckp = _handshakeState.split();
CipherState rcvr = ckp.getReceiver();
CipherState sender = ckp.getSender();
// debug, to be removed
byte[] k_ab = rcvr.getKey();
byte[] k_ba = sender.getKey();
// Data phase SipHash keys
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
@ -918,8 +915,6 @@ class InboundEstablishState extends EstablishBase implements NTCP2Payload.Payloa
} else {
if (_log.shouldDebug()) {
_log.debug("Finished establishment for " + this +
"\nGenerated ChaCha key for A->B: " + Base64.encode(k_ab) +
"\nGenerated ChaCha key for B->A: " + Base64.encode(k_ba) +
"\nGenerated SipHash key for A->B: " + Base64.encode(sip_ab) +
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
}

View File

@ -404,9 +404,6 @@ class OutboundNTCP2State implements EstablishState {
CipherStatePair ckp = _handshakeState.split();
CipherState rcvr = ckp.getReceiver();
CipherState sender = ckp.getSender();
// debug, to be removed
byte[] k_ab = sender.getKey();
byte[] k_ba = rcvr.getKey();
// Data phase SipHash keys
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
@ -415,8 +412,6 @@ class OutboundNTCP2State implements EstablishState {
if (_log.shouldDebug()) {
_log.debug("Finished establishment for " + this +
"\nGenerated ChaCha key for A->B: " + Base64.encode(k_ab) +
"\nGenerated ChaCha key for B->A: " + Base64.encode(k_ba) +
"\nGenerated SipHash key for A->B: " + Base64.encode(sip_ab) +
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
}