On Tue, 13 Jun 2006, Girish Venkatachalam wrote:

> Sorry I was wrong. d2i indeed resolves to
> d2i_RSAPrivateKey() which takes 3 parameters and
> passes the first type parameter to d2i_PrivateKey()
> which takes 4 parameters. 
> 
> But it beats me why I cannot find the definition of
> d2i_RSAPrivateKey() anywhere.

Isn't it always a pleasure to try finding where something is defined in 
OpenSSL?  
It is in crypto/rsa/rsa_asn1.c, defined through a macro 
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname
(I think the easies way to find these things is to build the library and 
then look for the object file where the function is defined)

> 
> --- Rajeshwar Singh Jenwar <[EMAIL PROTECTED]> wrote:
> 
> > how come ? plz explain.
> > 
> > On 6/13/06, Girish Venkatachalam
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > bcoz d2i resolves to d2i_X509() , not to
> > > d2i_PrivateKey
> > >
> > > --- ?????? ???????????? <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > > when i use PEM_read_PrivateKey find it work
> > error
> > > > ,so i look into
> > > > PEM_read_PrivateKey to find the reason.
> > > > first i find in
> > > > #define       PEM_read_PrivateKey(fp,x,cb,u)
> > (EVP_PKEY
> > > > *)PEM_ASN1_read( \
> > > >       (char
> > > >
> > *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char
> > > > **)x,cb,u)
> > > > next i find in
> > > > void *PEM_ASN1_read(d2i_of_void *d2i, const char
> > > > *name, FILE *fp, void **x,
> > > >                   pem_password_cb *cb, void *u)
> > > >       {
> > > >         BIO *b;
> > > >         void *ret;
> > > >
> > > >         if ((b=BIO_new(BIO_s_file())) == NULL)
> > > >               {
> > > >              
> > PEMerr(PEM_F_PEM_ASN1_READ,ERR_R_BUF_LIB);
> > > >                 return(0);
> > > >               }
> > > >         BIO_set_fp(b,fp,BIO_NOCLOSE);
> > > >        
> > ret=PEM_ASN1_read_bio(d2i,name,b,x,cb,u);
> > > >         BIO_free(b);
> > > >         return(ret);
> > > >       }
> > > > then i goto
> > > > void *PEM_ASN1_read_bio(d2i_of_void *d2i, const
> > char
> > > > *name, BIO *bp, void
> > > > **x,
> > > >                       pem_password_cb *cb, void
> > *u)
> > > >       {
> > > >       const unsigned char *p=NULL;
> > > >       unsigned char *data=NULL;
> > > >       long len;
> > > >       char *ret=NULL;
> > > >
> > > >       if (!PEM_bytes_read_bio(&data, &len, NULL,
> > name,
> > > > bp, cb, u))
> > > >               return NULL;
> > > >       p = data;
> > > >       ret=d2i(x,&p,len);
> > > >       if (ret == NULL)
> > > >              
> > PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB);
> > > >       OPENSSL_free(data);
> > > >       return(ret);
> > > >       }
> > > > i found the ret=d2i(x,&p,len);
> > > > but the function is
> > > > EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a,
> > > > const unsigned char **pp,
> > > >            long length)
> > > > i think d2i must have 4 parameter but is only
> > > > three,why? Thanks a lot!
> > > >
> > > >
> > >
> >
> _________________________________________________________________
> > > > ????????????????????? MSN Explorer:
> > > > http://explorer.msn.com/lccn/
> > > >
> > > >
> > >
> >
> ______________________________________________________________________
> > > > OpenSSL Project
> > > > http://www.openssl.org
> > > > User Support Mailing List
> > > > openssl-users@openssl.org
> > > > Automated List Manager
> > > > [EMAIL PROTECTED]
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> >
> ______________________________________________________________________
> > > OpenSSL Project                                
> > http://www.openssl.org
> > > User Support Mailing List                   
> > openssl-users@openssl.org
> > > Automated List Manager                          
> > [EMAIL PROTECTED]
> > >
> > 
> > 
> > 
> > -- 
> > Njoy
> > RSJ
> > "When life does not find a singer to sing her heart,
> >   she produces a philosopher to speak her mind."
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to