1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci#include <stdio.h>
11e1051a39Sopenharmony_ci#include "internal/cryptlib.h"
12e1051a39Sopenharmony_ci#include <openssl/evp.h>
13e1051a39Sopenharmony_ci#include <openssl/asn1.h>
14e1051a39Sopenharmony_ci#include <openssl/x509.h>
15e1051a39Sopenharmony_ci
16e1051a39Sopenharmony_ciX509_INFO *X509_INFO_new(void)
17e1051a39Sopenharmony_ci{
18e1051a39Sopenharmony_ci    X509_INFO *ret;
19e1051a39Sopenharmony_ci
20e1051a39Sopenharmony_ci    ret = OPENSSL_zalloc(sizeof(*ret));
21e1051a39Sopenharmony_ci    if (ret == NULL) {
22e1051a39Sopenharmony_ci        ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
23e1051a39Sopenharmony_ci        return NULL;
24e1051a39Sopenharmony_ci    }
25e1051a39Sopenharmony_ci
26e1051a39Sopenharmony_ci    return ret;
27e1051a39Sopenharmony_ci}
28e1051a39Sopenharmony_ci
29e1051a39Sopenharmony_civoid X509_INFO_free(X509_INFO *x)
30e1051a39Sopenharmony_ci{
31e1051a39Sopenharmony_ci    if (x == NULL)
32e1051a39Sopenharmony_ci        return;
33e1051a39Sopenharmony_ci
34e1051a39Sopenharmony_ci    X509_free(x->x509);
35e1051a39Sopenharmony_ci    X509_CRL_free(x->crl);
36e1051a39Sopenharmony_ci    X509_PKEY_free(x->x_pkey);
37e1051a39Sopenharmony_ci    OPENSSL_free(x->enc_data);
38e1051a39Sopenharmony_ci    OPENSSL_free(x);
39e1051a39Sopenharmony_ci}
40