From: Nikos Mavrogiannopoulos Date: Sat, 13 Sep 2014 11:06:33 +0000 (+0200) Subject: simulate pkcs11x.h when it doesn't exist X-Git-Tag: gnutls_3_4_0~938 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fb0624d1cbace4c94ce84eb9903a974e6446864;p=thirdparty%2Fgnutls.git simulate pkcs11x.h when it doesn't exist --- diff --git a/configure.ac b/configure.ac index 65eade2d7b..08d9c72a5a 100644 --- a/configure.ac +++ b/configure.ac @@ -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([[ diff --git a/lib/pkcs11.c b/lib/pkcs11.c index c5f3e062fc..3b55297908 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -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) diff --git a/lib/pkcs11x.c b/lib/pkcs11x.c index dbdd082d8c..7fe6fcdda7 100644 --- a/lib/pkcs11x.c +++ b/lib/pkcs11x.c @@ -19,8 +19,6 @@ * along with this program. If not, see */ -#define HAVE_PKCS11X_H - #include #include #include @@ -29,9 +27,7 @@ #include #include -#ifdef HAVE_PKCS11X_H -# include "pkcs11x.h" -#endif +#include "pkcs11x.h" struct find_ext_data_st { /* in */ diff --git a/lib/pkcs11x.h b/lib/pkcs11x.h index 0aac3f6f10..94ef48a330 100644 --- a/lib/pkcs11x.h +++ b/lib/pkcs11x.h @@ -21,6 +21,32 @@ #ifndef PKCS11X_H #define PKCS11X_H -#include +#ifdef HAVE_PKCS11X_H +# include +#else + +# include + +# 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