]> git.ipfire.org Git - thirdparty/strongswan.git/blobdiff - src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
Add a return value to hasher_t.allocate_hash()
[thirdparty/strongswan.git] / src / libstrongswan / plugins / openssl / openssl_ec_public_key.c
index 7461695ad8ddd4ed27e8b3fc32a12fbbf4599380..9cb68a3ab2896962ac7389e78320b3f1131608aa 100644 (file)
@@ -221,13 +221,13 @@ bool openssl_ec_fingerprint(EC_KEY *ec, cred_encoding_type_t type, chunk_t *fp)
                        return FALSE;
        }
        hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
-       if (!hasher)
+       if (!hasher || !hasher->allocate_hash(hasher, key, fp))
        {
                DBG1(DBG_LIB, "SHA1 hash algorithm not supported, fingerprinting failed");
+               DESTROY_IF(hasher);
                free(key.ptr);
                return FALSE;
        }
-       hasher->allocate_hash(hasher, key, fp);
        hasher->destroy(hasher);
        free(key.ptr);
        lib->encoding->cache(lib->encoding, type, ec, *fp);