From 047d97e95e1df831d699fb77cd58c269a13a5c5c Mon Sep 17 00:00:00 2001 From: David Shaw Date: Fri, 5 Jun 2009 14:11:03 +0000 Subject: Add full Camellia support. * configure.ac: Remove Camellia restriction. * gpg.c (main), misc.c (openpgp_cipher_test_algo): Remove Camellia restriction. * misc.c (map_cipher_openpgp_to_gcry), main.h: Add macros for openpgp_cipher_open, openpgp_cipher_get_algo_keylen, and openpgp_cipher_get_algo_blklen to wrap around the corresponding gcry_* functions, but pass the algorithm number through map_cipher_openpgp_to_gcry. This is needed in case the gcry algorithm number doesn't match the OpenPGP number (c.f. Camellia). * encr-data.c, pubkey-enc.c, mainproc.c, cipher.c, encode.c, seskey.c, passphrase.c, seckey-cert.c: Use new openpgp_cipher_* macros here. --- g10/cipher.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'g10/cipher.c') diff --git a/g10/cipher.c b/g10/cipher.c index dc248e395..f0dc57719 100644 --- a/g10/cipher.c +++ b/g10/cipher.c @@ -1,6 +1,6 @@ /* cipher.c - En-/De-ciphering filter * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -49,7 +49,7 @@ write_header( cipher_filter_context_t *cfx, IOBUF a ) unsigned int blocksize; unsigned int nprefix; - blocksize = gcry_cipher_get_algo_blklen (cfx->dek->algo); + blocksize = openpgp_cipher_get_algo_blklen (cfx->dek->algo); if ( blocksize < 8 || blocksize > 16 ) log_fatal("unsupported blocksize %u\n", blocksize ); @@ -81,12 +81,12 @@ write_header( cipher_filter_context_t *cfx, IOBUF a ) temp[nprefix] = temp[nprefix-2]; temp[nprefix+1] = temp[nprefix-1]; print_cipher_algo_note( cfx->dek->algo ); - err = gcry_cipher_open (&cfx->cipher_hd, - cfx->dek->algo, - GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | ((cfx->dek->use_mdc || cfx->dek->algo >= 100)? - 0 : GCRY_CIPHER_ENABLE_SYNC))); + err = openpgp_cipher_open (&cfx->cipher_hd, + cfx->dek->algo, + GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | ((cfx->dek->use_mdc || cfx->dek->algo >= 100)? + 0 : GCRY_CIPHER_ENABLE_SYNC))); if (err) { /* We should never get an error here cause we already checked, * that the algorithm is available. */ -- cgit