~xnox/debian/sid/cryptsetup/ubuntu

« back to all changes in this revision

Viewing changes to lib/tcrypt/tcrypt.h

  • Committer: Package Import Robot
  • Author(s): Jonas Meurer, Milan Broz, Steve Langasek, Jonas Meurer
  • Date: 2013-06-28 12:10:41 UTC
  • mfrom: (0.2.11)
  • Revision ID: package-import@ubuntu.com-20130628121041-ek9rtel19yehj31t
Tags: 2:1.6.1-1
[ Milan Broz ]
* new upstream version. (closes: #704827, 707997)
  - default LUKS encryption mode is XTS (aes-xts-plain64) (closes: #714331)
  - adds native support for Truecrypt and compatible on-disk format
  - adds benchmark command
  - adds cryptsetup-reencrypt, a tool to offline reencrypt LUKS device
  - adds veritysetup, a tool for dm-verity block device verification module
* install docs/examples into docs at cryptsetup-dev package.
* fix compilation warnings in askpass.c.

[ Steve Langasek ]
* fix upstart jobs to not cause boot hangs when actually used in
  conjunction with startpar.  (closes: #694499, #677712).
* in connection with the above, make the cryptdisks-early job explicitly
  wait for 'umountfs' on shutdown just like cryptdisks does; otherwise,
  the teardown of the cryptdisks upstart job may cause the cryptdisks-early
  init script run before we're done unmounting filesystems.

[ Jonas Meurer ]
* minor wording fixes to README.initramfs, suggested by intrigeri and Adam
  D. Barrett.
* add bash-completion script for cryptdisks_{start,stop}. Thanks to Claudius
  Hubig for providing a patch. (closes: #700777)
* support specifying key-slot in crypttab. Thanks to Kevin Locke for the
  patch. (closes: #704470)
* remove evms support code from cryptroot initramfs script. (closes: #713918)
* fix location of keyscripts in initramfs documentation. (closes: #697446)
* fix a typo in decrypt_ssl script that prevented stdout from beeing
  redirected to /dev/null. (closes: #700285)
* give full path to blkid in crytproot initramfs script. (closes: #697155)
* export number of previous tries from cryptroot and cryptdisks to
  keyscript. Thanks to Laurens Blankers for the idea. Opens the possibility
  to fallback after a given number of tries for keyscripts. (closes: #438481,
  #471729, #697455)
* improve check for cpu hardware encryption support in initramfs cryptroot
  hook. (closes: #714326)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * TCRYPT (TrueCrypt-compatible)  header defitinion
 
3
 *
 
4
 * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
 
5
 * Copyright (C) 2012-2013, Milan Broz
 
6
 *
 
7
 * This file is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation; either
 
10
 * version 2.1 of the License, or (at your option) any later version.
 
11
 *
 
12
 * This file is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this file; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
20
 */
 
21
 
 
22
#include "libcryptsetup.h"
 
23
 
 
24
#ifndef _CRYPTSETUP_TCRYPT_H
 
25
#define _CRYPTSETUP_TCRYPT_H
 
26
 
 
27
#define TCRYPT_HDR_SALT_LEN 64
 
28
#define TCRYPT_HDR_IV_LEN   16
 
29
#define TCRYPT_HDR_LEN     448
 
30
#define TCRYPT_HDR_KEY_LEN 192
 
31
#define TCRYPT_HDR_MAGIC "TRUE"
 
32
#define TCRYPT_HDR_MAGIC_LEN 4
 
33
 
 
34
#define TCRYPT_HDR_HIDDEN_OFFSET_OLD -1536
 
35
#define TCRYPT_HDR_HIDDEN_OFFSET 65536
 
36
 
 
37
#define TCRYPT_HDR_HIDDEN_OFFSET_BCK -65536
 
38
#define TCRYPT_HDR_OFFSET_BCK -131072
 
39
 
 
40
#define TCRYPT_HDR_SYSTEM_OFFSET 31744
 
41
 
 
42
#define TCRYPT_LRW_IKEY_LEN 16
 
43
#define TCRYPT_KEY_POOL_LEN 64
 
44
#define TCRYPT_KEYFILE_LEN  1048576
 
45
 
 
46
#define TCRYPT_HDR_FLAG_SYSTEM    (1 << 0)
 
47
#define TCRYPT_HDR_FLAG_NONSYSTEM (1 << 1)
 
48
 
 
49
struct tcrypt_phdr {
 
50
        char salt[TCRYPT_HDR_SALT_LEN];
 
51
 
 
52
        /* encrypted part, TCRYPT_HDR_LEN bytes */
 
53
        union {
 
54
        struct __attribute__((__packed__)) {
 
55
                char     magic[TCRYPT_HDR_MAGIC_LEN];
 
56
                uint16_t version;
 
57
                uint16_t version_tc;
 
58
                uint32_t keys_crc32;
 
59
                uint64_t _reserved1[2]; /* data/header ctime */
 
60
                uint64_t hidden_volume_size;
 
61
                uint64_t volume_size;
 
62
                uint64_t mk_offset;
 
63
                uint64_t mk_size;
 
64
                uint32_t flags;
 
65
                uint32_t sector_size;
 
66
                uint8_t  _reserved2[120];
 
67
                uint32_t header_crc32;
 
68
                char     keys[256];
 
69
        } d;
 
70
        char e[TCRYPT_HDR_LEN];
 
71
        };
 
72
} __attribute__((__packed__));
 
73
 
 
74
struct crypt_dm_active_device;
 
75
struct volume_key;
 
76
struct device;
 
77
 
 
78
int TCRYPT_read_phdr(struct crypt_device *cd,
 
79
                     struct tcrypt_phdr *hdr,
 
80
                     struct crypt_params_tcrypt *params);
 
81
 
 
82
int TCRYPT_init_by_name(struct crypt_device *cd, const char *name,
 
83
                        const struct crypt_dm_active_device *dmd,
 
84
                        struct device **device,
 
85
                        struct crypt_params_tcrypt *tcrypt_params,
 
86
                        struct tcrypt_phdr *tcrypt_hdr);
 
87
 
 
88
int TCRYPT_activate(struct crypt_device *cd,
 
89
                     const char *name,
 
90
                     struct tcrypt_phdr *hdr,
 
91
                     struct crypt_params_tcrypt *params,
 
92
                     uint32_t flags);
 
93
 
 
94
int TCRYPT_deactivate(struct crypt_device *cd,
 
95
                      const char *name);
 
96
 
 
97
uint64_t TCRYPT_get_data_offset(struct crypt_device *cd,
 
98
                                struct tcrypt_phdr *hdr,
 
99
                                struct crypt_params_tcrypt *params);
 
100
 
 
101
uint64_t TCRYPT_get_iv_offset(struct crypt_device *cd,
 
102
                              struct tcrypt_phdr *hdr,
 
103
                              struct crypt_params_tcrypt *params);
 
104
 
 
105
int TCRYPT_get_volume_key(struct crypt_device *cd,
 
106
                          struct tcrypt_phdr *hdr,
 
107
                          struct crypt_params_tcrypt *params,
 
108
                          struct volume_key **vk);
 
109
 
 
110
int TCRYPT_dump(struct crypt_device *cd,
 
111
                struct tcrypt_phdr *hdr,
 
112
                struct crypt_params_tcrypt *params);
 
113
 
 
114
#endif