cryptsetup
2.4.3
About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.
![]() ![]() |
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <gcrypt.h>
#include "crypto_backend_internal.h"
Go to the source code of this file.
Data Structures | |
struct | crypt_hash |
struct | crypt_hmac |
struct | crypt_cipher |
struct | hash_alg |
Functions | |
static void | crypt_hash_test_whirlpool_bug (void) |
int | crypt_backend_init (bool fips) |
void | crypt_backend_destroy (void) |
const char * | crypt_backend_version (void) |
uint32_t | crypt_backend_flags (void) |
static const char * | crypt_hash_compat_name (const char *name, unsigned int *flags) |
int | crypt_hash_size (const char *name) |
int | crypt_hash_init (struct crypt_hash **ctx, const char *name) |
static void | crypt_hash_restart (struct crypt_hash *ctx) |
int | crypt_hash_write (struct crypt_hash *ctx, const char *buffer, size_t length) |
int | crypt_hash_final (struct crypt_hash *ctx, char *buffer, size_t length) |
void | crypt_hash_destroy (struct crypt_hash *ctx) |
int | crypt_hmac_size (const char *name) |
int | crypt_hmac_init (struct crypt_hmac **ctx, const char *name, const void *key, size_t key_length) |
static void | crypt_hmac_restart (struct crypt_hmac *ctx) |
int | crypt_hmac_write (struct crypt_hmac *ctx, const char *buffer, size_t length) |
int | crypt_hmac_final (struct crypt_hmac *ctx, char *buffer, size_t length) |
void | crypt_hmac_destroy (struct crypt_hmac *ctx) |
int | crypt_backend_rng (char *buffer, size_t length, int quality, int fips) |
static int | pbkdf2 (const char *hash, const char *password, size_t password_length, const char *salt, size_t salt_length, char *key, size_t key_length, uint32_t iterations) |
int | crypt_pbkdf (const char *kdf, const char *hash, const char *password, size_t password_length, const char *salt, size_t salt_length, char *key, size_t key_length, uint32_t iterations, uint32_t memory, uint32_t parallel) |
static int | _cipher_init (gcry_cipher_hd_t *hd, const char *name, const char *mode, const void *buffer, size_t length) |
int | crypt_cipher_init (struct crypt_cipher **ctx, const char *name, const char *mode, const void *key, size_t key_length) |
void | crypt_cipher_destroy (struct crypt_cipher *ctx) |
int | crypt_cipher_encrypt (struct crypt_cipher *ctx, const char *in, char *out, size_t length, const char *iv, size_t iv_length) |
int | crypt_cipher_decrypt (struct crypt_cipher *ctx, const char *in, char *out, size_t length, const char *iv, size_t iv_length) |
bool | crypt_cipher_kernel_only (struct crypt_cipher *ctx) |
int | crypt_bitlk_decrypt_key (const void *key, size_t key_length, const char *in, char *out, size_t length, const char *iv, size_t iv_length, const char *tag, size_t tag_length) |
Variables | |
static int | crypto_backend_initialised = 0 |
static int | crypto_backend_secmem = 1 |
static int | crypto_backend_whirlpool_bug = -1 |
static char | version [64] |
|
static |
Definition at line 410 of file crypto_gcrypt.c.
References crypt_hmac::hd, and name.
Referenced by crypt_cipher_init().
void crypt_backend_destroy | ( | void | ) |
Definition at line 140 of file crypto_gcrypt.c.
uint32_t crypt_backend_flags | ( | void | ) |
Definition at line 153 of file crypto_gcrypt.c.
int crypt_backend_init | ( | bool | fips | ) |
Definition at line 97 of file crypto_gcrypt.c.
int crypt_backend_rng | ( | char * | buffer, |
size_t | length, | ||
int | quality, | ||
int | fips | ||
) |
Definition at line 350 of file crypto_gcrypt.c.
const char * crypt_backend_version | ( | void | ) |
Definition at line 148 of file crypto_gcrypt.c.
int crypt_bitlk_decrypt_key | ( | const void * | key, |
size_t | key_length, | ||
const char * | in, | ||
char * | out, | ||
size_t | length, | ||
const char * | iv, | ||
size_t | iv_length, | ||
const char * | tag, | ||
size_t | tag_length | ||
) |
Definition at line 514 of file crypto_gcrypt.c.
int crypt_cipher_decrypt | ( | struct crypt_cipher * | ctx, |
const char * | in, | ||
char * | out, | ||
size_t | length, | ||
const char * | iv, | ||
size_t | iv_length | ||
) |
Definition at line 493 of file crypto_gcrypt.c.
void crypt_cipher_destroy | ( | struct crypt_cipher * | ctx | ) |
Definition at line 468 of file crypto_gcrypt.c.
int crypt_cipher_encrypt | ( | struct crypt_cipher * | ctx, |
const char * | in, | ||
char * | out, | ||
size_t | length, | ||
const char * | iv, | ||
size_t | iv_length | ||
) |
Definition at line 477 of file crypto_gcrypt.c.
int crypt_cipher_init | ( | struct crypt_cipher ** | ctx, |
const char * | name, | ||
const char * | mode, | ||
const void * | key, | ||
size_t | key_length | ||
) |
Definition at line 441 of file crypto_gcrypt.c.
bool crypt_cipher_kernel_only | ( | struct crypt_cipher * | ctx | ) |
Definition at line 509 of file crypto_gcrypt.c.
|
static |
Definition at line 158 of file crypto_gcrypt.c.
References hash_alg::gcrypt_name, hash_algs, name, and NULL.
Referenced by crypt_hash_init(), crypt_hash_size(), crypt_hmac_init(), and pbkdf2().
void crypt_hash_destroy | ( | struct crypt_hash * | ctx | ) |
Definition at line 267 of file crypto_gcrypt.c.
Referenced by crypt_hash_test_whirlpool_bug().
int crypt_hash_final | ( | struct crypt_hash * | ctx, |
char * | buffer, | ||
size_t | length | ||
) |
Definition at line 250 of file crypto_gcrypt.c.
Referenced by crypt_hash_test_whirlpool_bug().
int crypt_hash_init | ( | struct crypt_hash ** | ctx, |
const char * | name | ||
) |
Definition at line 212 of file crypto_gcrypt.c.
Referenced by crypt_hash_test_whirlpool_bug().
|
static |
Definition at line 239 of file crypto_gcrypt.c.
References crypt_hash::hd.
Referenced by crypt_hash_final().
int crypt_hash_size | ( | const char * | name | ) |
Definition at line 199 of file crypto_gcrypt.c.
Referenced by crypt_hmac_size().
|
static |
Definition at line 63 of file crypto_gcrypt.c.
References crypt_hash_destroy(), crypt_hash_final(), crypt_hash_init(), crypt_hash_write(), and crypto_backend_whirlpool_bug.
Referenced by crypt_backend_init().
int crypt_hash_write | ( | struct crypt_hash * | ctx, |
const char * | buffer, | ||
size_t | length | ||
) |
Definition at line 244 of file crypto_gcrypt.c.
Referenced by crypt_hash_test_whirlpool_bug().
void crypt_hmac_destroy | ( | struct crypt_hmac * | ctx | ) |
Definition at line 342 of file crypto_gcrypt.c.
int crypt_hmac_final | ( | struct crypt_hmac * | ctx, |
char * | buffer, | ||
size_t | length | ||
) |
Definition at line 325 of file crypto_gcrypt.c.
int crypt_hmac_init | ( | struct crypt_hmac ** | ctx, |
const char * | name, | ||
const void * | key, | ||
size_t | key_length | ||
) |
Definition at line 280 of file crypto_gcrypt.c.
|
static |
Definition at line 314 of file crypto_gcrypt.c.
References crypt_hmac::hd.
Referenced by crypt_hmac_final().
int crypt_hmac_size | ( | const char * | name | ) |
Definition at line 275 of file crypto_gcrypt.c.
int crypt_hmac_write | ( | struct crypt_hmac * | ctx, |
const char * | buffer, | ||
size_t | length | ||
) |
Definition at line 319 of file crypto_gcrypt.c.
int crypt_pbkdf | ( | const char * | kdf, |
const char * | hash, | ||
const char * | password, | ||
size_t | password_length, | ||
const char * | salt, | ||
size_t | salt_length, | ||
char * | key, | ||
size_t | key_length, | ||
uint32_t | iterations, | ||
uint32_t | memory, | ||
uint32_t | parallel | ||
) |
Definition at line 391 of file crypto_gcrypt.c.
|
static |
Definition at line 365 of file crypto_gcrypt.c.
References crypt_hash_compat_name(), hash, crypt_hmac::hash_id, iterations, crypt_hmac::key, crypt_hmac::key_length, NULL, and pkcs5_pbkdf2().
Referenced by crypt_pbkdf(), and openssl_pbkdf2().
|
static |
Definition at line 29 of file crypto_gcrypt.c.
Referenced by crypt_backend_destroy(), crypt_backend_init(), crypt_backend_version(), crypt_hash_init(), crypt_hash_size(), and crypt_hmac_init().
|
static |
Definition at line 30 of file crypto_gcrypt.c.
Referenced by crypt_backend_init().
|
static |
Definition at line 31 of file crypto_gcrypt.c.
Referenced by crypt_backend_init(), and crypt_hash_test_whirlpool_bug().
|
static |
Definition at line 32 of file crypto_gcrypt.c.
Referenced by _crypt_load_luks(), argon2_hash(), create_or_verify(), crypt_backend_init(), crypt_backend_version(), crypt_header_restore(), crypt_token_unload_external_all(), device_check(), LUKS2_config_get_reencrypt_version(), LUKS2_reencrypt_get_params(), and verify_hash_block().