From c4d2611d123a47be00c29d8d718ed598a40da870 Mon Sep 17 00:00:00 2001 From: aet Date: Fri, 11 Jul 2003 16:31:06 +0000 Subject: [PATCH] - Various build fixes for various operating systems and compilers - Add missing .cvsignore files - Remove tools/ and make configure to work again git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1251 c6295689-39f2-0310-b995-f0e70906c6a9 --- AUTHORS | 1 + Makefile.am | 2 +- README | 1 + configure.in | 9 ++++----- src/pkcs11/libpkcs11.c | 9 ++++++--- src/pkcs11/openssl.c | 1 + src/pkcs11/pkcs11-object.c | 12 +++++++----- src/scrandom/scrandom.c | 17 +++++++++-------- src/tests/regression/.cvsignore | 19 +++++++++++++++++++ src/tools/pkcs11-tool.c | 6 +++--- src/usbtoken/Makefile.am | 2 ++ win32/.cvsignore | 19 +++++++++++++++++++ 12 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 AUTHORS create mode 100644 README create mode 100644 src/tests/regression/.cvsignore create mode 100644 win32/.cvsignore diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..4b74f24e --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +See docs/opensc.html for more info. diff --git a/Makefile.am b/Makefile.am index 44e73384..67feb9c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am -- Process this file with automake to produce Makefile.in -SUBDIRS = . tools aclocal docs etc src win32 +SUBDIRS = . aclocal docs etc src win32 EXTRA_DIST = CodingStyle bootstrap Makefile.mak diff --git a/README b/README new file mode 100644 index 00000000..4b74f24e --- /dev/null +++ b/README @@ -0,0 +1 @@ +See docs/opensc.html for more info. diff --git a/configure.in b/configure.in index 53cc3805..13ff6355 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Process this file with autoconf to produce a configure script. # Require autoconf 2.52 AC_PREREQ(2.52) -AC_INIT(opensc, 0.8.0-rc2) -AC_CONFIG_SRCDIR(src/libopensc/sc.c) -AC_CONFIG_AUX_DIR(tools) -AM_INIT_AUTOMAKE([foreign]) +AC_INIT(COPYING) +AM_INIT_AUTOMAKE(opensc, 0.8.0-rc2) AM_CONFIG_HEADER(config.h) +AC_CONFIG_SRCDIR(src/libopensc/sc.c) + AC_CANONICAL_HOST case $host in darwin* | rhapsody*) @@ -1194,7 +1194,6 @@ src/tests/Makefile src/tests/regression/Makefile src/tools/Makefile src/usbtoken/Makefile -tools/Makefile win32/Makefile ]) diff --git a/src/pkcs11/libpkcs11.c b/src/pkcs11/libpkcs11.c index 5497c5f5..f631844e 100644 --- a/src/pkcs11/libpkcs11.c +++ b/src/pkcs11/libpkcs11.c @@ -5,6 +5,9 @@ * Copyright (C) 2002 Olaf Kirch */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "pkcs11.h" #include #include @@ -17,7 +20,7 @@ struct sc_pkcs11_module { unsigned int _magic; -#if defined(linux) || defined(_WIN32) +#if defined(HAVE_DLFCN_H) || defined(_WIN32) void * _dl_handle; #endif #ifdef __APPLE__ @@ -78,7 +81,7 @@ C_UnloadModule(sc_pkcs11_module_t *mod) return CKR_OK; } -#ifdef linux +#ifdef HAVE_DLFCN_H #include /* @@ -187,7 +190,7 @@ sys_dlsym(sc_pkcs11_module_t *mod, const char *name) #include /* - * Module loader for MacOSX 10 + * Module loader for MacOS X */ int sys_dlopen(struct sc_pkcs11_module *mod, const char *name) diff --git a/src/pkcs11/openssl.c b/src/pkcs11/openssl.c index 4a37c65e..7dab09ba 100644 --- a/src/pkcs11/openssl.c +++ b/src/pkcs11/openssl.c @@ -5,6 +5,7 @@ * Copyright (C) 2002 Olaf Kirch */ +#include #include "sc-pkcs11.h" #include "opensc/scrandom.h" diff --git a/src/pkcs11/pkcs11-object.c b/src/pkcs11/pkcs11-object.c index 89ecde6c..15d13eec 100644 --- a/src/pkcs11/pkcs11-object.c +++ b/src/pkcs11/pkcs11-object.c @@ -937,11 +937,13 @@ CK_RV C_VerifyInit(CK_SESSION_HANDLE hSession, /* the session's handle */ if (rv != CKR_OK) goto out; - //rv = object->ops->get_attribute(session, object, &verify_attribute); - //if (rv != CKR_OK || !can_verify) { - // rv = CKR_KEY_TYPE_INCONSISTENT; - // goto out; - //} +#if 0 + rv = object->ops->get_attribute(session, object, &verify_attribute); + if (rv != CKR_OK || !can_verify) { + rv = CKR_KEY_TYPE_INCONSISTENT; + goto out; + } +#endif rv = object->ops->get_attribute(session, object, &key_type_attr); if (rv != CKR_OK) { rv = CKR_KEY_TYPE_INCONSISTENT; diff --git a/src/scrandom/scrandom.c b/src/scrandom/scrandom.c index 054fb708..4bf9dec7 100644 --- a/src/scrandom/scrandom.c +++ b/src/scrandom/scrandom.c @@ -19,11 +19,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _WIN32 - #ifdef HAVE_CONFIG_H #include #endif + +#ifndef _WIN32 #include #include #include @@ -310,14 +310,15 @@ int scrandom_get_data(unsigned char *buf, unsigned int len) #undef BLOCK_SIZE } -#else // #ifndef _WIN32 +#else -// Since the above is very *nix specific, we use Window's CryptoAPI -// random generation instead. +/* Since the above is very *nix specific, we use Window's CryptoAPI + * random generation instead. + */ #include "scrandom.h" -#include "windows.h" -#include "wincrypt.h" +#include +#include int scrandom_get_data(unsigned char *buf, unsigned int len) { @@ -334,4 +335,4 @@ int scrandom_get_data(unsigned char *buf, unsigned int len) return 0; } -#endif // #ifndef _WIN32 +#endif diff --git a/src/tests/regression/.cvsignore b/src/tests/regression/.cvsignore new file mode 100644 index 00000000..28bdbdc5 --- /dev/null +++ b/src/tests/regression/.cvsignore @@ -0,0 +1,19 @@ +.deps +.libs +.#*# +.*.bak +.*.orig +.*.rej +.*~ +#*# +*.bak +*.orig +*.rej +*~ +*.lo +*.la +*.u +gmon.out +core +Makefile +Makefile.in diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c index 1e2c1d2a..e2537e14 100644 --- a/src/tools/pkcs11-tool.c +++ b/src/tools/pkcs11-tool.c @@ -915,7 +915,9 @@ set_id_attr(CK_SLOT_ID slot, CK_SESSION_HANDLE session) { CK_OBJECT_HANDLE obj; CK_ATTRIBUTE templ[] = {CKA_ID, new_object_id, new_object_id_len}; - //CK_ATTRIBUTE templ2[] = {CKA_LABEL, "new_label", 9}; +#if 0 + CK_ATTRIBUTE templ2[] = {CKA_LABEL, "new_label", 9}; +#endif CK_RV rv; if (!find_object(session, opt_object_class, &obj, opt_object_id, opt_object_id_len, 0)) { @@ -2109,7 +2111,6 @@ p11_perror(const char *msg, CK_RV rv) int hex_to_bin(const char *in, unsigned char *out, size_t *outlen) { - int err = 0; size_t left, count = 0; if (in == NULL || *in == '\0') { @@ -2153,7 +2154,6 @@ int hex_to_bin(const char *in, unsigned char *out, size_t *outlen) c++; } -out: *outlen = count; return 1; } diff --git a/src/usbtoken/Makefile.am b/src/usbtoken/Makefile.am index cce1c4d4..c1c2e026 100644 --- a/src/usbtoken/Makefile.am +++ b/src/usbtoken/Makefile.am @@ -1,7 +1,9 @@ # Process this file with automake to create Makefile.in MAINTAINERCLEANFILES = Makefile.in +if HAVE_USBTOKEN sbin_PROGRAMS = usbtoken +endif usbtoken_SOURCES= atr.c eutron.c etoken.c ikey2k.c ikey3k.c main.c pid.c \ socket.c t1.c usb.c usbtoken.h diff --git a/win32/.cvsignore b/win32/.cvsignore new file mode 100644 index 00000000..28bdbdc5 --- /dev/null +++ b/win32/.cvsignore @@ -0,0 +1,19 @@ +.deps +.libs +.#*# +.*.bak +.*.orig +.*.rej +.*~ +#*# +*.bak +*.orig +*.rej +*~ +*.lo +*.la +*.u +gmon.out +core +Makefile +Makefile.in