- Whitespace cleanup from me and Martin Paljak

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2181 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aet 2005-02-11 20:09:34 +00:00
parent df12bfb5b1
commit df5e357694
17 changed files with 286 additions and 297 deletions

View File

@ -116,13 +116,12 @@ static int setcos_init(struct sc_card *card)
/* Handle unknown or forced cards */ /* Handle unknown or forced cards */
if (card->type < 0) { if (card->type < 0) {
card->type = SC_CARD_TYPE_SETCOS_GENERIC;
#if 0 #if 0
/* Hmm. For now, assume it's a bank card with FinEID application */ /* Hmm. For now, assume it's a bank card with FinEID application */
if (match_hist_bytes(card, "AVANT", 0)) { if (match_hist_bytes(card, "AVANT", 0)) {
card->type = SC_CARD_TYPE_SETCOS_FINEID; card->type = SC_CARD_TYPE_SETCOS_FINEID;
} else
#endif #endif
card->type = SC_CARD_TYPE_SETCOS_GENERIC;
} }
if (card->type == SC_CARD_TYPE_SETCOS_FINEID) { if (card->type == SC_CARD_TYPE_SETCOS_FINEID) {
card->cla = 0x00; card->cla = 0x00;

View File

@ -64,7 +64,6 @@ static int ccid_build_verify_pin_block(u8 * buf, size_t * size, struct sc_pin_cm
if (!data->pin1.min_length || !data->pin1.max_length) if (!data->pin1.min_length || !data->pin1.max_length)
return SC_ERROR_INVALID_ARGUMENTS; return SC_ERROR_INVALID_ARGUMENTS;
buf[count++] = data->pin1.max_length; /* wPINMaxExtraDigit: max */ buf[count++] = data->pin1.max_length; /* wPINMaxExtraDigit: max */
buf[count++] = data->pin1.min_length; /* wPINMaxExtraDigit: min */ buf[count++] = data->pin1.min_length; /* wPINMaxExtraDigit: min */
@ -150,7 +149,7 @@ ccid_pin_cmd(struct sc_reader *reader, sc_slot_info_t * slot,
/* The slot must be manually locked, as the control does not pass through card.c /* The slot must be manually locked, as the control does not pass through card.c
* wrappers that lock the card (card_transmit is not OK in this case, as it assumes * wrappers that lock the card (card_transmit is not OK in this case, as it assumes
* a proper APDU as a parameter, not a arbitary binary blob to be sent to the reader) * a proper APDU as a parameter, not an arbitary binary blob to be sent to the reader)
*/ */
r = reader->ops->lock(reader, slot); r = reader->ops->lock(reader, slot);
SC_TEST_RET(reader->ctx, r, "CCID PIN: Could not lock!"); SC_TEST_RET(reader->ctx, r, "CCID PIN: Could not lock!");

View File

@ -63,10 +63,8 @@ sc_pkcs15emu_esteid_init (sc_pkcs15_card_t * p15card)
set_string (&p15card->label, "EstEID isikutunnistus"); set_string (&p15card->label, "EstEID isikutunnistus");
set_string (&p15card->manufacturer_id, "AS Sertifitseerimiskeskus"); set_string (&p15card->manufacturer_id, "AS Sertifitseerimiskeskus");
select_esteid_df (card);
/* read the serial (document number) */ /* read the serial (document number) */
sc_format_path ("5044", &tmppath); sc_format_path ("3f00eeee5044", &tmppath);
tmppath.type = SC_PATH_TYPE_PATH; tmppath.type = SC_PATH_TYPE_PATH;
r = sc_select_file (card, &tmppath, NULL); r = sc_select_file (card, &tmppath, NULL);
SC_TEST_RET (card->ctx, r, "select esteid PD failed"); SC_TEST_RET (card->ctx, r, "select esteid PD failed");

View File

@ -1568,12 +1568,10 @@ static CK_RV pkcs15_cert_get_attribute(struct sc_pkcs11_session *session,
break; break;
case CKA_SUBJECT: case CKA_SUBJECT:
return asn1_sequence_wrapper(cert->cert_data->subject, return asn1_sequence_wrapper(cert->cert_data->subject,
cert->cert_data->subject_len, cert->cert_data->subject_len, attr);
attr);
case CKA_ISSUER: case CKA_ISSUER:
return asn1_sequence_wrapper(cert->cert_data->issuer, return asn1_sequence_wrapper(cert->cert_data->issuer,
cert->cert_data->issuer_len, cert->cert_data->issuer_len, attr);
attr);
default: default:
return CKR_ATTRIBUTE_TYPE_INVALID; return CKR_ATTRIBUTE_TYPE_INVALID;
} }
@ -1892,8 +1890,7 @@ pkcs15_prkey_decrypt(struct sc_pkcs11_session *ses, void *obj,
} }
rv = sc_pkcs15_decipher(fw_data->p15_card, prkey->prv_p15obj, rv = sc_pkcs15_decipher(fw_data->p15_card, prkey->prv_p15obj,
flags, flags, pEncryptedData, ulEncryptedDataLen,
pEncryptedData, ulEncryptedDataLen,
decrypted, sizeof(decrypted)); decrypted, sizeof(decrypted));
/* Do we have to try a re-login and then try to decrypt again? */ /* Do we have to try a re-login and then try to decrypt again? */
@ -1901,8 +1898,7 @@ pkcs15_prkey_decrypt(struct sc_pkcs11_session *ses, void *obj,
rv = revalidate_pin(data, ses); rv = revalidate_pin(data, ses);
if (rv == 0) if (rv == 0)
rv = sc_pkcs15_decipher(fw_data->p15_card, prkey->prv_p15obj, rv = sc_pkcs15_decipher(fw_data->p15_card, prkey->prv_p15obj,
flags, flags, pEncryptedData, ulEncryptedDataLen,
pEncryptedData, ulEncryptedDataLen,
decrypted, sizeof(decrypted)); decrypted, sizeof(decrypted));
} }
sc_unlock(ses->slot->card->card); sc_unlock(ses->slot->card->card);
@ -2227,7 +2223,6 @@ struct sc_pkcs11_object_ops pkcs15_dobj_ops = {
}; };
/* /*
* get_attribute helpers * get_attribute helpers
*/ */

View File

@ -79,7 +79,7 @@ int opensc_init(void)
if (r) if (r)
goto err; goto err;
return 1; return 1;
err: err:
/* need to do engine stuff? */ /* need to do engine stuff? */
fprintf(stderr, "error: %d", r); fprintf(stderr, "error: %d", r);
opensc_finish(); opensc_finish();
@ -178,7 +178,7 @@ int sc_prkey_op_init(const RSA * rsa, struct sc_pkcs15_object **key_obj_out,
} }
*key_obj_out = key_obj; *key_obj_out = key_obj;
return 0; return 0;
err: err:
return -1; return -1;
} }
@ -352,7 +352,7 @@ sc_private_decrypt(int flen, const unsigned char * from, unsigned char * to,
goto err; goto err;
} }
return r; return r;
err: err:
return -1; return -1;
} }
@ -386,7 +386,7 @@ sc_sign(int type, const unsigned char * m, unsigned int m_len,
} }
*siglen = r; *siglen = r;
return 1; return 1;
err: err:
return 0; return 0;
} }

View File

@ -367,7 +367,7 @@ static int do_cat(int argc, char **argv)
} }
} }
return -err; return -err;
usage: usage:
puts("Usage: cat [file_id]"); puts("Usage: cat [file_id]");
return -1; return -1;
} }
@ -392,8 +392,7 @@ static int do_info(int argc, char **argv)
printf("unable to select file: %s\n", sc_strerror(r)); printf("unable to select file: %s\n", sc_strerror(r));
return -1; return -1;
} }
} } else
else
goto usage; goto usage;
switch (file->type) { switch (file->type) {
@ -476,7 +475,7 @@ static int do_info(int argc, char **argv)
} }
return 0; return 0;
usage: usage:
puts("Usage: info [file_id]"); puts("Usage: info [file_id]");
return -1; return -1;
} }

View File

@ -1375,7 +1375,6 @@ show_dobj(CK_SESSION_HANDLE sess, CK_OBJECT_HANDLE obj)
if (getPRIVATE(sess, obj)) if (getPRIVATE(sess, obj))
printf(" private"); printf(" private");
printf ("\n"); printf ("\n");
} }
void void