diff options
author | Rich Salz <rsalz@openssl.org> | 2016-04-14 23:59:26 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-04-15 13:21:43 -0400 |
commit | f0e0fd51fd8307f6eae64862ad9aaea113f1177a (patch) | |
tree | b00de87cb2fd4dc437de5994d3c8028dd9262460 /crypto/x509/x509_lu.c | |
parent | 34da11b39d2421f546ec568f355875eec353844c (diff) | |
download | openssl-f0e0fd51fd8307f6eae64862ad9aaea113f1177a.tar.gz |
Make many X509_xxx types opaque.
Make X509_OBJECT, X509_STORE_CTX, X509_STORE, X509_LOOKUP,
and X509_LOOKUP_METHOD opaque.
Remove unused X509_CERT_FILE_CTX
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/x509/x509_lu.c')
-rw-r--r-- | crypto/x509/x509_lu.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c index f9802c5a80..b822966203 100644 --- a/crypto/x509/x509_lu.c +++ b/crypto/x509/x509_lu.c @@ -294,6 +294,23 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) } } +X509_OBJECT *X509_STORE_get_X509_by_subject(X509_STORE_CTX *vs, int type, + X509_NAME *name) +{ + X509_OBJECT *ret; + + ret = OPENSSL_malloc(sizeof (*ret)); + if (ret == NULL) { + X509err(X509_F_X509_STORE_GET_X509_BY_SUBJECT, ERR_R_MALLOC_FAILURE); + return NULL; + } + if (!X509_STORE_get_by_subject(vs, type, name, ret)) { + OPENSSL_free(ret); + return NULL; + } + return ret; +} + int X509_STORE_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, X509_NAME *name, X509_OBJECT *ret) { @@ -414,9 +431,22 @@ void X509_OBJECT_up_ref_count(X509_OBJECT *a) } } +X509 *X509_OBJECT_get0_X509(X509_OBJECT *a) +{ + return a->data.x509; +} + +void X509_OBJECT_free(X509_OBJECT *a) +{ + if (a == NULL) + return; + X509_OBJECT_free_contents(a); + OPENSSL_free(a); +} + void X509_OBJECT_free_contents(X509_OBJECT *a) { - if (!a) + if (a == NULL) return; switch (a->type) { default: @@ -613,6 +643,7 @@ int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) X509_NAME *xn; X509_OBJECT obj, *pobj; int i, ok, idx, ret; + *issuer = NULL; xn = X509_get_issuer_name(x); ok = X509_STORE_get_by_subject(ctx, X509_LU_X509, xn, &obj); |