jitsi / zrtp4j

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

zrtp4j-light-4.1.1 is not backward compatible with zrtp-light-4.1.0 for E255 public key support #6

Closed cmeng-git closed 4 years ago

cmeng-git commented 4 years ago

Encountered problem when making zrtp call between client with different zrtp libraries i.e. 4.1.1 and 4.1.0. It seems that the pubkey value in DHPart1 (4.1.0) is not valid under (4.1.1), when checking is done in ZEtp#prepareDHPart2() i.e.

ECPoint point = pubKey.curve.decodePoint(encoded);

This causes the whole zrtp setup to failed. See below debug log. Any advice what can be the cause?

2020-07-07 14:09:40.105 18897-10737/org.atalk.android D/(SecurityEventManager.java:253)#showMessage: AUDIO_SESSION: ZRTP message (Info): code: InfoHelloReceived; message: null
2020-07-07 14:09:40.308 18897-10737/org.atalk.android D/(SecurityEventManager.java:253)#showMessage: AUDIO_SESSION: ZRTP message (Info): code: InfoCommitDHGenerated; message: null
2020-07-07 14:09:40.388 18897-10737/org.atalk.android D/(SecurityEventManager.java:253)#showMessage: AUDIO_SESSION: ZRTP message (Info): code: InfoInitDH1Received; message: null
2020-07-07 14:09:40.390 18897-10737/org.atalk.android E/(SinglePacketTransformer.java:216)#transformArray: Failed to reverseTransform RawPacket(s)!
    java.lang.IllegalArgumentException: x value invalid for Curve25519FieldElement
        at org.bouncycastle.math.ec.custom.djb.Curve25519FieldElement.<init>(Unknown Source:30)
        at org.bouncycastle.math.ec.custom.djb.Curve25519.fromBigInteger(Unknown Source:2)
        at org.bouncycastle.math.ec.ECCurve$AbstractFp.decompressPoint(Unknown Source:0)
        at org.bouncycastle.math.ec.ECCurve.decodePoint(Unknown Source:144)
        at gnu.java.zrtp.ZRtp.prepareDHPart2(ZRtp.java:1579)
        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:560)
        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)