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