compiles for windoze
This commit is contained in:
23
configure.in
23
configure.in
@@ -71,17 +71,11 @@ AC_ARG_ENABLE(dot,
|
||||
test "$enableval" = "yes" && HAVE_DOT="YES" || HAVE_DOT="NO";
|
||||
AM_PATH_CPPUNIT([1.0.0], [have_cppunit="yes"], [have_cppunit="no"])
|
||||
|
||||
# Special Options
|
||||
AC_ARG_ENABLE(win,
|
||||
[AS_HELP_STRING([--enable-win],
|
||||
[on linux, also builds windows version using mingw])],
|
||||
[build_win="$enableval"], [build_win="no"])
|
||||
AM_CONDITIONAL(BUILD_WIN, test "$build_win" = "yes")
|
||||
AC_ARG_ENABLE(32bit-linux,
|
||||
[AS_HELP_STRING([--enable-32bit-linux],
|
||||
[build for 32bit linux instead of plattform specific])],
|
||||
[build_lin32="$enableval"], [build_lin32="no"])
|
||||
AM_CONDITIONAL(BUILD_LIN32, test "$build_lin32" = "yes")
|
||||
case $host_os in
|
||||
*mingw32*) MINGW32=yes;;
|
||||
*) MINGW32=no;;
|
||||
esac
|
||||
AM_CONDITIONAL(MINGW32, test "$MINGW32" = "yes")
|
||||
|
||||
# export macros
|
||||
SRCDIR=${srcdir}
|
||||
@@ -118,10 +112,3 @@ AC_MSG_NOTICE([Pedantic compile mode enabled!
|
||||
- all warnings for GNU g++ are enabled
|
||||
- all warnings result in an error
|
||||
- doxygen warnings are treated as error too]); fi
|
||||
if test "$build_win" == "yes"; then
|
||||
AC_MSG_NOTICE([Will cross-compile for windows
|
||||
Requires:
|
||||
- mingw32, mingw32-binutils, mingw32-runtime
|
||||
- i586-mingw32msvc-g++, i586-mingw32msvc-ar,
|
||||
i586-mingw32msvc-windres, i586-mingw32msvc-strip
|
||||
- Boost for MinGW in ~/.wine/drive_c/Programme/Boost-1.34.1]); fi
|
||||
|
@@ -5,14 +5,26 @@
|
||||
|
||||
noinst_PROGRAMS = pcsc-demo cryptoki-demo
|
||||
|
||||
AM_CXXFLAGS = -I${top_srcdir}/src \
|
||||
-I/usr/include/PCSC
|
||||
AM_CPPFLAGS = -I${top_srcdir}/src
|
||||
if !MINGW32
|
||||
AM_CPPFLAGS += -I/usr/include/PCSC
|
||||
endif
|
||||
|
||||
pcsc_demo_SOURCES = pcsc-demo.cxx
|
||||
if MINGW32
|
||||
pcsc_demo_LDFLAGS = -L.
|
||||
pcsc_demo_LDADD = winscard.a
|
||||
else
|
||||
pcsc_demo_LDADD = -lpcsclite
|
||||
endif
|
||||
|
||||
cryptoki_demo_SOURCES = cryptoki-demo.cxx
|
||||
cryptoki_demo_LDADD = -ldl -lpthread -lssl -lcryptoki++
|
||||
cryptoki_demo_LDADD = -lcryptoki++
|
||||
cryptoki_demo_LDFLAGS = -L${top_builddir}/src
|
||||
if MINGW32
|
||||
cryptoki_demo_LDADD += -leay32
|
||||
else
|
||||
cryptoki_demo_LDADD += -ldl -lpthread -lssl
|
||||
endif
|
||||
|
||||
MAINTAINERCLEANFILES = makefile.in
|
||||
|
21
install-64-and-32-bit-linux.sh
Executable file
21
install-64-and-32-bit-linux.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
./bootstrap.sh && \
|
||||
LDFLAGS="-L/usr/lib32 -m32" CXXFLAGS="-m32" ./configure \
|
||||
--libdir=/usr/local/lib32 \
|
||||
--build=x86_64 \
|
||||
--host=i386 && \
|
||||
make && \
|
||||
sudo make install && \
|
||||
make clean && \
|
||||
LDFLAGS="-L/opt/local/i586-mingw32msvc/lib" \
|
||||
CPPFLAGS="-I/opt/local/i586-mingw32msvc/include" \
|
||||
./configure \
|
||||
--prefix=/opt/local/i586-mingw32msvc \
|
||||
--build=x86_64 \
|
||||
--host=i586-mingw32msvc && \
|
||||
make && \
|
||||
sudo make install && \
|
||||
make clean && \
|
||||
./configure && \
|
||||
make check && \
|
||||
sudo make install
|
||||
|
@@ -9,27 +9,29 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#ifndef WIN32
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <iostream>
|
||||
#define CRYPTOKI_LOG(X) std::clog<<"... "<<X<<" in "<<__PRETTY_FUNCTION__<<std::endl;
|
||||
#else
|
||||
#include <windows.h>
|
||||
#undef ERROR
|
||||
#endif
|
||||
|
||||
namespace cryptoki {
|
||||
|
||||
#ifndef CRYPTOKI_FN_LOG
|
||||
#if __GNUC__ >= 2
|
||||
#define CRYPTOKI_FN_LOG(X) (std::string(X " failed in ") \
|
||||
+std::string(__PRETTY_FUNCTION__))
|
||||
#else
|
||||
#define CRYPTOKI_FN_LOG(X) X " failed"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool Init::functionList(const std::string& library) {
|
||||
#ifndef WIN32
|
||||
void* lib(dlopen(library.c_str(), RTLD_NOW));
|
||||
#else
|
||||
HMODULE lib(LoadLibrary(library.c_str()));
|
||||
#endif
|
||||
if (!lib) throw exception("open of library failed: "+library);
|
||||
#ifndef WIN32
|
||||
CK_RV(*fn)(CK_FUNCTION_LIST**)
|
||||
((CK_RV(*)(CK_FUNCTION_LIST**))dlsym(lib, "C_GetFunctionList"));
|
||||
#else
|
||||
CK_RV(*fn)(CK_FUNCTION_LIST**)
|
||||
((CK_RV(*)(CK_FUNCTION_LIST**))GetProcAddress(lib, "C_GetFunctionList"));
|
||||
#endif
|
||||
if (!fn)
|
||||
throw exception("required library symbol C_GetFunctionList not found in "
|
||||
+library);
|
||||
|
319
src/cryptoki.hxx
319
src/cryptoki.hxx
@@ -24,14 +24,53 @@
|
||||
#include <memory>
|
||||
#include <cryptaux.hxx>
|
||||
|
||||
#include <iostream> // debug
|
||||
|
||||
/*! @defgroup gcryptoki C++ Wrapper around Cryptoki API */
|
||||
//@{
|
||||
/*! @defgroup cryptokilib Cryptoki C++ Library */
|
||||
/*! @defgroup globaloperator Global Operator */
|
||||
/*! @defgroup cryptokitypes Cryptoki C++ Types and Auxiliary */
|
||||
/*! @defgroup cryptokiexceptions Cryptoki Exceptions */
|
||||
|
||||
#ifndef CRYPTOKI_FN_LOG
|
||||
#include <iostream>
|
||||
#if __GNUC__ >= 2
|
||||
//! Cryptoki Error Message Formatting
|
||||
/*! If you want to change cryptoki error formatting, just
|
||||
redefine your own CRYPTOKY_FN_LOG macro before <code>#include
|
||||
<cryptoki.hxx></code>.
|
||||
#return std::String */
|
||||
#define CRYPTOKI_FN_LOG(X) (std::string(X " failed in ") \
|
||||
+std::string(__PRETTY_FUNCTION__))
|
||||
#else
|
||||
#define CRYPTOKI_QUOTE(X) #X
|
||||
//! Cryptoki Error Message Formatting
|
||||
/*! If you want to change cryptoki error formatting, just
|
||||
redefine your own CRYPTOKY_FN_LOG macro before <code>#include
|
||||
<cryptoki.hxx></code>.
|
||||
#return std::String */
|
||||
#define CRYPTOKI_FN_LOG(X) X " failed in \
|
||||
" __FILE__ ":" CRYPTOKI_QUOTE(__LINE__)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CRYPTOKI_LOG
|
||||
#include <iostream>
|
||||
#if __GNUC__ >= 2
|
||||
//! Cryptoki Logging
|
||||
/*! If you want to change cryptoki logging mechanism, just
|
||||
redefine your own CRYPTOKY_LOG macro before <code>#include
|
||||
<cryptoki.hxx></code>. Define it empty for no logging at
|
||||
all. By default logs to <code>std::clog</code>. */
|
||||
#define CRYPTOKI_LOG(X) std::clog<<X<<" @ "<<__PRETTY_FUNCTION__<<std::endl
|
||||
#else
|
||||
//! Cryptoki Logging
|
||||
/*! If you want to change cryptoki logging mechanism, just
|
||||
redefine your own CRYPTOKY_LOG macro before <code>#include
|
||||
<cryptoki.hxx></code>. Define it empty for no logging at
|
||||
all. By default logs to <code>std::clog</code>. */
|
||||
#define CRYPTOKI_LOG(X) std::clog<<X<<" @ "<<__FILE__<<__LINE__<<std::endl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! @see gcryptoki
|
||||
namespace cryptoki {
|
||||
|
||||
@@ -148,17 +187,6 @@ namespace cryptoki {
|
||||
T* _p;
|
||||
};
|
||||
|
||||
#ifndef CRYPTOKI_FN_LOG
|
||||
#if __GNUC__ >= 2
|
||||
#define CRYPTOKI_FN_LOG(X) (std::string(X " failed in ") \
|
||||
+std::string(__PRETTY_FUNCTION__))
|
||||
#else
|
||||
#define CRYPTOKI_FN_LOG(X) X " failed in \
|
||||
" __FILE__ ":" CRYPTOKI_QUOTE(__LINE__)
|
||||
#endif
|
||||
#define UNDEF_CRYPTOKI_FN_LOG
|
||||
#endif
|
||||
|
||||
//! @addtogroup cryptokitypes
|
||||
//@{
|
||||
|
||||
@@ -342,7 +370,7 @@ namespace cryptoki {
|
||||
default: return crypto::readable(value);
|
||||
}
|
||||
}
|
||||
template<typename TYPE> Attribute from(const TYPE& v) {
|
||||
template<typename TYPE> Attribute& from(const TYPE& v) {
|
||||
value = std::string((char*)&v, sizeof(TYPE));
|
||||
return *this;
|
||||
}
|
||||
@@ -803,6 +831,17 @@ namespace cryptoki {
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Don't use without assignment! For standard containers only!
|
||||
Slot(): _init(0) {
|
||||
}
|
||||
|
||||
Slot& operator=(const Slot& o) {
|
||||
_init = o._init;
|
||||
_slot = o._slot;
|
||||
_res = o._res;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! @name C Like Error Handling
|
||||
|
||||
@@ -1052,69 +1091,6 @@ namespace cryptoki {
|
||||
//! Create a new object.
|
||||
Object create(const AttributeList& attrs);
|
||||
|
||||
std::string decrypt(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok (seems so ...)
|
||||
//! calls @c C_Decrypt
|
||||
check(_slot._init->_fn->C_Decrypt
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_Decrypt"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string decryptdigestupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptDigestUpdate
|
||||
check(_slot._init->_fn->C_DecryptDigestUpdate
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptDigestUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool decryptfinal() {
|
||||
//! calls @c C_DecryptFinal
|
||||
return check(_slot._init->_fn->C_DecryptFinal(_session, 0, 0),
|
||||
CRYPTOKI_FN_LOG("C_DecryptFinal"));
|
||||
//! @todo does this work?
|
||||
}
|
||||
|
||||
std::string decryptupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptUpdate
|
||||
check(_slot._init->_fn->C_DecryptUpdate
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string decryptverifyupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptVerifyUpdate
|
||||
check(_slot._init->_fn->C_DecryptVerifyUpdate
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptVerifyUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string digest(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
@@ -1170,43 +1146,6 @@ namespace cryptoki {
|
||||
}
|
||||
@endcode */
|
||||
|
||||
std::string encrypt(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_Encrypt
|
||||
check(_slot._init->_fn->C_Encrypt
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_Encrypt"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! @todo Not implemented:
|
||||
@code
|
||||
bool encryptfinal() {
|
||||
//! calls @c C_EncryptFinal
|
||||
return check(_slot._init->_fn->C_EncryptFinal(_session, CK_BYTE_PTR, CK_ULONG_PTR),
|
||||
CRYPTOKI_FN_LOG("C_EncryptFinal"));
|
||||
}
|
||||
@endcode */
|
||||
|
||||
std::string encryptupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_EncryptUpdate
|
||||
check(_slot._init->_fn->C_EncryptUpdate
|
||||
(_session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_EncryptUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! @todo Not implemented:
|
||||
@code
|
||||
bool findobjectsfinal() {
|
||||
@@ -1478,6 +1417,23 @@ namespace cryptoki {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! @name Comfortable Access
|
||||
|
||||
Use these methods in favour of the Low Level Cryptoki
|
||||
Functions. They provide a higher level simpler access. */
|
||||
//@{
|
||||
|
||||
std::string decrypt(std::string data, CK_MECHANISM_TYPE type,
|
||||
std::string param=std::string()) {
|
||||
CRYPTOKI_LOG("decryptinit");
|
||||
decryptinit(type, param);
|
||||
CRYPTOKI_LOG("decrypt");
|
||||
return decrypt(data);
|
||||
//! @todo don't call decryptfinal()?
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
/*! @name C Like Error Handling
|
||||
|
||||
You are strongly recommended not to disable exception
|
||||
@@ -1513,18 +1469,90 @@ namespace cryptoki {
|
||||
CRYPTOKI_FN_LOG("C_CopyObject"));
|
||||
}
|
||||
@endcode */
|
||||
|
||||
//! Call this method on a key object only.
|
||||
|
||||
bool decryptinit(CK_MECHANISM_TYPE type, std::string param) {
|
||||
CK_MECHANISM mech = {
|
||||
type, param.begin().operator->(), param.size()
|
||||
type, param.size()?¶m[0]:0, param.size()
|
||||
};
|
||||
CRYPTOKI_LOG("decryptinit: type="<<type<<"; mech=("<<mech.mechanism
|
||||
<<", "<<mech.pParameter<<", "<<mech.ulParameterLen<<')');
|
||||
//! calls @c C_DecryptInit
|
||||
return check(_session._slot._init->_fn->C_DecryptInit
|
||||
(_session._session, &mech, _object),
|
||||
CRYPTOKI_FN_LOG("C_DecryptInit"));
|
||||
}
|
||||
|
||||
//! requires decryptinit to be called before
|
||||
std::string decrypt(std::string in) {
|
||||
std::string res;
|
||||
CK_ULONG size(0); // two calls, first to get minimum buffer length
|
||||
CRYPTOKI_LOG("get size");
|
||||
//! calls @c C_Decrypt
|
||||
check(_session._slot._init->_fn->C_Decrypt
|
||||
(_session._session,
|
||||
(unsigned char*)&in[0], in.size(), 0, &size),
|
||||
CRYPTOKI_FN_LOG("C_Decrypt"));
|
||||
CRYPTOKI_LOG("maximum size is "<<size<<"Bytes");
|
||||
res.resize(size, 0);
|
||||
check(_session._slot._init->_fn->C_Decrypt
|
||||
(_session._session,
|
||||
(unsigned char*)&in[0], in.size(),
|
||||
(unsigned char*)&res[0], &size),
|
||||
CRYPTOKI_FN_LOG("C_Decrypt"));
|
||||
CRYPTOKI_LOG("exact size is "<<size<<"Bytes");
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string decryptdigestupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptDigestUpdate
|
||||
check(_session._slot._init->_fn->C_DecryptDigestUpdate
|
||||
(_session._session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptDigestUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool decryptfinal() {
|
||||
//! calls @c C_DecryptFinal
|
||||
return check(_session._slot._init->_fn->C_DecryptFinal
|
||||
(_session._session, 0, 0),
|
||||
CRYPTOKI_FN_LOG("C_DecryptFinal"));
|
||||
//! @todo does this work?
|
||||
}
|
||||
|
||||
std::string decryptupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptUpdate
|
||||
check(_session._slot._init->_fn->C_DecryptUpdate
|
||||
(_session._session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string decryptverifyupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_DecryptVerifyUpdate
|
||||
check(_session._slot._init->_fn->C_DecryptVerifyUpdate
|
||||
(_session._session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_DecryptVerifyUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! @todo Not implemented:
|
||||
@code
|
||||
@@ -1563,6 +1591,42 @@ namespace cryptoki {
|
||||
}
|
||||
@endcode */
|
||||
|
||||
std::string encrypt(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_Encrypt
|
||||
check(_session._slot._init->_fn->C_Encrypt
|
||||
(_session._session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_Encrypt"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! @todo Not implemented:
|
||||
@code
|
||||
bool encryptfinal() {
|
||||
//! calls @c C_EncryptFinal
|
||||
return check(_session._slot._init->_fn->C_EncryptFinal(_session._session, CK_BYTE_PTR, CK_ULONG_PTR),
|
||||
CRYPTOKI_FN_LOG("C_EncryptFinal"));
|
||||
}
|
||||
@endcode */
|
||||
|
||||
std::string encryptupdate(std::string in) {
|
||||
std::string res;
|
||||
res.resize(in.size());
|
||||
CK_ULONG size(res.size()); //! @todo check if size is ok
|
||||
//! calls @c C_EncryptUpdate
|
||||
check(_session._slot._init->_fn->C_EncryptUpdate
|
||||
(_session._session,
|
||||
(unsigned char*)in.begin().operator->(), in.size(),
|
||||
(unsigned char*)res.begin().operator->(), &size),
|
||||
CRYPTOKI_FN_LOG("C_EncryptUpdate"));
|
||||
res.resize(size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! @todo Not implemented:
|
||||
@code
|
||||
@@ -1882,12 +1946,23 @@ namespace cryptoki {
|
||||
|
||||
};
|
||||
//@}
|
||||
|
||||
#ifdef UNDEF_CRYPTOKI_FN_LOG // cleanup if it was set in here
|
||||
#undef CRYPTOKI_FN_LOG
|
||||
#undef CRYPTOKI_QUOTE
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//! @groupadd globaloperator
|
||||
//@{
|
||||
inline cryptoki::AttributeList& operator<<(cryptoki::AttributeList& list,
|
||||
const cryptoki::Attribute& attr) {
|
||||
list.push_back(attr);
|
||||
return list;
|
||||
}
|
||||
inline cryptoki::AttributeList operator<<(const cryptoki::AttributeList& list,
|
||||
const cryptoki::Attribute& attr) {
|
||||
cryptoki::AttributeList res(list);
|
||||
res.push_back(attr);
|
||||
return res;
|
||||
}
|
||||
//@}
|
||||
|
||||
//@}
|
||||
#endif
|
||||
|
@@ -14,10 +14,6 @@ lib_LTLIBRARIES = libcryptoki++.la
|
||||
libcryptoki___la_SOURCES = cryptoki.cxx cryptoki.hxx ${pkcs11_HEADERS}
|
||||
libcryptoki___la_LIBADD = -lssl
|
||||
|
||||
if BUILD_WIN
|
||||
else
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
-rm -r ${QMAKE_TARGET}.app
|
||||
|
||||
|
27
src/pcsc.hxx
27
src/pcsc.hxx
@@ -34,20 +34,29 @@
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#undef UNICODE
|
||||
#include <WinSCard.h>
|
||||
#undef ERROR
|
||||
#ifndef MAX_ATR_SIZE
|
||||
#define MAX_ATR_SIZE 33
|
||||
#endif
|
||||
namespace pcsc {
|
||||
//! stupid windows needs std::wstring
|
||||
inline std::wstring strconv(std::string s) {
|
||||
return std::wstring(s.begin(), s.end());
|
||||
}
|
||||
inline std::string strconv(std::wstring s) {
|
||||
return std::string(s.begin(), s.end());
|
||||
}
|
||||
typedef wchar_t char_t;
|
||||
typedef std::wstring string;
|
||||
#ifdef UNICODE
|
||||
inline std::wstring strconv(std::string s) {
|
||||
return std::wstring(s.begin(), s.end());
|
||||
}
|
||||
inline std::string strconv(std::wstring s) {
|
||||
return std::string(s.begin(), s.end());
|
||||
}
|
||||
typedef wchar_t char_t;
|
||||
typedef std::wstring string;
|
||||
#else
|
||||
inline const std::string& strconv(const std::string& s) {
|
||||
return s;
|
||||
}
|
||||
typedef char char_t;
|
||||
typedef std::string string;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#include <PCSC/pcsclite.h>
|
||||
|
@@ -13,5 +13,5 @@ TESTS=${check_PROGRAMS}
|
||||
sharedpointer_test_SOURCES = sharedpointer_test.cxx
|
||||
sharedpointer_test_LDFLAGS = -lcryptoki++
|
||||
|
||||
CLEANFILES =
|
||||
CLEANFILES = $(check_PROGRAMS:%=%.xml)
|
||||
MAINTAINERCLEANFILES = makefile.in
|
||||
|
Reference in New Issue
Block a user