~ubuntu-branches/debian/sid/cryptsetup/sid

« back to all changes in this revision

Viewing changes to lib/crypto_backend/crypto_gcrypt.c

  • Committer: Package Import Robot
  • Author(s): Jonas Meurer
  • Date: 2012-02-05 03:17:59 UTC
  • mfrom: (0.2.9)
  • Revision ID: package-import@ubuntu.com-20120205031759-kua3bplwunj0q2zl
Tags: 2:1.4.1-1
* new upstream release (1.4.0 + 1.4.1) (closes: #647851)
  - fixes typo in german translation. (closes: #645528)
  - remove patches, all incorporated upstream.
  - soname bump, rename library package to libcryptsetup4
* check for busybox in initramfs cryptroot hook, and install the sed binary
  in case it's either not installed or not activated. (closes: #591853)
* add checks for 'type $KEYSCRIPT' to initscripts cryptdisks.functions, and
  to cryptroot initramfs script/hook. this adds support for keyscripts inside
  $PATH. thanks to Ian Jackson for the suggestion. (closes: #597583)
* use argument '--sysinit' for vgchange in cryptroot initramfs script. Thanks
  to Christoph Anton Mitterer for the suggestion.
* add option for discard/trim features to crypttab and initramfs scripts.
  Thanks to intrigeri and Peter Colberg for patches. (closes: #648868)
* print $target on error in initramfs hook. Thanks to Daniel Hahler for the
  bugreport. (closes: #648192)
* add a warning about using decrypt_derived keyscript for devices with
  persistent data. Thanks to Arno Wagner for pointing this out.
* remove quotes from resume device candidates at get_resume_devs() in
  initramfs hook script. Thanks to Johannes Rohr. (closes: #634017)
* support custom $TABFILE, thanks to Douglas Huff. (closes: #638317)
* fix get_lvm_deps() in initramfs cryptroot hook to add all physical volumes
  of lvm volume group that contains the rootfs logical volume, even if the
  rootfs is lv is not spread over all physical volumes. Thanks to Christian
  Pernegger for bugreport and patch. (closes: #634109)
* debian/initramfs/cryptroot-script: Move check for maximum number of tries
  behind the while loop, to make the warning appear in case that maximum
  number of tries is reached. Thanks to Chistian Lamparter for bugreport and
  patch. (closes: #646083)
* incorporate changes to package descriptions and debconf templates that
  suggested by debian-l10n-english people. Special thanks go to Justin B Rye.
* acknowledge NMU, thanks a lot to Christian Perrier for his great work on
  the i18n front. (closes: #633105, #641719, #641839, #641947, #642470,
  #640056, #642540, #643633, #643962, #644853)
* add and update debconf translations:
  - italian, thanks to Milo Casagrande, Francesca Ciceri. (closes: #656933)
  - german, thanks to Erik Pfannenstein. (closes: #642147)
  - spanish, thanks to Camaleón. (closes: #658360)
  - russian, thanks to Yuri Kuzlov (closes: #654676)
* set architecture to linux-any, depends on linux kernel anyway. Thanks to
  Christoph Egger. (closes: #638257)
* small updates to the copyright file.
* add targets build-indep and build-arch to debian/rules, thanks to lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
18
 */
19
19
 
20
20
#include <string.h>
39
39
        int hash_len;
40
40
};
41
41
 
42
 
int crypt_backend_init(struct crypt_device *ctx)
 
42
int crypt_backend_init(struct crypt_device *ctx __attribute__((unused)))
43
43
{
44
44
        if (crypto_backend_initialised)
45
45
                return 0;
117
117
        return 0;
118
118
}
119
119
 
120
 
int crypt_hash_restart(struct crypt_hash *ctx)
 
120
static void crypt_hash_restart(struct crypt_hash *ctx)
121
121
{
122
122
        gcry_md_reset(ctx->hd);
123
 
        return 0;
124
123
}
125
124
 
126
125
int crypt_hash_write(struct crypt_hash *ctx, const char *buffer, size_t length)
133
132
{
134
133
        unsigned char *hash;
135
134
 
136
 
        if (length > ctx->hash_len)
 
135
        if (length > (size_t)ctx->hash_len)
137
136
                return -EINVAL;
138
137
 
139
138
        hash = gcry_md_read(ctx->hd, ctx->hash_id);
141
140
                return -EINVAL;
142
141
 
143
142
        memcpy(buffer, hash, length);
 
143
        crypt_hash_restart(ctx);
 
144
 
144
145
        return 0;
145
146
}
146
147
 
191
192
        return 0;
192
193
}
193
194
 
194
 
int crypt_hmac_restart(struct crypt_hmac *ctx)
 
195
static void crypt_hmac_restart(struct crypt_hmac *ctx)
195
196
{
196
197
        gcry_md_reset(ctx->hd);
197
 
        return 0;
198
198
}
199
199
 
200
200
int crypt_hmac_write(struct crypt_hmac *ctx, const char *buffer, size_t length)
207
207
{
208
208
        unsigned char *hash;
209
209
 
210
 
        if (length > ctx->hash_len)
 
210
        if (length > (size_t)ctx->hash_len)
211
211
                return -EINVAL;
212
212
 
213
213
        hash = gcry_md_read(ctx->hd, ctx->hash_id);
215
215
                return -EINVAL;
216
216
 
217
217
        memcpy(buffer, hash, length);
 
218
        crypt_hmac_restart(ctx);
 
219
 
218
220
        return 0;
219
221
}
220
222