- Minor build and C++ warning fixes
- pkcs15init: Use u8 for pin variable declarations like libopensc does git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1686 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
f5aeedf554
commit
7d3fc55736
|
@ -1351,7 +1351,7 @@ sc_der_copy(sc_pkcs15_der_t *dst, const sc_pkcs15_der_t *src)
|
|||
memset(dst, 0, sizeof(*dst));
|
||||
if (src->len) {
|
||||
dst->len = src->len;
|
||||
dst->value = malloc(src->len);
|
||||
dst->value = (u8 *) malloc(src->len);
|
||||
memcpy(dst->value, src->value, src->len);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -455,7 +455,9 @@ cyberflex_process_file_attrs(sc_card_t *card, sc_file_t *file,
|
|||
file->ef_structure = SC_FILE_EF_CYCLIC;
|
||||
break;
|
||||
case 0x04:
|
||||
// file->ef_structure = SC_FILE_EF_PROGRAM;
|
||||
#if 0
|
||||
file->ef_structure = SC_FILE_EF_PROGRAM;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
sc_error(ctx, "invalid file type: 0x%02X\n", *p);
|
||||
|
|
|
@ -205,7 +205,7 @@ pgp_set_blob(struct blob *blob, const u8 *data, size_t len)
|
|||
free(blob->data);
|
||||
blob->len = len;
|
||||
blob->status = 0;
|
||||
blob->data = malloc(len);
|
||||
blob->data = (unsigned char *) malloc(len);
|
||||
memcpy(blob->data, data, len);
|
||||
|
||||
blob->file->size = len;
|
||||
|
|
|
@ -80,7 +80,7 @@ sc_pkcs15emu_add_object(sc_pkcs15_card_t *p15card, int type,
|
|||
sc_pkcs15_object_t *obj;
|
||||
int df_type;
|
||||
|
||||
obj = calloc(1, sizeof(*obj));
|
||||
obj = (sc_pkcs15_object_t *) calloc(1, sizeof(*obj));
|
||||
obj->type = type;
|
||||
obj->data = data;
|
||||
if (label)
|
||||
|
@ -225,7 +225,7 @@ read_file(sc_card_t *card, const char *path_name, void *buf, size_t len)
|
|||
|
||||
if (file->size < len)
|
||||
len = file->size;
|
||||
return sc_read_binary(card, 0, buf, len, 0);
|
||||
return sc_read_binary(card, 0, (u8 *) buf, len, 0);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -189,7 +189,7 @@ int sc_pkcs15_compute_signature(struct sc_pkcs15_card *p15card,
|
|||
* can strip the input so a more restrictive algo can be used */
|
||||
if ((flags == (SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE)) &&
|
||||
!(alg_info->flags & (SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_NONE))) {
|
||||
int algo;
|
||||
unsigned int algo;
|
||||
tmpoutlen = sizeof(buf);
|
||||
r = sc_pkcs1_strip_digest_info_prefix(&algo, tmpin, inlen, tmpout, &tmpoutlen);
|
||||
if (r != SC_SUCCESS || algo == SC_ALGORITHM_RSA_HASH_NONE)
|
||||
|
|
|
@ -52,7 +52,7 @@ static void card_inserted(struct openscd_context *dctx,
|
|||
struct sc_card *card;
|
||||
struct sc_pkcs15_card *p15card;
|
||||
|
||||
dctx->cards = realloc(dctx->cards, (n + 1) * sizeof(struct openscd_card));
|
||||
dctx->cards = (struct openscd_card *) realloc(dctx->cards, (n + 1) * sizeof(struct openscd_card));
|
||||
assert(dctx->cards != NULL);
|
||||
memset(dctx->cards + n, 0, sizeof(struct openscd_card));
|
||||
|
||||
|
@ -101,13 +101,13 @@ static void card_removed(struct openscd_context *dctx,
|
|||
}
|
||||
assert(idx != dctx->card_count);
|
||||
dctx->card_count--;
|
||||
dctx->cards = realloc(dctx->cards, dctx->card_count * sizeof(struct openscd_card));
|
||||
dctx->cards = (struct openscd_card *) realloc(dctx->cards, dctx->card_count * sizeof(struct openscd_card));
|
||||
assert(dctx->cards != NULL || dctx->card_count == 0);
|
||||
}
|
||||
|
||||
static int cmd_list_readers(ASSUAN_CONTEXT actx, char *line)
|
||||
{
|
||||
struct openscd_context *dctx = assuan_get_pointer(actx);
|
||||
struct openscd_context *dctx = (struct openscd_context *) assuan_get_pointer(actx);
|
||||
int i, r;
|
||||
|
||||
for (i = 0; i < dctx->ctx->reader_count; i++) {
|
||||
|
@ -124,7 +124,7 @@ static int cmd_list_readers(ASSUAN_CONTEXT actx, char *line)
|
|||
|
||||
static int cmd_list_cards(ASSUAN_CONTEXT actx, char *line)
|
||||
{
|
||||
struct openscd_context *dctx = assuan_get_pointer(actx);
|
||||
struct openscd_context *dctx = (struct openscd_context *) assuan_get_pointer(actx);
|
||||
int i, r = 0;
|
||||
|
||||
pthread_mutex_lock(&dctx->card_mutex);
|
||||
|
@ -143,7 +143,7 @@ static int cmd_list_cards(ASSUAN_CONTEXT actx, char *line)
|
|||
|
||||
static int cmd_get_objects(ASSUAN_CONTEXT actx, char *line)
|
||||
{
|
||||
struct openscd_context *dctx = assuan_get_pointer(actx);
|
||||
struct openscd_context *dctx = (struct openscd_context *) assuan_get_pointer(actx);
|
||||
struct openscd_card *dcard;
|
||||
int card_id, obj_type, i, obj_count, r = 0;
|
||||
struct sc_pkcs15_object *objs[32];
|
||||
|
@ -171,7 +171,7 @@ static int cmd_get_objects(ASSUAN_CONTEXT actx, char *line)
|
|||
for (i = 0; i < obj_count; i++) {
|
||||
char *line;
|
||||
|
||||
line = malloc(objs[i]->der.len * 2 + 2);
|
||||
line = (char *) malloc(objs[i]->der.len * 2 + 2);
|
||||
if (line == NULL)
|
||||
return ASSUAN_Out_Of_Core;
|
||||
sc_bin_to_hex(objs[i]->der.value, objs[i]->der.len,
|
||||
|
@ -220,7 +220,7 @@ static int register_commands(ASSUAN_CONTEXT assuan_ctx)
|
|||
|
||||
static void * sc_thread(void *arg)
|
||||
{
|
||||
struct openscd_thread_arg *targ = arg;
|
||||
struct openscd_thread_arg *targ = (struct openscd_thread_arg *) arg;
|
||||
struct openscd_context *dctx = targ->dctx;
|
||||
struct sc_reader *reader = targ->reader;
|
||||
struct sc_context *ctx = dctx->ctx;
|
||||
|
@ -298,12 +298,12 @@ static void spawn_reader_threads(struct openscd_context *dctx)
|
|||
if (dctx->ctx->reader_count == 0)
|
||||
return;
|
||||
count = dctx->ctx->reader_count;
|
||||
dctx->threads = calloc(count, sizeof(pthread_t));
|
||||
dctx->threads = (pthread_t *) calloc(count, sizeof(pthread_t));
|
||||
assert(dctx->threads != NULL);
|
||||
for (i = 0; i < count; i++) {
|
||||
struct openscd_thread_arg *arg;
|
||||
|
||||
arg = malloc(sizeof(struct openscd_thread_arg));
|
||||
arg = (struct openscd_thread_arg *) malloc(sizeof(struct openscd_thread_arg));
|
||||
assert(arg != NULL);
|
||||
arg->dctx = dctx;
|
||||
arg->reader = dctx->ctx->reader[i];
|
||||
|
@ -335,11 +335,11 @@ void command_handler(struct openscd_context *dctx)
|
|||
r = assuan_init_socket_server(&assuan_ctx, dctx->socket_fd);
|
||||
if (r)
|
||||
die(1, "Failed to initialize the server: %s\n",
|
||||
assuan_strerror(r));
|
||||
assuan_strerror((AssuanError) r));
|
||||
r = register_commands(assuan_ctx);
|
||||
if (r)
|
||||
die(1, "Failed to register commands with Assuan: %s\n",
|
||||
assuan_strerror(r));
|
||||
assuan_strerror((AssuanError) r));
|
||||
|
||||
assuan_set_pointer(assuan_ctx, dctx);
|
||||
|
||||
|
@ -348,12 +348,12 @@ void command_handler(struct openscd_context *dctx)
|
|||
if (r == -1)
|
||||
break;
|
||||
if (r) {
|
||||
sc_error(dctx->ctx, "Assuan accept problem: %s\n", assuan_strerror(r));
|
||||
sc_error(dctx->ctx, "Assuan accept problem: %s\n", assuan_strerror((AssuanError) r));
|
||||
break;
|
||||
}
|
||||
r = assuan_process(assuan_ctx);
|
||||
if (r) {
|
||||
sc_error(dctx->ctx, "Assuan processing failed: %s\n", assuan_strerror(r));
|
||||
sc_error(dctx->ctx, "Assuan processing failed: %s\n", assuan_strerror((AssuanError) r));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,15 +42,15 @@
|
|||
# define mkdir(a,b) mkdir(a)
|
||||
#endif
|
||||
|
||||
char *mkdtemp(char *template)
|
||||
char *mkdtemp(char *tmpl)
|
||||
{
|
||||
int attempts, idx, count = 0;
|
||||
unsigned char *ch;
|
||||
char *ch;
|
||||
|
||||
idx = strlen(template);
|
||||
idx = strlen(tmpl);
|
||||
|
||||
/* Walk backwards to count all the Xes */
|
||||
while (idx > 0 && template[idx - 1] == 'X') {
|
||||
while (idx > 0 && tmpl[idx - 1] == 'X') {
|
||||
count++;
|
||||
idx--;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ char *mkdtemp(char *template)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ch = &template[idx];
|
||||
ch = &tmpl[idx];
|
||||
|
||||
/* Try 4 times to make the temp directory */
|
||||
for (attempts = 0; attempts < 4; attempts++) {
|
||||
|
@ -74,7 +74,7 @@ char *mkdtemp(char *template)
|
|||
worst thing that can happen with a directory name collision
|
||||
is that the function will return an error. */
|
||||
|
||||
randombits = malloc(4 * remaining);
|
||||
randombits = (unsigned char *) malloc(4 * remaining);
|
||||
assert(randombits != NULL);
|
||||
assert(scrandom_get_data(randombits, 4 * remaining) ==
|
||||
4 * remaining);
|
||||
|
@ -92,12 +92,12 @@ char *mkdtemp(char *template)
|
|||
|
||||
free(randombits);
|
||||
|
||||
if (mkdir(template, 0700) == 0)
|
||||
if (mkdir(tmpl, 0700) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempts == 4)
|
||||
return NULL; /* keeps the errno from mkdir, whatever it is */
|
||||
|
||||
return template;
|
||||
return tmpl;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void die(int return_code, const char *errmsg, ...)
|
|||
{
|
||||
if (errmsg != NULL) {
|
||||
va_list ap;
|
||||
char *p = malloc(strlen(errmsg)+2);
|
||||
char *p = (char *) malloc(strlen(errmsg)+2);
|
||||
|
||||
strcpy(p, errmsg);
|
||||
strcat(p, "\n");
|
||||
|
@ -70,7 +70,7 @@ void setup_socket(void)
|
|||
char *socket_name;
|
||||
struct sockaddr_un serv_addr;
|
||||
|
||||
socket_name = malloc(strlen(socket_dir)+strlen(socket_file)+2);
|
||||
socket_name = (char *) malloc(strlen(socket_dir)+strlen(socket_file)+2);
|
||||
assert(socket_name != NULL);
|
||||
strcpy(socket_name, socket_dir);
|
||||
|
||||
|
@ -111,7 +111,7 @@ void do_fork(void)
|
|||
char *infostr;
|
||||
int n = strlen(dctx->socket_name) + 40;
|
||||
|
||||
infostr = malloc(n);
|
||||
infostr = (char *) malloc(n);
|
||||
if (snprintf(infostr, n, "OPENSCD_INFO=%s:%lu:1",
|
||||
dctx->socket_name, (ulong) pid) < 0) {
|
||||
kill(pid, SIGTERM);
|
||||
|
@ -138,7 +138,7 @@ void init_dctx(void)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
dctx = malloc(sizeof(struct openscd_context));
|
||||
dctx = (struct openscd_context *) malloc(sizeof(struct openscd_context));
|
||||
assert(dctx != NULL);
|
||||
memset(dctx, 0, sizeof(struct openscd_context));
|
||||
|
||||
|
|
|
@ -4,23 +4,29 @@
|
|||
#include <opensc/opensc.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_CARDS 4
|
||||
|
||||
struct openscd_card {
|
||||
sc_card_t *card;
|
||||
sc_pkcs15_card_t *p15card;
|
||||
|
||||
struct sc_reader *reader;
|
||||
int slot_id;
|
||||
int card_id;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct openscd_context {
|
||||
struct sc_context *ctx;
|
||||
char *socket_name;
|
||||
int socket_fd;
|
||||
|
||||
int cmd_stuff_ok;
|
||||
struct openscd_card {
|
||||
sc_card_t *card;
|
||||
sc_pkcs15_card_t *p15card;
|
||||
|
||||
struct sc_reader *reader;
|
||||
int slot_id;
|
||||
int card_id;
|
||||
pthread_mutex_t mutex;
|
||||
} *cards;
|
||||
struct openscd_card *cards;
|
||||
int card_count;
|
||||
int card_id_number;
|
||||
pthread_mutex_t card_mutex;
|
||||
|
@ -34,10 +40,14 @@ struct openscd_thread_arg {
|
|||
struct sc_reader *reader;
|
||||
};
|
||||
|
||||
char *mkdtemp(char *template);
|
||||
char *mkdtemp(char *tmpl);
|
||||
void die(int return_code, const char *errmsg, ...);
|
||||
void command_handler(struct openscd_context *dctx);
|
||||
void init_cmd_stuff(struct openscd_context *dctx);
|
||||
void cleanup_cmd_stuff(struct openscd_context *dctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OPENSCD_H */
|
||||
|
|
|
@ -149,7 +149,7 @@ search_key(const sc_path_t *path, int type, int ref)
|
|||
/*
|
||||
* Store a secret in the cache
|
||||
*/
|
||||
struct secret *
|
||||
static struct secret *
|
||||
new_entry(const sc_path_t *path, int type, int ref)
|
||||
{
|
||||
struct secret *s;
|
||||
|
@ -200,10 +200,10 @@ sc_keycache_put_key(const sc_path_t *path, int type, int ref,
|
|||
}
|
||||
|
||||
int
|
||||
sc_keycache_put_pin(const sc_path_t *path, int ref, const char *pin)
|
||||
sc_keycache_put_pin(const sc_path_t *path, int ref, const u8 *pin)
|
||||
{
|
||||
return sc_keycache_put_key(path, SC_AC_CHV, ref, pin,
|
||||
pin? strlen(pin) : 0);
|
||||
pin? strlen((char *) pin) : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -224,7 +224,7 @@ sc_keycache_get_key(const sc_path_t *path, int type, int ref,
|
|||
return s->len;
|
||||
}
|
||||
|
||||
const char *
|
||||
const u8 *
|
||||
sc_keycache_get_pin(const sc_path_t *path, int ref)
|
||||
{
|
||||
struct secret *s;
|
||||
|
|
|
@ -29,12 +29,12 @@ extern "C" {
|
|||
|
||||
extern int sc_keycache_put_key(const sc_path_t *, int, int,
|
||||
const unsigned char *, size_t);
|
||||
extern int sc_keycache_put_pin(const sc_path_t *, int, const char *);
|
||||
extern int sc_keycache_put_pin(const sc_path_t *, int, const u8 *);
|
||||
extern int sc_keycache_set_pin_name(const sc_path_t *, int, int);
|
||||
extern int sc_keycache_get_pin_name(const sc_path_t *, int);
|
||||
extern int sc_keycache_find_named_pin(const sc_path_t *, int);
|
||||
extern int sc_keycache_get_key(const sc_path_t *, int, int, unsigned char *, size_t);
|
||||
extern const char *sc_keycache_get_pin(const sc_path_t *, int);
|
||||
extern const u8 *sc_keycache_get_pin(const sc_path_t *, int);
|
||||
extern void sc_keycache_forget_key(const sc_path_t *, int, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -39,8 +39,8 @@ static void cflex_delete_dummy_chvs(sc_profile_t *, sc_card_t *,
|
|||
int, sc_file_t **);
|
||||
static int cflex_create_pin_file(sc_profile_t *, sc_card_t *,
|
||||
sc_path_t *, int,
|
||||
const char *, size_t, int,
|
||||
const char *, size_t, int,
|
||||
const u8 *, size_t, int,
|
||||
const u8 *, size_t, int,
|
||||
sc_file_t **, int);
|
||||
static int cflex_create_empty_pin_file(sc_profile_t *, sc_card_t *,
|
||||
sc_path_t *, int, sc_file_t **);
|
||||
|
@ -172,8 +172,8 @@ cflex_select_pin_reference(sc_profile_t *profike, sc_card_t *card,
|
|||
static int
|
||||
cflex_create_pin(sc_profile_t *profile, sc_card_t *card, sc_file_t *df,
|
||||
sc_pkcs15_object_t *pin_obj,
|
||||
const unsigned char *pin, size_t pin_len,
|
||||
const unsigned char *puk, size_t puk_len)
|
||||
const u8 *pin, size_t pin_len,
|
||||
const u8 *puk, size_t puk_len)
|
||||
{
|
||||
sc_pkcs15_pin_info_t *pin_info = (sc_pkcs15_pin_info_t *) pin_obj->data;
|
||||
sc_file_t *dummies[2];
|
||||
|
@ -453,7 +453,7 @@ cflex_delete_dummy_chvs(sc_profile_t *profile, sc_card_t *card,
|
|||
*/
|
||||
static inline void
|
||||
put_pin(sc_profile_t *profile, unsigned char *buf,
|
||||
const char *pin, size_t len, int retry)
|
||||
const u8 *pin, size_t len, int retry)
|
||||
{
|
||||
if (len > 8)
|
||||
len = 8;
|
||||
|
@ -466,8 +466,8 @@ put_pin(sc_profile_t *profile, unsigned char *buf,
|
|||
static int
|
||||
cflex_create_pin_file(sc_profile_t *profile, sc_card_t *card,
|
||||
sc_path_t *df_path, int ref,
|
||||
const char *pin, size_t pin_len, int pin_tries,
|
||||
const char *puk, size_t puk_len, int puk_tries,
|
||||
const u8 *pin, size_t pin_len, int pin_tries,
|
||||
const u8 *puk, size_t puk_len, int puk_tries,
|
||||
sc_file_t **file_ret, int unprotected)
|
||||
{
|
||||
unsigned char buffer[23];
|
||||
|
@ -551,7 +551,7 @@ cflex_create_empty_pin_file(sc_profile_t *profile, sc_card_t *card,
|
|||
|
||||
*file_ret = NULL;
|
||||
r = cflex_create_pin_file(profile, card, path, ref,
|
||||
"0000", 4, 8,
|
||||
(const u8 *) "0000", 4, 8,
|
||||
NULL, 0, 0,
|
||||
file_ret, 1);
|
||||
if (r == SC_ERROR_FILE_ALREADY_EXISTS)
|
||||
|
|
|
@ -138,7 +138,7 @@ gpk_create_dir(sc_profile_t *profile, sc_card_t *card, sc_file_t *df)
|
|||
return r;
|
||||
|
||||
for (i = 0; i < GPK_MAX_PINS; i++)
|
||||
sc_keycache_put_pin(&df->path, GPK_PIN_SCOPE|i, " ");
|
||||
sc_keycache_put_pin(&df->path, GPK_PIN_SCOPE|i, (const u8 *) " ");
|
||||
}
|
||||
|
||||
return r;
|
||||
|
@ -181,12 +181,12 @@ gpk_select_pin_reference(sc_profile_t *profile, sc_card_t *card,
|
|||
static int
|
||||
gpk_create_pin(sc_profile_t *profile, sc_card_t *card, sc_file_t *df,
|
||||
sc_pkcs15_object_t *pin_obj,
|
||||
const unsigned char *pin, size_t pin_len,
|
||||
const unsigned char *puk, size_t puk_len)
|
||||
const u8 *pin, size_t pin_len,
|
||||
const u8 *puk, size_t puk_len)
|
||||
{
|
||||
sc_pkcs15_pin_info_t *pin_info = (sc_pkcs15_pin_info_t *) pin_obj->data;
|
||||
unsigned char nulpin[8];
|
||||
int r, type;
|
||||
u8 nulpin[8];
|
||||
int r, type;
|
||||
|
||||
if (pin_info->flags & SC_PKCS15_PIN_FLAG_SO_PIN) {
|
||||
type = SC_PKCS15INIT_SO_PIN;
|
||||
|
|
|
@ -53,8 +53,8 @@ struct sc_pkcs15init_operations {
|
|||
*/
|
||||
int (*create_pin)(sc_profile_t *, sc_card_t *, sc_file_t *,
|
||||
sc_pkcs15_object_t *,
|
||||
const unsigned char *pin, size_t pin_len,
|
||||
const unsigned char *puk, size_t puk_len);
|
||||
const u8 *pin, size_t pin_len,
|
||||
const u8 *puk, size_t puk_len);
|
||||
|
||||
/*
|
||||
* Select a reference for a private key object
|
||||
|
@ -107,8 +107,8 @@ struct sc_pkcs15init_operations {
|
|||
*/
|
||||
int (*init_app)(struct sc_profile *, struct sc_card *,
|
||||
struct sc_pkcs15_pin_info *,
|
||||
const unsigned char *pin, size_t pin_len,
|
||||
const unsigned char *puk, size_t puk_len);
|
||||
const u8 *pin, size_t pin_len,
|
||||
const u8 *puk, size_t puk_len);
|
||||
|
||||
/*
|
||||
* Store a new PIN
|
||||
|
@ -120,8 +120,8 @@ struct sc_pkcs15init_operations {
|
|||
*/
|
||||
int (*new_pin)(struct sc_profile *, struct sc_card *,
|
||||
struct sc_pkcs15_pin_info *, unsigned int index,
|
||||
const unsigned char *pin, size_t pin_len,
|
||||
const unsigned char *puk, size_t puk_len);
|
||||
const u8 *pin, size_t pin_len,
|
||||
const u8 *puk, size_t puk_len);
|
||||
|
||||
/*
|
||||
* Store a key on the card
|
||||
|
|
|
@ -2669,7 +2669,7 @@ sc_pkcs15init_get_serial(struct sc_profile *profile, const char **res)
|
|||
|
||||
int
|
||||
sc_pkcs15init_set_pin_data(sc_profile_t *profile, int id,
|
||||
const void *key, size_t len)
|
||||
const u8 *key, size_t len)
|
||||
{
|
||||
return sc_keycache_put_key(NULL, SC_AC_SYMBOLIC, id, key, len);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static void buf_init(BUFHAN * bp, FILE * fp, const char *saved_string)
|
|||
{
|
||||
bp->fp = fp;
|
||||
bp->saved_char = 0;
|
||||
bp->buf = malloc(256);
|
||||
bp->buf = (char *) malloc(256);
|
||||
bp->bufmax = 256;
|
||||
bp->bufcur = 0;
|
||||
bp->buf[0] = '\0';
|
||||
|
@ -55,7 +55,7 @@ static void buf_addch(BUFHAN * bp, char ch)
|
|||
{
|
||||
if (bp->bufcur >= bp->bufmax) {
|
||||
bp->bufmax += 256;
|
||||
bp->buf = realloc(bp->buf, bp->bufmax);
|
||||
bp->buf = (char *) realloc(bp->buf, bp->bufmax);
|
||||
}
|
||||
#if 0
|
||||
printf("pushback %c\n", ch);
|
||||
|
|
|
@ -1220,15 +1220,15 @@ int do_get_data(int argc, char **argv)
|
|||
|
||||
return 0;
|
||||
|
||||
usage: printf("Usage: %s hex_tag [dest_file]\n", argv[-1]);
|
||||
usage: printf("Usage: do_get hex_tag [dest_file]\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int do_put_data(int argc, char **argv)
|
||||
{
|
||||
usage: printf("Usage: put hex_tag source_file\n"
|
||||
"or: put hex_tag aa:bb:cc\n"
|
||||
"or: put hex_tag \"foobar...\"\n");
|
||||
printf("Usage: do_put hex_tag source_file\n"
|
||||
"or: do_put hex_tag aa:bb:cc\n"
|
||||
"or: do_put hex_tag \"foobar...\"\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ char * opt_cert = NULL;
|
|||
char * opt_data = NULL;
|
||||
char * opt_pubkey = NULL;
|
||||
char * opt_outfile = NULL;
|
||||
char * opt_newpin = NULL;
|
||||
char * opt_pin = NULL;
|
||||
char * opt_puk = NULL;
|
||||
u8 * opt_newpin = NULL;
|
||||
u8 * opt_pin = NULL;
|
||||
u8 * opt_puk = NULL;
|
||||
|
||||
static int quiet = 0;
|
||||
|
||||
|
@ -577,7 +577,7 @@ authenticate(sc_pkcs15_object_t *obj)
|
|||
pin = get_pin("Please enter PIN", pin_obj);
|
||||
|
||||
return sc_pkcs15_verify_pin(p15card, pin_info,
|
||||
pin, pin? strlen(pin) : 0);
|
||||
pin, pin? strlen((char *) pin) : 0);
|
||||
}
|
||||
|
||||
void print_pin_info(const struct sc_pkcs15_object *obj)
|
||||
|
@ -898,13 +898,13 @@ int main(int argc, char * const argv[])
|
|||
opt_reader = atoi(optarg);
|
||||
break;
|
||||
case OPT_PIN:
|
||||
opt_pin = optarg;
|
||||
opt_pin = (u8 *) optarg;
|
||||
break;
|
||||
case OPT_NEWPIN:
|
||||
opt_newpin = optarg;
|
||||
opt_newpin = (u8 *) optarg;
|
||||
break;
|
||||
case OPT_PUK:
|
||||
opt_puk = optarg;
|
||||
opt_puk = (u8 *) optarg;
|
||||
break;
|
||||
case 'o':
|
||||
opt_outfile = optarg;
|
||||
|
|
Loading…
Reference in New Issue