kill lots of warnings (unused variables, unsigned/signed comparison etc.)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3765 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
80f16d4f4e
commit
ff9951d94d
|
@ -538,7 +538,7 @@ static int entersafe_select_path(sc_card_t *card,
|
|||
const u8 *path=pathbuf;
|
||||
size_t pathlen=len;
|
||||
int bMatch = -1;
|
||||
int i;
|
||||
unsigned int i;
|
||||
int r;
|
||||
|
||||
if (pathlen%2 != 0 || pathlen > 6 || pathlen <= 0)
|
||||
|
|
|
@ -40,7 +40,8 @@ static struct sc_card_operations myeid_ops;
|
|||
static struct sc_card_driver myeid_drv = {
|
||||
"MyEID cards with PKCS#15 applet",
|
||||
"myeid",
|
||||
&myeid_ops
|
||||
&myeid_ops,
|
||||
NULL, 0, NULL
|
||||
};
|
||||
|
||||
static const char *myeid_atrs[] = {
|
||||
|
@ -202,7 +203,7 @@ static int myeid_read_binary(struct sc_card *card, unsigned int idx,
|
|||
static int myeid_list_files(struct sc_card *card, u8 *buf, size_t buflen)
|
||||
{
|
||||
struct sc_apdu apdu;
|
||||
int r,i;
|
||||
int r;
|
||||
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xCA, 0x01, 0xA1);
|
||||
apdu.resp = buf;
|
||||
|
|
|
@ -887,8 +887,6 @@ static int piv_cache_internal_data(sc_card_t *card, int enumtag)
|
|||
priv->obj_cache[enumtag].internal_obj_data,
|
||||
priv->obj_cache[enumtag].internal_obj_len);
|
||||
|
||||
|
||||
ok:
|
||||
SC_FUNC_RETURN(card->ctx, 1, 0);
|
||||
}
|
||||
|
||||
|
@ -907,7 +905,6 @@ static int piv_read_binary(sc_card_t *card, unsigned int idx,
|
|||
u8 *rbuf = NULL;
|
||||
size_t rbuflen = 0;
|
||||
u8 *tag;
|
||||
size_t taglen;
|
||||
u8 *body;
|
||||
size_t bodylen;
|
||||
|
||||
|
|
|
@ -337,7 +337,8 @@ static int tcos_select_file(sc_card_t *card,
|
|||
sc_apdu_t apdu;
|
||||
sc_file_t *file=NULL;
|
||||
u8 buf[SC_MAX_APDU_BUFFER_SIZE], pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;
|
||||
int i, r, pathlen;
|
||||
unsigned int i;
|
||||
int r, pathlen;
|
||||
|
||||
assert(card != NULL && in_path != NULL);
|
||||
ctx=card->ctx;
|
||||
|
@ -653,7 +654,7 @@ static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len,
|
|||
|
||||
if (apdu.sw1==0x90 && apdu.sw2==0x00) {
|
||||
size_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;
|
||||
int offset=0;
|
||||
unsigned int offset=0;
|
||||
if(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2){
|
||||
offset=2; while(offset<len && apdu.resp[offset]!=0) ++offset;
|
||||
offset=(offset<len-1) ? offset+1 : 0;
|
||||
|
|
|
@ -871,6 +871,7 @@ static int sc_lock_phase(sc_card_t * card, u8 phase)
|
|||
|
||||
static int westcos_card_ctl(sc_card_t * card, unsigned long cmd, void *ptr)
|
||||
{
|
||||
unsigned int i;
|
||||
int r;
|
||||
size_t buflen;
|
||||
u8 buf[256];
|
||||
|
@ -1006,9 +1007,9 @@ static int westcos_card_ctl(sc_card_t * card, unsigned long cmd, void *ptr)
|
|||
memcpy(temp, ck->key_template, sizeof(temp));
|
||||
westcos_compute_aetb_crc(CRC_A, ck->new_key.key_value,
|
||||
ck->new_key.key_len, &temp[5], &temp[6]);
|
||||
for (r = 0, temp[4] = 0xAA, lrc = 0; r < sizeof(temp);
|
||||
r++)
|
||||
lrc += temp[r];
|
||||
for (i = 0, temp[4] = 0xAA, lrc = 0; i < sizeof(temp);
|
||||
i++)
|
||||
lrc += temp[i];
|
||||
temp[4] = (lrc % 256);
|
||||
buflen = sizeof(buf);
|
||||
r = westcos_get_crypte_challenge(card,
|
||||
|
@ -1199,7 +1200,7 @@ out:
|
|||
BIO_free(mem);
|
||||
if (rsa)
|
||||
RSA_free(rsa);
|
||||
#endif ENABLE_OPENSSL
|
||||
#endif /* ENABLE_OPENSSL */
|
||||
if (keyfile)
|
||||
sc_file_free(keyfile);
|
||||
return r;
|
||||
|
|
|
@ -41,10 +41,8 @@ static int entersafe_detect_card( sc_pkcs15_card_t *p15card)
|
|||
|
||||
static int sc_pkcs15emu_entersafe_init( sc_pkcs15_card_t *p15card)
|
||||
{
|
||||
int r, i;
|
||||
int r;
|
||||
char buf[256];
|
||||
sc_path_t path;
|
||||
sc_file_t *file = NULL;
|
||||
sc_card_t *card = p15card->card;
|
||||
sc_serial_number_t serial;
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ static int pcsc_connect(sc_reader_t *reader, sc_slot_info_t *slot)
|
|||
int r;
|
||||
u8 feature_buf[256], rbuf[SC_MAX_APDU_BUFFER_SIZE];
|
||||
size_t rcount;
|
||||
DWORD i, feature_len, display_ioctl;
|
||||
DWORD i, feature_len, display_ioctl = 0;
|
||||
PCSC_TLV_STRUCTURE *pcsc_tlv;
|
||||
|
||||
r = refresh_slot_attributes(reader, slot);
|
||||
|
@ -929,7 +929,7 @@ static int pcsc_detect_readers(sc_context_t *ctx, void *prv_data)
|
|||
struct pcsc_private_data *priv = NULL;
|
||||
struct pcsc_slot_data *pslot = NULL;
|
||||
sc_slot_info_t *slot = NULL;
|
||||
int i;
|
||||
unsigned int i;
|
||||
int found = 0;
|
||||
|
||||
for (i=0;i < sc_ctx_get_reader_count (ctx) && !found;i++) {
|
||||
|
|
|
@ -175,7 +175,8 @@ CK_RV C_Initialize(CK_VOID_PTR pInitArgs)
|
|||
#if !defined(_WIN32)
|
||||
pid_t current_pid = getpid();
|
||||
#endif
|
||||
int i, rc, rv;
|
||||
unsigned int i;
|
||||
int rc, rv;
|
||||
sc_context_param_t ctx_opts;
|
||||
|
||||
/* Handle fork() exception */
|
||||
|
@ -323,7 +324,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
|||
CK_ULONG_PTR pulCount) /* receives the number of slots */
|
||||
{
|
||||
CK_SLOT_ID_PTR found = NULL;
|
||||
int i;
|
||||
unsigned int i;
|
||||
CK_ULONG numMatches;
|
||||
sc_pkcs11_slot_t *slot;
|
||||
CK_RV rv;
|
||||
|
|
|
@ -259,15 +259,17 @@ sc_keycache_set_pin_name(const sc_path_t *path, int ref, int name)
|
|||
}
|
||||
|
||||
if (ref >= 0) {
|
||||
int r;
|
||||
/* Create the named PIN if it doesn't exist */
|
||||
if (!(s = find_entry(path, SC_AC_CHV, ref, 0))) {
|
||||
s = new_entry(path, SC_AC_CHV, ref);
|
||||
if (s == NULL)
|
||||
return SC_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
s->len = sc_keycache_get_key(path, SC_AC_CHV, -1, s->value, MAX_SECRET);
|
||||
if(s->len < 0)
|
||||
r = sc_keycache_get_key(path, SC_AC_CHV, -1, s->value, MAX_SECRET);
|
||||
if(r < 0)
|
||||
return SC_ERROR_OBJECT_NOT_FOUND;
|
||||
s->len = r;
|
||||
}
|
||||
|
||||
/* Set the pin name */
|
||||
|
|
|
@ -253,7 +253,7 @@ cardos_store_key(sc_profile_t *profile, sc_card_t *card,
|
|||
sc_pkcs15_prkey_t *key)
|
||||
{
|
||||
sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
|
||||
int algorithm, r;
|
||||
int algorithm = 0, r;
|
||||
|
||||
if (obj->type != SC_PKCS15_TYPE_PRKEY_RSA) {
|
||||
sc_error(card->ctx, "CardOS supports RSA keys only.");
|
||||
|
@ -306,7 +306,7 @@ cardos_generate_key(sc_profile_t *profile, sc_card_t *card,
|
|||
struct sc_cardctl_cardos_genkey_info args;
|
||||
struct sc_file *temp;
|
||||
u8 abignum[256];
|
||||
int algorithm, r, delete_it = 0, use_ext_rsa = 0;
|
||||
int algorithm = 0, r, delete_it = 0, use_ext_rsa = 0;
|
||||
size_t keybits, rsa_max_size;
|
||||
int pin_id = -1;
|
||||
|
||||
|
|
|
@ -232,10 +232,7 @@ static int myeid_generate_store_key(sc_profile_t *profile, sc_card_t *card,
|
|||
sc_pkcs15_prkey_info_t *info)
|
||||
{
|
||||
struct sc_cardctl_myeid_gen_store_key_info args;
|
||||
struct sc_cardctl_myeid_data_obj data_obj;
|
||||
unsigned char raw_pubkey[256];
|
||||
int r;
|
||||
unsigned int mod_len;
|
||||
sc_file_t *prkf = NULL;
|
||||
|
||||
/* Parameter check */
|
||||
|
@ -362,7 +359,7 @@ static int myeid_create_pin_internal(sc_profile_t *profile, sc_card_t *card,
|
|||
|
||||
data[17] = 0x00;
|
||||
data[18] = 0x00;
|
||||
data[19] = 0x00;
|
||||
data[19] = 0x00; /* FIXME, array is only 0..18 */
|
||||
|
||||
data_obj.Data = data;
|
||||
data_obj.DataLen = 0x10;
|
||||
|
|
|
@ -99,7 +99,7 @@ static int westcos_pkcs15_create_pin(sc_profile_t *profile,
|
|||
sc_file_t *file = sc_file_new();
|
||||
sc_path_t path;
|
||||
|
||||
if(pin_len>9 || puk_len>9 || pin_len<0 || puk_len<0)
|
||||
if(pin_len>9 || puk_len>9)
|
||||
return SC_ERROR_INVALID_ARGUMENTS;
|
||||
|
||||
file->type = SC_FILE_TYPE_INTERNAL_EF;
|
||||
|
@ -314,7 +314,7 @@ static int westcos_pkcs15init_generate_key(sc_profile_t *profile,
|
|||
r = sc_pkcs15_decode_pubkey(card->ctx, pubkey, p, lg);
|
||||
}
|
||||
|
||||
BIO_reset(mem);
|
||||
(void) BIO_reset(mem);
|
||||
|
||||
if(!i2d_RSAPrivateKey_bio(mem, rsa))
|
||||
{
|
||||
|
|
|
@ -1569,7 +1569,7 @@ static int do_asn1(int argc, char **argv)
|
|||
goto err;
|
||||
}
|
||||
if ((size_t)r != len) {
|
||||
printf("expecting %d, got only %d bytes.\n", len, r);
|
||||
printf("expecting %ld, got only %d bytes.\n", len, r);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ int util_connect_card(sc_context_t *ctx, sc_card_t **cardp,
|
|||
return 1;
|
||||
}
|
||||
if (reader_id < 0) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
/* Automatically try to skip to a reader with a card if reader not specified */
|
||||
for (i = 0; i < sc_ctx_get_reader_count(ctx); i++) {
|
||||
reader = sc_ctx_get_reader(ctx, i);
|
||||
|
|
Loading…
Reference in New Issue