Used LUKS1 compiled-in defaults also in Python wrapper.

This commit is contained in:
Milan Broz
2017-03-12 10:29:46 +01:00
parent 2701993dd6
commit 2657746451

View File

@@ -1,7 +1,7 @@
/*
* Python bindings to libcryptsetup
*
* Copyright (C) 2009-2014, Red Hat, Inc. All rights reserved.
* Copyright (C) 2009-2017, Red Hat, Inc. All rights reserved.
* Written by Martin Sivak
*
* This file is free software; you can redistribute it and/or
@@ -376,7 +376,7 @@ static PyObject *CryptSetup_luksFormat(CryptSetupObject* self, PyObject *args, P
{
static const char *kwlist[] = {"cipher", "cipherMode", "keysize", "hashMode", NULL};
char *cipher_mode = NULL, *cipher = NULL, *hashMode = NULL;
int keysize = 256;
int keysize = DEFAULT_LUKS1_KEYBITS;
PyObject *keysize_object = NULL;
struct crypt_params_luks1 params = {};
@@ -400,9 +400,9 @@ static PyObject *CryptSetup_luksFormat(CryptSetupObject* self, PyObject *args, P
} else
keysize = PyInt_AsLong(keysize_object);
// FIXME use #defined defaults
return PyObjectResult(crypt_format(self->device, CRYPT_LUKS1,
cipher ?: "aes", cipher_mode ?: "cbc-essiv:sha256",
cipher ?: DEFAULT_LUKS1_CIPHER,
cipher_mode ?: DEFAULT_LUKS1_MODE,
NULL, NULL, keysize / 8, &params));
}