Prevent to initialise backends twice.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@414 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2011-01-16 10:38:55 +00:00
parent 9da29e8759
commit f48c312fc7
6 changed files with 43 additions and 5 deletions

View File

@@ -23,6 +23,8 @@
#include <openssl/hmac.h>
#include "crypto_backend.h"
static int crypto_backend_initialised = 0;
struct crypt_hash {
EVP_MD_CTX md;
const EVP_MD *hash_id;
@@ -37,8 +39,13 @@ struct crypt_hmac {
int crypt_backend_init(void)
{
if (crypto_backend_initialised)
return 0;
OpenSSL_add_all_digests();
log_dbg("OpenSSL crypto backend initialized.");
crypto_backend_initialised = 1;
return 0;
}