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.

53 lines
2.3 KiB

  1. From b9dae832db54b206a15bcc12e290cef50f31c3d0 Mon Sep 17 00:00:00 2001
  2. From: george <ggkitsas@yahoo.com>
  3. Date: Tue, 11 Nov 2014 16:16:15 +0100
  4. Subject: [PATCH 26/26] hardcode->defines for DO's
  5. ---
  6. src/libopensc/card-openpgp.c | 16 ++++++++++++++--
  7. 1 file changed, 14 insertions(+), 2 deletions(-)
  8. diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
  9. index 1e6e338..8464914 100644
  10. --- a/src/libopensc/card-openpgp.c
  11. +++ b/src/libopensc/card-openpgp.c
  12. @@ -164,6 +164,18 @@ static int pgp_get_pubkey_pem(sc_card_t *, unsigned int,
  13. #define DO_SIGN_SYM 0xb601
  14. #define DO_ENCR_SYM 0xb801
  15. #define DO_AUTH_SYM 0xa401
  16. +/* Private DO's */
  17. +#define DO_PRIV1 0x0101
  18. +#define DO_PRIV2 0x0102
  19. +#define DO_PRIV3 0x0103
  20. +#define DO_PRIV4 0x0104
  21. +/* Cardholder information DO's */
  22. +#define DO_CARDHOLDER 0x65
  23. +#define DO_NAME 0x5b
  24. +#define DO_LANG_PREF 0x5f2d
  25. +#define DO_SEX 0x5f35
  26. +
  27. +
  28. /* Maximum length for response buffer when reading pubkey. This value is calculated with
  29. * 4096-bit key length */
  30. #define MAXLEN_RESP_PUBKEY 527
  31. @@ -851,7 +863,7 @@ pgp_get_blob(sc_card_t *card, pgp_blob_t *blob, unsigned int id,
  32. /* Special case:
  33. * Gnuk does not have default value for children of DO 65 (DOs 5B, 5F2D, 5F35)
  34. * So, if these blob was not found, we create it. */
  35. - if (blob->id == 0x65 && (id == 0x5B || id == 0x5F2D || id == 0x5F35)) {
  36. + if (blob->id == DO_CARDHOLDER && (id == DO_NAME || id == DO_LANG_PREF || id == DO_SEX)) {
  37. sc_log(card->ctx, "Create blob %X under %X", id, blob->id);
  38. child = pgp_new_blob(card, blob, id, sc_file_new());
  39. if (child) {
  40. @@ -1198,7 +1210,7 @@ pgp_get_data(sc_card_t *card, unsigned int tag, u8 *buf, size_t buf_len)
  41. /* For Gnuk card, if there is no certificate, it returns error instead of empty data.
  42. * So, for this case, we ignore error and consider success */
  43. if (r == SC_ERROR_DATA_OBJECT_NOT_FOUND && card->type == SC_CARD_TYPE_OPENPGP_GNUK
  44. - && (tag == DO_CERT || tag == 0x0101 || tag == 0x0102 || tag == 0x0103 || tag == 0x0104)) {
  45. + && (tag == DO_CERT || tag == DO_PRIV1 || tag == DO_PRIV2 || tag == DO_PRIV3 || tag == DO_PRIV4)) {
  46. r = SC_SUCCESS;
  47. apdu.resplen = 0;
  48. }
  49. --
  50. 2.1.3