Re: DH_generate_key() segmentation fault

2014-01-24 Thread khan wahid
These built-in functions do not return the size of the binary data, so how can I get the length of the binary data? I need the length in some other parts of my program. Do I need to convert them to Hex everytime to get the length? Or is there any direct method to get the length? I want to use

RE: DH_generate_key() segmentation fault

2014-01-24 Thread Salz, Rich
Ø These built-in functions do not return the size of the binary data, so how can I get the length of the binary data? BN_num_bytes() which you already used in your initial posting? -- Principal Security Engineer Akamai Technology Cambridge, MA

Re: DH_generate_key() segmentation fault

2014-01-24 Thread khan wahid
Oh! what a miss!! Signs of excessive pressure!!! When I divide the program in multiple files, I create one of the functions like this- char *dh_sender_pub(DH *dhPar) {     char *pubinHex=NULL;     DH_generate_key(dhPar);     pubinHex=BN_bn2hex(dhPar-pub_key);     return pubinHex; }  And I was

Re: DH_generate_key() segmentation fault

2014-01-21 Thread khan wahid
Hi, Thank you all for your quick responses. I am using openssl 1.0.1 on a Linux machine. The DH_new() works correctly in my machine. It does not return NULL. Only the problem occurs in these lines-         BN_bin2bn(parmp,strlen(parmp), dhPar2-p);         BN_bin2bn(parmg,strlen(parmg),

RE: DH_generate_key() segmentation fault

2014-01-21 Thread Salz, Rich
As two other people have already said, you cannot use strlen() on binary data. BN_bin2bn(parmp,strlen(parmp), dhPar2-p); BN_bin2bn(parmg,strlen(parmg), dhPar2-g); /r$ -- Principal Security Engineer Akamai Technology Cambridge, MA

Re: DH_generate_key() segmentation fault

2014-01-20 Thread Matt Caswell
On 20 January 2014 15:34, khan wahid rr...@yahoo.com wrote: Hi, I am trying to implement DH key exchage using openssl in the same program, so I generate DH parameters once, and then transfer the p and g to another DH object, here is my code- #include stdio.h #include string.h #include

RE: DH_generate_key() segmentation fault

2014-01-20 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Matt Caswell Sent: Monday, January 20, 2014 15:45 On 20 January 2014 15:34, khan wahid rr...@yahoo.com wrote: Hi, I am trying to implement DH key exchage using openssl in the same program, so I generate DH parameters once, and then