* SSU: Fix corruption of introducer keys

This commit is contained in:
zzz
2014-03-16 18:27:46 +00:00
parent 6c202e8f1d
commit bd6c588c74
4 changed files with 12 additions and 3 deletions

View File

@@ -1,3 +1,6 @@
2014-03-16 zzz
* SSU: Fix corruption of introducer keys
2014-03-15 zzz
* Certificate: Fix null cert hash code
* Hash: Cleanup of cached hash

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 20;
public final static long BUILD = 21;
/** for example "-test" */
public final static String EXTRA = "-rc";

View File

@@ -1108,7 +1108,10 @@ class PacketBuilder {
SessionKey cipherKey = null;
SessionKey macKey = null;
// first look up by ikey, it is equal to router hash for now
PeerState bobState = transport.getPeerState(Hash.create(ikey));
PeerState bobState = null;
if (ikey.length == Hash.HASH_LENGTH) {
bobState = transport.getPeerState(new Hash(ikey));
}
if (bobState == null) {
RemoteHostId rhid = new RemoteHostId(iaddr.getAddress(), iport);
bobState = transport.getPeerState(rhid);

View File

@@ -1360,7 +1360,10 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
int valid = 0;
for (int i = 0; i < ua.getIntroducerCount(); i++) {
// warning: this is only valid as long as we use the ident hash as their key.
PeerState peer = getPeerState(Hash.create(ua.getIntroducerKey(i)));
byte[] key = ua.getIntroducerKey(i);
if (key.length != Hash.HASH_LENGTH)
continue;
PeerState peer = getPeerState(new Hash(key));
if (peer != null)
valid++;
}