Colin Chalmers wrote:
> 
> Hi,
> 
> Since there was no response on the earlier posting here's a second chance
> perhaps explaining the problem better.
> 
> The code at the bottom works for me when used within the same program
> however when I pass the (vtrCertStatus) structure to a DLL, although I can
> access the memory using other *means*, I cannot init a cert.
> I 've looked in the list server and see possible problems with multithreaded
> apps. however if that was the case here surely I wouldn't be able to access
> the memory at all. Or am I missing something?
> 
> Any help much appreciated.
> 
> /colin
> 
>  X509 *cert = NULL;
> 
>  SSLeay_add_all_algorithms();
>  ERR_load_crypto_strings();
> 
> cert = d2i_X509(NULL, (unsigned char
> **)&vtrCertStatus[0].cs_entityCert.b_data ,
> (long)vtrCertStatus[0].cs_entityCert.b_size );
> 
>  if (cert != NULL) {
>   X509_NAME *name = NULL;
>   name = X509_get_subject_name(cert);
>  }
> 
>  X509_free(cert);
> 

Well since I've no idea what that vtrCertStatus structure does any
analysis is somewhat limited. However because you presumably have to use
the (unsigned char **) case and because I'd guess its an internal
pointer that looks questionable. Do you really want the call to modify
.b_data after it has been made?

Reading the FAQ might help. Particularly the bits about how to get
further info if a function fails and how to use the ASN1 functions.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


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

Reply via email to