jitsi / zrtp4j

Java implementation of ZRTP protocol
GNU General Public License v3.0
6 stars 14 forks source link

Call to ECPublicKeyParameters() pass in ECDomainParameters cannot be null #4

Closed cmeng-git closed 4 years ago

cmeng-git commented 4 years ago

XRtp#prepareDHPart2() line#1584

BigInteger bi = pubKey.dhContext.calculateAgreement(new ECPublicKeyParameters(point, null));

make call to ECPublicKeyParameters(), but pass in null for parameters causing the following exceptions throw by bouncyCastle ECKeyParameters class:

2020-06-23 12:27:18.711 30194-2706/org.atalk.android E/(SinglePacketTransformer.java:216)#transformArray: Failed to reverseTransform RawPacket(s)!
    java.lang.NullPointerException: 'parameters' cannot be null
        at org.bouncycastle.crypto.params.ECKeyParameters.<init>(Unknown Source:12)
        at org.bouncycastle.crypto.params.ECPublicKeyParameters.<init>(Unknown Source:1)
        at gnu.java.zrtp.ZRtp.prepareDHPart2(ZRtp.java:1584)
        at gnu.java.zrtp.ZrtpStateClass.evCommitSent(ZrtpStateClass.java:1102)
        at gnu.java.zrtp.ZrtpStateClass.dispatchEvent(ZrtpStateClass.java:327)
        at gnu.java.zrtp.ZrtpStateClass.processEvent(ZrtpStateClass.java:287)
        at gnu.java.zrtp.ZRtp.processZrtpMessage(ZRtp.java:562)
        at org.atalk.impl.neomedia.transform.zrtp.ZRTPTransformEngine.reverseTransform(ZRTPTransformEngine.java:699)
        at org.atalk.impl.neomedia.transform.-$$Lambda$KpqTOGim0FGCQHqRXPZjVA7awAk.apply(Unknown Source:4)
        at org.atalk.impl.neomedia.transform.SinglePacketTransformer.transformArray(SinglePacketTransformer.java:211)
        at org.atalk.impl.neomedia.transform.SinglePacketTransformer.reverseTransform(SinglePacketTransformer.java:121)
        at org.atalk.impl.neomedia.transform.TransformEngineChain$PacketTransformerChain.reverseTransform(TransformEngineChain.java:328)
        at org.atalk.impl.neomedia.transform.TransformInputStream.createRawPacket(TransformInputStream.java:63)
        at org.atalk.impl.neomedia.RTPConnectorInputStream.runInReceiveThread(RTPConnectorInputStream.java:592)
        at org.atalk.impl.neomedia.RTPConnectorInputStream.access$000(RTPConnectorInputStream.java:37)
        at org.atalk.impl.neomedia.RTPConnectorInputStream$2.run(RTPConnectorInputStream.java:429)
cmeng-git commented 4 years ago

aTalk has implemented the following patch to fix the above problem. It seems the below change is also required for dhSize i.e.

dhSize = pubKey == (ZrtpConstants.SupportedPubKeys.E255) ? pubKey.pubKeySize: pubKey.pubKeySize / 2;

ZRtp.zip

ibauersachs commented 4 years ago

Unless you sign the CLA I cannot use any of your patches.