- win32 patch from Stef Hoeben
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@769 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
2e6af762c3
commit
23158d7a96
|
@ -1,5 +1,5 @@
|
|||
|
||||
SUBDIRS = include common scconf libopensc tools pkcs11
|
||||
SUBDIRS = include common scconf libopensc tools tests scrandom pkcs15init pkcs11
|
||||
|
||||
all::
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ TOPDIR = ..\..
|
|||
TARGET = opensc-pkcs11.dll
|
||||
|
||||
OBJECTS = pkcs11-global.obj pkcs11-session.obj pkcs11-object.obj misc.obj slot.obj \
|
||||
secretkey.obj framework-pkcs15.obj
|
||||
secretkey.obj framework-pkcs15.obj framework-pkcs15init.obj
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
link $(LINKFLAGS) /dll /out:$(TARGET) $(OBJECTS) ..\libopensc\opensc.lib winscard.lib
|
||||
link $(LINKFLAGS) /dll /out:$(TARGET) $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib winscard.lib
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <string.h>
|
||||
#include "sc-pkcs11.h"
|
||||
#ifdef USE_PKCS15_INIT
|
||||
#include "pkcs15-init.h"
|
||||
#include "opensc/pkcs15-init.h"
|
||||
|
||||
/*
|
||||
* Deal with uninitialized cards
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
#define DEF_PRKEY_DSA_ACCESS 0x12
|
||||
#define DEF_PUBKEY_ACCESS 0x12
|
||||
|
||||
#ifdef _WIN32
|
||||
#define access(name, R_OK) _access(name, 4)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Parser state
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
@ -307,3 +309,29 @@ int scrandom_get_data(unsigned char *buf, unsigned int len)
|
|||
return rv;
|
||||
#undef BLOCK_SIZE
|
||||
}
|
||||
|
||||
#else // #ifndef _WIN32
|
||||
|
||||
// Since the above is very *nix specific, we use Window's CryptoAPI
|
||||
// random generation instead.
|
||||
|
||||
#include "scrandom.h"
|
||||
#include "windows.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
int scrandom_get_data(unsigned char *buf, unsigned int len)
|
||||
{
|
||||
HCRYPTPROV hProv = 0;
|
||||
|
||||
if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
||||
return GetLastError();
|
||||
|
||||
if(!CryptGenRandom(hProv, len, buf))
|
||||
return GetLastError();
|
||||
|
||||
CryptReleaseContext(hProv, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // #ifndef _WIN32
|
||||
|
|
|
@ -13,5 +13,6 @@ all: util.obj $(TARGETS)
|
|||
|
||||
.c.exe:
|
||||
cl $(COPTS) /c $<
|
||||
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj util.obj ..\common\common.lib ..\libopensc\opensc.lib
|
||||
|
||||
link $(LINKFLAGS) /pdb:$*.pdb /out:$@ $*.obj util.obj \
|
||||
..\common\common.lib ..\scconf\scconf.lib ..\libopensc\opensc.lib \
|
||||
..\pkcs15init\pkcs15init.lib libeay32.lib
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
#include <opensc/pkcs15-init.h>
|
||||
#include "util.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
char *getpass(const char *prompt); /* in src/common/getpass.c */
|
||||
#endif
|
||||
|
||||
#undef GET_KEY_ECHO_OFF
|
||||
|
||||
const char *app_name = "pkcs15-init";
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#include <opensc/pkcs15.h>
|
||||
#include "util.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
char *getpass(const char *prompt); /* in src/common/getpass.c */
|
||||
#endif
|
||||
|
||||
const char *app_name = "pkcs15-tool";
|
||||
|
||||
int opt_reader = 0, opt_debug = 0;
|
||||
|
|
Loading…
Reference in New Issue