From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Doubt about the use and
initialization of DH structDate: Fri, 14 Dec 2007 10:23:19 +0000
Hello,I have a problem with DH struct in my source code C.
Here a small list of my code:
#include <stdio.h>
#include <stdlib.h>
#include <openssl/dh.h>
#include <openssl/engine.h>
#include <openssl/bn.h>
DH *dh_struct;
int main()
{
unsigned char str_p[] = "57503";unsigned char str_g[] = "5";
unsigned char *string;
int num_byte,size,i;
dh_struct = DH_new();
dh_struct->p = BN_new();
dh_struct->g = BN_new();
dh_struct->priv_key = BN_new();
dh_struct->pub_key = BN_new();
num_byte = BN_dec2bn(dh_struct->p,str_p); // Here it seems that not execute
anything about structure "dh_struct->p"....why???
num_byte = BN_dec2bn(dh_struct->p,str_g);
size = BN_num_bytes(dh_struct->p); // Here,the result is zero...why???
string = BN_bn2dec(dh_struct->p); // TEST,but string is NULL...why???
i=DH_generate_ket(dh_struct); // return 0,operation failed.....
}
I can not understand where I mistake in the code!
Thank you for your help,
Hector Agustin Cozzetti
_________________________________________________________________
Scarica GRATIS la versione personalizzata MSN di Internet Explorer 7!
http://optimizedie7.msn.com/default.aspx?mkt=it-it