2
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
4
* Inspired by libvolume_id by
5
* Kay Sievers <kay.sievers@vrfy.org>
7
* This file may be redistributed under the terms of the
8
* GNU Lesser General Public License.
18
#include "superblocks.h"
20
#define LUKS_CIPHERNAME_L 32
21
#define LUKS_CIPHERMODE_L 32
22
#define LUKS_HASHSPEC_L 32
23
#define LUKS_DIGESTSIZE 20
24
#define LUKS_SALTSIZE 32
25
#define LUKS_MAGIC_L 6
26
#define UUID_STRING_L 40
29
uint8_t magic[LUKS_MAGIC_L];
31
uint8_t cipherName[LUKS_CIPHERNAME_L];
32
uint8_t cipherMode[LUKS_CIPHERMODE_L];
33
uint8_t hashSpec[LUKS_HASHSPEC_L];
34
uint32_t payloadOffset;
36
uint8_t mkDigest[LUKS_DIGESTSIZE];
37
uint8_t mkDigestSalt[LUKS_SALTSIZE];
38
uint32_t mkDigestIterations;
39
uint8_t uuid[UUID_STRING_L];
40
} __attribute__((packed));
42
static int probe_luks(blkid_probe pr, const struct blkid_idmag *mag)
44
struct luks_phdr *header;
46
header = blkid_probe_get_sb(pr, mag, struct luks_phdr);
50
blkid_probe_strncpy_uuid(pr, (unsigned char *) header->uuid,
51
sizeof(header->uuid));
52
blkid_probe_sprintf_version(pr, "%u", be16_to_cpu(header->version));
56
const struct blkid_idinfo luks_idinfo =
58
.name = "crypto_LUKS",
59
.usage = BLKID_USAGE_CRYPTO,
60
.probefunc = probe_luks,
63
{ .magic = "LUKS\xba\xbe", .len = 6 },