aboutsummaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
Diffstat (limited to 'scd')
-rw-r--r--scd/apdu.c2
-rw-r--r--scd/app-help.c2
-rw-r--r--scd/app-openpgp.c27
-rw-r--r--scd/app-p15.c28
-rw-r--r--scd/app.c2
-rw-r--r--scd/ccid-driver.c14
-rw-r--r--scd/command.c10
-rw-r--r--scd/iso7816.c18
-rw-r--r--scd/pcsc-wrapper.c4
9 files changed, 56 insertions, 51 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 212b9df24..975fffa24 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -2393,7 +2393,7 @@ apdu_activate (int slot)
unsigned char *
apdu_get_atr (int slot, size_t *atrlen)
{
- char *buf;
+ unsigned char *buf;
if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used )
return NULL;
diff --git a/scd/app-help.c b/scd/app-help.c
index 1c3c52b15..27cbea5c7 100644
--- a/scd/app-help.c
+++ b/scd/app-help.c
@@ -48,7 +48,7 @@ app_help_get_keygrip_string (ksba_cert_t cert, char *hexkeygrip)
n = gcry_sexp_canon_len (p, 0, NULL, NULL);
if (!n)
return gpg_error (GPG_ERR_INV_SEXP);
- err = gcry_sexp_sscan (&s_pkey, NULL, p, n);
+ err = gcry_sexp_sscan (&s_pkey, NULL, (char*)p, n);
xfree (p);
if (err)
return err; /* Can't parse that S-expression. */
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 1ff096138..11e6eebaf 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -948,8 +948,8 @@ get_public_key (app_t app, int keyno)
size_t buflen, keydatalen, mlen, elen;
unsigned char *mbuf = NULL;
unsigned char *ebuf = NULL;
- unsigned char *keybuf = NULL;
- unsigned char *keybuf_p;
+ char *keybuf = NULL;
+ char *keybuf_p;
if (keyno < 1 || keyno > 3)
return gpg_error (GPG_ERR_INV_ID);
@@ -963,14 +963,16 @@ get_public_key (app_t app, int keyno)
app->app_local->pk[keyno].key = NULL;
app->app_local->pk[keyno].keylen = 0;
+ m = e = NULL; /* (avoid cc warning) */
+
if (app->card_version > 0x0100)
{
/* We may simply read the public key out of these cards. */
- err = iso7816_read_public_key (app->slot,
- keyno == 0? "\xB6" :
- keyno == 1? "\xB8" : "\xA4",
- 2,
- &buffer, &buflen);
+ err = iso7816_read_public_key
+ (app->slot, (const unsigned char*)(keyno == 0? "\xB6" :
+ keyno == 1? "\xB8" : "\xA4"),
+ 2,
+ &buffer, &buflen);
if (err)
{
log_error (_("reading public key failed: %s\n"), gpg_strerror (err));
@@ -1107,7 +1109,7 @@ get_public_key (app_t app, int keyno)
strcpy (keybuf_p, ")))");
keybuf_p += strlen (keybuf_p);
- app->app_local->pk[keyno].key = keybuf;
+ app->app_local->pk[keyno].key = (unsigned char*)keybuf;
app->app_local->pk[keyno].keylen = (keybuf_p - keybuf);
leave:
@@ -1889,11 +1891,10 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags,
#warning key generation temporary replaced by reading an existing key.
rc = iso7816_read_public_key
#endif
- (app->slot,
- keyno == 0? "\xB6" :
- keyno == 1? "\xB8" : "\xA4",
- 2,
- &buffer, &buflen);
+ (app->slot, (const unsigned char*)(keyno == 0? "\xB6" :
+ keyno == 1? "\xB8" : "\xA4"),
+ 2,
+ &buffer, &buflen);
if (rc)
{
rc = gpg_error (GPG_ERR_CARD);
diff --git a/scd/app-p15.c b/scd/app-p15.c
index 831f0d1f4..f03e5d5f0 100644
--- a/scd/app-p15.c
+++ b/scd/app-p15.c
@@ -43,33 +43,35 @@ typedef enum
} card_type_t;
/* A list card types with ATRs noticed with these cards. */
+#define X(a) ((unsigned char const *)(a))
static struct
{
size_t atrlen;
- unsigned char *atr;
+ unsigned char const *atr;
card_type_t type;
} card_atr_list[] = {
- { 19, "\x3B\xBA\x13\x00\x81\x31\x86\x5D\x00\x64\x05\x0A\x02\x01\x31\x80"
- "\x90\x00\x8B",
+ { 19, X("\x3B\xBA\x13\x00\x81\x31\x86\x5D\x00\x64\x05\x0A\x02\x01\x31\x80"
+ "\x90\x00\x8B"),
CARD_TYPE_TCOS }, /* SLE44 */
- { 19, "\x3B\xBA\x14\x00\x81\x31\x86\x5D\x00\x64\x05\x14\x02\x02\x31\x80"
- "\x90\x00\x91",
+ { 19, X("\x3B\xBA\x14\x00\x81\x31\x86\x5D\x00\x64\x05\x14\x02\x02\x31\x80"
+ "\x90\x00\x91"),
CARD_TYPE_TCOS }, /* SLE66S */
- { 19, "\x3B\xBA\x96\x00\x81\x31\x86\x5D\x00\x64\x05\x60\x02\x03\x31\x80"
- "\x90\x00\x66",
+ { 19, X("\x3B\xBA\x96\x00\x81\x31\x86\x5D\x00\x64\x05\x60\x02\x03\x31\x80"
+ "\x90\x00\x66"),
CARD_TYPE_TCOS }, /* SLE66P */
- { 27, "\x3B\xFF\x94\x00\xFF\x80\xB1\xFE\x45\x1F\x03\x00\x68\xD2\x76\x00"
- "\x00\x28\xFF\x05\x1E\x31\x80\x00\x90\x00\x23",
+ { 27, X("\x3B\xFF\x94\x00\xFF\x80\xB1\xFE\x45\x1F\x03\x00\x68\xD2\x76\x00"
+ "\x00\x28\xFF\x05\x1E\x31\x80\x00\x90\x00\x23"),
CARD_TYPE_MICARDO }, /* German BMI card */
- { 19, "\x3B\x6F\x00\xFF\x00\x68\xD2\x76\x00\x00\x28\xFF\x05\x1E\x31\x80"
- "\x00\x90\x00",
+ { 19, X("\x3B\x6F\x00\xFF\x00\x68\xD2\x76\x00\x00\x28\xFF\x05\x1E\x31\x80"
+ "\x00\x90\x00"),
CARD_TYPE_MICARDO }, /* German BMI card (ATR due to reader problem) */
- { 26, "\x3B\xFE\x94\x00\xFF\x80\xB1\xFA\x45\x1F\x03\x45\x73\x74\x45\x49"
- "\x44\x20\x76\x65\x72\x20\x31\x2E\x30\x43",
+ { 26, X("\x3B\xFE\x94\x00\xFF\x80\xB1\xFA\x45\x1F\x03\x45\x73\x74\x45\x49"
+ "\x44\x20\x76\x65\x72\x20\x31\x2E\x30\x43"),
CARD_TYPE_MICARDO }, /* EstEID (Estonian Big Brother card) */
{ 0 }
};
+#undef X
/* The Pin Types as defined in pkcs#15 v1.1 */
diff --git a/scd/app.c b/scd/app.c
index 2c8c915d7..f27b400b1 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -357,7 +357,7 @@ app_munge_serialno (app_t app)
gpg_error_t
app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp)
{
- unsigned char *buf, *p;
+ char *buf, *p;
int i;
if (!app || !serial)
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 9ac655e63..096a6811b 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -555,7 +555,7 @@ get_escaped_usb_string (usb_dev_handle *idev, int idx,
all in a 2 bute Unicode encoding using little endian. */
rc = usb_control_msg (idev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
(USB_DT_STRING << 8), 0,
- buf, sizeof buf, 1000 /* ms timeout */);
+ (char*)buf, sizeof buf, 1000 /* ms timeout */);
if (rc < 4)
langid = 0x0409; /* English. */
else
@@ -563,7 +563,7 @@ get_escaped_usb_string (usb_dev_handle *idev, int idx,
rc = usb_control_msg (idev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
(USB_DT_STRING << 8) + idx, langid,
- buf, sizeof buf, 1000 /* ms timeout */);
+ (char*)buf, sizeof buf, 1000 /* ms timeout */);
if (rc < 2 || buf[1] != USB_DT_STRING)
return NULL; /* Error or not a string. */
len = buf[0];
@@ -1155,7 +1155,7 @@ bulk_out (ccid_driver_t handle, unsigned char *msg, size_t msglen)
rc = usb_bulk_write (handle->idev,
handle->ep_bulk_out,
- msg, msglen,
+ (char*)msg, msglen,
1000 /* ms timeout */);
if (rc == msglen)
return 0;
@@ -1188,7 +1188,7 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
retry:
rc = usb_bulk_read (handle->idev,
handle->ep_bulk_in,
- buffer, length,
+ (char*)buffer, length,
timeout);
if (rc < 0)
{
@@ -1300,7 +1300,7 @@ ccid_poll (ccid_driver_t handle)
rc = usb_bulk_read (handle->idev,
handle->ep_intr,
- msg, sizeof msg,
+ (char*)msg, sizeof msg,
0 /* ms timeout */ );
if (rc < 0 && errno == ETIMEDOUT)
return 0;
@@ -1444,7 +1444,7 @@ ccid_get_atr (ccid_driver_t handle,
{
tried_iso = 1;
/* Try switching to ISO mode. */
- if (!send_escape_cmd (handle, "\xF1\x01", 2))
+ if (!send_escape_cmd (handle, (const unsigned char*)"\xF1\x01", 2))
goto again;
}
else if (CCID_COMMAND_FAILED (msg))
@@ -2026,7 +2026,7 @@ ccid_transceive_secure (ccid_driver_t handle,
if (handle->id_vendor == VENDOR_SCM)
{
DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
- rc = send_escape_cmd (handle, "\x80\x02\x00", 3);
+ rc = send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3);
if (rc)
return rc;
}
diff --git a/scd/command.c b/scd/command.c
index a308078d3..52a86871e 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -679,7 +679,7 @@ pin_cb (void *opaque, const char *info, char **retstr)
xfree (value);
return gpg_error (GPG_ERR_INV_RESPONSE);
}
- *retstr = value;
+ *retstr = (char*)value;
return 0;
}
@@ -844,7 +844,7 @@ cmd_getattr (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
- char *keyword;
+ const char *keyword;
if ((rc = open_card (ctrl, NULL)))
return rc;
@@ -860,7 +860,6 @@ cmd_getattr (assuan_context_t ctx, char *line)
/* FIXME: Applications should not return sensistive data if the card
is locked. */
rc = app_getattr (ctrl->app_ctx, ctrl, keyword);
- xfree (keyword);
TEST_CARD_REMOVAL (ctrl, rc);
return map_to_assuan_status (rc);
@@ -908,9 +907,10 @@ cmd_setattr (assuan_context_t ctx, char *orig_line)
*line++ = 0;
while (spacep (line))
line++;
- nbytes = percent_plus_unescape (line);
+ nbytes = percent_plus_unescape ((unsigned char*)line);
- rc = app_setattr (ctrl->app_ctx, keyword, pin_cb, ctx, line, nbytes);
+ rc = app_setattr (ctrl->app_ctx, keyword, pin_cb, ctx,
+ (const unsigned char*)line, nbytes);
xfree (linebuf);
TEST_CARD_REMOVAL (ctrl, rc);
diff --git a/scd/iso7816.c b/scd/iso7816.c
index e9dc6541c..742ed9433 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -153,7 +153,7 @@ iso7816_select_file (int slot, int tag, int is_dir,
p0 = (tag == 0x3F00)? 0: is_dir? 1:2;
p1 = 0x0c; /* No FC return. */
sw = apdu_send_simple (slot, 0x00, CMD_SELECT_FILE,
- p0, p1, 2, tagbuf );
+ p0, p1, 2, (char*)tagbuf );
return map_sw (sw);
}
@@ -285,7 +285,7 @@ iso7816_put_data (int slot, int tag,
sw = apdu_send_simple (slot, 0x00, CMD_PUT_DATA,
((tag >> 8) & 0xff), (tag & 0xff),
- datalen, data);
+ datalen, (const char*)data);
return map_sw (sw);
}
@@ -303,7 +303,7 @@ iso7816_manage_security_env (int slot, int p1, int p2,
return gpg_error (GPG_ERR_INV_VALUE);
sw = apdu_send_simple (slot, 0x00, CMD_MSE, p1, p2,
- data? datalen : -1, data);
+ data? datalen : -1, (const char*)data);
return map_sw (sw);
}
@@ -323,7 +323,7 @@ iso7816_compute_ds (int slot, const unsigned char *data, size_t datalen,
*result = NULL;
*resultlen = 0;
- sw = apdu_send (slot, 0x00, CMD_PSO, 0x9E, 0x9A, datalen, data,
+ sw = apdu_send (slot, 0x00, CMD_PSO, 0x9E, 0x9A, datalen, (const char*)data,
result, resultlen);
if (sw != SW_SUCCESS)
{
@@ -364,13 +364,15 @@ iso7816_decipher (int slot, const unsigned char *data, size_t datalen,
*buf = padind; /* Padding indicator. */
memcpy (buf+1, data, datalen);
- sw = apdu_send (slot, 0x00, CMD_PSO, 0x80, 0x86, datalen+1, buf,
+ sw = apdu_send (slot, 0x00, CMD_PSO, 0x80, 0x86,
+ datalen+1, (char*)buf,
result, resultlen);
xfree (buf);
}
else
{
- sw = apdu_send (slot, 0x00, CMD_PSO, 0x80, 0x86, datalen, data,
+ sw = apdu_send (slot, 0x00, CMD_PSO, 0x80, 0x86,
+ datalen, (const char *)data,
result, resultlen);
}
if (sw != SW_SUCCESS)
@@ -399,7 +401,7 @@ iso7816_internal_authenticate (int slot,
*resultlen = 0;
sw = apdu_send (slot, 0x00, CMD_INTERNAL_AUTHENTICATE, 0, 0,
- datalen, data, result, resultlen);
+ datalen, (const char*)data, result, resultlen);
if (sw != SW_SUCCESS)
{
/* Make sure that pending buffers are released. */
@@ -426,7 +428,7 @@ do_generate_keypair (int slot, int readonly,
*resultlen = 0;
sw = apdu_send (slot, 0x00, CMD_GENERATE_KEYPAIR, readonly? 0x81:0x80, 0,
- datalen, data, result, resultlen);
+ datalen, (const char*)data, result, resultlen);
if (sw != SW_SUCCESS)
{
/* Make sure that pending buffers are released. */
diff --git a/scd/pcsc-wrapper.c b/scd/pcsc-wrapper.c
index 93e78fdfe..21af16fba 100644
--- a/scd/pcsc-wrapper.c
+++ b/scd/pcsc-wrapper.c
@@ -390,9 +390,9 @@ handle_open (unsigned char *argbuf, size_t arglen)
unsigned char atr[33];
/* Make sure there is only the port string */
- if (arglen != strlen (argbuf))
+ if (arglen != strlen ((char*)argbuf))
bad_request ("OPEN");
- portstr = argbuf;
+ portstr = (char*)argbuf;
if (driver_is_open)
{