~xnox/debian/sid/cryptsetup/ubuntu

« back to all changes in this revision

Viewing changes to lib/crypto_backend/crypto_kernel.c

  • Committer: Package Import Robot
  • Author(s): Jonas Meurer, Jonas Meurer, Jean-Louis Dupond
  • Date: 2012-06-08 13:42:51 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20120608134251-kjh1n5poebys8zqz
Tags: 2:1.4.3-1
[ Jonas Meurer ]
* mention limitations for keyscripts in crypttab(5) manpage: keyscripts
  must not depend on binaries/files which are part of the to-be-unlocked
  device. (closes: #665494)
* bump versioned build-dependency on debhelper now that we install
  upstart initscripts in debian as well.
* change versioned breaks/replaces for cryptsetup-bin on cryptsetup to
  1.4.3-1~, fixing upgrades in debian.

[ Jean-Louis Dupond ]
* New upstream version. (closes: #670071)
  - Fix keyslot removal (closes: #672299)
  - Add -r to cryptsetup.8 (closes: #674027)
* Split up package in cryptsetup and cryptsetup-bin.
* I'm now co-maintainer (closes: #600777).
* Start cryptdisks-enable upstart job on 'or container', to let us
  simplify the udevtrigger job.
* debian/cryptdisks.functions: handle the case where crypttab contains a
  name for the source device that is not the kernel's preferred name for
  it (as is the case for LVs). (Thanks Steve Langasek)
* debian/cryptdisks.functions: fix a race condition in some cases by
  adding and udevadm settle before rename.
* debian/cryptdisks.functions: add UUID & LABEL support to do_start.
* debian/copyright: really fix lintian warning.
* debian/rules: also include upstart files in debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Linux kernel userspace API crypto backend implementation
3
3
 *
4
 
 * Copyright (C) 2010-2011, Red Hat, Inc. All rights reserved.
 
4
 * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or
7
7
 * modify it under the terms of the GNU General Public License
36
36
#endif
37
37
 
38
38
static int crypto_backend_initialised = 0;
 
39
static char version[64];
39
40
 
40
41
struct hash_alg {
41
42
        const char *name;
93
94
int crypt_backend_init(struct crypt_device *ctx)
94
95
{
95
96
        struct utsname uts;
96
 
 
97
97
        struct sockaddr_alg sa = {
98
98
                .salg_family = AF_ALG,
99
99
                .salg_type = "hash",
104
104
        if (crypto_backend_initialised)
105
105
                return 0;
106
106
 
107
 
        log_dbg("Initialising kernel crypto API backend.");
108
 
 
109
107
        if (uname(&uts) == -1 || strcmp(uts.sysname, "Linux"))
110
108
                return -EINVAL;
111
 
        log_dbg("Kernel version %s %s.", uts.sysname, uts.release);
112
109
 
113
110
        if (_socket_init(&sa, &tfmfd, &opfd) < 0)
114
111
                return -EINVAL;
116
113
        close(tfmfd);
117
114
        close(opfd);
118
115
 
 
116
        snprintf(version, sizeof(version), "%s %s kernel cryptoAPI",
 
117
                 uts.sysname, uts.release);
 
118
 
119
119
        crypto_backend_initialised = 1;
120
120
        return 0;
121
121
}
125
125
        return CRYPT_BACKEND_KERNEL;
126
126
}
127
127
 
 
128
const char *crypt_backend_version(void)
 
129
{
 
130
        return crypto_backend_initialised ? version : "";
 
131
}
 
132
 
128
133
static struct hash_alg *_get_alg(const char *name)
129
134
{
130
135
        int i = 0;
291
296
        free(ctx);
292
297
        return 0;
293
298
}
 
299
 
 
300
/* RNG - N/A */
 
301
int crypt_backend_rng(char *buffer, size_t length, int quality, int fips)
 
302
{
 
303
        return -EINVAL;
 
304
}