Initialize crypto library before LUKS header load.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@111 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2009-09-15 15:10:23 +00:00
parent 1e7d8afc99
commit 935e83ebfa
5 changed files with 25 additions and 13 deletions

View File

@@ -9,6 +9,20 @@
#define MAX_DIGESTS 64
#define GCRYPT_REQ_VERSION "1.1.42"
int init_crypto(void)
{
if (!gcry_control (GCRYCTL_INITIALIZATION_FINISHED_P)) {
//if (!gcry_check_version (GCRYPT_VERSION))
// return -ENOSYS;
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
}
return 0;
}
static int gcrypt_hash(void *data, int size, char *key,
int sizep, const char *passphrase)
{