]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
simulate pkcs11x.h when it doesn't exist
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 13 Sep 2014 11:06:33 +0000 (13:06 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 13 Sep 2014 11:06:33 +0000 (13:06 +0200)
configure.ac
lib/pkcs11.c
lib/pkcs11x.c
lib/pkcs11x.h

index 65eade2d7b33897289b36bfc304ac42643177a8b..08d9c72a5a1982a30f1001bdf7e9eceac6cfe00f 100644 (file)
@@ -35,6 +35,7 @@ AC_MSG_RESULT([***
 ])
 
 dnl Checks for programs.
+PKG_PROG_PKG_CONFIG
 AC_PROG_CC
 gl_EARLY
 ggl_EARLY
@@ -411,6 +412,7 @@ system_priority_file="/etc/gnutls/default-priorities"
 AC_DEFINE_UNQUOTED([SYSTEM_PRIORITY_FILE],
   ["$system_priority_file"], [The system priority file])
 
+
 dnl Check for p11-kit
 P11_KIT_MINIMUM=0.20.0
 AC_ARG_WITH(p11-kit,
@@ -425,6 +427,9 @@ if test "$with_p11_kit" != "no"; then
                else
                        GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
                fi
+               if $PKG_CONFIG --atleast-version=2.20.6 p11-kit; then
+                       AC_DEFINE([HAVE_PKCS11X_H], 1, [There is p11-kit/pkcs11x.h])
+               fi
        else
                with_p11_kit=no
                AC_MSG_WARN([[
index c5f3e062fc9d20320451fd8a779667d423e9b89e..3b55297908bf4bf35a1fdaff80b11f626d82a1c0 100644 (file)
@@ -3107,11 +3107,6 @@ const char *gnutls_pkcs11_type_get_name(gnutls_pkcs11_obj_type_t type)
        }
 }
 
-#ifndef CKA_X_DISTRUSTED
-# define CKA_X_VENDOR (CKA_VENDOR_DEFINED | 0x58444700UL)
-# define CKA_X_DISTRUSTED (CKA_X_VENDOR + 100)
-#endif
-
 static int
 find_cert_cb(struct pkcs11_session_info *sinfo,
            struct token_info *info, struct ck_info *lib_info, void *input)
index dbdd082d8c94d9b8e1fa8e5731d572f40454a860..7fe6fcdda7ee2464bdfd7819ed7d870e804bb144 100644 (file)
@@ -19,8 +19,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>
  */
 
-#define HAVE_PKCS11X_H
-
 #include <gnutls_int.h>
 #include <gnutls/pkcs11.h>
 #include <gnutls_global.h>
@@ -29,9 +27,7 @@
 
 #include <pkcs11_int.h>
 #include <p11-kit/p11-kit.h>
-#ifdef HAVE_PKCS11X_H
-# include "pkcs11x.h"
-#endif
+#include "pkcs11x.h"
 
 struct find_ext_data_st {
        /* in */
index 0aac3f6f103671269244b869bafde7b0f726e75b..94ef48a33037ba8debb8adfc0ac2572a23e2c99c 100644 (file)
 #ifndef PKCS11X_H
 #define PKCS11X_H
 
-#include <p11-kit/pkcs11x.h>
+#ifdef HAVE_PKCS11X_H
+# include <p11-kit/pkcs11x.h>
+#else
+
+# include <p11-kit/pkcs11.h>
+
+# ifndef CKA_X_VENDOR
+#  define CKA_X_VENDOR (CKA_VENDOR_DEFINED | 0x58444700UL)
+# endif
+
+# ifndef CKO_X_VENDOR
+#  define CKO_X_VENDOR   (CKA_VENDOR_DEFINED | 0x58444700UL)
+# endif
+
+# ifndef CKA_X_DISTRUSTED
+#  define CKA_X_DISTRUSTED (CKA_X_VENDOR + 100)
+# endif
+
+# ifndef CKO_X_CERTIFICATE_EXTENSION
+#  define CKO_X_CERTIFICATE_EXTENSION                  (CKO_X_VENDOR + 200)
+# endif
+
+# ifndef CKA_PUBLIC_KEY_INFO
+#  define CKA_PUBLIC_KEY_INFO                          0x00000129UL
+# endif
+
+#endif
 
 #endif