allow TA without PACE
This commit is contained in:
@@ -676,9 +676,8 @@ main (int argc, char **argv)
|
|||||||
pace_input.pin_length = strlen(puk);
|
pace_input.pin_length = strlen(puk);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Please specify whether to do PACE with "
|
fprintf(stderr, "Skipping PIN verification\n");
|
||||||
"PIN, CAN, MRZ or PUK.\n");
|
goto nopace;
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = perform_pace(card, pace_input, &pace_output, tr_version);
|
r = perform_pace(card, pace_input, &pace_output, tr_version);
|
||||||
@@ -687,6 +686,7 @@ main (int argc, char **argv)
|
|||||||
printf("Established PACE channel with %s.\n",
|
printf("Established PACE channel with %s.\n",
|
||||||
npa_secret_name(pace_input.pin_id));
|
npa_secret_name(pace_input.pin_id));
|
||||||
|
|
||||||
|
nopace:
|
||||||
if (cmdline.cv_certificate_given || cmdline.private_key_given) {
|
if (cmdline.cv_certificate_given || cmdline.private_key_given) {
|
||||||
r = perform_terminal_authentication(card,
|
r = perform_terminal_authentication(card,
|
||||||
(const unsigned char **) certs, certs_lens,
|
(const unsigned char **) certs, certs_lens,
|
||||||
|
|||||||
@@ -300,9 +300,11 @@ npa_sm_ctx_create(EAC_CTX *ctx, const unsigned char *certificate_description,
|
|||||||
} else
|
} else
|
||||||
out->certificate_description = NULL;
|
out->certificate_description = NULL;
|
||||||
|
|
||||||
out->id_icc = BUF_MEM_create_init(id_icc, id_icc_length);
|
if (id_icc && id_icc_length) {
|
||||||
if (!out->id_icc)
|
out->id_icc = BUF_MEM_create_init(id_icc, id_icc_length);
|
||||||
goto err;
|
if (!out->id_icc)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
out->eph_pub_key = NULL;
|
out->eph_pub_key = NULL;
|
||||||
out->auxiliary_data = NULL;
|
out->auxiliary_data = NULL;
|
||||||
@@ -1582,17 +1584,32 @@ int perform_terminal_authentication(sc_card_t *card,
|
|||||||
size_t cert_len = 0;
|
size_t cert_len = 0;
|
||||||
CVC_CERT *cvc_cert = NULL;
|
CVC_CERT *cvc_cert = NULL;
|
||||||
BUF_MEM *nonce = NULL, *signature = NULL;
|
BUF_MEM *nonce = NULL, *signature = NULL;
|
||||||
|
struct iso_sm_ctx *isosmctx = NULL;
|
||||||
|
struct npa_sm_ctx *eacsmctx = NULL;
|
||||||
|
|
||||||
if (!card || !card->sm_ctx.info.cmd_data || !certs_lens || !certs) {
|
if (!card || !certs_lens || !certs) {
|
||||||
r = SC_ERROR_INVALID_ARGUMENTS;
|
r = SC_ERROR_INVALID_ARGUMENTS;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
struct iso_sm_ctx *isosmctx = card->sm_ctx.info.cmd_data;
|
if (!card->sm_ctx.info.cmd_data) {
|
||||||
|
card->sm_ctx.info.cmd_data = iso_sm_ctx_create();
|
||||||
|
}
|
||||||
|
if (!card->sm_ctx.info.cmd_data) {
|
||||||
|
r = SC_ERROR_INTERNAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
isosmctx = card->sm_ctx.info.cmd_data;
|
||||||
if (!isosmctx->priv_data) {
|
if (!isosmctx->priv_data) {
|
||||||
r = SC_ERROR_INVALID_ARGUMENTS;
|
isosmctx->priv_data = npa_sm_ctx_create(EAC_CTX_new(), NULL, 0, NULL, 0);
|
||||||
|
/* XXX this is only a hack... */
|
||||||
|
card->caps |= SC_CARD_CAP_APDU_EXT;
|
||||||
|
}
|
||||||
|
if (!isosmctx->priv_data) {
|
||||||
|
r = SC_ERROR_INTERNAL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
struct npa_sm_ctx *eacsmctx = isosmctx->priv_data;
|
eacsmctx = isosmctx->priv_data;
|
||||||
|
|
||||||
|
|
||||||
while (*certs && *certs_lens) {
|
while (*certs && *certs_lens) {
|
||||||
|
|||||||
Reference in New Issue
Block a user