diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-27 09:52:53 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-27 09:52:53 +0200 |
commit | 435e23e647c021b767a723f2fe406e78860685a0 (patch) | |
tree | e1476f04ba0e097f5645b289ac6b0224f85f6054 /src | |
parent | e0daac553632fc6bcc024d27fde5f2e8246d4237 (diff) | |
download | strongswan-435e23e647c021b767a723f2fe406e78860685a0.tar.bz2 strongswan-435e23e647c021b767a723f2fe406e78860685a0.tar.xz |
set parsed = TRUE before calling parse_certificate()
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/plugins/x509/x509_cert.c | 15 |
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; } |