summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3
diff options
context:
space:
mode:
authorViktor Dukhovni <openssl-users@dukhovni.org>2016-01-27 21:54:09 -0500
committerViktor Dukhovni <openssl-users@dukhovni.org>2016-01-27 22:16:12 -0500
commit109f8b5dec6aa3f46c1df79c8d5f8e8aba10474b (patch)
treea3b829adb790d377a5fa820d7d1acc9510485168 /crypto/x509v3
parentb4f35e5e07afa2df7125b814b45242648b33e39e (diff)
Comment side-effect only calls of X509_check_purpose
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/pcy_tree.c1
-rw-r--r--crypto/x509v3/v3_purp.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/crypto/x509v3/pcy_tree.c b/crypto/x509v3/pcy_tree.c
index 6cf6f4e089..850d488460 100644
--- a/crypto/x509v3/pcy_tree.c
+++ b/crypto/x509v3/pcy_tree.c
@@ -186,7 +186,6 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
uint32_t ex_flags;
x = sk_X509_value(certs, i);
ex_flags = X509_get_extension_flags(x);
- X509_check_purpose(x, -1, -1);
cache = policy_cache_set(x);
/* If cache NULL something bad happened: return immediately */
if (cache == NULL)
diff --git a/crypto/x509v3/v3_purp.c b/crypto/x509v3/v3_purp.c
index 2d5a29fbc8..e5231b3231 100644
--- a/crypto/x509v3/v3_purp.c
+++ b/crypto/x509v3/v3_purp.c
@@ -132,6 +132,7 @@ int X509_check_purpose(X509 *x, int id, int ca)
x509v3_cache_extensions(x);
CRYPTO_w_unlock(CRYPTO_LOCK_X509);
}
+ /* Return if side-effect only call */
if (id == -1)
return 1;
idx = X509_PURPOSE_get_by_id(id);
@@ -850,12 +851,14 @@ int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
uint32_t X509_get_extension_flags(X509 *x)
{
+ /* Call for side-effect of computing hash and caching extensions */
X509_check_purpose(x, -1, -1);
return x->ex_flags;
}
uint32_t X509_get_key_usage(X509 *x)
{
+ /* Call for side-effect of computing hash and caching extensions */
X509_check_purpose(x, -1, -1);
if (x->ex_flags & EXFLAG_KUSAGE)
return x->ex_kusage;
@@ -864,6 +867,7 @@ uint32_t X509_get_key_usage(X509 *x)
uint32_t X509_get_extended_key_usage(X509 *x)
{
+ /* Call for side-effect of computing hash and caching extensions */
X509_check_purpose(x, -1, -1);
if (x->ex_flags & EXFLAG_XKUSAGE)
return x->ex_xkusage;
@@ -872,6 +876,7 @@ uint32_t X509_get_extended_key_usage(X509 *x)
const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x)
{
+ /* Call for side-effect of computing hash and caching extensions */
X509_check_purpose(x, -1, -1);
return x->skid;
}