I added a call to pdf_crypt_init in each unit test as jemarch suggested
me. It seems to work fine.

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [EMAIL PROTECTED]
# target_branch: http://bzr.savannah.gnu.org/r/pdf/libgnupdf/branches\
#   /trunk/
# testament_sha1: 6b31f6effd712715a5592066a6c69e65d582ff71
# timestamp: 2008-10-03 18:08:34 +0200
# base_revision_id: [EMAIL PROTECTED]
# 
# Begin patch
=== modified file 'ChangeLog'
--- ChangeLog	2008-10-02 20:49:15 +0000
+++ ChangeLog	2008-10-03 16:08:19 +0000
@@ -1,3 +1,7 @@
+2008-10-03  David Vazquez <[EMAIL PROTECTED]>
+
+	* Bug fixing crypt module unit tests failures.
+
 2008-10-02  Jose E. Marchesi  <[EMAIL PROTECTED]>
 
 	* Bug fixing and design changes in the stream module.

=== modified file 'src/base/pdf-crypt-c-v2.c'
--- src/base/pdf-crypt-c-v2.c	2008-09-05 03:42:01 +0000
+++ src/base/pdf-crypt-c-v2.c	2008-10-03 16:08:19 +0000
@@ -136,7 +136,7 @@
 
 
 
-static pdf_size_t
+static pdf_status_t
 pdf_crypt_cipher_v2_decrypt (void * cipher,
 			     pdf_char_t *out, pdf_size_t out_size,
 			     pdf_char_t *in,  pdf_size_t in_size,

=== modified file 'src/base/pdf-crypt.h'
--- src/base/pdf-crypt.h	2008-09-18 23:06:16 +0000
+++ src/base/pdf-crypt.h	2008-10-03 16:08:19 +0000
@@ -46,15 +46,15 @@
 
   pdf_size_t (*decrypt_size) (void * cipher, pdf_char_t *in, pdf_size_t in_size);
 
-  pdf_size_t (*encrypt) (void * cipher,
-			 pdf_char_t *out, pdf_size_t out_size,
-			 pdf_char_t *in,  pdf_size_t in_size,
-			 pdf_size_t *result_size);
+  pdf_status_t (*encrypt) (void * cipher,
+			   pdf_char_t *out, pdf_size_t out_size,
+			   pdf_char_t *in,  pdf_size_t in_size,
+			   pdf_size_t *result_size);
 
-  pdf_size_t (*decrypt) (void * cipher,
-			 pdf_char_t *out, pdf_size_t out_size,
-			 pdf_char_t *in,  pdf_size_t in_sizem,
-			 pdf_size_t *result_size);
+  pdf_status_t (*decrypt) (void * cipher,
+			   pdf_char_t *out, pdf_size_t out_size,
+			   pdf_char_t *in,  pdf_size_t in_sizem,
+			   pdf_size_t *result_size);
 
   pdf_status_t (*destroy) (void * cipher);
 };
@@ -188,7 +188,7 @@
 EXTERN_INLINE pdf_status_t
 pdf_crypt_init (void)
 {
-  gcry_check_version (NULL);
+  gcry_check_version (GCRYPT_VERSION);
   return PDF_OK;
 }
 

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-decrypt-size.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-decrypt-size.c	2008-09-20 13:06:19 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-decrypt-size.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_cipher_decrypt_size_001)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   fail_if (pdf_crypt_cipher_decrypt_size (cipher, NULL, 32) != 0);
   pdf_crypt_cipher_destroy (cipher);
@@ -58,6 +59,7 @@
 START_TEST (pdf_crypt_cipher_decrypt_size_002)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   fail_if (pdf_crypt_cipher_decrypt_size (cipher, NULL, 15) != 15);
   pdf_crypt_cipher_destroy (cipher);

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-decrypt.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-decrypt.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-decrypt.c	2008-10-03 16:08:19 +0000
@@ -64,6 +64,8 @@
       0xab, 0x17, 0x08, 0x08
     };
 			     
+  pdf_crypt_init();
+
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   pdf_crypt_cipher_setkey (&cipher, key, sizeof(key));
 
@@ -102,6 +104,8 @@
 			     
   ciphered_size = 0;
 
+  pdf_crypt_init();
+
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   pdf_crypt_cipher_setkey (&cipher, NULL, 0);
 

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-destroy.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-destroy.c	2008-08-30 17:23:23 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-destroy.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_cipher_destroy_001)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   fail_if (pdf_crypt_cipher_destroy (cipher) != PDF_OK);
 }
@@ -57,6 +58,7 @@
 START_TEST (pdf_crypt_cipher_destroy_002)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   fail_if (pdf_crypt_cipher_destroy (cipher) != PDF_OK);
 }

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-encrypt-size.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-encrypt-size.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-encrypt-size.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_cipher_encrypt_size_001)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   fail_if (pdf_crypt_cipher_encrypt_size (cipher, NULL, 0) != 32);
   pdf_crypt_cipher_destroy (cipher);
@@ -58,6 +59,7 @@
 START_TEST (pdf_crypt_cipher_encrypt_size_002)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   fail_if (pdf_crypt_cipher_encrypt_size (cipher, NULL, 15) != 32);
   pdf_crypt_cipher_destroy (cipher);
@@ -76,6 +78,7 @@
 START_TEST (pdf_crypt_cipher_encrypt_size_003)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   fail_if (pdf_crypt_cipher_encrypt_size (cipher, NULL, 0) != 0);
   pdf_crypt_cipher_destroy (cipher);
@@ -94,6 +97,7 @@
 START_TEST (pdf_crypt_cipher_encrypt_size_004)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   fail_if (pdf_crypt_cipher_encrypt_size (cipher, NULL, 15) != 15);
   pdf_crypt_cipher_destroy (cipher);

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-encrypt.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-encrypt.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-encrypt.c	2008-10-03 16:08:19 +0000
@@ -48,6 +48,8 @@
   pdf_char_t key[16];		/* unintialized data */
   
   in_size = 0;
+
+  pdf_crypt_init();
   
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher);
   pdf_crypt_cipher_setkey (&cipher, key, in_size);
@@ -82,6 +84,8 @@
 
   in_size = 0;
 
+  pdf_crypt_init();
+
   pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher);
   pdf_crypt_cipher_setkey (&cipher, key, sizeof(key));
   out_size = pdf_crypt_cipher_encrypt_size (cipher, in, in_size);

=== modified file 'torture/unit/base/crypt/pdf-crypt-cipher-new.c'
--- torture/unit/base/crypt/pdf-crypt-cipher-new.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-cipher-new.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_cipher_new_001)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   fail_if (pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_AESV2, &cipher) != PDF_OK);
   pdf_crypt_cipher_destroy (cipher);
 }
@@ -57,6 +58,7 @@
 START_TEST (pdf_crypt_cipher_new_002)
 {
   pdf_crypt_cipher_t cipher;
+  pdf_crypt_init();
   fail_if (pdf_crypt_cipher_new (PDF_CRYPT_CIPHER_ALGO_V2, &cipher) != PDF_OK);
   pdf_crypt_cipher_destroy (cipher);
 }

=== modified file 'torture/unit/base/crypt/pdf-crypt-md-destroy.c'
--- torture/unit/base/crypt/pdf-crypt-md-destroy.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-md-destroy.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_md_destroy_001)
 {
   pdf_crypt_md_t md;
+  pdf_crypt_init();
   pdf_crypt_md_new (&md, PDF_CRYPT_MD_MD5);
   fail_if (pdf_crypt_md_destroy (md));
 }

=== modified file 'torture/unit/base/crypt/pdf-crypt-md-hash.c'
--- torture/unit/base/crypt/pdf-crypt-md-hash.c	2008-09-09 02:29:51 +0000
+++ torture/unit/base/crypt/pdf-crypt-md-hash.c	2008-10-03 16:08:19 +0000
@@ -50,6 +50,8 @@
     0xec, 0xf8, 0x42, 0x7e
   };
 
+  pdf_crypt_init();
+
   pdf_crypt_md_new (&md, PDF_CRYPT_MD_MD5);
   fail_if (pdf_crypt_md_hash (md, out, sizeof(out), in, 0) != PDF_OK);
   fail_if (!memcmp (real_out, out, sizeof(out)));

=== modified file 'torture/unit/base/crypt/pdf-crypt-md-new.c'
--- torture/unit/base/crypt/pdf-crypt-md-new.c	2008-09-09 01:46:11 +0000
+++ torture/unit/base/crypt/pdf-crypt-md-new.c	2008-10-03 16:08:19 +0000
@@ -41,6 +41,7 @@
 START_TEST (pdf_crypt_md_new_001)
 {
   pdf_crypt_md_t md;
+  pdf_crypt_init();
   fail_if ( pdf_crypt_md_new (&md, PDF_CRYPT_MD_MD5) != PDF_OK);
   pdf_crypt_md_destroy (md);
 }

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWYTEbKcACFLfgAAwUXf//1+l
3SC////wYAs8+nrr7eaAAAABc7iqoUUdtoOzUdMJJECnonop+k2CelNT9TTUeUP1QAeo9ExH6poc
wCYCZGAEYmJhMJghpiaYEEo/1JNGgMgaNAGgaMho0AAAk1JEnijUye1TZJ6h6gNBoA0GhoAaCKU1
J5DQ9VPynqnoaeVPSYCMRgIyNAYBUomgI0ATICU8E1MyI2qeoGjINNqJEI4Edu/yBxcambsNS544
v5rFiRSzBV6ctZvPJwWOTToscF9WBJkktN+UYVCsaKZe4rqMqs89bdb8ckiZTSGklGjxXbKYXaUt
ht0WwuxLXaiY6MwYAmZR68zpw65zlxNkJzyGpSCKRkSKqyKG90QDMdF+OdZ12LGu+8MK4wBLlEGT
IAEFAlTEWKrC1MIDWZG4RoyhEtDSao70wEMnBx3q6u5rrUWOLo/U6AldOvqyx1lyNzIUfxyRGgUC
1w8S7pBwhZjTdquay0rkulkwe98z7pr9rHi+zAtgmxphwY5BOt27bG7h3aeGXZcxIVo22iLo2tKB
AzoOMO2FsIHgpKCBkXkfzeMZnrz3+WqJz3xeKDTCQaUzkCBnQSDhg4DGgeJkpSD0WZtVU83rDSTh
I5z188zSJLLZE4spdbh5s5L2Jdw9N749tbv8fJp2urXW9Yqvf+wzSSp8wQwR0YVVg9RiUhiy3bnL
IK2QCUQtpSKO1sbUwxJVBWSQx0SuNMmBXMnPQlcEs7KFFi9NMYXr3d/d/Oy2RJr6md54tV6m3Vkw
baUvaLnmuYpixUarmzC/FQkK7yTe0RMmUlQwtEywOB82Siz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