From 62d6da67dd104b12e26b651acd59819f2c5306a1 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 16 Jun 2009 14:23:32 +0200 Subject: [PATCH] support older gcrypt libraries not defining the CAMELLIA cipher --- configure.in | 7 +++++++ src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/configure.in b/configure.in index 4c366b779..db61ae46d 100644 --- a/configure.in +++ b/configure.in @@ -1015,6 +1015,13 @@ fi if test x$gcrypt = xtrue; then AM_PATH_LIBGCRYPT(,,[AC_MSG_ERROR([libgcrypt not found!])]) + AC_MSG_CHECKING([gcrypt CAMELLIA cipher]) + AC_TRY_COMPILE( + [#include ], + [enum gcry_cipher_algos alg = GCRY_CIPHER_CAMELLIA128;], + [AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GCRY_CIPHER_CAMELLIA])], + [AC_MSG_RESULT([no])] + ) fi if test x$uci = xtrue; then diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c index 17e6ef26f..f82d23185 100644 --- a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c @@ -180,6 +180,7 @@ gcrypt_crypter_t *gcrypt_crypter_create(encryption_algorithm_t algo, case ENCR_CAMELLIA_CBC: switch (key_size) { +#ifdef HAVE_GCRY_CIPHER_CAMELLIA case 16: gcrypt_alg = GCRY_CIPHER_CAMELLIA128; break; @@ -189,6 +190,7 @@ gcrypt_crypter_t *gcrypt_crypter_create(encryption_algorithm_t algo, case 32: gcrypt_alg = GCRY_CIPHER_CAMELLIA256; break; +#endif /* HAVE_GCRY_CIPHER_CAMELLIA */ default: return NULL; }