remove code dealing with random numbers for now.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2420 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
e428f7e171
commit
dd08853693
|
@ -20,9 +20,7 @@ DISTCLEANFILES = \
|
|||
keycache.h \
|
||||
pkcs15-init.h \
|
||||
scconf.h \
|
||||
scdl.h \
|
||||
scldap.h \
|
||||
scrandom.h
|
||||
scdl.h
|
||||
|
||||
all-local:
|
||||
@$(RM) *.h
|
||||
|
|
|
@ -23,7 +23,7 @@ noinst_LTLIBRARIES = libpkcs11.la
|
|||
opensc_pkcs11_la_SOURCES = $(SRC) $(INC)
|
||||
opensc_pkcs11_la_LDFLAGS = -module -avoid-version
|
||||
opensc_pkcs11_la_LIBADD = @LIBOPENSC@ @LIBCRYPTO@ \
|
||||
../pkcs15init/libpkcs15init.la ../scrandom/libscrandom.la
|
||||
../pkcs15init/libpkcs15init.la
|
||||
|
||||
libpkcs11_la_SOURCES = libpkcs11.c
|
||||
libpkcs11_la_LDFLAGS = -version-info @OPENSC_LT_CURRENT@:@OPENSC_LT_REVISION@:@OPENSC_LT_AGE@
|
||||
|
|
|
@ -20,8 +20,8 @@ all: install-headers install-headers-dir $(TARGET) $(TARGET2) $(TARGET3)
|
|||
|
||||
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
|
||||
|
||||
$(TARGET): $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\scrandom\scrandom.lib ..\pkcs15init\pkcs15init.lib ..\scdl\scdl.lib
|
||||
link $(LINKFLAGS) /dll /out:$(TARGET) $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\scrandom\scrandom.lib ..\pkcs15init\pkcs15init.lib winscard.lib ..\scdl\scdl.lib $(OPENSSL_LIB) gdi32.lib
|
||||
$(TARGET): $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib ..\scdl\scdl.lib
|
||||
link $(LINKFLAGS) /dll /out:$(TARGET) $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib winscard.lib ..\scdl\scdl.lib $(OPENSSL_LIB) gdi32.lib
|
||||
|
||||
$(TARGET2): $(OBJECTS2) ..\scdl\scdl.lib
|
||||
lib /nologo /machine:ix86 /out:$(TARGET2) $(OBJECTS2) ..\scdl\scdl.lib
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "sc-pkcs11.h"
|
||||
#include "opensc/scrandom.h"
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/evp.h>
|
||||
|
@ -62,8 +61,6 @@ sc_pkcs11_register_openssl_mechanisms(struct sc_pkcs11_card *card)
|
|||
sc_pkcs11_register_mechanism(card, &openssl_ripemd160_mech);
|
||||
}
|
||||
|
||||
static int rng_seeded = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Handle OpenSSL digest functions
|
||||
|
@ -151,23 +148,11 @@ sc_pkcs11_openssl_add_gen_rand(struct sc_pkcs11_session *session,
|
|||
if (RandomData == NULL || ulRandomLen == 0)
|
||||
return CKR_OK;
|
||||
|
||||
if (scrandom_get_data(seed, 20) == -1) {
|
||||
sc_error(context, "scrandom_get_data() failed\n");
|
||||
return CKR_FUNCTION_FAILED;
|
||||
r = sc_get_challenge(session->slot->card->card, RandomData, ulRandomLen);
|
||||
if (r != 0) {
|
||||
sc_error(context, "sc_get_challenge() returned %d\n", r);
|
||||
return sc_to_cryptoki_error(r, session->slot->card->reader);
|
||||
}
|
||||
RAND_seed(seed, 20);
|
||||
|
||||
if (rng_seeded == 0) {
|
||||
r = sc_get_challenge(session->slot->card->card, seed, 20);
|
||||
if (r != 0) {
|
||||
sc_error(context, "sc_get_challenge() returned %d\n", r);
|
||||
return sc_to_cryptoki_error(r, session->slot->card->reader);
|
||||
}
|
||||
rng_seeded = 1;
|
||||
}
|
||||
RAND_seed(seed, 20);
|
||||
|
||||
r = RAND_bytes(RandomData, ulRandomLen);
|
||||
|
||||
return r == 1 ? CKR_OK : CKR_FUNCTION_FAILED;
|
||||
}
|
||||
|
|
|
@ -918,7 +918,7 @@ CK_RV C_SeedRandom(CK_SESSION_HANDLE hSession, /* the session's handle */
|
|||
CK_BYTE_PTR pSeed, /* the seed material */
|
||||
CK_ULONG ulSeedLen) /* count of bytes of seed material */
|
||||
{
|
||||
#ifdef HAVE_OPENSSL
|
||||
#ifdef NEW_IMPLEMENTATION_COMPLETE
|
||||
struct sc_pkcs11_session *session;
|
||||
int rv;
|
||||
|
||||
|
@ -941,7 +941,7 @@ CK_RV C_GenerateRandom(CK_SESSION_HANDLE hSession, /* the session's handle */
|
|||
CK_BYTE_PTR RandomData, /* receives the random data */
|
||||
CK_ULONG ulRandomLen) /* number of bytes to be generated */
|
||||
{
|
||||
#ifdef HAVE_OPENSSL
|
||||
#ifdef NEW_IMPLEMENTATION_COMPLETE
|
||||
struct sc_pkcs11_session *session;
|
||||
int rv;
|
||||
|
||||
|
|
Loading…
Reference in New Issue