summaryrefslogtreecommitdiff
path: root/lib/libcryptsetup.h
diff options
context:
space:
mode:
authorMilan Broz <gmazyland@gmail.com>2012-12-07 15:29:44 +0100
committerMilan Broz <gmazyland@gmail.com>2012-12-07 15:33:47 +0100
commit05af3a3383aea6bdd5050b6c5207ac3a55a3f05b (patch)
treeac80666185734bf4b1e0f78439d655e5222f26d2 /lib/libcryptsetup.h
parent16c82312f33535eef956764749d598e00fa5b855 (diff)
downloadcryptsetup-05af3a3383aea6bdd5050b6c5207ac3a55a3f05b.tar.gz
cryptsetup-05af3a3383aea6bdd5050b6c5207ac3a55a3f05b.tar.bz2
cryptsetup-05af3a3383aea6bdd5050b6c5207ac3a55a3f05b.zip
Move change key into library (add crypt_keyslot_change_by_passphrase).
This change is useful mainly in FIPS mode, where we cannot extract volume key directly from libcryptsetup.
Diffstat (limited to 'lib/libcryptsetup.h')
-rw-r--r--lib/libcryptsetup.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h
index 04c53fb..54bcbff 100644
--- a/lib/libcryptsetup.h
+++ b/lib/libcryptsetup.h
@@ -599,6 +599,33 @@ int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
size_t new_passphrase_size);
/**
+ * Change defined key slot using provided passphrase
+ *
+ * @pre @e cd contains initialized and formatted LUKS device context
+ *
+ * @param cd crypt device handle
+ * @param keyslot_old old keyslot or @e CRYPT_ANY_SLOT
+ * @param keyslot_new new keyslot (can be the same as old)
+ * @param passphrase passphrase used to unlock volume key, @e NULL for query
+ * @param passphrase_size size of passphrase (binary data)
+ * @param new_passphrase passphrase for new keyslot, @e NULL for query
+ * @param new_passphrase_size size of @e new_passphrase (binary data)
+ *
+ * @return allocated key slot number or negative errno otherwise.
+ *
+ * @note This function is just internal implementation of luksChange
+ * command to avoid reading of volume key outside libcryptsetup boundary
+ * in FIPS mode.
+ */
+int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
+ int keyslot_old,
+ int keyslot_new,
+ const char *passphrase,
+ size_t passphrase_size,
+ const char *new_passphrase,
+ size_t new_passphrase_size);
+
+/**
* Add key slot using provided key file path
*
* @pre @e cd contains initialized and formatted LUKS device context