hi all,
in x509.c , load_cert(char * file , int format)
read certificate from a file .
i need read a certificate from a buf ( unsigned char * ),
a function  like
static X509 *load_cert(unsigned char *data , int len , int format )
len is the length of  data.
so i change the following :

        if ((cert=BIO_new(BIO_s_file())) == NULL)
                {
                ERR_print_errors(bio_err);
                goto end;
                }

        if (file == NULL)
                BIO_set_fp(cert,stdin,BIO_NOCLOSE);
        else
                {
                if (BIO_read_filename(cert,file) <= 0)
                        {
                        perror(file);
                        goto end;
                        }
                }

to :

        if ((cert=BIO_new(BIO_f_buffer)) == NULL)
                {
                ERR_print_errors(bio_err);
                goto end;
                }
        if( BIO_set_buffer_read_data ( cert ,data , len ) <=0 )
            {
                ERR_print_errors(bio_err);
                goto end;
            }
compile is ok ,but core dumped .
error is :
#0  0xef745a08 in _smalloc ()
#1  0xef745a50 in malloc ()
#2  0x1dfac in BUF_MEM_new () at buffer.c:67
#3  0x3dc00 in PEM_read_bio (bp=0x77140, name=0xeffffc3c,
header=0xeffffc38,
    data=0xeffffc34, len=0xeffffc30) at pem_lib.c:551
#4  0x3cdf8 in PEM_ASN1_read_bio (d2i=0x21240 <d2i_X509>,
    name=0x5ac80 "CERTIFICATE", bp=0x77140, x=0x0, cb=0) at
pem_lib.c:180
#5  0x24284 in PEM_read_bio_X509 (bp=0x77140, x=0x0, cb=0) at
pem_all.c:79

any one can help me?

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

Reply via email to