tcos: fix indentation and braces
Increase readability. No content-based changes.
This commit is contained in:
parent
45e29056cc
commit
6b84407c3d
|
@ -166,8 +166,7 @@ static int tcos_construct_fci(const sc_file_t *file,
|
||||||
if (file->namelen) {
|
if (file->namelen) {
|
||||||
sc_asn1_put_tag(0x84, file->name, file->namelen,
|
sc_asn1_put_tag(0x84, file->name, file->namelen,
|
||||||
p, 16, &p);
|
p, 16, &p);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* TCOS needs one, so we use a faked one */
|
/* TCOS needs one, so we use a faked one */
|
||||||
snprintf ((char *) buf, sizeof(buf)-1, "foo-%lu",
|
snprintf ((char *) buf, sizeof(buf)-1, "foo-%lu",
|
||||||
(unsigned long) time (NULL));
|
(unsigned long) time (NULL));
|
||||||
|
@ -179,8 +178,7 @@ static int tcos_construct_fci(const sc_file_t *file,
|
||||||
if (file->prop_attr_len && file->prop_attr) {
|
if (file->prop_attr_len && file->prop_attr) {
|
||||||
n = file->prop_attr_len;
|
n = file->prop_attr_len;
|
||||||
memcpy(buf, file->prop_attr, n);
|
memcpy(buf, file->prop_attr, n);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
n = 0;
|
n = 0;
|
||||||
buf[n++] = 0x01; /* not invalidated, permanent */
|
buf[n++] = 0x01; /* not invalidated, permanent */
|
||||||
if (file->type == SC_FILE_TYPE_WORKING_EF)
|
if (file->type == SC_FILE_TYPE_WORKING_EF)
|
||||||
|
@ -192,8 +190,7 @@ static int tcos_construct_fci(const sc_file_t *file,
|
||||||
if (file->sec_attr_len && file->sec_attr) {
|
if (file->sec_attr_len && file->sec_attr) {
|
||||||
memcpy(buf, file->sec_attr, file->sec_attr_len);
|
memcpy(buf, file->sec_attr, file->sec_attr_len);
|
||||||
n = file->sec_attr_len;
|
n = file->sec_attr_len;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* no attributes given - fall back to default one */
|
/* no attributes given - fall back to default one */
|
||||||
memcpy (buf+ 0, "\xa4\x00\x00\x00\xff\xff", 6); /* select */
|
memcpy (buf+ 0, "\xa4\x00\x00\x00\xff\xff", 6); /* select */
|
||||||
memcpy (buf+ 6, "\xb0\x00\x00\x00\xff\xff", 6); /* read bin */
|
memcpy (buf+ 6, "\xb0\x00\x00\x00\xff\xff", 6); /* read bin */
|
||||||
|
@ -282,16 +279,16 @@ static void parse_sec_attr(sc_card_t *card,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
for (; len >= 6; len -= 6, buf += 6) {
|
for (; len >= 6; len -= 6, buf += 6) {
|
||||||
/* FIXME: temporary hacks */
|
/* FIXME: temporary hacks */
|
||||||
if (!memcmp(buf, "\xa4\x00\x00\x00\xff\xff", 6)) /* select */
|
if (!memcmp(buf, "\xa4\x00\x00\x00\xff\xff", 6)) {/* select */
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_SELECT,
|
sc_file_add_acl_entry (file, SC_AC_OP_SELECT,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
else if (!memcmp(buf, "\xb0\x00\x00\x00\xff\xff", 6)) /*read*/
|
} else if (!memcmp(buf, "\xb0\x00\x00\x00\xff\xff", 6)) {/*read*/
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_READ,
|
sc_file_add_acl_entry (file, SC_AC_OP_READ,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
else if (!memcmp(buf, "\xd6\x00\x00\x00\xff\xff", 6)) /*upd*/
|
} else if (!memcmp(buf, "\xd6\x00\x00\x00\xff\xff", 6)) {/*upd*/
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_UPDATE,
|
sc_file_add_acl_entry (file, SC_AC_OP_UPDATE,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
else if (!memcmp(buf, "\x60\x00\x00\x00\xff\xff", 6)) {/*adm */
|
} else if (!memcmp(buf, "\x60\x00\x00\x00\xff\xff", 6)) {/*adm */
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_WRITE,
|
sc_file_add_acl_entry (file, SC_AC_OP_WRITE,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_CREATE,
|
sc_file_add_acl_entry (file, SC_AC_OP_CREATE,
|
||||||
|
@ -300,15 +297,13 @@ static void parse_sec_attr(sc_card_t *card,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
sc_file_add_acl_entry (file, SC_AC_OP_REHABILITATE,
|
sc_file_add_acl_entry (file, SC_AC_OP_REHABILITATE,
|
||||||
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
SC_AC_NONE, SC_AC_KEY_REF_NONE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* the first byte tells use the command or the
|
/* the first byte tells use the command or the
|
||||||
command group. We have to mask bit 0
|
command group. We have to mask bit 0
|
||||||
because this one distinguish between AND/OR
|
because this one distinguish between AND/OR
|
||||||
combination of PINs*/
|
combination of PINs*/
|
||||||
op = map_operations (buf[0]);
|
op = map_operations (buf[0]);
|
||||||
if (op == (unsigned int)-1)
|
if (op == (unsigned int)-1) {
|
||||||
{
|
|
||||||
sc_log(card->ctx,
|
sc_log(card->ctx,
|
||||||
"Unknown security command byte %02x\n",
|
"Unknown security command byte %02x\n",
|
||||||
buf[0]);
|
buf[0]);
|
||||||
|
|
Loading…
Reference in New Issue