body part of function i2d_DHparams()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

body part of function i2d_DHparams()

LIDA WANG-2
Does anyone know how to find the body part of function i2d_DHparams()? I can
only find the definition part of this function

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

Bernhard Fröhlich-2
LIDA WANG wrote:

> Does anyone know how to find the body part of function i2d_DHparams()?
> I can only find the definition part of this function

I 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
;)


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

LIDA WANG-2
yes, it is defined there. thank you very much.


>From: Bernhard Froehlich <[hidden email]>
>Reply-To: [hidden email]
>To: [hidden email]
>Subject: Re: body part of function i2d_DHparams()
>Date: Mon, 27 Mar 2006 20:42:57 +0200
>
>LIDA WANG wrote:
>
>>Does anyone know how to find the body part of function i2d_DHparams()? I
>>can only find the definition part of this function
>
>I 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
>;)
>


><< smime.p7s >>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

LIDA WANG-2
In reply to this post by Bernhard Fröhlich-2
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?

thanks

>From: Bernhard Froehlich <[hidden email]>
>Reply-To: [hidden email]
>To: [hidden email]
>Subject: Re: body part of function i2d_DHparams()
>Date: Mon, 27 Mar 2006 20:42:57 +0200
>
>LIDA WANG wrote:
>
>>Does anyone know how to find the body part of function i2d_DHparams()? I
>>can only find the definition part of this function
>
>I 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
>;)
>


><< smime.p7s >>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

Bernhard Fröhlich-2
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 function
>>
>> I 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 (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

Kyle Hamilton
On 3/28/06, Bernhard Froehlich <[hidden email]> wrote:
> 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.

The appropriate command is gcc -E, or cpp.  Essentially just add -E to
the existing command line.  (You may wish to change the suffix of the
output files to '.e' or something to avoid problems with '.o'.)

-Kyle H
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

Dr. Stephen Henson
In reply to this post by LIDA WANG-2
On Mon, Mar 27, 2006, LIDA WANG wrote:

> Does anyone know how to find the body part of function i2d_DHparams()? I
> can only find the definition part of this function
>

Well I could tell you and several people have started giving details. However
doing that will get you buried in the OpenSSL ASN1 internals pretty deeply and
you probably don't want to do that...

So it would make it easier to help you if you indicated why you want to
know.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: body part of function i2d_DHparams()

LIDA WANG-2
Thanks for all people's help, i really appreciate.  i have figured it out.

I did this for fun, i am very interested with this code, and i hope someday
i can also contribute some effort to help others or take part it further
development.


>From: "Dr. Stephen Henson" <[hidden email]>
>Reply-To: [hidden email]
>To: [hidden email]
>Subject: Re: body part of function i2d_DHparams()
>Date: Tue, 28 Mar 2006 15:54:49 +0200
>
>On Mon, Mar 27, 2006, LIDA WANG wrote:
>
> > Does anyone know how to find the body part of function i2d_DHparams()? I
> > can only find the definition part of this function
> >
>
>Well I could tell you and several people have started giving details.
>However
>doing that will get you buried in the OpenSSL ASN1 internals pretty deeply
>and
>you probably don't want to do that...
>
>So it would make it easier to help you if you indicated why you want to
>know.
>
>Steve.
>--
>Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
>OpenSSL project core developer and freelance consultant.
>Funding needed! Details on homepage.
>Homepage: http://www.drh-consultancy.demon.co.uk
>______________________________________________________________________
>OpenSSL Project                                 http://www.openssl.org
>User Support Mailing List                    [hidden email]
>Automated List Manager                           [hidden email]

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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