diff -ur voms-1.7.23.orig/configure voms-1.7.23/configure
--- voms-1.7.23.orig/configure	2007-09-25 10:31:45.000000000 +0200
+++ voms-1.7.23/configure	2007-10-16 00:48:14.000000000 +0200
@@ -19037,6 +19037,11 @@
 
 # Checks for libraries.
 
+  if test "x$host_cpu" = "xx86_64"; then
+     archlib=lib64
+  else
+     archlib=lib
+  fi
 
 # Check whether --with-openssl_prefix or --without-openssl_prefix was given.
 if test "${with_openssl_prefix+set}" = set; then
@@ -19062,7 +19067,7 @@
   fi
 
   SAVE_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-  LD_LIBRARY_PATH="$with_openssl_prefix/lib"
+  LD_LIBRARY_PATH="$with_openssl_prefix/$archlib"
 
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -19149,7 +19154,7 @@
 
   if test "x$found" = "xyes"; then
     NO_GLOBUS_FLAGS="-I$with_openssl_prefix/include"
-    OPENSSL_LIBS="-L$with_openssl_prefix/lib -lcrypto -lssl"
+    OPENSSL_LIBS="-L$with_openssl_prefix/$archlib -lcrypto -lssl"
 
 
     echo "$as_me:$LINENO: checking for system OpenSSL version" >&5
@@ -24696,7 +24701,7 @@
 main ()
 {
 
-      i2d_of_void fun = NULL;
+      i2d_of_void fun;
 
   ;
   return 0;
@@ -24770,7 +24775,7 @@
 main ()
 {
 
-      i2d_of_void fun = NULL;
+      i2d_of_void fun;
 
   ;
   return 0;
diff -ur voms-1.7.23.orig/project/acinclude.m4 voms-1.7.23/project/acinclude.m4
--- voms-1.7.23.orig/project/acinclude.m4	2007-09-21 10:36:04.000000000 +0200
+++ voms-1.7.23/project/acinclude.m4	2007-10-16 00:29:45.000000000 +0200
@@ -2,6 +2,12 @@
 # ---------------------------------------------
 AC_DEFUN([AC_OPENSSL],
 [
+  if test "x$host_cpu" = "xx86_64"; then
+     archlib=lib64
+  else
+     archlib=lib
+  fi
+
   AC_ARG_WITH(openssl_prefix,
               [ --with-openssl-prefix=PFX    prefix where OpenSSL (non-globus) is installed. (/usr)],
               [with_openssl_prefix="$withval"],
@@ -17,7 +23,7 @@
   fi  
 
   SAVE_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-  LD_LIBRARY_PATH="$with_openssl_prefix/lib"
+  LD_LIBRARY_PATH="$with_openssl_prefix/$archlib"
 
   AC_LANG_PUSH(C)
   AC_CHECK_LIB(crypto, CRYPTO_num_locks, [found=yes], [found=no])
@@ -25,7 +31,7 @@
 
   if test "x$found" = "xyes"; then
     NO_GLOBUS_FLAGS="-I$with_openssl_prefix/include"
-    OPENSSL_LIBS="-L$with_openssl_prefix/lib -lcrypto -lssl"
+    OPENSSL_LIBS="-L$with_openssl_prefix/$archlib -lcrypto -lssl"
     AC_SUBST(NO_GLOBUS_FLAGS)
     AC_SUBST(OPENSSL_LIBS)
     AC_MSG_CHECKING([for system OpenSSL version])
@@ -934,7 +940,7 @@
     #include <$with_globus_prefix/include/$with_globus_flavor/openssl/asn1.h>
     ],
     [
-      i2d_of_void fun = NULL;
+      i2d_of_void fun;
     ],
     [ac_have_i2d_of_void="yes"],
     [ac_have_i2d_of_void="no"])
@@ -957,7 +963,7 @@
     #include <openssl/asn1.h>
     ],
     [
-      i2d_of_void fun = NULL;
+      i2d_of_void fun;
     ],
     [ac_have_i2d_of_void="yes"],
     [ac_have_i2d_of_void="no"])
diff -ur voms-1.7.23.orig/src/ac/extensions.c voms-1.7.23/src/ac/extensions.c
--- voms-1.7.23.orig/src/ac/extensions.c	2007-06-27 09:46:48.000000000 +0200
+++ voms-1.7.23/src/ac/extensions.c	2007-10-15 23:20:18.000000000 +0200
@@ -34,9 +34,17 @@
 int i2d_AC_SEQ(AC_SEQ *a, unsigned char **pp)
 {
   M_ASN1_I2D_vars(a);
+#ifdef TYPEDEF_I2D_OF
+  M_ASN1_I2D_len_SEQUENCE(a->acs, (i2d_of_void *)i2d_AC);
+#else
   M_ASN1_I2D_len_SEQUENCE(a->acs, i2d_AC);
+#endif
   M_ASN1_I2D_seq_total();
+#ifdef TYPEDEF_I2D_OF
+  M_ASN1_I2D_put_SEQUENCE(a->acs, (i2d_of_void *)i2d_AC);
+#else
   M_ASN1_I2D_put_SEQUENCE(a->acs, i2d_AC);
+#endif
   M_ASN1_I2D_finish();
 }
 
@@ -486,7 +494,7 @@
 void *authkey_s2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *data)
 {
   X509       *cert = (X509 *)data;
-  char digest[21];
+  unsigned char digest[21];
 
   ASN1_OCTET_STRING *str = ASN1_OCTET_STRING_new();
   AUTHORITY_KEYID *keyid = AUTHORITY_KEYID_new();
diff -ur voms-1.7.23.orig/src/ac/validate.c voms-1.7.23/src/ac/validate.c
--- voms-1.7.23.orig/src/ac/validate.c	2006-10-27 10:58:17.000000000 +0200
+++ voms-1.7.23/src/ac/validate.c	2007-10-15 23:20:18.000000000 +0200
@@ -17,6 +17,7 @@
 
 #define _GNU_SOURCE
 
+#include <stddef.h>
 #include <openssl/sha.h>
 #include <openssl/asn1.h>
 #include <openssl/asn1_mac.h>
@@ -569,7 +570,7 @@
         ret = 0;
         if (iss) {
           if (key->keyid) {
-            char hashed[20];
+            unsigned char hashed[20];
             if (!SHA1(iss->cert_info->key->public_key->data,
                       iss->cert_info->key->public_key->length,
                       hashed))
diff -ur voms-1.7.23.orig/src/ac/write.c voms-1.7.23/src/ac/write.c
--- voms-1.7.23.orig/src/ac/write.c	2006-11-20 11:53:52.000000000 +0100
+++ voms-1.7.23/src/ac/write.c	2007-10-15 23:20:18.000000000 +0200
@@ -267,8 +267,13 @@
 /*   for (i=0; i <sk_X509_num(stk); i ++) */
 /*     fprintf(stderr, "stk[%i] = %s\n", i , X509_NAME_oneline(X509_get_subject_name((X509 *)sk_X509_value(stk, i)), NULL, 0)); */
 
+#ifdef TYPEDEF_I2D_OF
+  sk_X509_push(stk,
+               (X509 *)ASN1_dup((i2d_of_void *)i2d_X509,(d2i_of_void *)d2i_X509, (char *)issuerc));
+#else
   sk_X509_push(stk,
                (X509 *)ASN1_dup((int (*)())i2d_X509,(char * (*)())d2i_X509, (char *)issuerc));
+#endif
 /*   for (i=0; i <sk_X509_num(stk); i ++) */
 /*     fprintf(stderr, "stk[%i] = %d\n", i , sk_X509_value(stk, i)); */
 
diff -ur voms-1.7.23.orig/src/api/ccapi/api_util.cc voms-1.7.23/src/api/ccapi/api_util.cc
--- voms-1.7.23.orig/src/api/ccapi/api_util.cc	2007-09-21 10:36:05.000000000 +0200
+++ voms-1.7.23/src/api/ccapi/api_util.cc	2007-10-15 23:20:18.000000000 +0200
@@ -150,7 +150,11 @@
     return false;
   }
 
+#ifdef TYPEDEF_I2D_OF
+  *holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509,(d2i_of_void*)d2i_X509, (char *)h);
+#else
   *holder = (X509 *)ASN1_dup((int (*)())i2d_X509,(char * (*)())d2i_X509, (char *)h);
+#endif
   if (!*holder) {
     seterror(VERR_MEM, "Cannot find enough memory to work!");
     return false;
@@ -308,8 +312,13 @@
   AC_free(tmp);   
   
   if (result)
+#ifdef TYPEDEF_I2D_OF
+    v.holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, 
+				(d2i_of_void*)d2i_X509, (char *)holder);
+#else
     v.holder = (X509 *)ASN1_dup((int (*) ())i2d_X509, 
 				(char * (*)())d2i_X509, (char *)holder);
+#endif
   return result;
 }
 
@@ -343,8 +352,13 @@
     return false;
   }
   else {
+#ifdef TYPEDEF_I2D_OF
+    ((struct realdata *)v.realdata)->ac = (AC *)ASN1_dup((i2d_of_void*)i2d_AC,
+                                                         (d2i_of_void*)d2i_AC,
+#else
     ((struct realdata *)v.realdata)->ac = (AC *)ASN1_dup((int (*) ())i2d_AC,
                                                          (char * (*) ())d2i_AC,
+#endif
                                                          (char *)ac);
   }
   
@@ -364,8 +378,13 @@
   X509_free(issuer);
   
   if (result)
+#ifdef TYPEDEF_I2D_OF
+    v.holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, 
+				(d2i_of_void*)d2i_X509, (char *)holder);
+#else
     v.holder = (X509 *)ASN1_dup((int (*) ())i2d_X509, 
 				(char * (*)())d2i_X509, (char *)holder);
+#endif
   return result;
 }
 
@@ -380,7 +399,11 @@
 
   AC *ac = (AC *)data;
 
+#ifdef TYPEDEF_I2D_OF
+  int res = ASN1_verify((i2d_of_void*)i2d_AC_INFO, ac->sig_alg, ac->signature,
+#else
   int res = ASN1_verify((int (*)())i2d_AC_INFO, ac->sig_alg, ac->signature,
+#endif
                         (char *)ac->acinfo, key);
 
   if (!res)
@@ -679,7 +702,11 @@
      among those specific for the vo or else in the vomsdir
      directory */
 
+#ifdef TYPEDEF_I2D_OF
+  X509 *cert = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, (d2i_of_void*)d2i_X509, (char *)sk_X509_value(certstack, 0));
+#else
   X509 *cert = (X509 *)ASN1_dup((int (*)())i2d_X509, (char * (*)())d2i_X509, (char *)sk_X509_value(certstack, 0));
+#endif
 
   bool found = false;
 
diff -ur voms-1.7.23.orig/src/api/ccapi/cinterface.cc voms-1.7.23/src/api/ccapi/cinterface.cc
--- voms-1.7.23.orig/src/api/ccapi/cinterface.cc	2007-03-14 10:47:37.000000000 +0100
+++ voms-1.7.23/src/api/ccapi/cinterface.cc	2007-10-15 23:20:18.000000000 +0200
@@ -277,9 +277,15 @@
       dst->serial    = mystrdup(serial);
       dst->datalen   = custom.size();
 
+#ifdef TYPEDEF_I2D_OF
+      dst->ac     = (AC *)  ASN1_dup((i2d_of_void*)i2d_AC,   (d2i_of_void*)d2i_AC,   
+                                     (char *)(((struct realdata *)realdata)->ac));
+      dst->holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, (d2i_of_void*)d2i_X509, (char *)holder);
+#else
       dst->ac     = (AC *)  ASN1_dup((int(*)())i2d_AC,   (char*(*)())d2i_AC,   
                                      (char *)(((struct realdata *)realdata)->ac));
       dst->holder = (X509 *)ASN1_dup((int(*)())i2d_X509, (char*(*)())d2i_X509, (char *)holder);
+#endif
 
       if (!dst->holder || !dst->ac)
         throw 3;
@@ -727,8 +733,13 @@
       dst->serial    = mystrdup(org->serial);
       dst->datalen   = org->datalen;
 
+#ifdef TYPEDEF_I2D_OF
+      dst->ac     = (AC *)  ASN1_dup((i2d_of_void*)i2d_AC,   (d2i_of_void*)d2i_AC,   (char *)org->ac);
+      dst->holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, (d2i_of_void*)d2i_X509, (char *)org->holder);
+#else
       dst->ac     = (AC *)  ASN1_dup((int(*)())i2d_AC,   (char*(*)())d2i_AC,   (char *)org->ac);
       dst->holder = (X509 *)ASN1_dup((int(*)())i2d_X509, (char*(*)())d2i_X509, (char *)org->holder);
+#endif
 
       if (!dst->holder || !dst->ac)
         throw 3;
@@ -851,7 +862,11 @@
 
 AC *VOMS_GetAC(vomsr *v)
 {
+#ifdef TYPEDEF_I2D_OF
+  return (AC *)ASN1_dup((i2d_of_void*)i2d_AC, (d2i_of_void*)d2i_AC, (char *)v->ac);
+#else
   return (AC *)ASN1_dup((int (*)())i2d_AC, (char * (*)())d2i_AC, (char *)v->ac);
+#endif
 }
 
 }
diff -ur voms-1.7.23.orig/src/api/ccapi/voms_api.cc voms-1.7.23/src/api/ccapi/voms_api.cc
--- voms-1.7.23.orig/src/api/ccapi/voms_api.cc	2007-07-09 15:10:47.000000000 +0200
+++ voms-1.7.23/src/api/ccapi/voms_api.cc	2007-10-15 23:20:18.000000000 +0200
@@ -493,7 +493,11 @@
   char *buf = NULL;
 
   std::string subject, ca;
+#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+  const unsigned char *buftmp, *copy;
+#else
   unsigned char *buftmp, *copy;
+#endif
 
   char *str;
   int len;
@@ -673,12 +677,12 @@
 }
 
 static bool
-tokenize(std::string str, unsigned int &start, std::string &value)
+tokenize(std::string str, size_t &start, std::string &value)
 {
   if (start != std::string::npos) {
-    unsigned int begin = str.find('"',start);
+    size_t begin = str.find('"',start);
     if (begin != std::string::npos) {
-      unsigned int end = str.find('"',begin+1);
+      size_t end = str.find('"',begin+1);
       if (end != std::string::npos) {
         value = str.substr(begin+1, end-begin-1);
         start = end+1;
@@ -729,7 +733,7 @@
 
     if (getline(f,line) && !empty(line)) {
       ok = verok = true;
-      unsigned int start = 0;
+      size_t start = 0;
       std::string port, version;
 
       ok &= tokenize(line, start, data.nick);
@@ -846,11 +850,21 @@
   fqan      = orig.fqan;
   serial    = orig.serial;
   realdata  = calloc(1, sizeof(struct realdata));
+#ifdef TYPEDEF_I2D_OF
+  ((struct realdata *)realdata)->ac = (AC *)ASN1_dup((i2d_of_void*)i2d_AC, 
+                                                     (d2i_of_void*)d2i_AC, 
+#else
   ((struct realdata *)realdata)->ac = (AC *)ASN1_dup((int (*)())i2d_AC, 
                                                      (char * (*)())d2i_AC, 
+#endif
                                                      (char *)((struct realdata *)orig.realdata)->ac);
+#ifdef TYPEDEF_I2D_OF
+  holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509,
+			    (d2i_of_void*)d2i_X509,
+#else
   holder = (X509 *)ASN1_dup((int (*)())i2d_X509,
 			    (char * (*)())d2i_X509,
+#endif
 			    (char *)orig.holder);
 
   
@@ -887,10 +901,19 @@
   serial    = orig.serial;
   if (((struct realdata *)realdata)->ac)
     AC_free(((struct realdata *)realdata)->ac);
+#ifdef TYPEDEF_I2D_OF
+  ((struct realdata *)realdata)->ac = (AC *)ASN1_dup((i2d_of_void*)i2d_AC, 
+                                                     (d2i_of_void*)d2i_AC, 
+#else
   ((struct realdata *)realdata)->ac = (AC *)ASN1_dup((int (*)())i2d_AC, 
                                                      (char * (*)())d2i_AC, 
+#endif
                                                      (char *)((struct realdata *)orig.realdata)->ac);
+#ifdef TYPEDEF_I2D_OF
+  holder = (X509 *)ASN1_dup((i2d_of_void*)i2d_X509, (d2i_of_void*)d2i_X509, (char *)orig.holder);
+#else
   holder = (X509 *)ASN1_dup((int (*)())i2d_X509, (char * (*)())d2i_X509, (char *)orig.holder);
+#endif
   delete ((struct realdata *)realdata)->attributes;
   ((struct realdata *)realdata)->attributes = 
     new std::vector<attributelist>(*(((struct realdata *)orig.realdata)->attributes));
@@ -907,8 +930,13 @@
 
 AC *voms::GetAC()
 {
+#ifdef TYPEDEF_I2D_OF
+  return (AC *)ASN1_dup((i2d_of_void*)i2d_AC, 
+                        (d2i_of_void*)d2i_AC, 
+#else
   return (AC *)ASN1_dup((int (*)())i2d_AC, 
                         (char * (*)())d2i_AC, 
+#endif
                         (char *)((struct realdata *)realdata)->ac);
 }
 
diff -ur voms-1.7.23.orig/src/client/vomsclient.cc voms-1.7.23/src/client/vomsclient.cc
--- voms-1.7.23.orig/src/client/vomsclient.cc	2007-09-21 10:36:05.000000000 +0200
+++ voms-1.7.23/src/client/vomsclient.cc	2007-10-15 23:20:18.000000000 +0200
@@ -1335,7 +1335,11 @@
     else BIO_write_filename(out, (char *)(separate+".ac").c_str());
     
     while(*aclist)
+#ifdef TYPEDEF_I2D_OF
+      if(!PEM_ASN1_write_bio((i2d_of_void *)i2d_AC, "ATTRIBUTE CERTIFICATE", out, (char *)*(aclist++), NULL, NULL, 0, NULL, NULL)) {
+#else
       if(!PEM_ASN1_write_bio(((int (*)())i2d_AC), "ATTRIBUTE CERTIFICATE", out, (char *)*(aclist++), NULL, NULL, 0, NULL, NULL)) {
+#endif
         if(!quiet) std::cout << "Unable to write to BIO" << std::endl;
         return false;;
       }
diff -ur voms-1.7.23.orig/src/common/credentials.c voms-1.7.23/src/common/credentials.c
--- voms-1.7.23.orig/src/common/credentials.c	2006-05-18 13:10:06.000000000 +0200
+++ voms-1.7.23/src/common/credentials.c	2007-10-15 23:20:18.000000000 +0200
@@ -76,7 +76,11 @@
   if ((base = decouple_cred(credential, 0, &stk))) {
     cert = get_real_cert(base, stk);
     if (cert) {
+#ifdef TYPEDEF_I2D_OF
+      ret = (X509 *)ASN1_dup((i2d_of_void *)i2d_X509, (d2i_of_void *)d2i_X509, (char *)cert);
+#else
       ret = (X509 *)ASN1_dup((int (*)())i2d_X509, (char * (*)())d2i_X509, (char *)cert);
+#endif
     }
   }
   gss_release_cred(&minor_status, &credential);
diff -ur voms-1.7.23.orig/src/common/xml.c voms-1.7.23/src/common/xml.c
--- voms-1.7.23.orig/src/common/xml.c	2007-06-28 14:43:31.000000000 +0200
+++ voms-1.7.23/src/common/xml.c	2007-10-15 23:20:18.000000000 +0200
@@ -150,7 +150,7 @@
   char *res;
   int size;
   char str[15];
-  char *tmp;
+  const char *tmp;
   int count = 0;
 
   if (!command)
@@ -170,7 +170,7 @@
   size += (count * 19);
 
   if ((res = (char *)malloc(size))) {
-    char * prev = command, * next = prev;
+    const char * prev = command, * next = prev;
     strcpy(res, "<?xml version=\"1.0\" encoding = \"US-ASCII\"?><voms>");
 
     while(next != 0)
diff -ur voms-1.7.23.orig/src/server/access_db_sql.cc voms-1.7.23/src/server/access_db_sql.cc
--- voms-1.7.23.orig/src/server/access_db_sql.cc	2006-12-14 13:37:15.000000000 +0100
+++ voms-1.7.23/src/server/access_db_sql.cc	2007-10-15 23:20:18.000000000 +0200
@@ -150,8 +150,8 @@
    * Inefficient, but will do for now.
    */
 
-  unsigned int userp = format.find("$user");
-  unsigned int cap = format.find("$ca");
+  size_t userp = format.find("$user");
+  size_t cap = format.find("$ca");
 
   while (userp != format.npos && cap != format.npos) {
 
diff -ur voms-1.7.23.orig/src/socklib/globuswrap.c voms-1.7.23/src/socklib/globuswrap.c
--- voms-1.7.23.orig/src/socklib/globuswrap.c	2006-09-04 10:41:05.000000000 +0200
+++ voms-1.7.23/src/socklib/globuswrap.c	2007-10-15 23:20:18.000000000 +0200
@@ -47,7 +47,7 @@
         char *str = NULL;
         globus_gss_assist_display_status_str(&str,
                                              "Failed to send data:",
-                                             res, m, tok_stat);
+                                             res, *m, *tok_stat);
         done = LogBuffer(f, logh, LEV_ERROR, -1, str);
         LOG(logh, LEV_ERROR, -1, str);
         free(str);
@@ -86,7 +86,7 @@
         char *str = NULL;
         globus_gss_assist_display_status_str(&str,
                                              "Failed to receive data: ",
-                                             res, m, t_s);
+                                             res, *m, *t_s);
         done = LogBuffer(f, logh, LEV_ERROR, -1, str);
         LOG(logh, LEV_ERROR, -1, str);
         free(str);
diff -ur voms-1.7.23.orig/src/sslutils/oldgaa/oldgaa_gl_internal_err.c voms-1.7.23/src/sslutils/oldgaa/oldgaa_gl_internal_err.c
--- voms-1.7.23.orig/src/sslutils/oldgaa/oldgaa_gl_internal_err.c	2005-07-29 17:18:58.000000000 +0200
+++ voms-1.7.23/src/sslutils/oldgaa/oldgaa_gl_internal_err.c	2007-10-15 23:20:18.000000000 +0200
@@ -4,6 +4,7 @@
  */
 #include "config.h"
 
+#include <stdlib.h>
 #include "oldgaa_gl_internal_err.h"
 #include <stdio.h>
 
diff -ur voms-1.7.23.orig/src/sslutils/oldgaa/oldgaa_utils.c voms-1.7.23/src/sslutils/oldgaa/oldgaa_utils.c
--- voms-1.7.23.orig/src/sslutils/oldgaa/oldgaa_utils.c	2006-10-27 10:58:22.000000000 +0200
+++ voms-1.7.23/src/sslutils/oldgaa/oldgaa_utils.c	2007-10-15 23:20:18.000000000 +0200
@@ -470,7 +470,7 @@
       oldgaa_cond_bindings_ptr new_cond_bind = NULL;
       if (oldgaa_allocate_cond_bindings(&new_cond_bind) == OLDGAA_SUCCESS) {
         element->cond_bindings = new_cond_bind;
-        new_cond_bind->reference_count = NULL;
+        new_cond_bind->reference_count = 0;
       }
       else
         return;
diff -ur voms-1.7.23.orig/src/sslutils/proxycertinfo.c voms-1.7.23/src/sslutils/proxycertinfo.c
--- voms-1.7.23.orig/src/sslutils/proxycertinfo.c	2007-06-28 14:43:32.000000000 +0200
+++ voms-1.7.23/src/sslutils/proxycertinfo.c	2007-10-15 23:20:18.000000000 +0200
@@ -50,8 +50,13 @@
 
 /* duplicate */
 myPROXYPOLICY * myPROXYPOLICY_dup(myPROXYPOLICY * policy) {
+#ifdef TYPEDEF_I2D_OF
+  return ((myPROXYPOLICY *) ASN1_dup((i2d_of_void *)i2d_myPROXYPOLICY,
+				   (d2i_of_void *)d2i_myPROXYPOLICY,
+#else
   return ((myPROXYPOLICY *) ASN1_dup((int (*)())i2d_myPROXYPOLICY,
 				   (char *(*)())d2i_myPROXYPOLICY,
+#endif
 				   (char *)policy));
 }
 
diff -ur voms-1.7.23.orig/src/sslutils/sslutils.c voms-1.7.23/src/sslutils/sslutils.c
--- voms-1.7.23.orig/src/sslutils/sslutils.c	2007-07-09 15:10:48.000000000 +0200
+++ voms-1.7.23/src/sslutils/sslutils.c	2007-10-15 23:20:18.000000000 +0200
@@ -14,6 +14,7 @@
 /**********************************************************************
                              Include header files
 **********************************************************************/
+#define _GNU_SOURCE
 #include "config.h"
 #include "replace.h"
 #include "myproxycertinfo.h"
@@ -983,7 +984,11 @@
     if(proxyver>=3) {
 
       user_public_key = X509_get_pubkey(user_cert);
+#ifdef TYPEDEF_I2D_OF
+      ASN1_digest((i2d_of_void *)i2d_PUBKEY, EVP_sha1(), (char *) user_public_key, md, &len);
+#else
       ASN1_digest(i2d_PUBKEY, EVP_sha1(), (char *) user_public_key, md, &len);
+#endif
       EVP_PKEY_free(user_public_key);
 
       sub_hash = md[0] + (md[1] + (md[2] + (md[3] >> 1) * 256) * 256) * 256;
@@ -1079,7 +1084,7 @@
 proxy_sign_ext(
     X509 *                              user_cert,
     EVP_PKEY *                          user_private_key,
-    EVP_MD *                            method,
+    const EVP_MD *                            method,
     X509_REQ *                          req,
     X509 **                             new_cert,
     X509_NAME *                         subject_name,
@@ -1731,7 +1736,11 @@
 
 static int 
 proxy_app_verify_callback(
-    X509_STORE_CTX *                    ctx)
+    X509_STORE_CTX *                    ctx
+#if SSLEAY_VERSION_NUMBER >=  0x0090700fL
+    , void * dummy
+#endif
+    )
 {
     /*
      * OpenSSL-0.9.6 has a  check_issued routine which
@@ -3288,7 +3297,7 @@
 Returns:
 **********************************************************************/
 
-static int cert_load_pkcs12(BIO *bio, int (*pw_cb)(), X509 **cert, EVP_PKEY **key, STACK_OF(X509) *chain) 
+static int cert_load_pkcs12(BIO *bio, int (*pw_cb)(), X509 **cert, EVP_PKEY **key, STACK_OF(X509) **chain) 
 {
   PKCS12 *p12 = NULL;
   char *password = NULL;
@@ -3703,15 +3712,27 @@
             {
                 fclose(fp);
                 error = ERR_peek_error();
+#ifdef PEM_F_PEM_DEF_CALLBACK
+                if (error == ERR_PACK(ERR_LIB_PEM,
+                                      PEM_F_PEM_DEF_CALLBACK,
+                                      PEM_R_PROBLEMS_GETTING_PASSWORD))
+#else
                 if (error == ERR_PACK(ERR_LIB_PEM,
                                       PEM_F_DEF_CALLBACK,
                                       PEM_R_PROBLEMS_GETTING_PASSWORD))
+#endif
                 {
                     ERR_clear_error(); 
                 }
+#ifdef EVP_F_EVP_DECRYPTFINAL_EX
+                else if (error == ERR_PACK(ERR_LIB_EVP,
+                                           EVP_F_EVP_DECRYPTFINAL_EX,
+                                           EVP_R_BAD_DECRYPT))
+#else
                 else if (error == ERR_PACK(ERR_LIB_EVP,
                                            EVP_F_EVP_DECRYPTFINAL,
                                            EVP_R_BAD_DECRYPT))
+#endif
                 {
                     ERR_clear_error();
                     PRXYerr(PRXYERR_F_INIT_CRED,PRXYERR_R_WRONG_PASSPHRASE);
@@ -4562,7 +4583,11 @@
 
     ASN1_INTEGER_set(asn1_int, v);
 
+#ifdef TYPEDEF_I2D_OF
+   ASN1_i2d_bio((i2d_of_void *)i2d_ASN1_INTEGER, bp, (unsigned char *) asn1_int);
+#else
     ASN1_i2d_bio(i2d_ASN1_INTEGER, bp, (unsigned char *) asn1_int);
+#endif
     
     ASN1_INTEGER_free(asn1_int);
     
@@ -4575,10 +4600,17 @@
 {
     ASN1_INTEGER *                      asn1_int = NULL;
     
+#ifdef TYPEDEF_I2D_OF
+    ASN1_d2i_bio((void *(*)())ASN1_INTEGER_new,
+                 (d2i_of_void *)d2i_ASN1_INTEGER,
+                 (bp),
+                 (void **)(&asn1_int));
+#else
     ASN1_d2i_bio((char *(*)())ASN1_INTEGER_new,
                  (char *(*)())d2i_ASN1_INTEGER,
                  (bp),
                  (unsigned char **)(&asn1_int));
+#endif
     
     *v = ASN1_INTEGER_get(asn1_int);
     ASN1_INTEGER_free(asn1_int);
diff -ur voms-1.7.23.orig/src/sslutils/sslutils.h voms-1.7.23/src/sslutils/sslutils.h
--- voms-1.7.23.orig/src/sslutils/sslutils.h	2007-07-09 15:10:48.000000000 +0200
+++ voms-1.7.23/src/sslutils/sslutils.h	2007-10-15 23:20:18.000000000 +0200
@@ -441,7 +441,7 @@
 proxy_sign_ext(
     X509 *                              user_cert,
     EVP_PKEY *                          user_private_key,
-    EVP_MD *                            method,
+    const EVP_MD *                            method,
     X509_REQ *                          req,
     X509 **                             new_cert,
     X509_NAME *                         subject_name,
diff -ur voms-1.7.23.orig/src/utils/vomsfake.cc voms-1.7.23/src/utils/vomsfake.cc
--- voms-1.7.23.orig/src/utils/vomsfake.cc	2007-02-15 16:40:59.000000000 +0100
+++ voms-1.7.23/src/utils/vomsfake.cc	2007-10-15 23:20:18.000000000 +0200
@@ -787,7 +787,11 @@
     BIO_write_filename(out, (char *)separate.c_str());
     
     while(*aclist)
+#ifdef TYPEDEF_I2D_OF
+      if (!PEM_ASN1_write_bio((i2d_of_void *)i2d_AC, "ATTRIBUTE CERTIFICATE", out, (char *)*(aclist++), NULL, NULL, 0, NULL, NULL)) {
+#else
       if (!PEM_ASN1_write_bio(((int (*)())i2d_AC), "ATTRIBUTE CERTIFICATE", out, (char *)*(aclist++), NULL, NULL, 0, NULL, NULL)) {
+#endif
         if (!quiet) 
           std::cout << "Unable to write to BIO" << std::endl;
         return false;
diff -ur voms-1.7.23.orig/src/utils/voms_proxy_info.cc voms-1.7.23/src/utils/voms_proxy_info.cc
--- voms-1.7.23.orig/src/utils/voms_proxy_info.cc	2007-07-09 15:10:48.000000000 +0200
+++ voms-1.7.23/src/utils/voms_proxy_info.cc	2007-10-15 23:20:18.000000000 +0200
@@ -566,15 +566,25 @@
     std::cout << leftcert << "\n";
 
   if(text) {
+#ifdef TYPEDEF_I2D_OF
+    X509 *tmp = (X509 *)ASN1_dup((i2d_of_void *)i2d_X509,
+				   (d2i_of_void *)d2i_X509, (char*)cert);
+#else
     X509 *tmp = (X509 *)ASN1_dup((int (*)())i2d_X509,
 				   (char * (*)())d2i_X509, (char*)cert);
+#endif
     X509_print_fp(stdout, tmp);
 
     if (dochain) {
       for (int start = sk_X509_num(chain)-1; start >= 1; start--) {
 	X509 *tmp = sk_X509_value(chain, start);
+#ifdef TYPEDEF_I2D_OF
+	X509 *cert = (X509 *)ASN1_dup((i2d_of_void *)i2d_X509,
+				      (d2i_of_void *)d2i_X509, (char*)tmp);
+#else
 	X509 *cert = (X509 *)ASN1_dup((int (*)())i2d_X509,
 				      (char * (*)())d2i_X509, (char*)tmp);
+#endif
 	X509_print_fp(stdout, cert);
       }
     }
