diff options
author | Tobias Brunner <tobias@strongswan.org> | 2008-04-30 09:23:13 +0000 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2008-04-30 09:23:13 +0000 |
commit | 87aa386df1f45d7336a00e6f4610b991de926c06 (patch) | |
tree | 7ffe43ee0d59dab272f161e47c3c2d7fbdb2afd6 /src | |
parent | bc75840fb16d6dd12165b28b4f7e7cfaf6bc6997 (diff) | |
download | strongswan-87aa386df1f45d7336a00e6f4610b991de926c06.tar.bz2 strongswan-87aa386df1f45d7336a00e6f4610b991de926c06.tar.xz |
simplified the OpenSSL hasher a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_hasher.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_hasher.c b/src/libstrongswan/plugins/openssl/openssl_hasher.c index 8c8223a1b..b70b9da9b 100644 --- a/src/libstrongswan/plugins/openssl/openssl_hasher.c +++ b/src/libstrongswan/plugins/openssl/openssl_hasher.c @@ -103,11 +103,6 @@ static size_t get_hash_size(private_openssl_hasher_t *this) */ static void reset(private_openssl_hasher_t *this) { - if (this->ctx) - { - EVP_MD_CTX_destroy(this->ctx); - } - this->ctx = EVP_MD_CTX_create(); EVP_DigestInit_ex(this->ctx, this->hasher, NULL); } @@ -147,10 +142,7 @@ static void allocate_hash(private_openssl_hasher_t *this, chunk_t chunk, */ static void destroy (private_openssl_hasher_t *this) { - if (this->ctx) - { - EVP_MD_CTX_destroy(this->ctx); - } + EVP_MD_CTX_destroy(this->ctx); free(this); } @@ -184,9 +176,9 @@ openssl_hasher_t *openssl_hasher_create(hash_algorithm_t algo) this->public.hasher_interface.reset = (void (*) (hasher_t*))reset; this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy; - this->ctx = NULL; + this->ctx = EVP_MD_CTX_create(); - /* initialize */ + /* initialization */ reset(this); return &this->public; |