Fix diffie hellman

fix bug from DW implementation.