You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB

  1. From 00a2c08c9125103ee0bff9af9e7ff42c5cdc14fe Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?=
  3. <ng.hong.quan@gmail.com>
  4. Date: Fri, 12 Apr 2013 17:24:00 +0700
  5. Subject: [PATCH 02/26] OpenPGP: Add Gnuk in pkcs15 emulation layer.
  6. ---
  7. src/libopensc/pkcs15-openpgp.c | 6 ++++--
  8. src/libopensc/pkcs15-syn.c | 1 +
  9. 2 files changed, 5 insertions(+), 2 deletions(-)
  10. diff --git a/src/libopensc/pkcs15-openpgp.c b/src/libopensc/pkcs15-openpgp.c
  11. index 4daaa98..fdf720a 100644
  12. --- a/src/libopensc/pkcs15-openpgp.c
  13. +++ b/src/libopensc/pkcs15-openpgp.c
  14. @@ -151,7 +151,8 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
  15. u8 c4data[10];
  16. u8 c5data[70];
  17. int r, i;
  18. - const pgp_pin_cfg_t *pin_cfg = (card->type == SC_CARD_TYPE_OPENPGP_V2) ? pin_cfg_v2 : pin_cfg_v1;
  19. + const pgp_pin_cfg_t *pin_cfg = (card->type == SC_CARD_TYPE_OPENPGP_V2 || card->type == SC_CARD_TYPE_OPENPGP_GNUK)
  20. + ? pin_cfg_v2 : pin_cfg_v1;
  21. sc_path_t path;
  22. sc_file_t *file;
  23. @@ -363,7 +364,8 @@ failed: sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Failed to initialize OpenPGP e
  24. static int openpgp_detect_card(sc_pkcs15_card_t *p15card)
  25. {
  26. - if (p15card->card->type == SC_CARD_TYPE_OPENPGP_V1 || p15card->card->type == SC_CARD_TYPE_OPENPGP_V2)
  27. + if (p15card->card->type == SC_CARD_TYPE_OPENPGP_V1 || p15card->card->type == SC_CARD_TYPE_OPENPGP_V2
  28. + || p15card->card->type == SC_CARD_TYPE_OPENPGP_GNUK)
  29. return SC_SUCCESS;
  30. else
  31. return SC_ERROR_WRONG_CARD;
  32. diff --git a/src/libopensc/pkcs15-syn.c b/src/libopensc/pkcs15-syn.c
  33. index ffbf642..d2c086c 100644
  34. --- a/src/libopensc/pkcs15-syn.c
  35. +++ b/src/libopensc/pkcs15-syn.c
  36. @@ -115,6 +115,7 @@ int sc_pkcs15_is_emulation_only(sc_card_t *card)
  37. case SC_CARD_TYPE_GEMSAFEV1_PTEID:
  38. case SC_CARD_TYPE_OPENPGP_V1:
  39. case SC_CARD_TYPE_OPENPGP_V2:
  40. + case SC_CARD_TYPE_OPENPGP_GNUK:
  41. case SC_CARD_TYPE_SC_HSM:
  42. case SC_CARD_TYPE_DNIE_BASE:
  43. case SC_CARD_TYPE_DNIE_BLANK:
  44. --
  45. 2.1.3