Deleted Added
full compact
g_eli.h (148867) g_eli.h (149303)
1/*-
2 * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/geom/eli/g_eli.h 148867 2005-08-08 19:40:38Z pjd $
26 * $FreeBSD: head/sys/geom/eli/g_eli.h 149303 2005-08-19 22:16:26Z pjd $
27 */
28
29#ifndef _G_ELI_H_
30#define _G_ELI_H_
31
32#include <sys/endian.h>
33#include <sys/errno.h>
34#include <sys/malloc.h>

--- 108 unchanged lines hidden (view full) ---

143 char md_magic[16]; /* Magic value. */
144 uint32_t md_version; /* Version number. */
145 uint32_t md_flags; /* Additional flags. */
146 uint16_t md_algo; /* Encryption algorithm. */
147 uint16_t md_keylen; /* Key length. */
148 uint64_t md_provsize; /* Provider's size. */
149 uint32_t md_sectorsize; /* Sector size. */
150 uint8_t md_keys; /* Available keys. */
27 */
28
29#ifndef _G_ELI_H_
30#define _G_ELI_H_
31
32#include <sys/endian.h>
33#include <sys/errno.h>
34#include <sys/malloc.h>

--- 108 unchanged lines hidden (view full) ---

143 char md_magic[16]; /* Magic value. */
144 uint32_t md_version; /* Version number. */
145 uint32_t md_flags; /* Additional flags. */
146 uint16_t md_algo; /* Encryption algorithm. */
147 uint16_t md_keylen; /* Key length. */
148 uint64_t md_provsize; /* Provider's size. */
149 uint32_t md_sectorsize; /* Sector size. */
150 uint8_t md_keys; /* Available keys. */
151 int32_t md_iterations; /* Number of iterations for PKCS#5v2 */
151 int32_t md_iterations; /* Number of iterations for PKCS#5v2. */
152 uint8_t md_salt[G_ELI_SALTLEN]; /* Salt. */
153 /* Encrypted master key (IV-key, Data-key, HMAC). */
154 uint8_t md_mkeys[G_ELI_MAXMKEYS * G_ELI_MKEYLEN];
155 u_char md_hash[16]; /* MD5 hash. */
156};
157#ifndef _OpenSSL_
158static __inline void
159eli_metadata_encode(struct g_eli_metadata *md, u_char *data)

--- 108 unchanged lines hidden (view full) ---

268 printf("sectorsize: %u\n", (u_int)md->md_sectorsize);
269 printf(" keys: 0x%02x\n", (u_int)md->md_keys);
270 printf("iterations: %u\n", (u_int)md->md_iterations);
271 bzero(str, sizeof(str));
272 for (i = 0; i < sizeof(md->md_salt); i++) {
273 str[i * 2] = hex[md->md_salt[i] >> 4];
274 str[i * 2 + 1] = hex[md->md_salt[i] & 0x0f];
275 }
152 uint8_t md_salt[G_ELI_SALTLEN]; /* Salt. */
153 /* Encrypted master key (IV-key, Data-key, HMAC). */
154 uint8_t md_mkeys[G_ELI_MAXMKEYS * G_ELI_MKEYLEN];
155 u_char md_hash[16]; /* MD5 hash. */
156};
157#ifndef _OpenSSL_
158static __inline void
159eli_metadata_encode(struct g_eli_metadata *md, u_char *data)

--- 108 unchanged lines hidden (view full) ---

268 printf("sectorsize: %u\n", (u_int)md->md_sectorsize);
269 printf(" keys: 0x%02x\n", (u_int)md->md_keys);
270 printf("iterations: %u\n", (u_int)md->md_iterations);
271 bzero(str, sizeof(str));
272 for (i = 0; i < sizeof(md->md_salt); i++) {
273 str[i * 2] = hex[md->md_salt[i] >> 4];
274 str[i * 2 + 1] = hex[md->md_salt[i] & 0x0f];
275 }
276 printf(" Salt: %s\n", str);
276 printf(" Salt: %s\n", str);
277 bzero(str, sizeof(str));
278 for (i = 0; i < sizeof(md->md_mkeys); i++) {
279 str[i * 2] = hex[md->md_mkeys[i] >> 4];
280 str[i * 2 + 1] = hex[md->md_mkeys[i] & 0x0f];
281 }
282 printf("Master Key: %s\n", str);
283 bzero(str, sizeof(str));
284 for (i = 0; i < 16; i++) {
285 str[i * 2] = hex[md->md_hash[i] >> 4];
286 str[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];
287 }
277 bzero(str, sizeof(str));
278 for (i = 0; i < sizeof(md->md_mkeys); i++) {
279 str[i * 2] = hex[md->md_mkeys[i] >> 4];
280 str[i * 2 + 1] = hex[md->md_mkeys[i] & 0x0f];
281 }
282 printf("Master Key: %s\n", str);
283 bzero(str, sizeof(str));
284 for (i = 0; i < 16; i++) {
285 str[i * 2] = hex[md->md_hash[i] >> 4];
286 str[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];
287 }
288 printf(" MD5 hash: %s\n", str);
288 printf(" MD5 hash: %s\n", str);
289}
290
291static __inline u_int
292g_eli_keylen(u_int algo, u_int keylen)
293{
294
295 switch (algo) {
296 case CRYPTO_NULL_CBC:

--- 71 unchanged lines hidden ---
289}
290
291static __inline u_int
292g_eli_keylen(u_int algo, u_int keylen)
293{
294
295 switch (algo) {
296 case CRYPTO_NULL_CBC:

--- 71 unchanged lines hidden ---