Nils Larsch:
here is a patch to remove a bug in card-starcos.c and two warnings: card-starcos.c: fix apdu.le value pkcs15-pin.c: remove unused labels => avoid compiler warnings pkcs11-tool.c : remove memory leak (a RSA_free() was missing) and simplify code (+ remove warning). git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1072 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
fecf9f5e15
commit
07668a30ff
|
@ -320,7 +320,7 @@ static int starcos_select_fid(struct sc_card *card,
|
||||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x00, 0x00);
|
sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x00, 0x00);
|
||||||
apdu.resp = (u8*)resp;
|
apdu.resp = (u8*)resp;
|
||||||
apdu.resplen = SC_MAX_APDU_BUFFER_SIZE;
|
apdu.resplen = SC_MAX_APDU_BUFFER_SIZE;
|
||||||
apdu.le = 0;
|
apdu.le = 256;
|
||||||
apdu.lc = 2;
|
apdu.lc = 2;
|
||||||
apdu.data = (u8*)data;
|
apdu.data = (u8*)data;
|
||||||
apdu.datalen = 2;
|
apdu.datalen = 2;
|
||||||
|
|
|
@ -267,7 +267,7 @@ int sc_pkcs15_change_pin(struct sc_pkcs15_card *p15card,
|
||||||
memset(pinbuf, pin->pad_char, pin->max_length * 2);
|
memset(pinbuf, pin->pad_char, pin->max_length * 2);
|
||||||
memcpy(pinbuf, oldpin, oldpinlen);
|
memcpy(pinbuf, oldpin, oldpinlen);
|
||||||
memcpy(pinbuf + pin->max_length, newpin, newpinlen);
|
memcpy(pinbuf + pin->max_length, newpin, newpinlen);
|
||||||
change_pin:
|
|
||||||
r = sc_change_reference_data(card, SC_AC_CHV, pin->reference, pinbuf,
|
r = sc_change_reference_data(card, SC_AC_CHV, pin->reference, pinbuf,
|
||||||
pin->max_length, pinbuf+pin->max_length,
|
pin->max_length, pinbuf+pin->max_length,
|
||||||
pin->max_length, &pin->tries_left);
|
pin->max_length, &pin->tries_left);
|
||||||
|
@ -309,7 +309,7 @@ int sc_pkcs15_unblock_pin(struct sc_pkcs15_card *p15card,
|
||||||
sc_unlock(card);
|
sc_unlock(card);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
unblock_pin:
|
|
||||||
r = sc_reset_retry_counter (card, SC_AC_CHV, pin->reference,
|
r = sc_reset_retry_counter (card, SC_AC_CHV, pin->reference,
|
||||||
puk, puklen, newpin, newpinlen);
|
puk, puklen, newpin, newpinlen);
|
||||||
sc_unlock(card);
|
sc_unlock(card);
|
||||||
|
|
|
@ -1116,7 +1116,6 @@ EVP_PKEY *get_public_key(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE privKeyObje
|
||||||
CK_OBJECT_HANDLE pubkeyObject;
|
CK_OBJECT_HANDLE pubkeyObject;
|
||||||
unsigned char *pubkey, *pubkey_sav;
|
unsigned char *pubkey, *pubkey_sav;
|
||||||
CK_ULONG pubkeyLen;
|
CK_ULONG pubkeyLen;
|
||||||
RSA *rsa;
|
|
||||||
EVP_PKEY *pkey;
|
EVP_PKEY *pkey;
|
||||||
|
|
||||||
id = NULL;
|
id = NULL;
|
||||||
|
@ -1140,18 +1139,15 @@ EVP_PKEY *get_public_key(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE privKeyObje
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkey_sav = pubkey; /* The function below may change pubkey */
|
pubkey_sav = pubkey; /* The function below may change pubkey */
|
||||||
rsa = d2i_RSAPublicKey(NULL, &pubkey, pubkeyLen);
|
pkey = d2i_PublicKey(EVP_PKEY_RSA, NULL, &pubkey, pubkeyLen);
|
||||||
free(pubkey_sav);
|
free(pubkey_sav);
|
||||||
|
|
||||||
if (rsa == NULL) {
|
if (pkey == NULL) {
|
||||||
printf(" couldn't parse pubkey, no verification done\n");
|
printf(" couldn't parse pubkey, no verification done\n");
|
||||||
/* ERR_print_errors_fp(stderr); */
|
/* ERR_print_errors_fp(stderr); */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkey = EVP_PKEY_new();
|
|
||||||
EVP_PKEY_set1_RSA(pkey, rsa);
|
|
||||||
|
|
||||||
return pkey;
|
return pkey;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue