BOLT 8: use an alternate ECDH function#43
Conversation
If we change the definition of our ECDH function to return the actual point in compressed format we should be able to reuse existing Noise implementations without any modifications.
|
Is there actually any advantage in using the point/coordinate in an unhashed fashion? |
|
I think so: if we return the actual point then we can just use the output of the Write() construct as defined in the Noise specs and feed it to the Read() construct. |
|
Yech, I implemented this wrong too, and used libsecp's ECDH function, which as @cdecker points out, doesn't do either! Since everyone has should be probably eventually be using libsecp256k1, even if via language wrappers, my preference would be to use its ECDH function, which is: Let's see if I can pull @apoelstra into this conversation... |
|
gmaxwell says on sepc256k1 (https://botbot.me/freenode/secp256k1/2016-12-09/?msg=77695797&page=1 )
Implementations of Noise need to define ECDH over sepc256k1 anyway, so from that POV why does it matter what the definition is? What am I missing? |
|
It does not matter very much. I was just being lazy and it seems that the Noise specs assume that dhLen == pubkeyLen (i.e. when processing "e" Write produces e.pub || xxx and Read says re = first dhLen bytes etc...), and I've seen ECDH libraries return either compressed point, point.x or sha256(point.x). |
|
Yeah, so in either case, implementers which are instantiating new noise schemes will need to define the semantics of their I agree with Rusty, I think we should redefine our |
|
Fine with me, closing this PR. Thanks! |
If we change the definition of our ECDH function to return the actual point in compressed format, I believe that we should be able to reuse existing Noise implementations without any modifications.
The actual code that I've used is there: https://github.com/sstone/noise/tree/wip-secp256k1.