return NULL;
}
- ret->references = 1;
-
- ret->lock = CRYPTO_THREAD_lock_new();
- if (ret->lock == NULL) {
- X509_INFO_free(ret);
- return NULL;
- }
-
return ret;
}
void X509_INFO_free(X509_INFO *x)
{
- int i;
-
if (x == NULL)
return;
- CRYPTO_atomic_add(&x->references, -1, &i, x->lock);
- REF_PRINT_COUNT("X509_INFO", x);
- if (i > 0)
- return;
- REF_ASSERT_ISNT(i < 0);
-
X509_free(x->x509);
X509_CRL_free(x->crl);
X509_PKEY_free(x->x_pkey);
OPENSSL_free(x->enc_data);
- CRYPTO_THREAD_lock_free(x->lock);
OPENSSL_free(x);
}
if (ret == NULL)
goto err;
- ret->references = 1;
- ret->lock = CRYPTO_THREAD_lock_new();
- if (ret->lock == NULL) {
- OPENSSL_free(ret);
- return NULL;
- }
ret->enc_algor = X509_ALGOR_new();
ret->enc_pkey = ASN1_OCTET_STRING_new();
if (ret->enc_algor == NULL || ret->enc_pkey == NULL)
void X509_PKEY_free(X509_PKEY *x)
{
- int i;
-
if (x == NULL)
return;
- CRYPTO_atomic_add(&x->references, -1, &i, x->lock);
- REF_PRINT_COUNT("X509_PKEY", x);
- if (i > 0)
- return;
- REF_ASSERT_ISNT(i < 0);
-
X509_ALGOR_free(x->enc_algor);
ASN1_OCTET_STRING_free(x->enc_pkey);
EVP_PKEY_free(x->dec_pkey);
if (x->key_free)
OPENSSL_free(x->key_data);
- CRYPTO_THREAD_lock_free(x->lock);
OPENSSL_free(x);
}
int key_free; /* true if we should auto free key_data */
/* expanded version of 'enc_algor' */
EVP_CIPHER_INFO cipher;
- int references;
- CRYPTO_RWLOCK *lock;
} X509_PKEY;
typedef struct X509_info_st {
EVP_CIPHER_INFO enc_cipher;
int enc_len;
char *enc_data;
- int references;
- CRYPTO_RWLOCK *lock;
} X509_INFO;
DEFINE_STACK_OF(X509_INFO)