Title: unable to get same shared key using Diffie-Hellman

I have a simple client server test program that uses the OPENSSL Diffie-Hellman functions to derive the secret shared key. Of late during our stress runs, we have found that a few sessions do not derive the same shared key. One such example is below. The client and server both use the same 'p' and 'g' key. Using the data I tested the output of the BN_mod_exp and BN_mod_exp_simple functions and got the same results. I am not sure if this is a bug in the BN functions or if the private key is invalid.

In order to eliminate locking issues, the test program was restricted to one thread. However we are still seeing the same problem. I suspect that I may be doing something wrong. Checked the data structures to see if there is any corruption, but could not see any. I am using the 0.9.7c version of the OPENSSL library and running the test programs on Windows. Any pointers would be appreciated.


P Key:

0xef 0x65 0x44 0xf8 0x80 0x90 0x7c 0x2b

0xc4 0x98 0x7d 0xad 0xeb 0x77 0x08 0xe1

0x8b 0x4a 0x5a 0xa6 0xe5 0x1e 0xba 0x38

0x6c 0xb1 0x01 0x26 0x25 0x79 0x93 0xb9

0xb9 0x64 0xa5 0xff 0xa8 0x3b 0xa0 0xc6

0xf0 0x8f 0x6d 0x38 0x17 0x58 0x13 0x8c

0x8d 0x66 0x59 0x6e 0xf8 0x63 0x6e 0x43

0x92 0x93 0x91 0x59 0x66 0xce 0x6b 0x8b

G Key:

0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

SERVER:

Server Private Key:

0x60 0x50 0x79 0x91 0x23 0xa7 0x2d 0x44

0xb8 0x58 0x48 0x1f 0x04 0xb8 0xad 0xeb

0x20 0xdd 0x6e 0x7f 0x6c 0xa3 0xde 0x34

0x8b 0x1b 0x62 0x51 0xd8 0xa4 0x7b 0xe1

0xa6 0x59 0x88 0xa3 0xa8 0x4e 0xa2 0xf5

0x35 0xfd 0x8b 0x31 0x32 0x66 0xbc 0x9b

0x52 0x9e 0x0e 0xfb 0x3a 0xe0 0x87 0x9a

0x80 0x72 0x4f 0x7a 0x19 0xe2 0x86 0x03

Server Public Key:

0xa7 0x25 0xf2 0xc9 0x84 0xca 0xee 0xd0

0x67 0xe1 0xea 0x19 0x84 0x18 0x27 0x04

0x73 0x5f 0x1e 0x90 0xb6 0xa4 0x67 0xf7

0xb4 0xb8 0xe8 0x61 0xda 0xcf 0xb7 0x3f

0x70 0xfe 0xac 0xb3 0xe6 0x98 0x18 0xf8

0x44 0x21 0xd4 0x4d 0xa2 0x6e 0xba 0xc4

0x9d 0xbe 0x9e 0xb6 0x0c 0xfe 0xf4 0xdb

0xd9 0xef 0x78 0x6f 0xc1 0x85 0x71 0x03

Server Shared Key:

0x94 0x23 0xdf 0x07 0xcd 0xd3 0x1f 0x51

0x06 0xa5 0xe6 0x41 0x17 0x7f 0xa4 0x84

0xf3 0x28 0x4b 0x16 0xdd 0x7d 0x67 0x64

0xd5 0x42 0x66 0x5a 0x77 0x1b 0x27 0xef

0x8e 0x59 0x19 0xbb 0x8a 0xe3 0x4c 0xfb

0x07 0x14 0xe0 0x67 0x9f 0x6f 0x67 0x0a

0x81 0xc6 0x3c 0x43 0xd2 0x60 0x16 0xb7

0xc7 0x78 0xf9 0x5a 0xd6 0x51 0x99 0xb7



CLIENT:

Client Private Key:

0x5c 0xef 0x3c 0xd0 0x64 0xa1 0x17 0x25

0x66 0x04 0x74 0xbd 0x6a 0x63 0x78 0x55

0xd8 0xcb 0x24 0x39 0x1e 0x78 0xae 0x41

0x80 0x9c 0x43 0x11 0x1d 0x39 0x1e 0x2d

0x96 0x87 0xe9 0x3f 0xcf 0x76 0x6d 0x54

0xbe 0x83 0x27 0x84 0x00 0x83 0xe7 0xd9

0x0f 0x37 0x7d 0xca 0x35 0x11 0x0d 0x4f

0xe3 0xfa 0xcb 0x73 0x33 0xdd 0x0a 0x45

Client Public Key:

0x79 0x0b 0xc3 0xaa 0x13 0x40 0xa3 0xf4

0x17 0xc7 0x0c 0x40 0x2f 0x09 0xba 0x1a

0xd8 0x6a 0x9e 0xe3 0xe0 0xa1 0x5d 0x66

0x45 0x04 0x46 0xed 0x27 0x66 0x25 0xbc

0x1b 0x75 0x9d 0x89 0xc8 0x89 0x55 0x5f

0xee 0x6f 0xa3 0xf5 0x1a 0xb8 0xef 0x9e

0x95 0x03 0x2f 0x22 0x68 0x0f 0xc2 0x81

0x64 0x41 0x10 0xa9 0x85 0xbe 0xea 0xaa

Client Shared Key:

0x3f 0xb3 0xa4 0xbc 0x12 0x20 0xa3 0xe3

0x1e 0x0a 0x01 0x65 0x3c 0x09 0x43 0x74

0x9d 0x5a 0xdc 0xc5 0x11 0xba 0x82 0x67

0x8e 0xe0 0x71 0x4b 0xaa 0xc9 0x97 0x92

0x8a 0x12 0x16 0xdd 0x64 0x47 0x9c 0xdc

0xa0 0x8c 0x86 0xc6 0xbc 0xb2 0xa6 0x04

0xc4 0x19 0x07 0xd9 0x11 0x41 0x64 0x0f

0x0d 0xf2 0xda 0xdb 0x3d 0x42 0x04 0xff

Thanks in advance,

James

Reply via email to