fix more warnings found by gcc/sparse.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3178 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
4acfe6b096
commit
047ee1d73e
|
@ -1056,6 +1056,8 @@ static int mcrd_restore_se(sc_card_t * card, int se_num)
|
|||
return sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* this function isn't used anywhere */
|
||||
static int select_key_df(sc_card_t * card)
|
||||
{
|
||||
int r;
|
||||
|
@ -1078,6 +1080,7 @@ static int select_key_df(sc_card_t * card)
|
|||
SC_TEST_RET(card->ctx, r, "Micardo select DF failed");
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* It seems that MICARDO does not fully comply with ISO, so I use
|
||||
values gathered from peeking actual signing opeations using a
|
||||
|
|
|
@ -80,7 +80,7 @@ static int muscle_match_card(sc_card_t *card)
|
|||
*/
|
||||
static unsigned short muscle_parse_singleAcl(const sc_acl_entry_t* acl)
|
||||
{
|
||||
unsigned short access = 0;
|
||||
unsigned short acl_entry = 0;
|
||||
while(acl) {
|
||||
int key = acl->key_ref;
|
||||
int method = acl->method;
|
||||
|
@ -92,7 +92,7 @@ static unsigned short muscle_parse_singleAcl(const sc_acl_entry_t* acl)
|
|||
case SC_AC_UNKNOWN:
|
||||
break;
|
||||
case SC_AC_CHV:
|
||||
access |= (1 << key); /* Assuming key 0 == SO */
|
||||
acl_entry |= (1 << key); /* Assuming key 0 == SO */
|
||||
break;
|
||||
case SC_AC_AUT:
|
||||
case SC_AC_TERM:
|
||||
|
@ -103,15 +103,15 @@ static unsigned short muscle_parse_singleAcl(const sc_acl_entry_t* acl)
|
|||
}
|
||||
acl = acl->next;
|
||||
}
|
||||
return access;
|
||||
return acl_entry;
|
||||
}
|
||||
|
||||
static void muscle_parse_acls(const sc_file_t* file, unsigned short* read, unsigned short* write, unsigned short* delete)
|
||||
static void muscle_parse_acls(const sc_file_t* file, unsigned short* read_perm, unsigned short* write_perm, unsigned short* delete_perm)
|
||||
{
|
||||
assert(read && write && delete);
|
||||
*read = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_READ));
|
||||
*write = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_UPDATE));
|
||||
*delete = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_DELETE));
|
||||
assert(read_perm && write_perm && delete_perm);
|
||||
*read_perm = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_READ));
|
||||
*write_perm = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_UPDATE));
|
||||
*delete_perm = muscle_parse_singleAcl(sc_file_get_acl_entry(file, SC_AC_OP_DELETE));
|
||||
}
|
||||
|
||||
static int muscle_create_directory(sc_card_t *card, sc_file_t *file)
|
||||
|
@ -147,7 +147,7 @@ static int muscle_create_file(sc_card_t *card, sc_file_t *file)
|
|||
{
|
||||
mscfs_t *fs = MUSCLE_FS(card);
|
||||
int objectSize = file->size;
|
||||
unsigned short read = 0, write = 0, delete = 0;
|
||||
unsigned short read_perm = 0, write_perm = 0, delete_perm = 0;
|
||||
msc_id objectId;
|
||||
int r;
|
||||
if(file->type == SC_FILE_TYPE_DF)
|
||||
|
@ -157,16 +157,16 @@ static int muscle_create_file(sc_card_t *card, sc_file_t *file)
|
|||
if(file->id == 0) /* No null name files */
|
||||
return SC_ERROR_INVALID_ARGUMENTS;
|
||||
|
||||
muscle_parse_acls(file, &read, &write, &delete);
|
||||
muscle_parse_acls(file, &read_perm, &write_perm, &delete_perm);
|
||||
|
||||
mscfs_lookup_local(fs, file->id, &objectId);
|
||||
r = msc_create_object(card, objectId, objectSize, read, write, delete);
|
||||
r = msc_create_object(card, objectId, objectSize, read_perm, write_perm, delete_perm);
|
||||
mscfs_clear_cache(fs);
|
||||
if(r >= 0) return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static int muscle_read_binary(sc_card_t *card, unsigned int index, u8* buf, size_t count, unsigned long flags)
|
||||
static int muscle_read_binary(sc_card_t *card, unsigned int idx, u8* buf, size_t count, unsigned long flags)
|
||||
{
|
||||
mscfs_t *fs = MUSCLE_FS(card);
|
||||
int r;
|
||||
|
@ -184,11 +184,11 @@ static int muscle_read_binary(sc_card_t *card, unsigned int index, u8* buf, size
|
|||
oid[1] = oid[3];
|
||||
oid[2] = oid[3] = 0;
|
||||
}
|
||||
r = msc_read_object(card, objectId, index, buf, count);
|
||||
r = msc_read_object(card, objectId, idx, buf, count);
|
||||
SC_FUNC_RETURN(card->ctx, 0, r);
|
||||
}
|
||||
|
||||
static int muscle_update_binary(sc_card_t *card, unsigned int index, const u8* buf, size_t count, unsigned long flags)
|
||||
static int muscle_update_binary(sc_card_t *card, unsigned int idx, const u8* buf, size_t count, unsigned long flags)
|
||||
{
|
||||
mscfs_t *fs = MUSCLE_FS(card);
|
||||
int r;
|
||||
|
@ -207,8 +207,8 @@ static int muscle_update_binary(sc_card_t *card, unsigned int index, const u8* b
|
|||
oid[1] = oid[3];
|
||||
oid[2] = oid[3] = 0;
|
||||
}
|
||||
if(file->size < index + count) {
|
||||
int newFileSize = index + count;
|
||||
if(file->size < idx + count) {
|
||||
int newFileSize = idx + count;
|
||||
u8* buffer = malloc(newFileSize);
|
||||
if(buffer == NULL) SC_FUNC_RETURN(card->ctx, 0, SC_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -219,7 +219,7 @@ static int muscle_update_binary(sc_card_t *card, unsigned int index, const u8* b
|
|||
if(r < 0) goto update_bin_free_buffer;
|
||||
r = msc_create_object(card, objectId, newFileSize, 0,0,0);
|
||||
if(r < 0) goto update_bin_free_buffer;
|
||||
memcpy(buffer + index, buf, count);
|
||||
memcpy(buffer + idx, buf, count);
|
||||
r = msc_update_object(card, objectId, 0, buffer, newFileSize);
|
||||
if(r < 0) goto update_bin_free_buffer;
|
||||
file->size = newFileSize;
|
||||
|
@ -227,7 +227,7 @@ update_bin_free_buffer:
|
|||
free(buffer);
|
||||
SC_FUNC_RETURN(card->ctx, 0, r);
|
||||
} else {
|
||||
r = msc_update_object(card, objectId, index, buf, count);
|
||||
r = msc_update_object(card, objectId, idx, buf, count);
|
||||
}
|
||||
//mscfs_clear_cache(fs);
|
||||
return r;
|
||||
|
|
|
@ -143,6 +143,8 @@ static int auth_sm_release (struct sc_card *card, struct sc_sm_info *sm_info,
|
|||
unsigned char *data, int data_len);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* this function isn't used anywhere */
|
||||
static void _auth_print_acls(struct sc_card *card, struct sc_file *file)
|
||||
{
|
||||
int ii, jj;
|
||||
|
@ -156,7 +158,7 @@ static void _auth_print_acls(struct sc_card *card, struct sc_file *file)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
auth_finish(sc_card_t *card)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "internal.h"
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <openssl/evp.h>
|
||||
|
@ -1185,7 +1186,7 @@ err:
|
|||
static int piv_general_external_authenticate(sc_card_t *card,
|
||||
unsigned int key_ref, unsigned int alg_id)
|
||||
{
|
||||
piv_private_data_t * priv = PIV_DATA(card);
|
||||
/* unused: piv_private_data_t * priv = PIV_DATA(card); */
|
||||
int r, outl;
|
||||
u8 *rbuf = NULL;
|
||||
size_t rbuflen;
|
||||
|
|
|
@ -84,6 +84,9 @@ static int sc_decompress_gzip(u8* out, size_t* outLen, const u8* in, size_t inLe
|
|||
}
|
||||
|
||||
int sc_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method) {
|
||||
unsigned long zlib_outlen;
|
||||
int rc;
|
||||
|
||||
if(method == COMPRESSION_AUTO) {
|
||||
method = detect_method(in, inLen);
|
||||
if(method == COMPRESSION_UNKNOWN) {
|
||||
|
@ -92,7 +95,10 @@ int sc_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int metho
|
|||
}
|
||||
switch(method) {
|
||||
case COMPRESSION_ZLIB:
|
||||
return zerr_to_opensc(uncompress(out, outLen, in, inLen));
|
||||
zlib_outlen = *outLen;
|
||||
rc = zerr_to_opensc(uncompress(out, &zlib_outlen, in, inLen));
|
||||
*outLen = zlib_outlen;
|
||||
return rc;
|
||||
case COMPRESSION_GZIP:
|
||||
return sc_decompress_gzip(out, outLen, in, inLen);
|
||||
default:
|
||||
|
|
|
@ -114,7 +114,7 @@ static int sc_pkcs15emu_atrust_acos_init(sc_pkcs15_card_t *p15card)
|
|||
#if 0
|
||||
{"C.CH.DS", 0, "DF70C002","2", 0},/* Signature Certificate */
|
||||
#endif
|
||||
{NULL, 0, NULL, 0, 0}
|
||||
{NULL, 0, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
const pindata pins[] = {
|
||||
|
|
|
@ -173,7 +173,7 @@ static int sc_pkcs15emu_gemsafe_init(sc_pkcs15_card_t *p15card)
|
|||
{
|
||||
const cdata certs[] = {
|
||||
{"User certificate",0, "","1", 0},
|
||||
{NULL, 0, NULL, 0, 0}
|
||||
{NULL, 0, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
const pindata pins[] = {
|
||||
|
|
|
@ -113,9 +113,9 @@ static int sc_pkcs15emu_piv_init(sc_pkcs15_card_t *p15card)
|
|||
|
||||
const objdata objects[] = {
|
||||
{"1", "Card Capability Container",
|
||||
"2.16.840.1.101.3.7.1.219.0", 0, "DB00", 0},
|
||||
"2.16.840.1.101.3.7.1.219.0", NULL, "DB00", 0},
|
||||
{"2", "Card Holder Unique Identifier",
|
||||
"2.16.840.1.101.3.7.2.48.0", 0, "3000", 0},
|
||||
"2.16.840.1.101.3.7.2.48.0", NULL, "3000", 0},
|
||||
{"3", "Card Holder Fingerprints",
|
||||
"2.16.840.1.101.3.7.2.96.16", "1", "6010", SC_PKCS15_CO_FLAG_PRIVATE},
|
||||
{"4", "Printed Information",
|
||||
|
@ -123,7 +123,7 @@ const objdata objects[] = {
|
|||
{"5", "Card Holder Facial Image",
|
||||
"2.16.840.1.101.3.7.2.96.48", "1", "6030", SC_PKCS15_CO_FLAG_PRIVATE},
|
||||
{"6", "Security Object",
|
||||
"2.16.840.1.101.3.7.2.144.0", 0, "9000", 0},
|
||||
"2.16.840.1.101.3.7.2.144.0", NULL, "9000", 0},
|
||||
{NULL, NULL, NULL, 0, NULL, 0}
|
||||
};
|
||||
/*
|
||||
|
@ -213,7 +213,7 @@ const objdata objects[] = {
|
|||
{ "4", "CARD AUTH key", 0000,
|
||||
SC_PKCS15_PRKEY_USAGE_SIGN |
|
||||
SC_PKCS15_PRKEY_USAGE_SIGNRECOVER,
|
||||
"", 0x9E, 0, 0}, /* no PIN needed, works with wireless */
|
||||
"", 0x9E, NULL, 0}, /* no PIN needed, works with wireless */
|
||||
{ NULL, NULL, 0, 0, NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ static int sc_pkcs15emu_starcert_init(sc_pkcs15_card_t *p15card)
|
|||
SC_PKCS15_CO_FLAG_MODIFIABLE},
|
||||
{"AUT certificate",0, "3F00DF01C500","4",
|
||||
SC_PKCS15_CO_FLAG_MODIFIABLE},
|
||||
{NULL, 0, NULL, 0, 0}
|
||||
{NULL, 0, NULL, NULL, 0}
|
||||
};
|
||||
|
||||
const pindata pins[] = {
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
#include <stdio.h>
|
||||
#include "strlcpy.h"
|
||||
|
||||
static void
|
||||
set_string(char **strp, const char *value)
|
||||
static void set_string(char **strp, const char *value)
|
||||
{
|
||||
if (*strp) free(*strp);
|
||||
*strp = value ? strdup(value) : NULL;
|
||||
}
|
||||
|
||||
int sc_pkcs15emu_tcos_init_ex(sc_pkcs15_card_t *p15card, sc_pkcs15emu_opt_t *opts)
|
||||
static int sc_pkcs15emu_tcos_init_ex(sc_pkcs15_card_t *p15card,
|
||||
sc_pkcs15emu_opt_t *opts)
|
||||
{
|
||||
static const struct {
|
||||
const char *card, *manufacturer;
|
||||
|
|
|
@ -604,8 +604,7 @@ cflex_create_empty_pin_file(sc_profile_t *profile, sc_card_t *card,
|
|||
/*
|
||||
* Get private and public key file
|
||||
*/
|
||||
int
|
||||
cflex_get_keyfiles(sc_profile_t *profile, sc_card_t *card,
|
||||
static int cflex_get_keyfiles(sc_profile_t *profile, sc_card_t *card,
|
||||
const sc_path_t *df_path,
|
||||
sc_file_t **prkf, sc_file_t **pukf)
|
||||
{
|
||||
|
|
|
@ -935,8 +935,7 @@ gpk_add_bignum(struct pkpart *part, unsigned int tag,
|
|||
/* printf("TAG 0x%02x, len=%u\n", tag, comp->size); */
|
||||
}
|
||||
|
||||
int
|
||||
gpk_encode_rsa_key(sc_profile_t *profile, sc_card_t *card,
|
||||
static int gpk_encode_rsa_key(sc_profile_t *profile, sc_card_t *card,
|
||||
struct sc_pkcs15_prkey_rsa *rsa, struct pkdata *p,
|
||||
sc_pkcs15_prkey_info_t *info)
|
||||
{
|
||||
|
@ -1013,8 +1012,7 @@ gpk_encode_rsa_key(sc_profile_t *profile, sc_card_t *card,
|
|||
* DSA with 512 as well as 1024 bits, but all byte sizes shown
|
||||
* in the tables are 512 bits only...
|
||||
*/
|
||||
int
|
||||
gpk_encode_dsa_key(sc_profile_t *profile, sc_card_t *card,
|
||||
static int gpk_encode_dsa_key(sc_profile_t *profile, sc_card_t *card,
|
||||
struct sc_pkcs15_prkey_dsa *dsa, struct pkdata *p,
|
||||
sc_pkcs15_prkey_info_t *info)
|
||||
{
|
||||
|
|
|
@ -1963,8 +1963,7 @@ sc_pkcs15init_map_usage(unsigned long x509_usage, int _private)
|
|||
/*
|
||||
* Compute modulus length
|
||||
*/
|
||||
size_t
|
||||
sc_pkcs15init_keybits(sc_pkcs15_bignum_t *bn)
|
||||
static size_t sc_pkcs15init_keybits(sc_pkcs15_bignum_t *bn)
|
||||
{
|
||||
unsigned int mask, bits;
|
||||
|
||||
|
@ -2129,11 +2128,11 @@ prkey_fixup_rsa(sc_pkcs15_card_t *p15card, struct sc_pkcs15_prkey_rsa *key)
|
|||
BN_CTX *ctx = BN_CTX_new();
|
||||
|
||||
rsa = RSA_new();
|
||||
rsa->n = BN_bin2bn(key->modulus.data, key->modulus.len, 0);
|
||||
rsa->e = BN_bin2bn(key->exponent.data, key->exponent.len, 0);
|
||||
rsa->d = BN_bin2bn(key->d.data, key->d.len, 0);
|
||||
rsa->p = BN_bin2bn(key->p.data, key->p.len, 0);
|
||||
rsa->q = BN_bin2bn(key->q.data, key->q.len, 0);
|
||||
rsa->n = BN_bin2bn(key->modulus.data, key->modulus.len, NULL);
|
||||
rsa->e = BN_bin2bn(key->exponent.data, key->exponent.len, NULL);
|
||||
rsa->d = BN_bin2bn(key->d.data, key->d.len, NULL);
|
||||
rsa->p = BN_bin2bn(key->p.data, key->p.len, NULL);
|
||||
rsa->q = BN_bin2bn(key->q.data, key->q.len, NULL);
|
||||
if (!rsa->dmp1)
|
||||
rsa->dmp1 = BN_new();
|
||||
if (!rsa->dmq1)
|
||||
|
@ -2215,8 +2214,7 @@ find_df_by_type(struct sc_pkcs15_card *p15card, unsigned int type)
|
|||
return df;
|
||||
}
|
||||
|
||||
int
|
||||
select_id(sc_pkcs15_card_t *p15card, int type, sc_pkcs15_id_t *id,
|
||||
static int select_id(sc_pkcs15_card_t *p15card, int type, sc_pkcs15_id_t *id,
|
||||
int (*can_reuse)(const sc_pkcs15_object_t *, void *),
|
||||
void *data, sc_pkcs15_object_t **reuse_obj)
|
||||
{
|
||||
|
@ -2304,8 +2302,7 @@ select_id(sc_pkcs15_card_t *p15card, int type, sc_pkcs15_id_t *id,
|
|||
* look for a file corresponding to the type of object we
|
||||
* wish to create ("private-key", "public-key" etc).
|
||||
*/
|
||||
int
|
||||
select_object_path(sc_pkcs15_card_t *p15card, sc_profile_t *profile,
|
||||
static int select_object_path(sc_pkcs15_card_t *p15card, sc_profile_t *profile,
|
||||
sc_pkcs15_object_t *obj, sc_pkcs15_id_t *obj_id,
|
||||
sc_path_t *path)
|
||||
{
|
||||
|
@ -2687,8 +2684,8 @@ sc_pkcs15init_remove_object(sc_pkcs15_card_t *p15card,
|
|||
return r;
|
||||
}
|
||||
|
||||
sc_pkcs15_object_t *
|
||||
sc_pkcs15init_new_object(int type, const char *label, sc_pkcs15_id_t *auth_id, void *data)
|
||||
static sc_pkcs15_object_t * sc_pkcs15init_new_object(int type,
|
||||
const char *label, sc_pkcs15_id_t *auth_id, void *data)
|
||||
{
|
||||
sc_pkcs15_object_t *object;
|
||||
unsigned int data_size = 0;
|
||||
|
@ -3102,7 +3099,7 @@ found: if (type == SC_AC_CHV && pin_info.flags & SC_PKCS15_PIN_FLAG_NEEDS_PADDIN
|
|||
if (file)
|
||||
r = sc_select_file(card, &file->path, NULL);
|
||||
if (r >= 0
|
||||
&& (r = sc_verify(card, type, reference, pinbuf, *pinsize, 0)) < 0) {
|
||||
&& (r = sc_verify(card, type, reference, pinbuf, *pinsize, NULL)) < 0) {
|
||||
sc_error(card->ctx, "Failed to verify %s (ref=0x%x)",
|
||||
ident, reference);
|
||||
}
|
||||
|
@ -3147,8 +3144,8 @@ sc_pkcs15init_verify_key(struct sc_profile *pro, sc_card_t *card,
|
|||
* Find out whether the card was initialized using an SO PIN,
|
||||
* and if so, set the profile information
|
||||
*/
|
||||
int
|
||||
set_so_pin_from_card(struct sc_pkcs15_card *p15card, struct sc_profile *profile)
|
||||
static int set_so_pin_from_card(struct sc_pkcs15_card *p15card,
|
||||
struct sc_profile *profile)
|
||||
{
|
||||
struct sc_pkcs15_pin_info *pin;
|
||||
struct sc_pkcs15_object *obj;
|
||||
|
@ -3289,8 +3286,7 @@ sc_pkcs15init_authenticate(struct sc_profile *pro, sc_card_t *card,
|
|||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
do_select_parent(struct sc_profile *pro, sc_card_t *card,
|
||||
static int do_select_parent(struct sc_profile *pro, sc_card_t *card,
|
||||
sc_file_t *file, sc_file_t **parent)
|
||||
{
|
||||
struct sc_path path;
|
||||
|
@ -3404,8 +3400,6 @@ sc_pkcs15init_update_file(struct sc_profile *profile, sc_card_t *card,
|
|||
}
|
||||
|
||||
if (info->size < datalen) {
|
||||
char pbuf[SC_MAX_PATH_STRING_SIZE];
|
||||
|
||||
r = sc_path_print(pbuf, sizeof(pbuf), &file->path);
|
||||
if (r != SC_SUCCESS)
|
||||
pbuf[0] = '\0';
|
||||
|
@ -3565,8 +3559,7 @@ sc_pkcs15init_fixup_acls(struct sc_profile *profile, sc_file_t *file,
|
|||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
sc_pkcs15init_get_pin_path(sc_pkcs15_card_t *p15card,
|
||||
static int sc_pkcs15init_get_pin_path(sc_pkcs15_card_t *p15card,
|
||||
sc_pkcs15_id_t *auth_id, sc_path_t *path)
|
||||
{
|
||||
sc_pkcs15_object_t *obj;
|
||||
|
@ -3625,8 +3618,7 @@ sc_pkcs15init_get_label(struct sc_profile *profile, const char **res)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sc_pkcs15init_qualify_pin(sc_card_t *card, const char *pin_name,
|
||||
static int sc_pkcs15init_qualify_pin(sc_card_t *card, const char *pin_name,
|
||||
unsigned int pin_len, sc_pkcs15_pin_info_t *pin_info)
|
||||
{
|
||||
if (pin_len == 0)
|
||||
|
@ -3761,8 +3753,8 @@ do_encode_string(u8 **memp, u8 *end, u8 tag, const char *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sc_pkcs15init_write_info(sc_card_t *card, sc_profile_t *profile, sc_pkcs15_object_t *pin_obj)
|
||||
static int sc_pkcs15init_write_info(sc_card_t *card, sc_profile_t *profile,
|
||||
sc_pkcs15_object_t *pin_obj)
|
||||
{
|
||||
sc_file_t *file = NULL;
|
||||
sc_file_t *df = profile->df_info->file;
|
||||
|
|
|
@ -644,8 +644,10 @@ cosm_new_key(struct sc_profile *profile, sc_card_t *card,
|
|||
{
|
||||
sc_file_t *prvfile = NULL;
|
||||
struct sc_pkcs15_prkey_rsa *rsa = NULL;
|
||||
#ifndef NOT_YET
|
||||
sc_pkcs15_pubkey_t pubkey;
|
||||
int rv, ii;
|
||||
#endif
|
||||
int rv;
|
||||
char pbuf[SC_MAX_PATH_STRING_SIZE];
|
||||
struct sc_cardctl_oberthur_updatekey_info update_info;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#define SETCOS_MAX_PINS 7
|
||||
|
||||
unsigned char SETCOS_DEFAULT_PUBKEY[] = {0x01, 0x00, 0x01};
|
||||
static unsigned char SETCOS_DEFAULT_PUBKEY[] = {0x01, 0x00, 0x01};
|
||||
#define SETCOS_DEFAULT_PUBKEY_LEN sizeof(SETCOS_DEFAULT_PUBKEY)
|
||||
|
||||
static int setcos_generate_store_key( sc_profile_t *, sc_card_t *,
|
||||
|
@ -351,12 +351,12 @@ setcos_encode_public_key(sc_profile_t *profile, sc_card_t *card,
|
|||
*/
|
||||
static int
|
||||
setcos_old_generate_key(sc_profile_t *profile, sc_card_t *card,
|
||||
unsigned int index, /* keyref: 0 for 1st key, ... */
|
||||
unsigned int idx, /* keyref: 0 for 1st key, ... */
|
||||
unsigned int keybits,
|
||||
sc_pkcs15_pubkey_t *pubkey,
|
||||
struct sc_pkcs15_prkey_info *info)
|
||||
{
|
||||
return setcos_generate_store_key(profile, card, index,
|
||||
return setcos_generate_store_key(profile, card, idx,
|
||||
keybits, pubkey,
|
||||
NULL, info);
|
||||
}
|
||||
|
@ -366,10 +366,10 @@ setcos_old_generate_key(sc_profile_t *profile, sc_card_t *card,
|
|||
*/
|
||||
static int
|
||||
setcos_new_key(sc_profile_t *profile, sc_card_t *card,
|
||||
struct sc_pkcs15_prkey *key, unsigned int index,
|
||||
struct sc_pkcs15_prkey *key, unsigned int idx,
|
||||
struct sc_pkcs15_prkey_info *info)
|
||||
{
|
||||
return setcos_generate_store_key(profile, card, index,
|
||||
return setcos_generate_store_key(profile, card, idx,
|
||||
key->u.rsa.modulus.len * 8, NULL,
|
||||
key, info);
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ setcos_new_key(sc_profile_t *profile, sc_card_t *card,
|
|||
*/
|
||||
static int
|
||||
setcos_generate_store_key(sc_profile_t *profile, sc_card_t *card,
|
||||
unsigned int index, /* keynumber: 0 for 1st priv key, ... */
|
||||
unsigned int idx, /* keynumber: 0 for 1st priv key, ... */
|
||||
unsigned int keybits,
|
||||
sc_pkcs15_pubkey_t *pubkey,
|
||||
sc_pkcs15_prkey_t *prkey,
|
||||
|
@ -401,7 +401,7 @@ setcos_generate_store_key(sc_profile_t *profile, sc_card_t *card,
|
|||
}
|
||||
|
||||
/* Get the private key file */
|
||||
r = setcos_new_file(profile, card, SC_PKCS15_TYPE_PRKEY_RSA, index, &prkf);
|
||||
r = setcos_new_file(profile, card, SC_PKCS15_TYPE_PRKEY_RSA, idx, &prkf);
|
||||
if (r < 0)
|
||||
goto done;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static struct map aclNames[] = {
|
|||
{ "PRO", SC_AC_PRO },
|
||||
{ "AUT", SC_AC_AUT },
|
||||
{ "KEY", SC_AC_AUT },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map fileOpNames[] = {
|
||||
{ "SELECT", SC_AC_OP_SELECT },
|
||||
|
@ -105,13 +105,13 @@ static struct map fileOpNames[] = {
|
|||
{ "WRITE", SC_AC_OP_WRITE },
|
||||
{ "ERASE", SC_AC_OP_ERASE },
|
||||
{ "CRYPTO", SC_AC_OP_CRYPTO },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map fileTypeNames[] = {
|
||||
{ "EF", SC_FILE_TYPE_WORKING_EF },
|
||||
{ "INTERNAL-EF",SC_FILE_TYPE_INTERNAL_EF },
|
||||
{ "DF", SC_FILE_TYPE_DF },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map fileStructureNames[] = {
|
||||
{ "TRANSPARENT", SC_FILE_EF_TRANSPARENT },
|
||||
|
@ -121,7 +121,7 @@ static struct map fileStructureNames[] = {
|
|||
{ "LINEAR-VARIABLE-TLV",SC_FILE_EF_LINEAR_VARIABLE_TLV },
|
||||
{ "CYCLIC", SC_FILE_EF_CYCLIC },
|
||||
{ "CYCLIC-TLV", SC_FILE_EF_CYCLIC_TLV },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map pkcs15DfNames[] = {
|
||||
{ "PRKDF", SC_PKCS15_PRKDF },
|
||||
|
@ -133,7 +133,7 @@ static struct map pkcs15DfNames[] = {
|
|||
{ "CDF-USEFUL", SC_PKCS15_CDF_USEFUL },
|
||||
{ "DODF", SC_PKCS15_DODF },
|
||||
{ "AODF", SC_PKCS15_AODF },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map pinTypeNames[] = {
|
||||
{ "BCD", 0 },
|
||||
|
@ -141,7 +141,7 @@ static struct map pinTypeNames[] = {
|
|||
{ "utf8", 2 },
|
||||
{ "half-nibble-bcd", 3 },
|
||||
{ "iso9564-1", 4 },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map pinIdNames[] = {
|
||||
{ "pin", SC_PKCS15INIT_USER_PIN },
|
||||
|
@ -152,7 +152,7 @@ static struct map pinIdNames[] = {
|
|||
{ "sopuk", SC_PKCS15INIT_SO_PUK },
|
||||
{ "so-pin", SC_PKCS15INIT_SO_PIN },
|
||||
{ "so-puk", SC_PKCS15INIT_SO_PUK },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map pinFlagNames[] = {
|
||||
{ "case-sensitive", 0x0001 },
|
||||
|
@ -167,7 +167,7 @@ static struct map pinFlagNames[] = {
|
|||
{ "integrity-protected", 0x0200 },
|
||||
{ "confidentiality-protected", 0x0400 },
|
||||
{ "exchangeRefData", 0x0800 },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct {
|
||||
const char * name;
|
||||
|
@ -939,8 +939,7 @@ process_tmpl(struct state *cur, struct block *info,
|
|||
* Append new file at the end of the ef_list.
|
||||
* This is crucial; the profile instantiation code relies on it
|
||||
*/
|
||||
void
|
||||
append_file(sc_profile_t *profile, struct file_info *nfile)
|
||||
static void append_file(sc_profile_t *profile, struct file_info *nfile)
|
||||
{
|
||||
struct file_info **list, *fi;
|
||||
|
||||
|
@ -1178,7 +1177,7 @@ static int
|
|||
do_acl(struct state *cur, int argc, char **argv)
|
||||
{
|
||||
struct sc_file *file = cur->file->file;
|
||||
char oper[64], *what = 0;
|
||||
char oper[64], *what = NULL;
|
||||
|
||||
memset(oper, 0, sizeof(oper));
|
||||
while (argc--) {
|
||||
|
@ -1273,8 +1272,7 @@ new_pin(struct sc_profile *profile, unsigned int id)
|
|||
return pi;
|
||||
}
|
||||
|
||||
void
|
||||
set_pin_defaults(struct sc_profile *profile, struct pin_info *pi)
|
||||
static void set_pin_defaults(struct sc_profile *profile, struct pin_info *pi)
|
||||
{
|
||||
struct sc_pkcs15_pin_info *info = &pi->pin;
|
||||
|
||||
|
@ -1724,8 +1722,7 @@ sc_profile_find_file(struct sc_profile *pro,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct file_info *
|
||||
sc_profile_find_file_by_path(struct sc_profile *pro, const sc_path_t *path)
|
||||
static struct file_info * sc_profile_find_file_by_path(struct sc_profile *pro, const sc_path_t *path)
|
||||
{
|
||||
struct file_info *fi;
|
||||
struct sc_file *fp;
|
||||
|
|
Loading…
Reference in New Issue