fixed clang compiler warnings
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@777 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -75,7 +75,7 @@ main (int argc, char **argv)
|
|||||||
* You could set your PIN with pin=“123456”; or just leave it at NULL to be
|
* You could set your PIN with pin=“123456”; or just leave it at NULL to be
|
||||||
* asked for it. The same applies to the new PIN newpin. */
|
* asked for it. The same applies to the new PIN newpin. */
|
||||||
pace_input.pin_id = PACE_PIN;
|
pace_input.pin_id = PACE_PIN;
|
||||||
pace_input.pin = pin;
|
pace_input.pin = (unsigned char *) pin;
|
||||||
pace_input.pin_length = pin ? strlen(pin) : 0;
|
pace_input.pin_length = pin ? strlen(pin) : 0;
|
||||||
|
|
||||||
r = EstablishPACEChannel(NULL, card, pace_input, &pace_output,
|
r = EstablishPACEChannel(NULL, card, pace_input, &pace_output,
|
||||||
|
|||||||
@@ -213,9 +213,9 @@ main (int argc, char **argv)
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
if (strlen(can) > pace_input.pin_length) {
|
if (strlen(can) > pace_input.pin_length) {
|
||||||
fprintf(stderr, "%s too big, only %d digits allowed.\n",
|
fprintf(stderr, "%s too big, only %u digits allowed.\n",
|
||||||
npa_secret_name(pace_input.pin_id),
|
npa_secret_name(pace_input.pin_id),
|
||||||
pace_input.pin_length);
|
(unsigned int) pace_input.pin_length);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,9 +230,9 @@ main (int argc, char **argv)
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
if (strlen(can) > pace_input.pin_length) {
|
if (strlen(can) > pace_input.pin_length) {
|
||||||
fprintf(stderr, "%s too big, only %d digits allowed.\n",
|
fprintf(stderr, "%s too big, only %u digits allowed.\n",
|
||||||
npa_secret_name(pace_input.pin_id),
|
npa_secret_name(pace_input.pin_id),
|
||||||
pace_input.pin_length);
|
(unsigned int) pace_input.pin_length);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,9 +247,9 @@ main (int argc, char **argv)
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
if (strlen(puk) > pace_input.pin_length) {
|
if (strlen(puk) > pace_input.pin_length) {
|
||||||
fprintf(stderr, "%s too big, only %d digits allowed.\n",
|
fprintf(stderr, "%s too big, only %u digits allowed.\n",
|
||||||
npa_secret_name(pace_input.pin_id),
|
npa_secret_name(pace_input.pin_id),
|
||||||
pace_input.pin_length);
|
(unsigned int) pace_input.pin_length);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,10 +259,10 @@ main (int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pace_input.pin = secretbuf;
|
pace_input.pin = (unsigned char *) secretbuf;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
sprintf(secretbuf, "%0*llu", pace_input.pin_length, secret);
|
sprintf(secretbuf, "%0*llu", (unsigned int) pace_input.pin_length, secret);
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
printf("%u,%06u: Trying %s=%s\n",
|
printf("%u,%06u: Trying %s=%s\n",
|
||||||
@@ -292,7 +292,7 @@ main (int argc, char **argv)
|
|||||||
if (cmdline.resume_flag) {
|
if (cmdline.resume_flag) {
|
||||||
pace_input.pin_id = PACE_CAN;
|
pace_input.pin_id = PACE_CAN;
|
||||||
if (can) {
|
if (can) {
|
||||||
pace_input.pin = can;
|
pace_input.pin = (unsigned char *) can;
|
||||||
pace_input.pin_length = strlen(can);
|
pace_input.pin_length = strlen(can);
|
||||||
} else {
|
} else {
|
||||||
pace_input.pin = NULL;
|
pace_input.pin = NULL;
|
||||||
@@ -306,7 +306,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
pace_input.pin_id = PACE_PIN;
|
pace_input.pin_id = PACE_PIN;
|
||||||
if (pin) {
|
if (pin) {
|
||||||
pace_input.pin = pin;
|
pace_input.pin = (unsigned char *) pin;
|
||||||
pace_input.pin_length = strlen(pin);
|
pace_input.pin_length = strlen(pin);
|
||||||
} else {
|
} else {
|
||||||
pace_input.pin = NULL;
|
pace_input.pin = NULL;
|
||||||
@@ -322,7 +322,7 @@ main (int argc, char **argv)
|
|||||||
if (cmdline.unblock_flag) {
|
if (cmdline.unblock_flag) {
|
||||||
pace_input.pin_id = PACE_PUK;
|
pace_input.pin_id = PACE_PUK;
|
||||||
if (puk) {
|
if (puk) {
|
||||||
pace_input.pin = puk;
|
pace_input.pin = (unsigned char *) puk;
|
||||||
pace_input.pin_length = strlen(puk);
|
pace_input.pin_length = strlen(puk);
|
||||||
} else {
|
} else {
|
||||||
pace_input.pin = NULL;
|
pace_input.pin = NULL;
|
||||||
@@ -343,7 +343,7 @@ main (int argc, char **argv)
|
|||||||
if (cmdline.new_pin_given) {
|
if (cmdline.new_pin_given) {
|
||||||
pace_input.pin_id = PACE_PIN;
|
pace_input.pin_id = PACE_PIN;
|
||||||
if (pin) {
|
if (pin) {
|
||||||
pace_input.pin = pin;
|
pace_input.pin = (unsigned char *) pin;
|
||||||
pace_input.pin_length = strlen(pin);
|
pace_input.pin_length = strlen(pin);
|
||||||
} else {
|
} else {
|
||||||
pace_input.pin = NULL;
|
pace_input.pin = NULL;
|
||||||
@@ -369,25 +369,25 @@ main (int argc, char **argv)
|
|||||||
if (cmdline.pin_given) {
|
if (cmdline.pin_given) {
|
||||||
pace_input.pin_id = PACE_PIN;
|
pace_input.pin_id = PACE_PIN;
|
||||||
if (pin) {
|
if (pin) {
|
||||||
pace_input.pin = pin;
|
pace_input.pin = (unsigned char *) pin;
|
||||||
pace_input.pin_length = strlen(pin);
|
pace_input.pin_length = strlen(pin);
|
||||||
}
|
}
|
||||||
} else if (cmdline.can_given) {
|
} else if (cmdline.can_given) {
|
||||||
pace_input.pin_id = PACE_CAN;
|
pace_input.pin_id = PACE_CAN;
|
||||||
if (can) {
|
if (can) {
|
||||||
pace_input.pin = can;
|
pace_input.pin = (unsigned char *) can;
|
||||||
pace_input.pin_length = strlen(can);
|
pace_input.pin_length = strlen(can);
|
||||||
}
|
}
|
||||||
} else if (cmdline.mrz_given) {
|
} else if (cmdline.mrz_given) {
|
||||||
pace_input.pin_id = PACE_MRZ;
|
pace_input.pin_id = PACE_MRZ;
|
||||||
if (mrz) {
|
if (mrz) {
|
||||||
pace_input.pin = mrz;
|
pace_input.pin = (unsigned char *) mrz;
|
||||||
pace_input.pin_length = strlen(mrz);
|
pace_input.pin_length = strlen(mrz);
|
||||||
}
|
}
|
||||||
} else if (cmdline.puk_given) {
|
} else if (cmdline.puk_given) {
|
||||||
pace_input.pin_id = PACE_PUK;
|
pace_input.pin_id = PACE_PUK;
|
||||||
if (puk) {
|
if (puk) {
|
||||||
pace_input.pin = puk;
|
pace_input.pin = (unsigned char *) puk;
|
||||||
pace_input.pin_length = strlen(puk);
|
pace_input.pin_length = strlen(puk);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -401,7 +401,7 @@ main (int argc, char **argv)
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto err;
|
goto err;
|
||||||
printf("Established PACE channel with %s.\n",
|
printf("Established PACE channel with %s.\n",
|
||||||
npa_secret_name(pace_input.pin_id), cmdline.translate_arg);
|
npa_secret_name(pace_input.pin_id));
|
||||||
|
|
||||||
if (cmdline.translate_given) {
|
if (cmdline.translate_given) {
|
||||||
FILE *input;
|
FILE *input;
|
||||||
|
|||||||
@@ -1465,8 +1465,10 @@ npa_sm_authenticate(sc_card_t *card, const struct sm_ctx *ctx,
|
|||||||
struct npa_sm_ctx *eacsmctx = ctx->priv_data;
|
struct npa_sm_ctx *eacsmctx = ctx->priv_data;
|
||||||
|
|
||||||
inbuf = BUF_MEM_create_init(data, datalen);
|
inbuf = BUF_MEM_create_init(data, datalen);
|
||||||
if (!inbuf)
|
if (!inbuf) {
|
||||||
|
r = SC_ERROR_OUT_OF_MEMORY;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
macbuf = EAC_authenticate(eacsmctx->ctx, eacsmctx->ssc, inbuf);
|
macbuf = EAC_authenticate(eacsmctx->ctx, eacsmctx->ssc, inbuf);
|
||||||
if (!macbuf) {
|
if (!macbuf) {
|
||||||
@@ -1514,8 +1516,10 @@ npa_sm_verify_authentication(sc_card_t *card, const struct sm_ctx *ctx,
|
|||||||
struct npa_sm_ctx *eacsmctx = ctx->priv_data;
|
struct npa_sm_ctx *eacsmctx = ctx->priv_data;
|
||||||
|
|
||||||
inbuf = BUF_MEM_create_init(macdata, macdatalen);
|
inbuf = BUF_MEM_create_init(macdata, macdatalen);
|
||||||
if (!inbuf)
|
if (!inbuf) {
|
||||||
|
r = SC_ERROR_OUT_OF_MEMORY;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
my_mac = EAC_authenticate(eacsmctx->ctx, eacsmctx->ssc, inbuf);
|
my_mac = EAC_authenticate(eacsmctx->ctx, eacsmctx->ssc, inbuf);
|
||||||
if (!my_mac) {
|
if (!my_mac) {
|
||||||
@@ -1624,7 +1628,7 @@ npa_sm_pre_transmit(sc_card_t *card, const struct sm_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (CVC_check_description(cvc_cert,
|
switch (CVC_check_description(cvc_cert,
|
||||||
eacsmctx->certificate_description->data,
|
(unsigned char *) eacsmctx->certificate_description->data,
|
||||||
eacsmctx->certificate_description->length)) {
|
eacsmctx->certificate_description->length)) {
|
||||||
case 1:
|
case 1:
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,
|
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
|
|||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
sc_do_log(ctx, type, file, line, func,
|
sc_do_log(ctx, type, file, line, func,
|
||||||
"\n%s (%u byte%s):\n%s",
|
"\n%s (%u byte%s):\n%s",
|
||||||
label, len, len==1?"":"s", buf);
|
label, (unsigned int) len, len==1?"":"s", buf);
|
||||||
} else {
|
} else {
|
||||||
fprintf(f, "%s (%u byte%s):\n%s\n",
|
fprintf(f, "%s (%u byte%s):\n%s\n",
|
||||||
label, len, len==1?"":"s", sc_dump_hex(data, len));
|
label, (unsigned int) len, len==1?"":"s", sc_dump_hex(data, len));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user