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.

182 lines
6.9 KiB

  1. From c6abf7976f64be5191dc80fecdbcb07daab7a2e0 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: Sun, 3 Nov 2013 01:45:56 +0800
  5. Subject: [PATCH 19/26] OpenPGP: Make indentation consistent (space -> tab).
  6. ---
  7. src/libopensc/card-openpgp.c | 22 ++++++++---------
  8. src/tools/openpgp-tool.c | 56 ++++++++++++++++++++++----------------------
  9. 2 files changed, 39 insertions(+), 39 deletions(-)
  10. diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
  11. index 037ef73..ae40940 100644
  12. --- a/src/libopensc/card-openpgp.c
  13. +++ b/src/libopensc/card-openpgp.c
  14. @@ -192,12 +192,12 @@ static struct do_info pgp1_objects[] = { /* OpenPGP card spec 1.1 */
  15. { 0x5f35, SIMPLE, READ_ALWAYS | WRITE_PIN3, NULL, sc_put_data },
  16. { 0x5f50, SIMPLE, READ_ALWAYS | WRITE_PIN3, sc_get_data, sc_put_data },
  17. { 0x7f49, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, NULL, NULL },
  18. - { 0xa400, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  19. - { 0xa401, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  20. - { 0xb600, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  21. - { 0xb601, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  22. - { 0xb800, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  23. - { 0xb801, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  24. + { 0xa400, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  25. + { 0xa401, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  26. + { 0xb600, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  27. + { 0xb601, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  28. + { 0xb800, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  29. + { 0xb801, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  30. { 0, 0, 0, NULL, NULL },
  31. };
  32. @@ -253,11 +253,11 @@ static struct do_info pgp2_objects[] = { /* OpenPGP card spec 2.0 */
  33. /* The 0xA401, 0xB601, 0xB801 are just symbolic, it does not represent any real DO.
  34. * However, their R/W access condition may block the process of importing key in pkcs15init.
  35. * So we set their accesses condition as WRITE_PIN3 (writable). */
  36. - { 0xa401, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  37. - { 0xb600, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  38. - { 0xb601, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  39. - { 0xb800, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  40. - { 0xb801, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  41. + { 0xa401, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  42. + { 0xb600, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  43. + { 0xb601, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  44. + { 0xb800, CONSTRUCTED, READ_ALWAYS | WRITE_NEVER, pgp_get_pubkey, NULL },
  45. + { 0xb801, SIMPLE, READ_ALWAYS | WRITE_PIN3, pgp_get_pubkey_pem, NULL },
  46. { 0, 0, 0, NULL, NULL },
  47. };
  48. diff --git a/src/tools/openpgp-tool.c b/src/tools/openpgp-tool.c
  49. index 374819a..a0334ca 100644
  50. --- a/src/tools/openpgp-tool.c
  51. +++ b/src/tools/openpgp-tool.c
  52. @@ -37,11 +37,11 @@
  53. #include "util.h"
  54. #include "libopensc/log.h"
  55. -#define OPT_RAW 256
  56. -#define OPT_PRETTY 257
  57. -#define OPT_VERIFY 258
  58. -#define OPT_PIN 259
  59. -#define OPT_DELKEY 260
  60. +#define OPT_RAW 256
  61. +#define OPT_PRETTY 257
  62. +#define OPT_VERIFY 258
  63. +#define OPT_PIN 259
  64. +#define OPT_DELKEY 260
  65. /* define structures */
  66. struct ef_name_map {
  67. @@ -142,10 +142,10 @@ static const struct ef_name_map openpgp_data[] = {
  68. static void show_version(void)
  69. {
  70. fprintf(stderr,
  71. - "openpgp-tool - OpenPGP card utility version " PACKAGE_VERSION "\n"
  72. - "\n"
  73. - "Copyright (c) 2012 Peter Marschall <peter@adpm.de>\n"
  74. - "Licensed under LGPL v2\n");
  75. + "openpgp-tool - OpenPGP card utility version " PACKAGE_VERSION "\n"
  76. + "\n"
  77. + "Copyright (c) 2012 Peter Marschall <peter@adpm.de>\n"
  78. + "Licensed under LGPL v2\n");
  79. }
  80. @@ -176,16 +176,16 @@ static char *prettify_language(char *str)
  81. {
  82. if (str != NULL) {
  83. switch (strlen(str)) {
  84. - case 8: memmove(str+7, str+6, 1+strlen(str+6));
  85. + case 8: memmove(str+7, str+6, 1+strlen(str+6));
  86. str[6] = ',';
  87. /* fall through */
  88. - case 6: memmove(str+5, str+4, 1+strlen(str+4));
  89. + case 6: memmove(str+5, str+4, 1+strlen(str+4));
  90. str[4] = ',';
  91. /* fall through */
  92. - case 4: memmove(str+3, str+2, 1+strlen(str+2));
  93. + case 4: memmove(str+3, str+2, 1+strlen(str+2));
  94. str[2] = ',';
  95. /* fall through */
  96. - case 2: return str;
  97. + case 2: return str;
  98. }
  99. }
  100. return NULL;
  101. @@ -197,10 +197,10 @@ static char *prettify_gender(char *str)
  102. {
  103. if (str != NULL) {
  104. switch (*str) {
  105. - case '0': return "unknown";
  106. - case '1': return "male";
  107. - case '2': return "female";
  108. - case '9': return "not applicable";
  109. + case '0': return "unknown";
  110. + case '1': return "male";
  111. + case '2': return "female";
  112. + case '9': return "not applicable";
  113. }
  114. }
  115. return NULL;
  116. @@ -218,7 +218,7 @@ static void display_data(const struct ef_name_map *mapping, char *value)
  117. char *envvar;
  118. envvar = malloc(strlen(mapping->env_name) +
  119. - strlen(value) + 2);
  120. + strlen(value) + 2);
  121. if (envvar != NULL) {
  122. strcpy(envvar, mapping->env_name);
  123. strcat(envvar, "=");
  124. @@ -346,20 +346,20 @@ static int do_userinfo(sc_card_t *card)
  125. if (!count)
  126. continue;
  127. - if (count > (int)sizeof(buf) - 1) {
  128. + if (count > (int)sizeof(buf) - 1) {
  129. fprintf(stderr, "Too small buffer to read the OpenPGP data\n");
  130. return EXIT_FAILURE;
  131. }
  132. -
  133. - r = sc_read_binary(card, 0, buf, count, 0);
  134. - if (r < 0) {
  135. +
  136. + r = sc_read_binary(card, 0, buf, count, 0);
  137. + if (r < 0) {
  138. fprintf(stderr, "%s: read failed - %s\n", openpgp_data[i].ef, sc_strerror(r));
  139. return EXIT_FAILURE;
  140. - }
  141. - if (r != count) {
  142. - fprintf(stderr, "%s: expecting %d, got only %d bytes\n", openpgp_data[i].ef, count, r);
  143. + }
  144. + if (r != count) {
  145. + fprintf(stderr, "%s: expecting %d, got only %d bytes\n", openpgp_data[i].ef, count, r);
  146. return EXIT_FAILURE;
  147. - }
  148. + }
  149. buf[count] = '\0';
  150. @@ -628,7 +628,7 @@ int main(int argc, char **argv)
  151. r = sc_context_create(&ctx, &ctx_param);
  152. if (r) {
  153. util_fatal("failed to establish context: %s\n",
  154. - sc_strerror(r));
  155. + sc_strerror(r));
  156. return EXIT_FAILURE;
  157. }
  158. @@ -640,7 +640,7 @@ int main(int argc, char **argv)
  159. r = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose);
  160. if (r) {
  161. util_fatal("failed to connect to card: %s\n",
  162. - sc_strerror(r));
  163. + sc_strerror(r));
  164. return EXIT_FAILURE;
  165. }
  166. --
  167. 2.1.3