Merge branch 'master' of https://github.com/OpenSC/OpenSC
This commit is contained in:
commit
3f8f6facf5
|
@ -2,10 +2,10 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
|||
EXTRA_DIST = Makefile.mak
|
||||
|
||||
# Order IS important
|
||||
SUBDIRS = common scconf libsm pkcs15init libopensc pkcs11 \
|
||||
SUBDIRS = common scconf pkcs15init libopensc pkcs11 \
|
||||
tools tests minidriver
|
||||
|
||||
if ENABLE_SM
|
||||
SUBDIRS += smm
|
||||
SUBDIRS += smm libsm
|
||||
endif
|
||||
|
||||
|
|
|
@ -1185,7 +1185,7 @@ static int entersafe_write_large_rsa_key(sc_card_t *card,u8 key_id,struct sc_pkc
|
|||
sbuff[0]=0x83;
|
||||
sbuff[1]=0x02;
|
||||
sbuff[2]=key_id;
|
||||
sbuff[3]=0xA2;
|
||||
sbuff[3]=0x2A;
|
||||
sbuff[4]=0x89;
|
||||
sbuff[5]=0x40;
|
||||
memcpy(sbuff+6,rsa->modulus.data,0x40);
|
||||
|
|
|
@ -26,16 +26,13 @@
|
|||
#include "asn1.h"
|
||||
#include "cardctl.h"
|
||||
|
||||
#ifndef ENABLE_OPENSSL
|
||||
#error "Need OpenSSL"
|
||||
#endif
|
||||
|
||||
#include "sm.h"
|
||||
#include "iasecc.h"
|
||||
#include "authentic.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_SM
|
||||
|
||||
static int
|
||||
sm_save_sc_context (struct sc_card *card, struct sm_info *sm_info)
|
||||
{
|
||||
|
|
|
@ -312,7 +312,6 @@ sc_pkcs15_convert_pubkey
|
|||
sc_sm_parse_answer
|
||||
sc_sm_update_apdu_response
|
||||
sc_sm_single_transmit
|
||||
iasecc_sdo_encode_update_field
|
||||
iasecc_sm_create_file
|
||||
iasecc_sm_delete_file
|
||||
iasecc_sm_external_authentication
|
||||
|
|
|
@ -203,29 +203,32 @@ sc_dump_hex(const u8 * in, size_t count)
|
|||
{
|
||||
static char dump_buf[0x1000];
|
||||
size_t ii, size = sizeof(dump_buf) - 0x10;
|
||||
size_t offs = 0;
|
||||
size_t offs = 0;
|
||||
|
||||
memset(dump_buf, 0, sizeof(dump_buf));
|
||||
if (in == NULL)
|
||||
return dump_buf;
|
||||
return dump_buf;
|
||||
|
||||
for (ii=0; ii<count; ii++) {
|
||||
if (!(ii%16)) {
|
||||
if (!(ii%48))
|
||||
if (!ii)
|
||||
snprintf(dump_buf + offs, size - offs, ":\n");
|
||||
else if (!(ii%48))
|
||||
snprintf(dump_buf + offs, size - offs, "\n");
|
||||
else
|
||||
snprintf(dump_buf + offs, size - offs, " ");
|
||||
offs = strlen(dump_buf);
|
||||
}
|
||||
|
||||
snprintf(dump_buf + offs, size - offs, "%02X", *(in + ii));
|
||||
offs = strlen(dump_buf);
|
||||
offs += 2;
|
||||
|
||||
if (offs > size)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ii<count)
|
||||
snprintf(dump_buf + offs, sizeof(dump_buf) - offs, "....\n");
|
||||
if (ii<count)
|
||||
snprintf(dump_buf + offs, sizeof(dump_buf) - offs, "....\n");
|
||||
|
||||
return dump_buf;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "internal.h"
|
||||
#include "asn1.h"
|
||||
#include "sm.h"
|
||||
|
||||
static const struct sc_asn1_entry c_asn1_sm_response[4] = {
|
||||
{ "encryptedData", SC_ASN1_OCTET_STRING, SC_ASN1_CTX | 7, SC_ASN1_OPTIONAL, NULL, NULL },
|
||||
|
@ -160,14 +161,14 @@ sc_sm_single_transmit(struct sc_card *card, struct sc_apdu *apdu)
|
|||
}
|
||||
#else
|
||||
int
|
||||
sc_sm_parse_answer(struct sc_context *ctx, unsigned char *resp_data, size_t resp_len,
|
||||
sc_sm_parse_answer(struct sc_card *card, unsigned char *resp_data, size_t resp_len,
|
||||
struct sm_card_response *out)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
int
|
||||
sc_sm_update_apdu_response(struct sc_card *card, unsigned char *resp_data, size_t resp_len, int ref_rv,
|
||||
struct sc_apdu *apdu)
|
||||
sc_sm_update_apdu_response(struct sc_card *card, unsigned char *resp_data, size_t resp_len,
|
||||
int ref_rv, struct sc_apdu *apdu)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
|
|
@ -164,12 +164,14 @@ static int lock_card(struct pkcs15_fw_data *);
|
|||
static int unlock_card(struct pkcs15_fw_data *);
|
||||
static int reselect_app_df(sc_pkcs15_card_t *p15card);
|
||||
|
||||
#ifdef USE_PKCS15_INIT
|
||||
static CK_RV set_gost_params(struct sc_pkcs15init_keyarg_gost_params *,
|
||||
struct sc_pkcs15init_keyarg_gost_params *,
|
||||
CK_ATTRIBUTE_PTR, CK_ULONG, CK_ATTRIBUTE_PTR, CK_ULONG);
|
||||
static CK_RV pkcs15_create_slot(struct sc_pkcs11_card *p11card, struct pkcs15_fw_data *fw_data,
|
||||
struct sc_pkcs15_object *auth, struct sc_app_info *app,
|
||||
struct sc_pkcs11_slot **out);
|
||||
#endif
|
||||
|
||||
/* Returns WF data corresponding to the given application or,
|
||||
* if application info is not supplied, returns first available WF data. */
|
||||
|
@ -2721,6 +2723,9 @@ kpgen_done:
|
|||
static CK_RV
|
||||
pkcs15_skey_destroy(struct sc_pkcs11_session *session, void *object)
|
||||
{
|
||||
#ifndef USE_PKCS15_INIT
|
||||
return CKR_FUNCTION_NOT_SUPPORTED;
|
||||
#else
|
||||
struct pkcs15_any_object *any_obj = (struct pkcs15_any_object*) object;
|
||||
struct sc_pkcs11_card *p11card = session->slot->card;
|
||||
struct pkcs15_fw_data *fw_data = NULL;
|
||||
|
@ -2746,6 +2751,7 @@ pkcs15_skey_destroy(struct sc_pkcs11_session *session, void *object)
|
|||
return sc_to_cryptoki_error(rv, "C_DestroyObject");
|
||||
|
||||
return CKR_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static CK_RV
|
||||
|
@ -2852,8 +2858,8 @@ struct sc_pkcs11_framework_ops framework_pkcs15 = {
|
|||
pkcs15_login,
|
||||
pkcs15_logout,
|
||||
pkcs15_change_pin,
|
||||
pkcs15_initialize,
|
||||
#ifdef USE_PKCS15_INIT
|
||||
pkcs15_initialize,
|
||||
pkcs15_init_pin,
|
||||
pkcs15_create_object,
|
||||
pkcs15_gen_keypair,
|
||||
|
@ -2861,6 +2867,7 @@ struct sc_pkcs11_framework_ops framework_pkcs15 = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
pkcs15_get_random
|
||||
};
|
||||
|
|
|
@ -389,7 +389,9 @@ int main(int argc, char * argv[])
|
|||
CK_RV rv;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (_set_fmode(_O_BINARY) == EINVAL)
|
||||
if(_setmode(_fileno(stdout), _O_BINARY ) == -1)
|
||||
util_fatal("Cannot set FMODE to O_BINARY");
|
||||
if(_setmode(_fileno(stdin), _O_BINARY ) == -1)
|
||||
util_fatal("Cannot set FMODE to O_BINARY");
|
||||
#endif
|
||||
|
||||
|
@ -1458,7 +1460,7 @@ static void hash_data(CK_SLOT_ID slot, CK_SESSION_HANDLE session)
|
|||
|
||||
if (opt_input == NULL)
|
||||
fd = 0;
|
||||
else if ((fd = open(opt_input, O_RDONLY)) < 0)
|
||||
else if ((fd = open(opt_input, O_RDONLY|O_BINARY)) < 0)
|
||||
util_fatal("Cannot open %s: %m", opt_input);
|
||||
|
||||
while ((r = read(fd, buffer, sizeof(buffer))) > 0) {
|
||||
|
|
Loading…
Reference in New Issue