allow TA without PACE
This commit is contained in:
@@ -676,9 +676,8 @@ main (int argc, char **argv)
|
||||
pace_input.pin_length = strlen(puk);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Please specify whether to do PACE with "
|
||||
"PIN, CAN, MRZ or PUK.\n");
|
||||
exit(1);
|
||||
fprintf(stderr, "Skipping PIN verification\n");
|
||||
goto nopace;
|
||||
}
|
||||
|
||||
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",
|
||||
npa_secret_name(pace_input.pin_id));
|
||||
|
||||
nopace:
|
||||
if (cmdline.cv_certificate_given || cmdline.private_key_given) {
|
||||
r = perform_terminal_authentication(card,
|
||||
(const unsigned char **) certs, certs_lens,
|
||||
|
||||
@@ -300,9 +300,11 @@ npa_sm_ctx_create(EAC_CTX *ctx, const unsigned char *certificate_description,
|
||||
} else
|
||||
out->certificate_description = NULL;
|
||||
|
||||
out->id_icc = BUF_MEM_create_init(id_icc, id_icc_length);
|
||||
if (!out->id_icc)
|
||||
goto err;
|
||||
if (id_icc && id_icc_length) {
|
||||
out->id_icc = BUF_MEM_create_init(id_icc, id_icc_length);
|
||||
if (!out->id_icc)
|
||||
goto err;
|
||||
}
|
||||
|
||||
out->eph_pub_key = NULL;
|
||||
out->auxiliary_data = NULL;
|
||||
@@ -1582,17 +1584,32 @@ int perform_terminal_authentication(sc_card_t *card,
|
||||
size_t cert_len = 0;
|
||||
CVC_CERT *cvc_cert = 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;
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
struct npa_sm_ctx *eacsmctx = isosmctx->priv_data;
|
||||
eacsmctx = isosmctx->priv_data;
|
||||
|
||||
|
||||
while (*certs && *certs_lens) {
|
||||
|
||||
Reference in New Issue
Block a user