aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libstrongswan/plugins/x509/x509_cert.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libstrongswan/plugins/x509/x509_cert.c b/src/libstrongswan/plugins/x509/x509_cert.c
index 746254486..75f7f19a8 100644
--- a/src/libstrongswan/plugins/x509/x509_cert.c
+++ b/src/libstrongswan/plugins/x509/x509_cert.c
@@ -1176,6 +1176,7 @@ static private_x509_cert_t *create_from_chunk(chunk_t chunk)
private_x509_cert_t *this = create_empty();
this->encoding = chunk;
+ this->parsed = TRUE;
if (!parse_certificate(this))
{
destroy(this);
@@ -1189,17 +1190,15 @@ static private_x509_cert_t *create_from_chunk(chunk_t chunk)
}
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
- if (hasher != NULL)
- {
- hasher->allocate_hash(hasher, this->encoding, &this->encoding_hash);
- hasher->destroy(hasher);
- }
- else
+ if (hasher == NULL)
{
- DBG1(" unable to create hash of certificate, SHA1 not supported");
+ DBG1(" unable to create hash of certificate, SHA1 not supported");
+ destroy(this);
+ return NULL;
}
+ hasher->allocate_hash(hasher, this->encoding, &this->encoding_hash);
+ hasher->destroy(hasher);
- this->parsed = TRUE;
return this;
}