OpenPGP: Change the criteria to use ext APDU for put data.
Saner whitespace in logs Correct spelling
This commit is contained in:
parent
df39590aa4
commit
f515ed5be3
|
@ -722,7 +722,7 @@ pgp_read_blob(sc_card_t *card, struct blob *blob)
|
|||
|
||||
return pgp_set_blob(blob, buffer, r);
|
||||
}
|
||||
else { /* un-readable DO or part of a constrcuted DO */
|
||||
else { /* un-readable DO or part of a constructed DO */
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ pgp_get_pubkey_pem(sc_card_t *card, unsigned int tag, u8 *buf, size_t buf_len)
|
|||
int r;
|
||||
|
||||
sc_log(card->ctx, "called, tag=%04x\n", tag);
|
||||
|
||||
|
||||
if ((r = pgp_get_blob(card, priv->mf, tag & 0xFFFE, &blob)) < 0
|
||||
|| (r = pgp_get_blob(card, blob, 0x7F49, &blob)) < 0
|
||||
|| (r = pgp_get_blob(card, blob, 0x0081, &mod_blob)) < 0
|
||||
|
@ -1132,16 +1132,16 @@ pgp_put_data(sc_card_t *card, unsigned int tag, const u8 *buf, size_t buf_len)
|
|||
|
||||
/* Build APDU */
|
||||
/* Large data can be sent via extended APDU, if card supports */
|
||||
if (buf_len > 0xFF && card->caps & SC_CARD_CAP_APDU_EXT) {
|
||||
if (buf_len > 256 && card->caps & SC_CARD_CAP_APDU_EXT) {
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_EXT, ins, p1, p2);
|
||||
}
|
||||
/* Card/Reader does not support extended, use command chaining, if supported */
|
||||
else if (buf_len > 0xFF && priv->ext_caps & EXT_CAP_CHAINING) {
|
||||
else if (buf_len > 256 && priv->ext_caps & EXT_CAP_CHAINING) {
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3, ins, p1, p2);
|
||||
apdu.flags |= SC_APDU_FLAGS_CHAINING;
|
||||
/* FIXME: The case of command chaining is not tested. */
|
||||
}
|
||||
else if (buf_len <= 0xFF) {
|
||||
else if (buf_len <= 256) {
|
||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, ins, p1, p2);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -257,7 +257,7 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
if ((r = read_file(card, path_template, cxdata, sizeof(cxdata))) < 0)
|
||||
goto failed;
|
||||
if (r != 6) {
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Key info bytes have unexpected length(expected 6, got %d)\n", r);
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Key info bytes have unexpected length (expected 6, got %d)\n", r);
|
||||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
if ((r = read_file(card, path_template, cxdata, sizeof(cxdata))) < 0)
|
||||
goto failed;
|
||||
if (r != 6) {
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Key info bytes have unexpected length(expected 6, got %d)\n", r);
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Key info bytes have unexpected length (expected 6, got %d)\n", r);
|
||||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue