diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index c714c1150..66e55dfa7 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -210,7 +210,8 @@ AC_LANG_PUSH(C) | |||
210 | LIBS="$LIBS $LIBGCRYPT_LIBS" | 210 | LIBS="$LIBS $LIBGCRYPT_LIBS" |
211 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" | 211 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" |
212 | AC_RUN_IFELSE( | 212 | AC_RUN_IFELSE( |
213 | [AC_LANG_PROGRAM([#include <gcrypt.h>], [[ | 213 | [AC_LANG_PROGRAM([#include <gcrypt.h> |
214 | #include <stdio.h>], [[ | ||
214 | gcry_md_hd_t mac; | 215 | gcry_md_hd_t mac; |
215 | 216 | ||
216 | unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72, | 217 | unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72, |
@@ -225,19 +226,28 @@ AC_RUN_IFELSE( | |||
225 | 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3}; | 226 | 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3}; |
226 | 227 | ||
227 | if (!gcry_check_version (GCRYPT_VERSION)) | 228 | if (!gcry_check_version (GCRYPT_VERSION)) |
229 | { | ||
230 | fprintf (stderr, "Version mismatch %s <-> %s \n", gcry_check_version (NULL), GCRYPT_VERSION); | ||
228 | return 1; | 231 | return 1; |
232 | } | ||
229 | 233 | ||
230 | gcry_control (GCRYCTL_DISABLE_SECMEM, 0); | 234 | gcry_control (GCRYCTL_DISABLE_SECMEM, 0); |
231 | gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); | 235 | gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); |
232 | 236 | ||
233 | if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR) | 237 | if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR) |
238 | { | ||
239 | fprintf (stderr, "gcry_md_open error\n"); | ||
234 | return 2; | 240 | return 2; |
241 | } | ||
235 | 242 | ||
236 | gcry_md_setkey (mac, key, sizeof (key)); | 243 | gcry_md_setkey (mac, key, sizeof (key)); |
237 | gcry_md_write (mac, data, sizeof (data)); | 244 | gcry_md_write (mac, data, sizeof (data)); |
238 | 245 | ||
239 | if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0) | 246 | if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0) |
247 | { | ||
248 | fprintf (stderr, "memcmp error\n"); | ||
240 | return 3; | 249 | return 3; |
250 | } | ||
241 | 251 | ||
242 | gcry_md_close (mac); | 252 | gcry_md_close (mac); |
243 | 253 | ||
@@ -245,12 +255,19 @@ AC_RUN_IFELSE( | |||
245 | ]])], | 255 | ]])], |
246 | [AC_MSG_RESULT([yes])], | 256 | [AC_MSG_RESULT([yes])], |
247 | [ | 257 | [ |
248 | if test $? = 3 | 258 | RESULT=$? |
259 | if test $RESULT = 3 | ||
249 | then | 260 | then |
250 | AC_MSG_FAILURE([HMAC test vector does not match. This is a known problem with libgcrypt 1.2.2 on Windows and fixed in 1.4.6.]) | 261 | AC_MSG_FAILURE([HMAC test vector does not match. This is a known problem with libgcrypt 1.2.2 on Windows and fixed in 1.4.6.]) |
251 | else | 262 | fi |
263 | if test $RESULT = 2 | ||
264 | then | ||
252 | AC_MSG_FAILURE([HMAC test failed]) | 265 | AC_MSG_FAILURE([HMAC test failed]) |
253 | fi | 266 | fi |
267 | if test $RESULT = 1 | ||
268 | then | ||
269 | AC_MSG_FAILURE([libgcrypt header version does not match library version]) | ||
270 | fi | ||
254 | ]) | 271 | ]) |
255 | AC_LANG_POP(C) | 272 | AC_LANG_POP(C) |
256 | fi # $build = $target | 273 | fi # $build = $target |