forked from I2P_Developers/i2p.i2p
NTCP2: Remove debug code
This commit is contained in:
@ -41,8 +41,6 @@ public class ChaChaPolyCipherState implements CipherState {
|
|||||||
private final byte[] polyKey;
|
private final byte[] polyKey;
|
||||||
private long n;
|
private long n;
|
||||||
private boolean haskey;
|
private boolean haskey;
|
||||||
// I2P debug to be removed
|
|
||||||
private byte[] initialKey;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new cipher state for the "ChaChaPoly" algorithm.
|
* Constructs a new cipher state for the "ChaChaPoly" algorithm.
|
||||||
@ -82,9 +80,6 @@ public class ChaChaPolyCipherState implements CipherState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeKey(byte[] key, int offset) {
|
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);
|
ChaChaCore.initKey256(input, key, offset);
|
||||||
n = 0;
|
n = 0;
|
||||||
haskey = true;
|
haskey = true;
|
||||||
@ -293,16 +288,6 @@ public class ChaChaPolyCipherState implements CipherState {
|
|||||||
n = nonce;
|
n = nonce;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* I2P debug to be removed
|
|
||||||
* @return null if none yet
|
|
||||||
*/
|
|
||||||
public byte[] getKey() {
|
|
||||||
if (!haskey)
|
|
||||||
return null;
|
|
||||||
return initialKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I2P debug
|
* I2P debug
|
||||||
*/
|
*/
|
||||||
@ -312,13 +297,6 @@ public class ChaChaPolyCipherState implements CipherState {
|
|||||||
buf.append(" Cipher State:\n" +
|
buf.append(" Cipher State:\n" +
|
||||||
" nonce: ");
|
" nonce: ");
|
||||||
buf.append(n);
|
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: ");
|
buf.append("\n poly key: ");
|
||||||
if (haskey)
|
if (haskey)
|
||||||
buf.append(net.i2p.data.Base64.encode(polyKey));
|
buf.append(net.i2p.data.Base64.encode(polyKey));
|
||||||
|
@ -155,9 +155,4 @@ public interface CipherState extends Destroyable {
|
|||||||
* value goes backwards then security may be compromised.
|
* value goes backwards then security may be compromised.
|
||||||
*/
|
*/
|
||||||
void setNonce(long nonce);
|
void setNonce(long nonce);
|
||||||
|
|
||||||
/**
|
|
||||||
* I2P debug to be removed
|
|
||||||
*/
|
|
||||||
public byte[] getKey();
|
|
||||||
}
|
}
|
||||||
|
@ -901,9 +901,6 @@ class InboundEstablishState extends EstablishBase implements NTCP2Payload.Payloa
|
|||||||
CipherStatePair ckp = _handshakeState.split();
|
CipherStatePair ckp = _handshakeState.split();
|
||||||
CipherState rcvr = ckp.getReceiver();
|
CipherState rcvr = ckp.getReceiver();
|
||||||
CipherState sender = ckp.getSender();
|
CipherState sender = ckp.getSender();
|
||||||
// debug, to be removed
|
|
||||||
byte[] k_ab = rcvr.getKey();
|
|
||||||
byte[] k_ba = sender.getKey();
|
|
||||||
|
|
||||||
// Data phase SipHash keys
|
// Data phase SipHash keys
|
||||||
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
|
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
|
||||||
@ -918,8 +915,6 @@ class InboundEstablishState extends EstablishBase implements NTCP2Payload.Payloa
|
|||||||
} else {
|
} else {
|
||||||
if (_log.shouldDebug()) {
|
if (_log.shouldDebug()) {
|
||||||
_log.debug("Finished establishment for " + this +
|
_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 A->B: " + Base64.encode(sip_ab) +
|
||||||
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
|
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
|
||||||
}
|
}
|
||||||
|
@ -404,9 +404,6 @@ class OutboundNTCP2State implements EstablishState {
|
|||||||
CipherStatePair ckp = _handshakeState.split();
|
CipherStatePair ckp = _handshakeState.split();
|
||||||
CipherState rcvr = ckp.getReceiver();
|
CipherState rcvr = ckp.getReceiver();
|
||||||
CipherState sender = ckp.getSender();
|
CipherState sender = ckp.getSender();
|
||||||
// debug, to be removed
|
|
||||||
byte[] k_ab = sender.getKey();
|
|
||||||
byte[] k_ba = rcvr.getKey();
|
|
||||||
|
|
||||||
// Data phase SipHash keys
|
// Data phase SipHash keys
|
||||||
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
|
byte[][] sipkeys = generateSipHashKeys(_context, _handshakeState);
|
||||||
@ -415,8 +412,6 @@ class OutboundNTCP2State implements EstablishState {
|
|||||||
|
|
||||||
if (_log.shouldDebug()) {
|
if (_log.shouldDebug()) {
|
||||||
_log.debug("Finished establishment for " + this +
|
_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 A->B: " + Base64.encode(sip_ab) +
|
||||||
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
|
"\nGenerated SipHash key for B->A: " + Base64.encode(sip_ba));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user