Jordi Jaen Pallares wrote:
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 ?

don't know what you are precisely doing. Could you give us a code sample ?

Cheers,
Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to