예제 #1
0
static int asn1_bio_new(BIO *b)
	{
	BIO_ASN1_BUF_CTX *ctx;
	ctx = (BIO_ASN1_BUF_CTX*)OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX));
	if (!ctx)
		return 0;
	if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
		return 0;
	b->init = 1;
	b->ptr = (char *)ctx;
	b->flags = 0;
	return 1;
	}
예제 #2
0
파일: bio_asn1.c 프로젝트: AnClark/openssl
static int asn1_bio_new(BIO *b)
{
    BIO_ASN1_BUF_CTX *ctx;
    ctx = OPENSSL_malloc(sizeof(*ctx));
    if (ctx == NULL)
        return 0;
    if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) {
        OPENSSL_free(ctx);
        return 0;
    }
    b->init = 1;
    b->ptr = (char *)ctx;
    b->flags = 0;
    return 1;
}
예제 #3
0
파일: bio_asn1.c 프로젝트: Bilibili/openssl
static int asn1_bio_new(BIO *b)
{
    BIO_ASN1_BUF_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

    if (ctx == NULL)
        return 0;
    if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) {
        OPENSSL_free(ctx);
        return 0;
    }
    BIO_set_data(b, ctx);
    BIO_set_init(b, 1);

    return 1;
}