Example #1
0
static int file_read_asn1(BIO *bp, unsigned char **data, long *len)
{
    BUF_MEM *mem = NULL;

    if (asn1_d2i_read_bio(bp, &mem) < 0)
        return 0;

    *data = (unsigned char *)mem->data;
    *len = (long)mem->length;
    OPENSSL_free(mem);

    return 1;
}
Example #2
0
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
	{
	BUF_MEM *b = NULL;
	const unsigned char *p;
	void *ret=NULL;
	int len;

	len = asn1_d2i_read_bio(in, &b);
	if(len < 0) goto err;

	p=(const unsigned char *)b->data;
	ret=ASN1_item_d2i(x,&p,len, it);
err:
	if (b != NULL) BUF_MEM_free(b);
	return(ret);
	}
Example #3
0
void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x)
	{
	BUF_MEM *b = NULL;
	const unsigned char *p;
	void *ret=NULL;
	int len;

	len = asn1_d2i_read_bio(in, &b);
	if(len < 0) goto err;

	p=(unsigned char *)b->data;
	ret=d2i(x,&p,len);
err:
	if (b != NULL) BUF_MEM_free(b);
	return(ret);
	}
Example #4
0
EVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in)
{
    BUF_MEM *b = NULL;
    const unsigned char *p;
    void *ret = NULL;
    int len;

    len = asn1_d2i_read_bio(in, &b);
    if (len < 0)
        goto err;

    p = (unsigned char *)b->data;
    ret = d2i_KeyParams(type, a, &p, len);
err:
    BUF_MEM_free(b);
    return ret;
}