Dear list,
I used the "ecdhtest.c" file as starting point to write a small test application to do ECDH key exchange over a network.
In order to encode the peer's public keys in a TCP message I used the i2d_EC_PUBKEY_bio functions to write the
public keys to memory BIOs, and from the BIOs to the TCP messages.
The received bytes were copied to another BIO, and then decoded with d2i_EC_PUBKEY_bio without errors.
The problem is that the procedure ECDH_compute_key yields different key values for both peers !
I have tryed to simulate this behaviour locally , this is, using a "unsigned char " buffer instead a TCP message and
the results were reproduceable.
Then I tried with the d2i/i2d_EC_PUBKEY_fp functions and it yielded the same ECDH key in both peers.
Also, it worked :-)
As said, the only relevant change in the program was exchanging the *bio for the *fp procedures and it worked.
Am I missing something ?
The fp workaround, although locally seems to work good, in a networked environment might result quite ugly and
surely implies quite a performance loss.
BTW, I am using the 0.9.8a version. I looked through the CHANGES file from 0.9.8d and did not find any information
on that matter.
Best regards,
Jordi
- d2i/i2d_EC_PUBKEY_bio and d2i/i2d_EC_PUBKEY_fp functio... Jordi Jaen Pallares
- Re: d2i/i2d_EC_PUBKEY_bio and d2i/i2d_EC_PUBKEY_f... Nils Larsch
- Re: d2i/i2d_EC_PUBKEY_bio and d2i/i2d_EC_PUBK... Jordi Jaen Pallares