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

Skip to content
Snippets Groups Projects
Commit 70e9cf58 authored by zzz's avatar zzz
Browse files

add comments about the null privkey bug

parent 24020302
No related branches found
No related tags found
No related merge requests found
......@@ -699,6 +699,7 @@ public class EstablishmentManager {
// signs if we havent signed yet
state.prepareSessionConfirmed();
// BUG - handle null return
UDPPacket packets[] = _builder.buildSessionConfirmedPackets(state, _context.router().getRouterInfo().getIdentity());
if (_log.shouldLog(Log.DEBUG))
......
......@@ -348,6 +348,8 @@ public class OutboundEstablishState {
DataHelper.toLong(signed, off, 4, _receivedRelayTag);
off += 4;
DataHelper.toLong(signed, off, 4, _sentSignedOnTime);
// BUG - if SigningPrivateKey is null, _sentSignature will be null, leading to NPE later
// should we throw something from here?
_sentSignature = _context.dsa().sign(signed, _context.keyManager().getSigningPrivateKey());
}
......
......@@ -512,6 +512,10 @@ public class PacketBuilder {
* encrypting it as necessary.
*
* @return ready to send packets, or null if there was a problem
*
* TODO: doesn't really return null, and caller doesn't handle null return
* (null SigningPrivateKey should cause this?)
* Should probably return null if buildSessionConfirmedPacket() turns null for any fragment
*/
public UDPPacket[] buildSessionConfirmedPackets(OutboundEstablishState state, RouterIdentity ourIdentity) {
byte identity[] = ourIdentity.toByteArray();
......@@ -593,6 +597,7 @@ public class PacketBuilder {
off++;
}
// BUG: NPE here if null signature
System.arraycopy(state.getSentSignature().getData(), 0, data, off, Signature.SIGNATURE_BYTES);
packet.getPacket().setLength(off + Signature.SIGNATURE_BYTES);
authenticate(packet, state.getCipherKey(), state.getMACKey());
......
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