I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 85fbbf89 authored by zzz's avatar zzz
Browse files

* NetDB: Add hash collision detection

parent 612fab1b
No related branches found
No related tags found
No related merge requests found
...@@ -676,6 +676,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade { ...@@ -676,6 +676,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
throw new IllegalArgumentException("Attempt to replace RI with " + leaseSet); throw new IllegalArgumentException("Attempt to replace RI with " + leaseSet);
} }
// spoof / hash collision detection
if (rv != null && !leaseSet.getDestination().equals(rv.getDestination()))
throw new IllegalArgumentException("LS Hash collision");
String err = validate(key, leaseSet); String err = validate(key, leaseSet);
if (err != null) if (err != null)
throw new IllegalArgumentException("Invalid store attempt - " + err); throw new IllegalArgumentException("Invalid store attempt - " + err);
...@@ -815,6 +819,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade { ...@@ -815,6 +819,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
throw new IllegalArgumentException("Attempt to replace LS with " + routerInfo); throw new IllegalArgumentException("Attempt to replace LS with " + routerInfo);
} }
// spoof / hash collision detection
if (rv != null && !routerInfo.getIdentity().equals(rv.getIdentity()))
throw new IllegalArgumentException("RI Hash collision");
String err = validate(key, routerInfo); String err = validate(key, routerInfo);
if (err != null) if (err != null)
throw new IllegalArgumentException("Invalid store attempt - " + err); throw new IllegalArgumentException("Invalid store attempt - " + err);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment