> From: [email protected] On Behalf Of satzok
> Sent: Tuesday, 09 August, 2011 06:55

> out of curiosity i checked the  variables inside the DH object (dh->g,
> dh->p) after calling DH_generate_parameters_ex

> on printing the value of dh->g was 1064305904 !!
> g is supposed to hold the value 2 (int generator = 2;) right??  
> or am I in a wrong lane? 
> 
Even though g is usually small, presumably since it participates 
in bignum computations and for consistency it is represented 
like the other components as a pointer to BIGNUM. See dh.h. 

See bn.h, or use the provided interfaces, e.g.
BN_num_bits and BN_get_word, BN_print_fp or BN_print,
BN_bn2bin or BN_bn2mpi or BN_bn2hex or BN_bn2dec 

When you *printf a pointer with %d or %u, a good compiler 
should complain (although the C standard doesn't require 
this one); for example gcc does with -Wall* or -Wformat. 
(* Even though -Wall doesn't actually enable all warnings, 
a point of frequent confusion and controversy.) 

You might find it easier to just compile with symbols 
and use the debugger to display your variables; it will 
automatically know the type, components, etc. 


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to