LIDA WANG wrote:
I am sorry i keep bothering you guys, but i am stucked here.function d2i_DHparams() is created in the following macros:#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\} \ int i2d_##fname(const stname *a, unsigned char **out) \ { \return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\} also, we have #define ASN1_ITEM_rptr(ref) (&(ref##_it))but i can not fine the place where variable or function "DHparams_it" is defined. do you know how to find this variable?
The story just goes on: dh_asn1.c contains ASN1_SEQUENCE_cb(DHparams, dh_cb) = { ASN1_SIMPLE(DH, p, BIGNUM), ASN1_SIMPLE(DH, g, BIGNUM), ASN1_OPT(DH, length, ZLONG), } ASN1_SEQUENCE_END_cb(DH, DHparams) IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams) The whole bunch of macros is defined in asn1t.h: #define ASN1_SEQUENCE_cb(tname, cb) \ static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ ASN1_SEQUENCE(tname) #define ASN1_SEQUENCE(tname) \ static const ASN1_TEMPLATE tname##_seq_tt[]#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
#define ASN1_SEQUENCE_END_ref(stname, tname) \ ;\ ASN1_ITEM_start(tname) \ ASN1_ITYPE_SEQUENCE,\ V_ASN1_SEQUENCE,\ tname##_seq_tt,\ sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ &tname##_aux,\ sizeof(stname),\ #stname \ ASN1_ITEM_end(tname) #define ASN1_ITEM_start(itname) \ const ASN1_ITEM * itname##_it(void) \ { \ static const ASN1_ITEM local_it = { \Here we have your DHparams_it... With some (probably considerable) more effort you can do what the preprocessor does and manually find out which function will be compiled. There are probably ways to call gcc which will give you the output of the preprocessor, maybe the gcc manpage can help.
thanks[...]Does anyone know how to find the body part of function i2d_DHparams()? I can only find the definition part of this functionI think it is created by the macro IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname in file crypto/dh/dh_asn1.c.The macro is defined in crypto/asn1/asn1t.h. Hope it helps, Ted ;)
Hope it helps. Ted ;) -- PGP Public Key Information Download complete Key from http://www.convey.de/ted/tedkey_convey.asc Key fingerprint = 31B0 E029 BCF9 6605 DAC1 B2E1 0CC8 70F4 7AFB 8D26
smime.p7s
Description: S/MIME Cryptographic Signature