add comments about the null privkey bug
This commit is contained in:
@ -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());
|
||||
|
Reference in New Issue
Block a user