switch (cardproduct)
{
case CARD_PRODUCT_UNKNOWN: return "";
- case CARD_PRODUCT_RSCS: return "R&S";
+ case CARD_PRODUCT_RSCS: return "RSCS";
case CARD_PRODUCT_DTRUST: return "D-Trust";
}
return "";
}
if (!app->app_local->card_product
&& app->app_local->token_label
- && !strncmp (app->app_local->token_label, "D-TRUST Card V3", 15)
+ && !strcmp (app->app_local->token_label, "D-TRUST Card V3")
&& app->app_local->card_type == CARD_TYPE_CARDOS_50)
{
app->app_local->card_product = CARD_PRODUCT_DTRUST;
labelbuf, strlen (labelbuf),
NULL, (size_t)0);
xfree (buf);
- xfree (labelbuf);
}
return 0;
}
}
else
{
- char *sn;
-
/* We use the first private key object which has a serial
* number set. If none was found, we parse the first
* object and see whether this has then a serial number. */
if (!prkdf->serial_number)
prkdf = NULL;
}
- sn = get_dispserialno (app, prkdf);
- /* Unless there is a bogus S/N in the cert, or the product
- * has a different strategy for the display-s/n, we should
- * have a suitable one from the cert now. */
- if (sn)
+ if (prkdf)
{
+ char *sn = get_dispserialno (app, prkdf);
+ /* Unless there is a bogus S/N in the cert we should
+ * have a suitable one from the cert here now. */
err = send_status_printf (ctrl, name, "%s", sn);
xfree (sn);
return err;
}
else if (!strcmp (name, "MANUFACTURER"))
{
- if (app->app_local->manufacturer_id
- && !strchr (app->app_local->manufacturer_id, '[')
- && app->app_local->card_product)
- return send_status_printf (ctrl, "MANUFACTURER", "0 %s [%s]",
- app->app_local->manufacturer_id,
- cardproduct2str (app->app_local->card_product));
- else if (app->app_local->manufacturer_id)
+ if (app->app_local->manufacturer_id)
return send_status_printf (ctrl, "MANUFACTURER", "0 %s",
app->app_local->manufacturer_id);
else
get_dispserialno (app_t app, prkdf_object_t prkdf)
{
char *serial;
- size_t n;
/* We prefer the SerialNumber RDN from the Subject-DN but we don't
* use it if it features a percent sign (special character in pin
* prompts) or has any control character. */
- if (app->app_local->card_product == CARD_PRODUCT_RSCS)
- {
- /* We use only the right 8 hex digits. */
- serial = app_get_serialno (app);
- if (serial && (n=strlen (serial)) > 8)
- memmove (serial, serial + n - 8, 9);
- }
- else if (prkdf && prkdf->serial_number && *prkdf->serial_number
+ if (prkdf && prkdf->serial_number && *prkdf->serial_number
&& !strchr (prkdf->serial_number, '%')
&& !any_control_or_space (prkdf->serial_number))
{
if (err)
{
log_error ("p15: MSE failed: %s\n", gpg_strerror (err));
- goto leave;
+ return err;
}
/* Now that we have all the information available run the actual PIN
if (err)
{
log_error ("p15: MSE failed: %s\n", gpg_strerror (err));
- goto leave;
+ return err;
}
if (prkdf->keyalgo == GCRY_PK_RSA && prkdf->keynbits > 2048)