fix signed and size_t warnings.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2916 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2006-04-26 11:41:57 +00:00
parent 03f5827c30
commit 41ff15ec1f
12 changed files with 43 additions and 43 deletions

View File

@ -191,7 +191,7 @@ sc_pkcs11_gen_keypair_soft(CK_KEY_TYPE keytype, CK_ULONG keybits,
* If a hash function was used, we can make a big shortcut by
* finishing with EVP_VerifyFinal().
*/
CK_RV sc_pkcs11_verify_data(unsigned char *pubkey, int pubkey_len,
CK_RV sc_pkcs11_verify_data(const unsigned char *pubkey, int pubkey_len,
CK_MECHANISM_TYPE mech, sc_pkcs11_operation_t *md,
unsigned char *data, int data_len,
unsigned char *signat, int signat_len)

View File

@ -134,7 +134,7 @@ static void print_dn(FILE *f, CK_LONG type, CK_VOID_PTR value, CK_ULONG size, CK
print_generic(f, type, value, size, arg);
if(size && value) {
X509_NAME *name;
name = d2i_X509_NAME(NULL, (unsigned char **)&value, size);
name = d2i_X509_NAME(NULL, (const unsigned char **)&value, size);
if(name) {
BIO *bio = BIO_new(BIO_s_file());
BIO_set_fp(bio, f, 0);

View File

@ -430,7 +430,7 @@ CK_RV sc_pkcs11_register_sign_and_hash_mechanism(struct sc_pkcs11_card *,
/* Random generation functions */
CK_RV sc_pkcs11_gen_keypair_soft(CK_KEY_TYPE keytype, CK_ULONG keybits,
struct sc_pkcs15_prkey *privkey, struct sc_pkcs15_pubkey *pubkey);
CK_RV sc_pkcs11_verify_data(unsigned char *pubkey, int pubkey_len,
CK_RV sc_pkcs11_verify_data(const unsigned char *pubkey, int pubkey_len,
CK_MECHANISM_TYPE mech, sc_pkcs11_operation_t *md,
unsigned char *inp, int inp_len,
unsigned char *signat, int signat_len);

View File

@ -65,7 +65,7 @@ static void print_pin(const struct sc_pkcs15_object *obj)
printf(", %s", pin_flags[i]);
}
printf("\n");
printf("\tLength : min_len:%d, max_len:%d, stored_len:%d\n", pin->min_length, pin->max_length, pin->stored_length);
printf("\tLength : min_len:%lu, max_len:%lu, stored_len:%lu\n", pin->min_length, pin->max_length, pin->stored_length);
printf("\tPad char : 0x%02X\n", pin->pad_char);
printf("\tReference : %d\n", pin->reference);
printf("\tEncoding : ");
@ -122,7 +122,7 @@ static void print_prkey(const struct sc_pkcs15_object *obj)
}
printf("\n");
if (obj->type == SC_PKCS15_TYPE_PRKEY_RSA)
printf("\tModLength : %d\n", prkey->modulus_length);
printf("\tModLength : %lu\n", prkey->modulus_length);
printf("\tKey ref : %d\n", prkey->key_reference);
printf("\tNative : %s\n", prkey->native ? "yes" : "no");
if (prkey->path.len) {
@ -169,7 +169,7 @@ static void print_pubkey(const struct sc_pkcs15_object *obj)
}
printf("\n");
if (obj->type == SC_PKCS15_TYPE_PUBKEY_RSA)
printf("\tModLength : %d\n", pubkey->modulus_length);
printf("\tModLength : %lu\n", pubkey->modulus_length);
printf("\tKey ref : %d\n", pubkey->key_reference);
printf("\tNative : %s\n", pubkey->native ? "yes" : "no");
printf("\tPath : ");

View File

@ -138,7 +138,7 @@ static void do_esteid(sc_card_t *card)
{
sc_path_t path;
int r, i;
char buff[512];
unsigned char buff[512];
if (stats) {
int key_used[4];
@ -181,14 +181,14 @@ static void do_esteid(sc_card_t *card)
}
buff[r] = '\0';
if (exec_program) {
char * cp;
unsigned char * cp;
cp = malloc(strlen(esteid_data[i].env_name) +
strlen(buff) + 2);
strlen((char *) buff) + 2);
if (cp) {
strcpy(cp,esteid_data[i].env_name);
strcat(cp,"=");
strcat(cp,buff);
putenv(cp);
strcpy((char *) cp,esteid_data[i].env_name);
strcat((char *) cp,"=");
strcat((char *) cp,(char *) buff);
putenv((char *) cp);
}
} else {
printf("%s: %s\n", esteid_data[i].name, buff);
@ -319,7 +319,7 @@ static void do_belpic(sc_card_t *card)
{"municipal", SC_ASN1_UTF8STRING, 3, 0, address_data.municipality, &municipalitylen},
{NULL, 0, 0, 0, NULL, NULL}};
char buff[512];
unsigned char buff[512];
int r;
r = read_transp(card, "3f00df014031", buff, sizeof(buff));

View File

@ -95,7 +95,7 @@ void show_pin(
if(f->type!=SC_FILE_TYPE_WORKING_EF || f->ef_structure!=SC_FILE_EF_LINEAR_VARIABLE_TLV ||
f->prop_attr_len!=5 || f->prop_attr[0]!=0x01 || f->prop_attr[1]!=0x80
){
printf("\nInvald PIN-file: Type=%d, EF-Structure=%d, Prop-Len=%d %02X:%02X:%02X\n",
printf("\nInvald PIN-file: Type=%d, EF-Structure=%d, Prop-Len=%lu %02X:%02X:%02X\n",
f->type, f->ef_structure, f->prop_attr_len,
f->prop_attr[0], f->prop_attr[1], f->prop_attr[2]
);
@ -133,7 +133,7 @@ void show_certs(
printf("\n");
for(i=0;i<sizeof(certlist)/sizeof(certlist[0]);++i){
printf("Certificate %d: %s", i, certlist[i].label); fflush(stdout);
printf("Certificate %lu: %s", i, certlist[i].label); fflush(stdout);
sc_format_path(certlist[i].path,&p);
if((j=sc_select_file(card,&p,&f))<0){
@ -150,11 +150,11 @@ void show_certs(
printf(", Cannot read Cert-file, %s\n", sc_strerror(j));
continue;
}
printf(", Maxlen=%u", f->size);
printf(", Maxlen=%lu", f->size);
q=buf;
if(q[0]==0x30 && q[1]==0x82){
if(q[4]==6 && q[5]<10 && q[q[5]+6]==0x30 && q[q[5]+7]==0x82) q+=q[5]+6;
printf(", Len=%u\n", (q[2]<<8)|q[3]);
printf(", Len=%d\n", (q[2]<<8)|q[3]);
if((c=d2i_X509(NULL,&q,f->size))){
X509_NAME_get_text_by_NID(c->cert_info->subject, NID_commonName, buf,sizeof(buf));
printf(" Subject-CN: %s\n", buf);
@ -233,7 +233,7 @@ void show_card(
if(file->type!=SC_FILE_TYPE_WORKING_EF || file->ef_structure!=SC_FILE_EF_TRANSPARENT ||
file->size!=12 || (len=sc_read_binary(card,0,buf,12,0))!=12 || buf[0]!=0x5A || buf[1]!=0x0A
){
printf("\nInvald Serial-Number: Type=%d, EF-Structure=%d, Size=%d\n",
printf("\nInvald Serial-Number: Type=%d, EF-Structure=%d, Size=%lu\n",
file->type, file->ef_structure, file->size
);
return;
@ -588,7 +588,7 @@ int main(
printf("%d Reader detected\n", sc_ctx_get_reader_count(ctx));
for(i=0; i < sc_ctx_get_reader_count(ctx); ++i){
sc_reader_t *reader = sc_ctx_get_reader(ctx, i);
printf("%d: %s, Driver: %s, %d Slot(s)\n", i, reader->name,
printf("%lu: %s, Driver: %s, %d Slot(s)\n", i, reader->name,
reader->driver->name, reader->slot_count);
}
if(reader < 0 || reader >= (int)sc_ctx_get_reader_count(ctx)){

View File

@ -175,7 +175,7 @@ static void print_file(const sc_file_t *file)
break;
}
printf("\t%4s", st);
printf(" %5d", file->size);
printf(" %5lu", file->size);
if (file->namelen) {
printf("\tName: ");
print_binary(stdout, file->name, file->namelen);
@ -418,7 +418,7 @@ static int do_info(int argc, char **argv)
printf("%02X", path.value[i]);
}
}
printf("\n%-15s%d bytes\n", "File size:", file->size);
printf("\n%-15s%lu bytes\n", "File size:", file->size);
if (file->type == SC_FILE_TYPE_DF) {
const char *ops[] = {

View File

@ -173,7 +173,7 @@ static int print_file(sc_card_t *in_card, const sc_file_t *file,
};
printf("ef structure: %s, ", structs[file->ef_structure]);
}
printf("size: %d\n", file->size);
printf("size: %lu\n", file->size);
for (r = 0; r < depth; r++)
printf(" ");
if (file->type == SC_FILE_TYPE_DF)
@ -310,7 +310,7 @@ static int send_apdu(void)
apdu.data = sbuf;
apdu.datalen = apdu.lc;
if (len < apdu.lc) {
fprintf(stderr, "APDU too short (need %d bytes).\n",
fprintf(stderr, "APDU too short (need %lu bytes).\n",
apdu.lc-len);
return 2;
}
@ -324,7 +324,7 @@ static int send_apdu(void)
} else
apdu.cse = SC_APDU_CASE_3_SHORT;
if (len) {
fprintf(stderr, "APDU too long (%d bytes extra).\n", len);
fprintf(stderr, "APDU too long (%lu bytes extra).\n", len);
return 2;
}
} else if (len == 1) {

View File

@ -279,7 +279,7 @@ static int send_apdu(void)
apdu.data = sbuf;
apdu.datalen = apdu.lc;
if (len < apdu.lc) {
fprintf(stderr, "APDU too short (need %d bytes).\n",
fprintf(stderr, "APDU too short (need %lu bytes).\n",
apdu.lc-len);
return 2;
}
@ -293,7 +293,7 @@ static int send_apdu(void)
} else
apdu.cse = SC_APDU_CASE_3_SHORT;
if (len) {
fprintf(stderr, "APDU too long (%d bytes extra).\n", len);
fprintf(stderr, "APDU too long (%lu bytes extra).\n", len);
return 2;
}
} else if (len == 1) {

View File

@ -783,14 +783,14 @@ static int login(CK_SESSION_HANDLE session, int need_to_be_so)
void
init_token(CK_SLOT_ID slot)
{
char token_label[33];
unsigned char token_label[33];
char new_buf[21], *new_pin = NULL;
CK_TOKEN_INFO info;
CK_RV rv;
if (!opt_object_label)
fatal("The token label must be specified using --label\n");
snprintf(token_label, sizeof (token_label), "%-32.32s",
snprintf((char *) token_label, sizeof (token_label), "%-32.32s",
opt_object_label);
get_token_info(slot, &info);

View File

@ -251,7 +251,7 @@ static int sign_ext(struct sc_pkcs15_object *obj,
nid = NID_sha1;
else {
fprintf(stderr,
"Invalid input size (%u bytes)\n",
"Invalid input size (%lu bytes)\n",
len);
return SC_ERROR_INVALID_ARGUMENTS;
}
@ -293,7 +293,7 @@ static int sign(struct sc_pkcs15_object *obj)
if (obj->type == SC_PKCS15_TYPE_PRKEY_RSA
&& !(opt_crypt_flags & SC_ALGORITHM_RSA_PAD_PKCS1)
&& (size_t)c != key->modulus_length/8) {
fprintf(stderr, "Input has to be exactly %d bytes, when using no padding.\n",
fprintf(stderr, "Input has to be exactly %lu bytes, when using no padding.\n",
key->modulus_length/8);
return 2;
}

View File

@ -216,7 +216,7 @@ list_data_object(const char *kind, const u8*data, size_t data_len)
{
size_t i;
printf("%s (%i bytes): <", kind, data_len);
printf("%s (%lu bytes): <", kind, data_len);
for (i = 0; i < data_len; i++)
printf(" %02X", data[i]);
printf(" >\n");
@ -239,13 +239,13 @@ print_data_object(const char *kind, const u8*data, size_t data_len)
}
for (i=0; i < data_len; i++)
fprintf(outf, "%c", data[i]);
printf("Dumping (%i bytes) to file <%s>: <", data_len, opt_outfile);
printf("Dumping (%lu bytes) to file <%s>: <", data_len, opt_outfile);
for (i=0; i < data_len; i++)
printf(" %02X", data[i]);
printf(" >\n");
fclose(outf);
} else {
printf("%s (%i bytes): <", kind, data_len);
printf("%s (%lu bytes): <", kind, data_len);
for (i=0; i < data_len; i++)
printf(" %02X", data[i]);
printf(" >\n");
@ -411,7 +411,7 @@ static void print_prkey_info(const struct sc_pkcs15_object *obj)
printf(", %s", access_flags[i]);
}
printf("\n");
printf("\tModLength : %d\n", prkey->modulus_length);
printf("\tModLength : %lu\n", prkey->modulus_length);
printf("\tKey ref : %d\n", prkey->key_reference);
printf("\tNative : %s\n", prkey->native ? "yes" : "no");
printf("\tPath : %s\n", sc_print_path(&prkey->path));
@ -469,7 +469,7 @@ static void print_pubkey_info(const struct sc_pkcs15_object *obj)
printf(", %s", access_flags[i]);
}
printf("\n");
printf("\tModLength : %d\n", pubkey->modulus_length);
printf("\tModLength : %lu\n", pubkey->modulus_length);
printf("\tKey ref : %d\n", pubkey->key_reference);
printf("\tNative : %s\n", pubkey->native ? "yes" : "no");
printf("\tPath : %s\n", sc_print_path(&pubkey->path));
@ -634,8 +634,8 @@ static int read_ssh_key(void)
/* key_to_blob */
if (pubkey->algorithm == SC_ALGORITHM_RSA) {
char buf[2048];
char *uu;
unsigned char buf[2048];
unsigned char *uu;
uint32_t len;
uint32_t n;
@ -644,7 +644,7 @@ static int read_ssh_key(void)
buf[2]=0;
buf[3]=7;
len = sprintf(buf+4,"ssh-rsa");
len = sprintf((char *) buf+4,"ssh-rsa");
len+=4;
if (sizeof(buf)-len < 4+pubkey->u.rsa.exponent.len)
@ -686,8 +686,8 @@ static int read_ssh_key(void)
}
if (pubkey->algorithm == SC_ALGORITHM_DSA) {
char buf[2048];
char *uu;
unsigned char buf[2048];
unsigned char *uu;
uint32_t len;
uint32_t n;
@ -696,7 +696,7 @@ static int read_ssh_key(void)
buf[2]=0;
buf[3]=7;
len = sprintf(buf+4,"ssh-dss");
len = sprintf((char *) buf+4,"ssh-dss");
len+=4;
if (sizeof(buf)-len < 5+pubkey->u.dsa.p.len)
@ -882,7 +882,7 @@ static void print_pin_info(const struct sc_pkcs15_object *obj)
printf(", %s", pin_flags[i]);
}
printf("\n");
printf("\tLength : min_len:%d, max_len:%d, stored_len:%d\n",
printf("\tLength : min_len:%lu, max_len:%lu, stored_len:%lu\n",
pin->min_length, pin->max_length, pin->stored_length);
printf("\tPad char : 0x%02X\n", pin->pad_char);
printf("\tReference : %d\n", pin->reference);