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

Skip to content
Snippets Groups Projects
Commit 29dc311c authored by zzz's avatar zzz
Browse files

Ratchet: Destroy HandshakeState after fatal NS/NSR errors

parent 7aa78a1a
No related branches found
No related tags found
No related merge requests found
......@@ -513,6 +513,7 @@ public final class ECIESAEADEngine {
if (_log.shouldDebug())
_log.debug("Elg2 decode fail NSR");
data[TAGLEN + KEYLEN - 1] = yy31;
state.destroy();
return null;
}
if (_log.shouldDebug())
......@@ -534,6 +535,7 @@ public final class ECIESAEADEngine {
// unlikely since we already matched the tag
System.arraycopy(yy, 0, data, TAGLEN, KEYLEN - 1);
data[TAGLEN + KEYLEN - 1] = yy31;
state.destroy();
return null;
}
if (_log.shouldDebug())
......@@ -559,6 +561,7 @@ public final class ECIESAEADEngine {
if (_log.shouldDebug())
_log.debug("State at failure: " + state);
}
state.destroy();
return NO_CLOVES;
}
......@@ -575,8 +578,10 @@ public final class ECIESAEADEngine {
if (_log.shouldDebug())
_log.debug("Processed " + blocks + " blocks in IB NSR");
} catch (DataFormatException e) {
state.destroy();
throw e;
} catch (Exception e) {
state.destroy();
throw new DataFormatException("NSR payload error", e);
}
}
......@@ -589,6 +594,7 @@ public final class ECIESAEADEngine {
// TODO
if (_log.shouldWarn())
_log.warn("NSR reply to zero static key NS");
state.destroy();
return NO_CLOVES;
}
......
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