- remove signedness warnings printed by new gcc
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1176 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
81f2b7fe7d
commit
2abc504051
|
@ -517,7 +517,8 @@ static int encode_bit_field(const u8 *inbuf, size_t inlen,
|
|||
|
||||
int sc_asn1_decode_integer(const u8 * inbuf, size_t inlen, int *out)
|
||||
{
|
||||
int i, a = 0;
|
||||
int a = 0;
|
||||
size_t i;
|
||||
|
||||
if (inlen > sizeof(int))
|
||||
return SC_ERROR_INVALID_ASN1_OBJECT;
|
||||
|
|
|
@ -49,7 +49,8 @@ static const u8 bin_table[128] = {
|
|||
|
||||
static void to_base64(unsigned int i, u8 *out, int fillers)
|
||||
{
|
||||
unsigned int c, s = 18;
|
||||
unsigned int s = 18;
|
||||
int c;
|
||||
|
||||
for (c = 0; c < 4; c++) {
|
||||
if (fillers >= 4 - c)
|
||||
|
@ -95,8 +96,8 @@ static int from_base64(const char *in, unsigned int *out, int *skip)
|
|||
|
||||
int sc_base64_encode(const u8 *in, size_t len, u8 *out, size_t outlen, size_t linelength)
|
||||
{
|
||||
unsigned int i, chars = 0;
|
||||
int c;
|
||||
unsigned int chars = 0;
|
||||
size_t i, c;
|
||||
|
||||
linelength -= linelength & 0x03;
|
||||
if (linelength < 0)
|
||||
|
|
|
@ -258,9 +258,9 @@ int etoken_list_files(struct sc_card *card, u8 *buf, size_t buflen)
|
|||
{
|
||||
struct sc_apdu apdu;
|
||||
u8 rbuf[256];
|
||||
int r,i;
|
||||
int fids;
|
||||
int r;
|
||||
int len;
|
||||
size_t i, fids;
|
||||
u8 offset;
|
||||
u8 *fid;
|
||||
|
||||
|
@ -398,7 +398,7 @@ static const int ef_acl[9] = {
|
|||
|
||||
static void parse_sec_attr(struct sc_file *file, const u8 *buf, size_t len)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
const int *idx;
|
||||
|
||||
idx = (file->type == SC_FILE_TYPE_DF) ? df_acl : ef_acl;
|
||||
|
@ -430,7 +430,7 @@ static int etoken_create_file(struct sc_card *card, struct sc_file *file)
|
|||
|
||||
if (card->ctx->debug >= 1) {
|
||||
char pbuf[128+1];
|
||||
int n;
|
||||
size_t n;
|
||||
|
||||
for (n = 0; n < file->path.len; n++) {
|
||||
snprintf(pbuf + 2 * n, sizeof(pbuf) - 2 * n,
|
||||
|
|
|
@ -758,7 +758,8 @@ static int flex_compute_signature(struct sc_card *card, const u8 *data,
|
|||
struct flex_private_data *prv = (struct flex_private_data *) card->drv_data;
|
||||
struct sc_apdu apdu;
|
||||
u8 sbuf[SC_MAX_APDU_BUFFER_SIZE];
|
||||
int i, r;
|
||||
int r;
|
||||
size_t i;
|
||||
|
||||
if (data_len != 64 && data_len != 96 && data_len != 128 && data_len != 256) {
|
||||
error(card->ctx, "Illegal input length: %d\n", data_len);
|
||||
|
|
|
@ -78,14 +78,14 @@ struct keyd_record_s {
|
|||
struct df_info_s {
|
||||
struct df_info_s *next;
|
||||
unsigned short path[MAX_CURPATH];
|
||||
int pathlen;
|
||||
size_t pathlen;
|
||||
struct rule_record_s *rule_file; /* keeps records of EF_Rule. */
|
||||
struct keyd_record_s *keyd_file; /* keeps records of EF_KeyD. */
|
||||
};
|
||||
|
||||
struct mcrd_priv_data {
|
||||
unsigned short curpath[MAX_CURPATH]; /* The currently selected path. */
|
||||
int curpathlen; /* Length of this path or 0 if unknown. */
|
||||
size_t curpathlen; /* Length of this path or 0 if unknown. */
|
||||
int is_ef; /* True if the path points to an EF. */
|
||||
struct df_info_s *df_infos;
|
||||
};
|
||||
|
@ -559,7 +559,7 @@ static void process_fcp(struct sc_card *card, struct sc_file *file,
|
|||
tag = sc_asn1_find_tag(ctx, p, len, 0x84, &taglen);
|
||||
if (tag != NULL && taglen > 0 && taglen <= 16) {
|
||||
char name[17];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
memcpy(file->name, tag, taglen);
|
||||
file->namelen = taglen;
|
||||
|
@ -750,7 +750,7 @@ select_file_by_path (struct sc_card *card, unsigned short *pathptr,
|
|||
{
|
||||
struct mcrd_priv_data *priv = DRVDATA (card);
|
||||
int r;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
assert (!priv->curpathlen || priv->curpath[0] == MFID);
|
||||
|
||||
|
@ -913,7 +913,7 @@ mcrd_select_file(struct sc_card *card, const struct sc_path *path,
|
|||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
if (card->ctx->debug >= 3) {
|
||||
char line[256], *linep = line;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
linep += sprintf(linep,
|
||||
"requesting type %d, path ",
|
||||
|
@ -964,7 +964,7 @@ mcrd_select_file(struct sc_card *card, const struct sc_path *path,
|
|||
|
||||
if (card->ctx->debug >= 3) {
|
||||
char line[256], *linep = line;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
linep += sprintf(linep, " result=%d, ef=%d, curpath=",
|
||||
r, priv->is_ef);
|
||||
|
|
|
@ -260,7 +260,8 @@ static int starcos_select_aid(struct sc_card *card,
|
|||
{
|
||||
sc_apdu_t apdu;
|
||||
sc_file_t *file = NULL;
|
||||
int i = 0, r;
|
||||
int r;
|
||||
size_t i = 0;
|
||||
|
||||
if (!card )
|
||||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||
|
@ -425,7 +426,8 @@ static int starcos_select_file(struct sc_card *card,
|
|||
struct sc_file **file_out)
|
||||
{
|
||||
u8 pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;
|
||||
int r, pathlen, i;
|
||||
int r;
|
||||
size_t i, pathlen;
|
||||
|
||||
if ( !card || !in_path )
|
||||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||
|
|
|
@ -388,7 +388,7 @@ static void tcos_process_fci(struct sc_context *ctx, struct sc_file *file,
|
|||
tag = sc_asn1_find_tag(ctx, p, len, 0x84, &taglen);
|
||||
if (tag != NULL && taglen > 0 && taglen <= 16) {
|
||||
char name[17];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
memcpy(file->name, tag, taglen);
|
||||
file->namelen = taglen;
|
||||
|
|
|
@ -651,22 +651,23 @@ int sc_select_file(struct sc_card *card,
|
|||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||
if (in_path->type == SC_PATH_TYPE_PATH) {
|
||||
/* Perform a sanity check */
|
||||
int i;
|
||||
size_t i;
|
||||
if ((in_path->len & 1) != 0)
|
||||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||
for (i = 0; i < in_path->len/2; i++) {
|
||||
u8 p1 = in_path->value[2*i],
|
||||
p2 = in_path->value[2*i+1];
|
||||
if ((p1 == 0x3F && p2 == 0x00) && i > 0)
|
||||
if ((p1 == 0x3F && p2 == 0x00) && i != 0)
|
||||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||
}
|
||||
}
|
||||
if (card->ctx->debug >= 2) {
|
||||
size_t i;
|
||||
char line[128], *linep = line;
|
||||
|
||||
linep += sprintf(linep, "called with type %d, path ", in_path->type);
|
||||
for (r = 0; r < in_path->len; r++) {
|
||||
sprintf(linep, "%02X", in_path->value[r]);
|
||||
for (i = 0; i < in_path->len; i++) {
|
||||
sprintf(linep, "%02X", in_path->value[i]);
|
||||
linep += 2;
|
||||
}
|
||||
strcpy(linep, "\n");
|
||||
|
|
|
@ -38,7 +38,7 @@ static const struct app_entry apps[] = {
|
|||
|
||||
static const struct app_entry * find_app_entry(const u8 * aid, size_t aid_len)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof(apps)/sizeof(apps[0]); i++) {
|
||||
if (apps[i].aid_len == aid_len &&
|
||||
|
|
|
@ -343,7 +343,7 @@ static void process_fci(struct sc_context *ctx, struct sc_file *file,
|
|||
tag = sc_asn1_find_tag(ctx, p, len, 0x84, &taglen);
|
||||
if (tag != NULL && taglen > 0 && taglen <= 16) {
|
||||
char name[17];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
memcpy(file->name, tag, taglen);
|
||||
file->namelen = taglen;
|
||||
|
|
|
@ -155,7 +155,7 @@ void sc_hex_dump(struct sc_context *ctx, const u8 * in, size_t count, char *buf,
|
|||
return;
|
||||
while (count) {
|
||||
char ascbuf[17];
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < count && i < 16; i++) {
|
||||
sprintf(p, "%02X ", *in);
|
||||
|
|
|
@ -208,7 +208,7 @@ struct sc_pbkdf2_params {
|
|||
u8 salt[16];
|
||||
size_t salt_len;
|
||||
int iterations;
|
||||
int key_length;
|
||||
size_t key_length;
|
||||
struct sc_algorithm_id hash_alg;
|
||||
};
|
||||
|
||||
|
@ -426,7 +426,7 @@ struct sc_card {
|
|||
int cla;
|
||||
u8 atr[SC_MAX_ATR_SIZE];
|
||||
size_t atr_len;
|
||||
int max_le;
|
||||
size_t max_le;
|
||||
|
||||
struct sc_app_info *app[SC_MAX_CARD_APPS];
|
||||
int app_count;
|
||||
|
|
|
@ -269,7 +269,7 @@ sc_asn1_get_algorithm_info(const struct sc_algorithm_id *id)
|
|||
}
|
||||
} else {
|
||||
while (aip->id >= 0) {
|
||||
if (aip->id == id->algorithm)
|
||||
if (aip->id == (int)id->algorithm)
|
||||
return aip;
|
||||
aip++;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ static int generate_cache_filename(struct sc_pkcs15_card *p15card,
|
|||
{
|
||||
char dir[PATH_MAX];
|
||||
char pathname[SC_MAX_PATH_SIZE*2+1];
|
||||
int i, r;
|
||||
int r;
|
||||
const u8 *pathptr;
|
||||
size_t pathlen;
|
||||
size_t i, pathlen;
|
||||
|
||||
if (path->type != SC_PATH_TYPE_PATH)
|
||||
return SC_ERROR_INVALID_ARGUMENTS;
|
||||
|
@ -69,9 +69,9 @@ int sc_pkcs15_read_cached_file(struct sc_pkcs15_card *p15card,
|
|||
u8 **buf, size_t *bufsize)
|
||||
{
|
||||
char fname[160];
|
||||
int r, got;
|
||||
int r;
|
||||
FILE *f;
|
||||
size_t count, offset;
|
||||
size_t count, offset, got;
|
||||
struct stat stbuf;
|
||||
u8 *data = NULL;
|
||||
|
||||
|
@ -87,8 +87,8 @@ int sc_pkcs15_read_cached_file(struct sc_pkcs15_card *p15card,
|
|||
} else {
|
||||
count = path->count;
|
||||
offset = path->index;
|
||||
if (offset >= stbuf.st_size
|
||||
|| offset + count >= stbuf.st_size)
|
||||
if (offset >= (size_t)stbuf.st_size
|
||||
|| offset + count >= (size_t)stbuf.st_size)
|
||||
return SC_ERROR_FILE_NOT_FOUND; /* cache file bad? */
|
||||
}
|
||||
if (*buf == NULL) {
|
||||
|
|
|
@ -47,7 +47,7 @@ static const struct digest_info_prefix {
|
|||
unsigned int algorithm;
|
||||
const u8 * hdr;
|
||||
size_t hdr_len;
|
||||
int hash_len;
|
||||
size_t hash_len;
|
||||
} digest_info_prefix[DIGEST_INFO_COUNT] = {
|
||||
{ SC_ALGORITHM_RSA_HASH_NONE, NULL, 0, -1 },
|
||||
{ SC_ALGORITHM_RSA_HASH_MD5, hdr_md5, sizeof(hdr_md5), 16 },
|
||||
|
@ -242,7 +242,8 @@ static int add_padding(struct sc_context *ctx, const u8 *in, size_t inlen, u8 *o
|
|||
size_t *outlen, unsigned long flags, unsigned int mod_length)
|
||||
{
|
||||
const struct digest_info_prefix *pfx;
|
||||
int j, hash_algo, pad_algo;
|
||||
int j, pad_algo;
|
||||
unsigned int hash_algo;
|
||||
|
||||
hash_algo = flags & SC_ALGORITHM_RSA_HASHES;
|
||||
pad_algo = flags & SC_ALGORITHM_RSA_PADS;
|
||||
|
|
|
@ -87,8 +87,9 @@ static const struct sc_asn1_entry c_asn1_tokeninfo[] = {
|
|||
|
||||
static void parse_tokeninfo(struct sc_pkcs15_card *card, const u8 * buf, size_t buflen)
|
||||
{
|
||||
int i, r;
|
||||
int r;
|
||||
u8 serial[128];
|
||||
size_t i;
|
||||
size_t serial_len = sizeof(serial);
|
||||
u8 mnfid[SC_PKCS15_MAX_LABEL_SIZE];
|
||||
size_t mnfid_len = sizeof(mnfid);
|
||||
|
@ -1194,7 +1195,7 @@ void sc_pkcs15_format_id(const char *str, struct sc_pkcs15_id *id)
|
|||
|
||||
void sc_pkcs15_print_id(const struct sc_pkcs15_id *id)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < id->len; i++)
|
||||
printf("%02X", id->value[i]);
|
||||
|
|
|
@ -71,7 +71,7 @@ struct sc_pkcs15_pin_info {
|
|||
struct sc_pkcs15_id auth_id;
|
||||
int reference;
|
||||
int flags, type;
|
||||
int min_length, stored_length, max_length;
|
||||
size_t min_length, stored_length, max_length;
|
||||
u8 pad_char;
|
||||
struct sc_path path;
|
||||
int tries_left;
|
||||
|
@ -247,7 +247,7 @@ struct sc_pkcs15_prkey_info {
|
|||
struct sc_pkcs15_id id; /* correlates to public certificate id */
|
||||
unsigned int usage, access_flags;
|
||||
int native, key_reference;
|
||||
int modulus_length;
|
||||
size_t modulus_length;
|
||||
|
||||
struct sc_path path;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue