2 * @file libcryptsetup.h
3 * @brief Public cryptsetup API
5 * For more verbose examples of LUKS related use cases,
6 * please read @ref index "examples".
9 #ifndef _LIBCRYPTSETUP_H
10 #define _LIBCRYPTSETUP_H
17 struct crypt_device; /* crypt device handle */
20 * Initialize crypt device handle and check if provided device exists.
22 * @param cd Returns pointer to crypt device handle
23 * @param device Path to the backing device.
24 * If @e device is not a block device but a path to some file,
25 * the function will try to create a loopdevice and attach
26 * the file to the loopdevice with AUTOCLEAR flag set.
27 * If @e device is @e NULL function it will initialize dm backend only.
29 * @return @e 0 on success or negative errno value otherwise.
31 * @note Note that logging is not initialized here, possible messages uses
32 * default log function.
34 int crypt_init(struct crypt_device **cd, const char *device);
37 * Initialize crypt device handle from provided active device name,
38 * and, optionally, from separate metadata (header) device
39 * and check if provided device exists.
41 * @return @e 0 on success or negative errno value otherwise.
43 * @param cd returns crypt device handle for active device
44 * @param name name of active crypt device
45 * @param header_device optional device containing on-disk header
46 * (@e NULL if it the same as underlying device on there is no on-disk header)
48 * @post In case @e device points to active LUKS device but header load fails,
49 * context device type is set to @e NULL and @e 0 is returned as if it were successful.
50 * Context with @e NULL device type can only be deactivated by crypt_deactivate
52 * @note @link crypt_init_by_name @endlink is equivalent to calling
53 * crypt_init_by_name_and_header(cd, name, NULL);
55 int crypt_init_by_name_and_header(struct crypt_device **cd,
57 const char *header_device);
60 * This is equivalent to call
61 * @ref crypt_init_by_name_and_header "crypt_init_by_name_and_header(cd, name, NULL)"
63 * @sa crypt_init_by_name_and_header
65 int crypt_init_by_name(struct crypt_device **cd, const char *name);
68 * @defgroup loglevel "Cryptsetup logging"
70 * Set of functions and defines used in cryptsetup for
76 * @addtogroup loglevel
80 /** normal log level */
81 #define CRYPT_LOG_NORMAL 0
82 /** error log level */
83 #define CRYPT_LOG_ERROR 1
84 /** verbose log level */
85 #define CRYPT_LOG_VERBOSE 2
86 /** debug log level - always on stdout */
87 #define CRYPT_LOG_DEBUG -1
92 * @param cd crypt device handle (can be @e NULL to set default log function)
93 * @param log user defined log function reference
94 * @param usrptr provided identification in callback
95 * @param level log level below (debug messages can uses other levels)
96 * @param msg log message
98 void crypt_set_log_callback(struct crypt_device *cd,
99 void (*log)(int level, const char *msg, void *usrptr),
103 * Defines log function or use the default one otherwise.
105 * @see crypt_set_log_callback
107 * @param cd crypt device handle
108 * @param level log level
109 * @param msg log message
111 void crypt_log(struct crypt_device *cd, int level, const char *msg);
115 * Set confirmation callback (yes/no)
117 * If code need confirmation (like resetting uuid or restoring LUKS header from file)
118 * this function is called. If not defined, everything is confirmed.
120 * Callback function @e confirm should return @e 0 if operation is declined,
121 * other values mean accepted.
123 * @param cd crypt device handle
124 * @param confirm user defined confirm callback reference
125 * @param usrptr provided identification in callback
126 * @param msg Message for user to confirm
128 * @note Current version of cryptsetup API requires confirmation only when UUID is being changed
130 void crypt_set_confirm_callback(struct crypt_device *cd,
131 int (*confirm)(const char *msg, void *usrptr),
135 * Set password query callback.
137 * If code need @e _interactive_ query for password, this callback is called.
138 * If not defined, compiled-in default is called (uses terminal input).
140 * Callback should return length of password in buffer
141 * or negative errno value in case of error.
143 * @param cd crypt device handle
144 * @param password user defined password callback reference
145 * @param usrptr provided identification in callback
146 * @param msg Message for user
147 * @param buf buffer for password
148 * @param length size of buffer
150 * @note Note that if this function is defined, verify option is ignored
151 * (caller which provided callback is responsible for password verification)
152 * @note Only zero terminated passwords can be entered this way, for complex
153 * use API functions directly.
154 * @note Maximal length of password is limited to @e length @e - @e 1 (minimal 511 chars)
156 * @see Callback function is used in these call provided, that certain conditions are met:
157 * @li crypt_keyslot_add_by_passphrase
158 * @li crypt_activate_by_passphrase
159 * @li crypt_resume_by_passphrase
160 * @li crypt_resume_by_keyfile
161 * @li crypt_keyslot_add_by_keyfile
162 * @li crypt_keyslot_add_by_volume_key
165 void crypt_set_password_callback(struct crypt_device *cd,
166 int (*password)(const char *msg, char *buf, size_t length, void *usrptr),
170 * Set timeout for interactive password entry using default
173 * @param cd crypt device handle
174 * @param timeout_sec timeout in seconds
176 void crypt_set_timeout(struct crypt_device *cd, uint64_t timeout_sec);
179 * Set number of retries in case password input has been incorrect
181 * @param cd crypt device handle
182 * @param tries the number
184 void crypt_set_password_retry(struct crypt_device *cd, int tries);
187 * Set how long should cryptsetup iterate in PBKDF2 function.
188 * Default value heads towards the iterations which takes around 1 second
190 * @param cd crypt device handle
191 * @param iteration_time_ms the time in ms
193 void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms);
195 void crypt_set_iterarion_time(struct crypt_device *cd, uint64_t iteration_time_ms);
198 * Set whether passphrase will be verified on input
199 * (user has to input same passphrase twice)
201 * @param cd crypt device handle
202 * @param password_verify @e 0 = false, @e !0 true
204 void crypt_set_password_verify(struct crypt_device *cd, int password_verify);
207 * Set data device (encrypted payload area device) if LUKS header is separated
209 * @param cd crypt device handle
210 * @param device path to device
212 * @pre context is of LUKS type
213 * @pre unlike @ref crypt_init, in this function param @e device
214 * has to be block device (at least 512B large)
216 int crypt_set_data_device(struct crypt_device *cd, const char *device);
219 * @defgroup rng "Cryptsetup RNG"
226 /** CRYPT_RNG_URANDOM - use /dev/urandom */
227 #define CRYPT_RNG_URANDOM 0
228 /** CRYPT_RNG_RANDOM - use /dev/random (waits if no entropy in system) */
229 #define CRYPT_RNG_RANDOM 1
232 * Set which RNG (random number generator) is used for generating long term key
234 * @param cd crypt device handle
235 * @param rng_type kernel random number generator to use
238 void crypt_set_rng_type(struct crypt_device *cd, int rng_type);
241 * Get which RNG (random number generator) is used for generating long term key
243 * @param cd crypt device handle
244 * @return RNG type on success or negative errno value otherwise.
247 int crypt_get_rng_type(struct crypt_device *cd);
252 * Helper to lock/unlock memory to avoid swap sensitive data to disk
254 * @param cd crypt device handle, can be @e NULL
255 * @param lock 0 to unlock otherwise lock memory
257 * @returns Value indicating whether the memory is locked (function can be called multiple times).
259 * @note Only root can do this.
260 * @note It locks/unlocks all process memory, not only crypt context.
262 int crypt_memory_lock(struct crypt_device *cd, int lock);
265 * @defgroup crypt_type "Cryptsetup on-disk format types"
267 * Set of functions, \#defines and structs related
268 * to on-disk format types
272 * @addtogroup crypt_type
276 /** regular crypt device, no on-disk header */
277 #define CRYPT_PLAIN "PLAIN"
278 /** LUKS version 1 header on-disk */
279 #define CRYPT_LUKS1 "LUKS1"
280 /** loop-AES compatibility mode */
281 #define CRYPT_LOOPAES "LOOPAES"
286 * @param cd crypt device handle
287 * @return string according to device type or @e NULL if not known.
289 const char *crypt_get_type(struct crypt_device *cd);
293 * Structure used as parameter for PLAIN device type
297 struct crypt_params_plain {
298 const char *hash; /**< password hash function */
299 uint64_t offset; /**< offset in sectors */
300 uint64_t skip; /**< IV offset / initialization sector */
301 uint64_t size; /**< size of mapped device or @e 0 for autodetection */
305 * Structure used as parameter for LUKS device type
307 * @see crypt_format, crypt_load
309 * @note during crypt_format @e data_device attribute determines
310 * if the LUKS header is separated from encrypted payload device
313 struct crypt_params_luks1 {
314 const char *hash; /**< hash used in LUKS header */
315 size_t data_alignment; /**< data alignment in sectors, data offset is multiple of this */
316 const char *data_device; /**< detached encrypted data device or @e NULL */
321 * Structure used as parameter for loop-AES device type
326 struct crypt_params_loopaes {
327 const char *hash; /**< key hash function */
328 uint64_t offset; /**< offset in sectors */
329 uint64_t skip; /**< IV offset / initialization sector */
335 * Create (format) new crypt device (and possible header on-disk) but not activates it.
337 * @pre @e cd contains initialized and not formatted device context (device type must @b not be set)
339 * @param cd crypt device handle
340 * @param type type of device (optional params struct must be of this type)
341 * @param cipher (e.g. "aes")
342 * @param cipher_mode including IV specification (e.g. "xts-plain")
343 * @param uuid requested UUID or @e NULL if it should be generated
344 * @param volume_key pre-generated volume key or @e NULL if it should be generated (only for LUKS)
345 * @param volume_key_size size of volume key in bytes.
346 * @param params crypt type specific parameters (see @link crypt_type @endlink)
348 * @returns @e 0 on success or negative errno value otherwise.
350 * @note Note that crypt_format does not enable any keyslot (in case of work with LUKS device), but it stores volume key internally
351 * and subsequent crypt_keyslot_add_* calls can be used.
353 int crypt_format(struct crypt_device *cd,
356 const char *cipher_mode,
358 const char *volume_key,
359 size_t volume_key_size,
363 * Set new UUID for already existing device
365 * @param cd crypt device handle
366 * @param uuid requested UUID or @e NULL if it should be generated
368 * @returns 0 on success or negative errno value otherwise.
370 * @note Currently, only LUKS device type are supported
372 int crypt_set_uuid(struct crypt_device *cd,
376 * Load crypt device parameters from on-disk header
378 * @param cd crypt device handle
379 * @param requested_type - use @e NULL for all known
380 * @param params crypt type specific parameters (see @link crypt_type @endlink)
382 * @returns 0 on success or negative errno value otherwise.
384 * @post In case LUKS header is read successfully but payload device is too small
385 * error is returned and device type in context is set to @e NULL
387 * @note Note that in current version load works only for LUKS device type
390 int crypt_load(struct crypt_device *cd,
391 const char *requested_type,
395 * Try to repair crypt device on-disk header if invalid
397 * @param cd crypt device handle
398 * @param requested_type - use @e NULL for all known
399 * @param params crypt type specific parameters (see @link crypt_type @endlink)
401 * @returns 0 on success or negative errno value otherwise.
404 int crypt_repair(struct crypt_device *cd,
405 const char *requested_type,
406 void *params __attribute__((unused)));
409 * Resize crypt device
411 * @param cd - crypt device handle
412 * @param name - name of device to resize
413 * @param new_size - new device size in sectors or @e 0 to use all of the underlying device size
415 * @return @e 0 on success or negative errno value otherwise.
417 int crypt_resize(struct crypt_device *cd,
422 * Suspends crypt device.
424 * @param cd crypt device handle, can be @e NULL
425 * @param name name of device to suspend
427 * @return 0 on success or negative errno value otherwise.
429 * @note Only LUKS device type is supported
432 int crypt_suspend(struct crypt_device *cd,
436 * Resumes crypt device using passphrase.
439 * @param cd crypt device handle
440 * @param name name of device to resume
441 * @param keyslot requested keyslot or CRYPT_ANY_SLOT
442 * @param passphrase passphrase used to unlock volume key, @e NULL for query
443 * @param passphrase_size size of @e passphrase (binary data)
445 * @return unlocked key slot number or negative errno otherwise.
447 * @note Only LUKS device type is supported
449 int crypt_resume_by_passphrase(struct crypt_device *cd,
452 const char *passphrase,
453 size_t passphrase_size);
456 * Resumes crypt device using key file.
458 * @param cd crypt device handle
459 * @param name name of device to resume
460 * @param keyslot requested keyslot or CRYPT_ANY_SLOT
461 * @param keyfile key file used to unlock volume key, @e NULL for passphrase query
462 * @param keyfile_size number of bytes to read from keyfile, 0 is unlimited
463 * @param keyfile_offset number of bytes to skip at start of keyfile
465 * @return unlocked key slot number or negative errno otherwise.
467 int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
472 size_t keyfile_offset);
474 * Backward compatible crypt_resume_by_keyfile_offset() (without offset).
476 int crypt_resume_by_keyfile(struct crypt_device *cd,
480 size_t keyfile_size);
483 * Releases crypt device context and used memory.
485 * @param cd crypt device handle
487 void crypt_free(struct crypt_device *cd);
490 * @defgroup keyslot "Cryptsetup LUKS keyslots"
491 * @addtogroup keyslot
496 /** iterate through all keyslots and find first one that fits */
497 #define CRYPT_ANY_SLOT -1
500 * Add key slot using provided passphrase
502 * @pre @e cd contains initialized and formatted LUKS device context
504 * @param cd crypt device handle
505 * @param keyslot requested keyslot or @e CRYPT_ANY_SLOT
506 * @param passphrase passphrase used to unlock volume key, @e NULL for query
507 * @param passphrase_size size of passphrase (binary data)
508 * @param new_passphrase passphrase for new keyslot, @e NULL for query
509 * @param new_passphrase_size size of @e new_passphrase (binary data)
511 * @return allocated key slot number or negative errno otherwise.
513 int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
515 const char *passphrase,
516 size_t passphrase_size,
517 const char *new_passphrase,
518 size_t new_passphrase_size);
521 * Get number of keyslots supported for device type.
523 * @param type crypt device type
525 * @return slot count or negative errno otherwise if device
526 * doesn't not support keyslots.
528 int crypt_keyslot_max(const char *type);
531 * Add key slot using provided key file path
533 * @pre @e cd contains initialized and formatted LUKS device context
535 * @param cd crypt device handle
536 * @param keyslot requested keyslot or @e CRYPT_ANY_SLOT
537 * @param keyfile key file used to unlock volume key, @e NULL for passphrase query
538 * @param keyfile_size number of bytes to read from keyfile, @e 0 is unlimited
539 * @param keyfile_offset number of bytes to skip at start of keyfile
540 * @param new_keyfile keyfile for new keyslot, @e NULL for passphrase query
541 * @param new_keyfile_size number of bytes to read from @e new_keyfile, @e 0 is unlimited
542 * @param new_keyfile_offset number of bytes to skip at start of new_keyfile
544 * @return allocated key slot number or negative errno otherwise.
546 * @note Note that @e keyfile can be "-" for STDIN
549 int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
553 size_t keyfile_offset,
554 const char *new_keyfile,
555 size_t new_keyfile_size,
556 size_t new_keyfile_offset);
558 * Backward compatible crypt_keyslot_add_by_keyfile_offset() (without offset).
560 int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
564 const char *new_keyfile,
565 size_t new_keyfile_size);
568 * Add key slot using provided volume key
570 * @pre @e cd contains initialized and formatted LUKS device context
572 * @param cd crypt device handle
573 * @param keyslot requested keyslot or CRYPT_ANY_SLOT
574 * @param volume_key provided volume key or @e NULL if used after crypt_format
575 * @param volume_key_size size of volume_key
576 * @param passphrase passphrase for new keyslot, @e NULL for query
577 * @param passphrase_size size of passphrase
579 * @return allocated key slot number or negative errno otherwise.
582 int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
584 const char *volume_key,
585 size_t volume_key_size,
586 const char *passphrase,
587 size_t passphrase_size);
590 * Destroy (and disable) key slot
592 * @pre @e cd contains initialized and formatted LUKS device context
594 * @param cd crypt device handle
595 * @param keyslot requested key slot to destroy
597 * @return @e 0 on success or negative errno value otherwise.
599 * @note Note that there is no passphrase verification used.
601 int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
606 * @defgroup aflags "Device runtime attributes"
614 /** device is read only */
615 #define CRYPT_ACTIVATE_READONLY (1 << 0)
616 /** only reported for device without uuid */
617 #define CRYPT_ACTIVATE_NO_UUID (1 << 1)
618 /** activate more non-overlapping mapping to the same device */
619 #define CRYPT_ACTIVATE_SHARED (1 << 2)
620 /** enable discards aka TRIM */
621 #define CRYPT_ACTIVATE_ALLOW_DISCARDS (1 << 3)
624 * Active device runtime attributes
626 struct crypt_active_device {
627 uint64_t offset; /**< offset in sectors */
628 uint64_t iv_offset; /**< IV initialization sector */
629 uint64_t size; /**< active device size */
630 uint32_t flags; /**< activation flags */
634 * Receives runtime attributes of active crypt device
636 * @param cd crypt device handle (can be @e NULL)
637 * @param name name of active device
638 * @param cad preallocated active device attributes to fill
640 * @return @e 0 on success or negative errno value otherwise
643 int crypt_get_active_device(struct crypt_device *cd,
645 struct crypt_active_device *cad);
650 * Activate device or check passphrase
652 * @param cd crypt device handle
653 * @param name name of device to create, if @e NULL only check passphrase
654 * @param keyslot requested keyslot to check or @e CRYPT_ANY_SLOT
655 * @param passphrase passphrase used to unlock volume key, @e NULL for query
656 * @param passphrase_size size of @e passphrase
657 * @param flags activation flags
659 * @return unlocked key slot number or negative errno otherwise.
661 int crypt_activate_by_passphrase(struct crypt_device *cd,
664 const char *passphrase,
665 size_t passphrase_size,
669 * Activate device or check using key file
671 * @param cd crypt device handle
672 * @param name name of device to create, if @e NULL only check keyfile
673 * @param keyslot requested keyslot to check or CRYPT_ANY_SLOT
674 * @param keyfile key file used to unlock volume key
675 * @param keyfile_size number of bytes to read from keyfile, 0 is unlimited
676 * @param keyfile_offset number of bytes to skip at start of keyfile
677 * @param flags activation flags
679 * @return unlocked key slot number or negative errno otherwise.
681 int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
686 size_t keyfile_offset,
689 * Backward compatible crypt_activate_by_keyfile_offset() (without offset).
691 int crypt_activate_by_keyfile(struct crypt_device *cd,
699 * Activate device using provided volume key
702 * @param cd crypt device handle
703 * @param name name of device to create, if @e NULL only check volume key
704 * @param volume_key provided volume key (or @e NULL to use internal)
705 * @param volume_key_size size of volume_key
706 * @param flags activation flags
708 * @return @e 0 on success or negative errno value otherwise.
710 * @note If @e NULL is used for volume_key, device has to be initialized
711 * by previous operation (like @ref crypt_format
712 * or @ref crypt_init_by_name)
714 int crypt_activate_by_volume_key(struct crypt_device *cd,
716 const char *volume_key,
717 size_t volume_key_size,
721 * Deactivate crypt device. This function tries to remove active device-mapper
722 * mapping from kernel. Also, sensitive data like the volume key are removed from
725 * @param cd crypt device handle, can be @e NULL
726 * @param name name of device to deactivate
728 * @return @e 0 on success or negative errno value otherwise.
731 int crypt_deactivate(struct crypt_device *cd, const char *name);
734 * Get volume key from of crypt device
736 * @param cd crypt device handle
737 * @param keyslot use this keyslot or @e CRYPT_ANY_SLOT
738 * @param volume_key buffer for volume key
739 * @param volume_key_size on input, size of buffer @e volume_key,
740 * on output size of @e volume_key
741 * @param passphrase passphrase used to unlock volume key
742 * @param passphrase_size size of @e passphrase
744 * @return unlocked key slot number or negative errno otherwise.
746 int crypt_volume_key_get(struct crypt_device *cd,
749 size_t *volume_key_size,
750 const char *passphrase,
751 size_t passphrase_size);
754 * Verify that provided volume key is valid for crypt device
756 * @param cd crypt device handle
757 * @param volume_key provided volume key
758 * @param volume_key_size size of @e volume_key
760 * @return @e 0 on success or negative errno value otherwise.
762 int crypt_volume_key_verify(struct crypt_device *cd,
763 const char *volume_key,
764 size_t volume_key_size);
768 * @defgroup devstat "dmcrypt device status"
769 * @addtogroup devstat
777 CRYPT_INVALID, /**< device mapping is invalid in this context */
778 CRYPT_INACTIVE, /**< no such mapped device */
779 CRYPT_ACTIVE, /**< device is active */
780 CRYPT_BUSY /**< device is active and has open count > 0 */
784 * Get status info about device name
786 * @param cd crypt device handle, can be @e NULL
787 * @param name crypt device name
789 * @return value defined by crypt_status_info.
792 crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
795 * Dump text-formatted information about crypt device to log output
797 * @param cd crypt device handle
799 * @return @e 0 on success or negative errno value otherwise.
801 int crypt_dump(struct crypt_device *cd);
804 * Get cipher used in device
806 * @param cd crypt device handle
808 * @return used cipher, e.g. "aes" or @e NULL otherwise
811 const char *crypt_get_cipher(struct crypt_device *cd);
814 * Get cipher mode used in device
816 * @param cd crypt device handle
818 * @return used cipher mode e.g. "xts-plain" or @e otherwise
821 const char *crypt_get_cipher_mode(struct crypt_device *cd);
826 * @param cd crypt device handle
828 * @return device UUID or @e NULL if not set
831 const char *crypt_get_uuid(struct crypt_device *cd);
834 * Get path to underlaying device
836 * @param cd crypt device handle
838 * @return path to underlaying device name
841 const char *crypt_get_device_name(struct crypt_device *cd);
844 * Get device offset in sectors where real data starts on underlying device)
846 * @param cd crypt device handle
848 * @return device offset in sectors
851 uint64_t crypt_get_data_offset(struct crypt_device *cd);
854 * Get IV offset in sectors (skip)
856 * @param cd crypt device handle
861 uint64_t crypt_get_iv_offset(struct crypt_device *cd);
864 * Get size (in bytes) of volume key for crypt device
866 * @param cd crypt device handle
868 * @return volume key size
871 int crypt_get_volume_key_size(struct crypt_device *cd);
874 * @addtogroup keyslot
883 CRYPT_SLOT_INVALID, /**< invalid keyslot */
884 CRYPT_SLOT_INACTIVE, /**< keyslot is inactive (free) */
885 CRYPT_SLOT_ACTIVE, /**< keyslot is active (used) */
886 CRYPT_SLOT_ACTIVE_LAST /**< keylost is active (used)
887 * and last used at the same time */
888 } crypt_keyslot_info;
891 * Get information about particular key slot
894 * @param cd crypt device handle
895 * @param keyslot requested keyslot to check or CRYPT_ANY_SLOT
897 * @return value defined by crypt_keyslot_info
900 crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot);
904 * Backup header and keyslots to file
906 * @param cd crypt device handle
907 * @param requested_type type of header to backup
908 * @param backup_file file to backup header to
910 * @return @e 0 on success or negative errno value otherwise.
913 int crypt_header_backup(struct crypt_device *cd,
914 const char *requested_type,
915 const char *backup_file);
918 * Restore header and keyslots from backup file
921 * @param cd crypt device handle
922 * @param requested_type type of header to restore
923 * @param backup_file file to restore header from
925 * @return @e 0 on success or negative errno value otherwise.
928 int crypt_header_restore(struct crypt_device *cd,
929 const char *requested_type,
930 const char *backup_file);
933 * Receives last reported error
935 * @param cd crypt device handle
936 * @param buf buffef for message
937 * @param size size of buffer
939 * @note Note that this is old API function using global context.
940 * All error messages are reported also through log callback.
942 void crypt_last_error(struct crypt_device *cd, char *buf, size_t size);
945 * Receives last reported error, DEPRECATED
947 * @param buf buffef for message
948 * @param size size of buffer
950 * @note Note that this is old API function using global context.
951 * All error messages are reported also through log callback.
953 void crypt_get_error(char *buf, size_t size);
956 * Get directory where mapped crypt devices are created
958 * @return the directory path
960 const char *crypt_get_dir(void);
963 * @defgroup dbg "Library debug level"
965 * Set library debug level
972 #define CRYPT_DEBUG_ALL -1
974 #define CRYPT_DEBUG_NONE 0
977 * Set the debug level for library
979 * @param level debug level
982 void crypt_set_debug_level(int level);
989 #endif /* _LIBCRYPTSETUP_H */