summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2011-02-04 12:57:53 +0100
committerWerner Koch <wk@gnupg.org>2011-02-04 12:57:53 +0100
commitb008274afdbe375b32a7e66dbd073e200f6f0587 (patch)
tree219e239d39cf06be3f03aa82fb572080ac163a15 /agent
parentLet autogen.sh check the git config (diff)
downloadgnupg2-b008274afdbe375b32a7e66dbd073e200f6f0587.tar.xz
gnupg2-b008274afdbe375b32a7e66dbd073e200f6f0587.zip
Nuked almost all trailing white space.post-nuke-of-trailing-ws
We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
Diffstat (limited to 'agent')
-rw-r--r--agent/Makefile.am12
-rw-r--r--agent/agent.h22
-rw-r--r--agent/cache.c11
-rw-r--r--agent/call-pinentry.c64
-rw-r--r--agent/call-scd.c46
-rw-r--r--agent/command-ssh.c124
-rw-r--r--agent/command.c167
-rw-r--r--agent/cvt-openpgp.h4
-rw-r--r--agent/divert-scd.c35
-rw-r--r--agent/findkey.c66
-rw-r--r--agent/genkey.c42
-rw-r--r--agent/gpg-agent.c180
-rw-r--r--agent/keyformat.txt22
-rw-r--r--agent/learncard.c38
-rw-r--r--agent/pkdecrypt.c6
-rw-r--r--agent/pksign.c36
-rw-r--r--agent/preset-passphrase.c18
-rw-r--r--agent/protect-tool.c65
-rw-r--r--agent/t-protect.c12
-rw-r--r--agent/trustlist.c44
-rw-r--r--agent/w32main.c28
21 files changed, 511 insertions, 531 deletions
diff --git a/agent/Makefile.am b/agent/Makefile.am
index b20fdeafc..f3fb4eaa9 100644
--- a/agent/Makefile.am
+++ b/agent/Makefile.am
@@ -6,12 +6,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -53,7 +53,7 @@ gpg_agent_SOURCES = \
common_libs = $(libcommon) ../gl/libgnu.a
commonpth_libs = $(libcommonpth) ../gl/libgnu.a
if HAVE_W32CE_SYSTEM
-pwquery_libs =
+pwquery_libs =
else
pwquery_libs = ../common/libsimple-pwquery.a
endif
@@ -109,9 +109,5 @@ TESTS = t-protect
t_common_ldadd = $(common_libs) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \
$(LIBINTL) $(LIBICONV) $(NETLIBS)
-t_protect_SOURCES = t-protect.c protect.c
+t_protect_SOURCES = t-protect.c protect.c
t_protect_LDADD = $(t_common_ldadd)
-
-
-
-
diff --git a/agent/agent.h b/agent/agent.h
index e31b6a78e..1ec736c55 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -118,7 +118,7 @@ struct
#define DBG_CACHE_VALUE 64 /* debug the caching */
#define DBG_MEMSTAT_VALUE 128 /* show memory statistics */
#define DBG_HASHING_VALUE 512 /* debug hashing operations */
-#define DBG_ASSUAN_VALUE 1024
+#define DBG_ASSUAN_VALUE 1024
#define DBG_COMMAND (opt.debug & DBG_COMMAND_VALUE)
#define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
@@ -131,14 +131,14 @@ struct server_local_s;
struct scd_local_s;
/* Collection of data per session (aka connection). */
-struct server_control_s
+struct server_control_s
{
/* Private data used to fire up the connection thread. We use this
structure do avoid an extra allocation for just a few bytes. */
struct {
gnupg_fd_t fd;
} thread_startup;
-
+
/* Private data of the server (command.c). */
struct server_local_s *server_local;
@@ -165,7 +165,7 @@ struct server_control_s
};
-struct pin_entry_info_s
+struct pin_entry_info_s
{
int min_digits; /* min. number of digits required or 0 for freeform entry */
int max_digits; /* max. number of allowed digits allowed*/
@@ -180,7 +180,7 @@ struct pin_entry_info_s
};
-enum
+enum
{
PRIVATE_KEY_UNKNOWN = 0,
PRIVATE_KEY_CLEAR = 1,
@@ -191,7 +191,7 @@ enum
/* Values for the cache_mode arguments. */
-typedef enum
+typedef enum
{
CACHE_MODE_IGNORE = 0, /* Special mode to bypass the cache. */
CACHE_MODE_ANY, /* Any mode except ignore matches. */
@@ -231,7 +231,7 @@ void start_command_handler_ssh (ctrl_t, gnupg_fd_t);
/*-- findkey.c --*/
int agent_write_private_key (const unsigned char *grip,
const void *buffer, size_t length, int force);
-gpg_error_t agent_key_from_file (ctrl_t ctrl,
+gpg_error_t agent_key_from_file (ctrl_t ctrl,
const char *cache_nonce,
const char *desc_text,
const unsigned char *grip,
@@ -240,7 +240,7 @@ gpg_error_t agent_key_from_file (ctrl_t ctrl,
lookup_ttl_t lookup_ttl,
gcry_sexp_t *result,
char **r_passphrase);
-gpg_error_t agent_public_key_from_file (ctrl_t ctrl,
+gpg_error_t agent_public_key_from_file (ctrl_t ctrl,
const unsigned char *grip,
gcry_sexp_t *result);
int agent_is_dsa_key (gcry_sexp_t s_key);
@@ -307,7 +307,7 @@ unsigned long get_standard_s2k_count (void);
int agent_protect (const unsigned char *plainkey, const char *passphrase,
unsigned char **result, size_t *resultlen);
int agent_unprotect (const unsigned char *protectedkey, const char *passphrase,
- gnupg_isotime_t protected_at,
+ gnupg_isotime_t protected_at,
unsigned char **result, size_t *resultlen);
int agent_private_key_type (const unsigned char *privatekey);
unsigned char *make_shadow_info (const char *serialno, const char *idstring);
@@ -316,7 +316,7 @@ int agent_shadow_key (const unsigned char *pubkey,
unsigned char **result);
int agent_get_shadow_info (const unsigned char *shadowkey,
unsigned char const **shadow_info);
-gpg_error_t parse_shadow_info (const unsigned char *shadow_info,
+gpg_error_t parse_shadow_info (const unsigned char *shadow_info,
char **r_hexsn, char **r_idstr);
gpg_error_t s2k_hash_passphrase (const char *passphrase, int hashalgo,
int s2kmode,
@@ -335,7 +335,7 @@ void agent_reload_trustlist (void);
/*-- divert-scd.c --*/
-int divert_pksign (ctrl_t ctrl,
+int divert_pksign (ctrl_t ctrl,
const unsigned char *digest, size_t digestlen, int algo,
const unsigned char *shadow_info, unsigned char **r_sig);
int divert_pkdecrypt (ctrl_t ctrl,
diff --git a/agent/cache.c b/agent/cache.c
index 67c834b18..9c20469d2 100644
--- a/agent/cache.c
+++ b/agent/cache.c
@@ -126,7 +126,7 @@ init_encryption (void)
if (err)
log_error ("error initializing cache encryption context: %s\n",
gpg_strerror (err));
-
+
if (!pth_mutex_release (&encryption_lock))
log_fatal ("failed to release cache encryption mutex\n");
@@ -148,7 +148,7 @@ new_data (const char *string, struct secret_data_s **r_data)
struct secret_data_s *d, *d_enc;
size_t length;
int total;
-
+
*r_data = NULL;
err = init_encryption ();
@@ -222,7 +222,7 @@ housekeeping (void)
for (r=thecache; r; r = r->next)
{
unsigned long maxttl;
-
+
switch (r->cache_mode)
{
case CACHE_MODE_SSH: maxttl = opt.max_cache_ttl_ssh; break;
@@ -334,7 +334,7 @@ agent_put_cache (const char *key, cache_mode_t cache_mode,
}
if (data)
{
- r->created = r->accessed = gnupg_get_time ();
+ r->created = r->accessed = gnupg_get_time ();
r->ttl = ttl;
r->cache_mode = cache_mode;
err = new_data (data, &r->pw);
@@ -350,7 +350,7 @@ agent_put_cache (const char *key, cache_mode_t cache_mode,
else
{
strcpy (r->key, key);
- r->created = r->accessed = gnupg_get_time ();
+ r->created = r->accessed = gnupg_get_time ();
r->ttl = ttl;
r->cache_mode = cache_mode;
err = new_data (data, &r->pw);
@@ -428,4 +428,3 @@ agent_get_cache (const char *key, cache_mode_t cache_mode)
return NULL;
}
-
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 89450cd98..c570e3819 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -147,7 +147,7 @@ agent_reset_query (ctrl_t ctrl)
disconnect that pinentry - we do this after the unlock so that a
stalled pinentry does not block other threads. Fixme: We should
have a timeout in Assuan for the disconnect operation. */
-static int
+static int
unlock_pinentry (int rc)
{
assuan_context_t ctx = entry_ctx;
@@ -175,7 +175,7 @@ atfork_cb (void *opaque, int where)
{
int iterator = 0;
const char *name, *assname, *value;
-
+
gcry_control (GCRYCTL_TERM_SECMEM);
while ((name = session_env_list_stdenvnames (&iterator, &assname)))
@@ -184,7 +184,7 @@ atfork_cb (void *opaque, int where)
ones which do have an assuan name but are conveyed using
environment variables, update the environment of the
forked process. */
- if (!assname
+ if (!assname
|| !strcmp (name, "XAUTHORITY")
|| !strcmp (name, "PINENTRY_USER_DATA"))
{
@@ -250,12 +250,12 @@ start_pinentry (ctrl_t ctrl)
entry_owner = ctrl;
if (entry_ctx)
- return 0;
+ return 0;
if (opt.verbose)
log_info ("starting a new PIN Entry\n");
-#ifdef HAVE_W32_SYSTEM
+#ifdef HAVE_W32_SYSTEM
fflush (stdout);
fflush (stderr);
#endif
@@ -300,7 +300,7 @@ start_pinentry (ctrl_t ctrl)
}
else
argv[1] = NULL;
-
+
i=0;
if (!opt.running_detached)
{
@@ -342,7 +342,7 @@ start_pinentry (ctrl_t ctrl)
if (DBG_ASSUAN)
log_debug ("connection to PIN entry established\n");
- rc = assuan_transact (entry_ctx,
+ rc = assuan_transact (entry_ctx,
opt.no_grab? "OPTION no-grab":"OPTION grab",
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
@@ -426,7 +426,7 @@ start_pinentry (ctrl_t ctrl)
}
}
-
+
/* Tell the pinentry the name of a file it shall touch after having
messed with the tty. This is optional and only supported by
newer pinentries and thus we do no error checking. */
@@ -438,7 +438,7 @@ start_pinentry (ctrl_t ctrl)
if (tmpstr)
{
char *optstr;
-
+
if (asprintf (&optstr, "OPTION touch-file=%s", tmpstr ) < 0 )
;
else
@@ -454,7 +454,7 @@ start_pinentry (ctrl_t ctrl)
it will send the pid back and we will use an inquire to notify
our client. The client may answer the inquiry either with END or
with CAN to cancel the pinentry. */
- rc = assuan_transact (entry_ctx, "GETINFO pid",
+ rc = assuan_transact (entry_ctx, "GETINFO pid",
getinfo_pid_cb, &pinentry_pid,
NULL, NULL, NULL, NULL);
if (rc)
@@ -542,7 +542,7 @@ all_digitsp( const char *s)
for (; *s && *s >= '0' && *s <= '9'; s++)
;
return !*s;
-}
+}
/* Return a new malloced string by unescaping the string S. Escaping
@@ -561,7 +561,7 @@ unescape_passphrase_string (const unsigned char *s)
while (*s && !spacep (s))
{
if (*s == '%' && s[1] && s[2])
- {
+ {
s++;
*d = xtoi_2 (s);
if (!*d)
@@ -577,7 +577,7 @@ unescape_passphrase_string (const unsigned char *s)
else
*d++ = *s++;
}
- *d = 0;
+ *d = 0;
return buffer;
}
@@ -619,7 +619,7 @@ inq_quality (void *opaque, const char *line)
line += 7;
while (*line == ' ')
line++;
-
+
pin = unescape_passphrase_string (line);
if (!pin)
rc = gpg_error_from_syserror ();
@@ -651,7 +651,7 @@ setup_qualitybar (void)
char line[ASSUAN_LINELENGTH];
char *tmpstr, *tmpstr2;
const char *tooltip;
-
+
/* TRANSLATORS: This string is displayed by Pinentry as the label
for the quality bar. */
tmpstr = try_percent_escape (_("Quality:"), "\t\r\n\f\v");
@@ -664,7 +664,7 @@ setup_qualitybar (void)
; /* Ignore Unknown Command from old Pinentry versions. */
else if (rc)
return rc;
-
+
tmpstr2 = gnupg_get_help_string ("pinentry.qualitybar.tooltip", 0);
if (tmpstr2)
tooltip = tmpstr2;
@@ -715,7 +715,7 @@ close_button_status_cb (void *opaque, const char *line)
if ( !strcmp (line, "close") )
*flag = 1;
}
-
+
return 0;
}
@@ -738,7 +738,7 @@ agent_askpin (ctrl_t ctrl,
int is_pin = 0;
int saveflag;
int close_button;
-
+
if (opt.batch)
return 0; /* fixme: we should return BAD PIN */
@@ -784,7 +784,7 @@ agent_askpin (ctrl_t ctrl,
}
if (initial_errtext)
- {
+ {
snprintf (line, DIM(line)-1, "SETERROR %s", initial_errtext);
line[DIM(line)-1] = 0;
rc = assuan_transact (entry_ctx, line,
@@ -801,7 +801,7 @@ agent_askpin (ctrl_t ctrl,
parm.buffer = (unsigned char*)pininfo->pin;
if (errtext)
- {
+ {
/* TRANLATORS: The string is appended to an error message in
the pinentry. The %s is the actual error message, the
two %d give the current and maximum number of tries. */
@@ -814,7 +814,7 @@ agent_askpin (ctrl_t ctrl,
return unlock_pinentry (rc);
errtext = NULL;
}
-
+
saveflag = assuan_get_flag (entry_ctx, ASSUAN_CONFIDENTIAL);
assuan_begin_confidential (entry_ctx);
close_button = 0;
@@ -879,7 +879,7 @@ agent_askpin (ctrl_t ctrl,
/* Ask for the passphrase using the supplied arguments. The returned
passphrase needs to be freed by the caller. */
-int
+int
agent_get_passphrase (ctrl_t ctrl,
char **retpass, const char *desc, const char *prompt,
const char *errtext, int with_qualitybar)
@@ -893,7 +893,7 @@ agent_get_passphrase (ctrl_t ctrl,
*retpass = NULL;
if (opt.batch)
- return gpg_error (GPG_ERR_BAD_PASSPHRASE);
+ return gpg_error (GPG_ERR_BAD_PASSPHRASE);
rc = start_pinentry (ctrl);
if (rc)
@@ -973,9 +973,9 @@ agent_get_passphrase (ctrl_t ctrl,
displayed to allow the user to easily return a GPG_ERR_CANCELED.
if the Pinentry does not support this, the user can still cancel by
closing the Pinentry window. */
-int
+int
agent_get_confirmation (ctrl_t ctrl,
- const char *desc, const char *ok,
+ const char *desc, const char *ok,
const char *notok, int with_cancel)
{
int rc;
@@ -1049,7 +1049,7 @@ agent_get_confirmation (ctrl_t ctrl,
text OK_BTN (which may be NULL to use the default of "OK") and waut
for the user to hit this button. The return value is not
relevant. */
-int
+int
agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn)
{
int rc;
@@ -1083,7 +1083,7 @@ agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn)
if (rc)
return unlock_pinentry (rc);
}
-
+
rc = assuan_transact (entry_ctx, "CONFIRM --one-button", NULL, NULL, NULL,
NULL, NULL, NULL);
if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
@@ -1103,7 +1103,7 @@ popup_message_thread (void *arg)
allow the use of old Pinentries. Those old Pinentries will then
show an additional Cancel button but that is mostly a visual
annoyance. */
- assuan_transact (entry_ctx, "CONFIRM --one-button",
+ assuan_transact (entry_ctx, "CONFIRM --one-button",
NULL, NULL, NULL, NULL, NULL, NULL);
popup_finished = 1;
return NULL;
@@ -1116,7 +1116,7 @@ popup_message_thread (void *arg)
as the message is not anymore required because the message is
system modal and all other attempts to use the pinentry will fail
(after a timeout). */
-int
+int
agent_popup_message_start (ctrl_t ctrl, const char *desc, const char *ok_btn)
{
int rc;
@@ -1177,7 +1177,7 @@ agent_popup_message_stop (ctrl_t ctrl)
if (!popup_tid || !entry_ctx)
{
log_debug ("agent_popup_message_stop called with no active popup\n");
- return;
+ return;
}
pid = assuan_get_pid (entry_ctx);
@@ -1192,7 +1192,7 @@ agent_popup_message_stop (ctrl_t ctrl)
&& pid != 0)
{
HANDLE process = (HANDLE) pid;
-
+
/* Arbitrary error code. */
TerminateProcess (process, 1);
}
@@ -1221,5 +1221,3 @@ agent_popup_message_stop (ctrl_t ctrl)
/* Now we can close the connection. */
unlock_pinentry (0);
}
-
-
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 34d5254bd..40770abae 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -85,7 +85,7 @@ struct learn_parm_s
void *sinfo_cb_arg;
};
-struct inq_needpin_s
+struct inq_needpin_s
{
assuan_context_t ctx;
int (*getpin_cb)(void *, const char *, char*, size_t);
@@ -169,7 +169,7 @@ agent_scd_dump_state (void)
dump_mutex_state (&start_scd_lock);
log_printf ("\n");
log_info ("agent_scd_dump_state: primary_scd_ctx=%p pid=%ld reusable=%d\n",
- primary_scd_ctx,
+ primary_scd_ctx,
(long)assuan_get_pid (primary_scd_ctx),
primary_scd_ctx_reusable);
if (socket_name)
@@ -184,7 +184,7 @@ agent_scd_dump_state (void)
called and error checked before any SCD operation. CTRL is the
usual connection context and RC the error code to be passed trhough
the function. */
-static int
+static int
unlock_scd (ctrl_t ctrl, int rc)
{
if (ctrl->scd_local->locked != 1)
@@ -313,7 +313,7 @@ start_scd (ctrl_t ctrl)
/* Nope, it has not been started. Fire it up now. */
if (opt.verbose)
log_info ("no running SCdaemon - starting it\n");
-
+
if (fflush (NULL))
{
#ifndef HAVE_W32_SYSTEM
@@ -402,9 +402,9 @@ start_scd (ctrl_t ctrl)
if (opt.sigusr2_enabled)
{
char buf[100];
-
+
#ifdef HAVE_W32_SYSTEM
- snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
+ snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
(unsigned long)get_agent_scd_notify_event ());
#else
snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
@@ -422,7 +422,7 @@ start_scd (ctrl_t ctrl)
unlock_scd (ctrl, err);
if (ctx)
assuan_release (ctx);
- }
+ }
else
{
ctrl->scd_local->ctx = ctx;
@@ -511,7 +511,7 @@ agent_scd_check_aliveness (void)
sl->ctx = NULL;
}
}
-
+
primary_scd_ctx = NULL;
primary_scd_ctx_reusable = 0;
@@ -560,7 +560,7 @@ agent_reset_scd (ctrl_t ctrl)
assuan_release (ctrl->scd_local->ctx);
ctrl->scd_local->ctx = NULL;
}
-
+
/* Remove the local context from our list and release it. */
if (!scd_local_list)
BUG ();
@@ -569,7 +569,7 @@ agent_reset_scd (ctrl_t ctrl)
else
{
struct scd_local_s *sl;
-
+
for (sl=scd_local_list; sl->next_local; sl = sl->next_local)
if (sl->next_local == ctrl->scd_local)
break;
@@ -609,7 +609,7 @@ learn_status_cb (void *opaque, const char *line)
{
parm->sinfo_cb (parm->sinfo_cb_arg, keyword, keywordlen, line);
}
-
+
return 0;
}
@@ -676,7 +676,7 @@ get_serialno_cb (void *opaque, const char *line)
memcpy (*serialno, line, n);
(*serialno)[n] = 0;
}
-
+
return 0;
}
@@ -716,7 +716,7 @@ membuf_data_cb (void *opaque, const void *buffer, size_t length)
put_membuf (data, buffer, length);
return 0;
}
-
+
/* Handle the NEEDPIN inquiry. */
static gpg_error_t
inq_needpin (void *opaque, const char *line)
@@ -731,7 +731,7 @@ inq_needpin (void *opaque, const char *line)
line += 7;
while (*line == ' ')
line++;
-
+
pinlen = 90;
pin = gcry_malloc_secure (pinlen);
if (!pin)
@@ -748,7 +748,7 @@ inq_needpin (void *opaque, const char *line)
line += 17;
while (*line == ' ')
line++;
-
+
rc = parm->getpin_cb (parm->getpin_cb_arg, line, NULL, 1);
}
else if (!strncmp (line, "DISMISSKEYPADPROMPT", 19)
@@ -774,7 +774,7 @@ inq_needpin (void *opaque, const char *line)
assuan_end_confidential (parm->passthru);
if (!rc)
{
- if ((rest = (needrest
+ if ((rest = (needrest
&& !assuan_get_flag (parm->ctx, ASSUAN_CONFIDENTIAL))))
assuan_begin_confidential (parm->ctx);
rc = assuan_send_data (parm->ctx, value, valuelen);
@@ -783,7 +783,7 @@ inq_needpin (void *opaque, const char *line)
xfree (value);
}
else
- log_error ("error forwarding inquiry `%s': %s\n",
+ log_error ("error forwarding inquiry `%s': %s\n",
line, gpg_strerror (rc));
}
else
@@ -837,7 +837,7 @@ agent_card_pksign (ctrl_t ctrl,
inqparm.getpin_cb = getpin_cb;
inqparm.getpin_cb_arg = getpin_cb_arg;
inqparm.passthru = 0;
- snprintf (line, DIM(line)-1,
+ snprintf (line, DIM(line)-1,
ctrl->use_auth_call? "PKAUTH %s":"PKSIGN %s", keyid);
line[DIM(line)-1] = 0;
rc = assuan_transact (ctrl->scd_local->ctx, line,
@@ -1042,7 +1042,7 @@ card_getattr_cb (void *opaque, const char *line)
if (!parm->data)
parm->error = errno;
}
-
+
return 0;
}
@@ -1070,7 +1070,7 @@ agent_card_getattr (ctrl_t ctrl, const char *name, char **result)
/* We assume that NAME does not need escaping. */
if (8 + strlen (name) > DIM(line)-1)
return gpg_error (GPG_ERR_TOO_LARGE);
- stpcpy (stpcpy (line, "GETATTR "), name);
+ stpcpy (stpcpy (line, "GETATTR "), name);
err = start_scd (ctrl);
if (err)
@@ -1081,10 +1081,10 @@ agent_card_getattr (ctrl_t ctrl, const char *name, char **result)
card_getattr_cb, &parm);
if (!err && parm.error)
err = gpg_error_from_errno (parm.error);
-
+
if (!err && !parm.data)
err = gpg_error (GPG_ERR_NO_DATA);
-
+
if (!err)
*result = parm.data;
else
@@ -1161,5 +1161,3 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
return unlock_scd (ctrl, 0);
}
-
-
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index ec1c73e6a..8603a539b 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -68,7 +68,7 @@ static const char sshcontrolblurb[] =
"# in the SSH protocol. The ssh-add tool may add new entries to this\n"
"# file to enable them; you may also add them manually. Comment\n"
"# lines, like this one, as well as empty lines are ignored. Lines do\n"
-"# have a certain length limit but this is not serious limitation as\n"
+"# have a certain length limit but this is not serious limitation as\n"
"# the format of the entries is fixed and checked by gpg-agent. A\n"
"# non-comment line starts with optional white spaces, followed by the\n"
"# keygrip of the key given as 40 hex digits, optionally followed by a\n"
@@ -192,7 +192,7 @@ static gpg_error_t ssh_signature_encoder_dsa (estream_t signature_blob,
/* Global variables. */
-
+
/* Associating request types with the corresponding request
handlers. */
@@ -234,7 +234,7 @@ static ssh_key_type_spec_t ssh_key_types[] =
/*
- General utility functions.
+ General utility functions.
*/
/* A secure realloc, i.e. it makes sure to allocate secure memory if A
@@ -245,7 +245,7 @@ static void *
realloc_secure (void *a, size_t n)
{
void *p;
-
+
if (a)
p = gcry_realloc (a, n);
else
@@ -275,8 +275,8 @@ make_cstring (const char *data, size_t data_n)
-/*
- Primitive I/O functions.
+/*
+ Primitive I/O functions.
*/
@@ -466,7 +466,7 @@ stream_read_cstring (estream_t stream, char **string)
err = stream_read_string (stream, 0, &buffer, NULL);
if (err)
goto out;
-
+
*string = (char *) buffer;
out:
@@ -503,7 +503,7 @@ stream_write_cstring (estream_t stream, const char *string)
(const unsigned char *) string, strlen (string));
return err;
-}
+}
/* Read an MPI from STREAM, store it in MPINT. Depending on SECURE
use secure memory. */
@@ -614,7 +614,7 @@ file_to_buffer (const char *filename, unsigned char **buffer, size_t *buffer_n)
buffer_new = NULL;
err = 0;
-
+
stream = es_fopen (filename, "r");
if (! stream)
{
@@ -678,7 +678,7 @@ open_control_file (FILE **r_fp, int append)
fp = fopen (fname, append? "a+":"r");
if (!fp && errno == ENOENT)
{
- estream_t stream = es_fopen (fname, "wx,mode=-rw-r");
+ estream_t stream = es_fopen (fname, "wx,mode=-rw-r");
if (!stream)
{
err = gpg_error_from_syserror ();
@@ -698,8 +698,8 @@ open_control_file (FILE **r_fp, int append)
xfree (fname);
return err;
}
-
- *r_fp = fp;
+
+ *r_fp = fp;
return 0;
}
@@ -710,7 +710,7 @@ open_control_file (FILE **r_fp, int append)
DISABLED if the found key has been disabled. If R_TTL is not NULL
a specified TTL for that key is stored there. */
static gpg_error_t
-search_control_file (FILE *fp, const char *hexgrip,
+search_control_file (FILE *fp, const char *hexgrip,
int *r_disabled, int *r_ttl)
{
int c, i;
@@ -731,7 +731,7 @@ search_control_file (FILE *fp, const char *hexgrip,
return gpg_error (GPG_ERR_EOF);
return gpg_error (gpg_err_code_from_errno (errno));
}
-
+
if (!*line || line[strlen(line)-1] != '\n')
{
/* Eat until end of line */
@@ -740,13 +740,13 @@ search_control_file (FILE *fp, const char *hexgrip,
return gpg_error (*line? GPG_ERR_LINE_TOO_LONG
: GPG_ERR_INCOMPLETE_LINE);
}
-
+
/* Allow for empty lines and spaces */
for (p=line; spacep (p); p++)
;
}
while (!*p || *p == '\n' || *p == '#');
-
+
*r_disabled = 0;
if (*p == '!')
{
@@ -774,7 +774,7 @@ search_control_file (FILE *fp, const char *hexgrip,
if (r_ttl)
*r_ttl = ttl;
- /* Here is the place to parse flags if we need them. */
+ /* Here is the place to parse flags if we need them. */
return 0; /* Okay: found it. */
}
@@ -812,7 +812,7 @@ add_control_entry (ctrl_t ctrl, const char *hexgrip, int ttl)
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
hexgrip, ttl);
-
+
}
fclose (fp);
return 0;
@@ -836,7 +836,7 @@ ttl_from_sshcontrol (const char *hexgrip)
|| disabled)
ttl = 0; /* Use the global default if not found or disabled. */
- fclose (fp);
+ fclose (fp);
return ttl;
}
@@ -847,7 +847,7 @@ ttl_from_sshcontrol (const char *hexgrip)
/*
- MPI lists.
+ MPI lists.
*/
@@ -884,7 +884,7 @@ ssh_receive_mpint_list (estream_t stream, int secret,
mpis = NULL;
err = 0;
-
+
if (secret)
elems = key_spec.elems_key_secret;
else
@@ -1006,7 +1006,7 @@ ssh_signature_encoder_dsa (estream_t signature_blob, gcry_mpi_t *mpis)
err = gpg_error (GPG_ERR_INTERNAL); /* FIXME? */
break;
}
-
+
memset (buffer + (i * SSH_DSA_SIGNATURE_PADDING), 0,
SSH_DSA_SIGNATURE_PADDING - data_n);
memcpy (buffer + (i * SSH_DSA_SIGNATURE_PADDING)
@@ -1027,8 +1027,8 @@ ssh_signature_encoder_dsa (estream_t signature_blob, gcry_mpi_t *mpis)
return err;
}
-/*
- S-Expressions.
+/*
+ S-Expressions.
*/
@@ -1250,7 +1250,7 @@ sexp_key_extract (gcry_sexp_t sexp,
gcry_sexp_release (value_list);
gcry_sexp_release (value_pair);
gcry_sexp_release (comment_list);
-
+
if (err)
{
xfree (comment_new);
@@ -1260,7 +1260,7 @@ sexp_key_extract (gcry_sexp_t sexp,
return err;
}
-/* Extract the car from SEXP, and create a newly created C-string
+/* Extract the car from SEXP, and create a newly created C-string
which is to be stored in IDENTIFIER. */
static gpg_error_t
sexp_extract_identifier (gcry_sexp_t sexp, char **identifier)
@@ -1273,7 +1273,7 @@ sexp_extract_identifier (gcry_sexp_t sexp, char **identifier)
identifier_new = NULL;
err = 0;
-
+
sublist = gcry_sexp_nth (sexp, 1);
if (! sublist)
{
@@ -1327,7 +1327,7 @@ ssh_key_type_lookup (const char *ssh_name, const char *name,
if ((ssh_name && (! strcmp (ssh_name, ssh_key_types[i].ssh_identifier)))
|| (name && (! strcmp (name, ssh_key_types[i].identifier))))
break;
-
+
if (i == DIM (ssh_key_types))
err = gpg_error (GPG_ERR_NOT_FOUND);
else
@@ -1360,7 +1360,7 @@ ssh_receive_key (estream_t stream, gcry_sexp_t *key_new, int secret,
key_type = NULL;
comment = "";
key = NULL;
-
+
err = stream_read_cstring (stream, &key_type);
if (err)
goto out;
@@ -1399,7 +1399,7 @@ ssh_receive_key (estream_t stream, gcry_sexp_t *key_new, int secret,
if (key_spec)
*key_spec = spec;
*key_new = key;
-
+
out:
mpint_list_free (mpi_list);
@@ -1452,7 +1452,7 @@ ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size,
err = gpg_error_from_syserror ();
goto out;
}
-
+
err = es_fseek (stream, 0, SEEK_SET);
if (err)
goto out;
@@ -1480,7 +1480,7 @@ ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size,
return err;
}
-
+
/* Write the public key KEY_PUBLIC to STREAM in SSH key format. If
OVERRIDE_COMMENT is not NULL, it will be used instead of the
@@ -1518,14 +1518,14 @@ ssh_send_key_public (estream_t stream, gcry_sexp_t key_public,
spec.ssh_identifier, mpi_list);
if (err)
goto out;
-
+
err = stream_write_string (stream, blob, blob_n);
if (err)
goto out;
err = stream_write_cstring (stream,
override_comment? override_comment : comment);
-
+
out:
mpint_list_free (mpi_list);
@@ -1548,7 +1548,7 @@ ssh_read_key_public_from_blob (unsigned char *blob, size_t blob_size,
gpg_error_t err;
err = 0;
-
+
blob_stream = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
if (! blob_stream)
{
@@ -1712,7 +1712,7 @@ card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn)
/* (Shadow)-key is not available in our key storage. */
unsigned char *shadow_info;
unsigned char *tmp;
-
+
shadow_info = make_shadow_info (serialno, authkeyid);
if (!shadow_info)
{
@@ -1847,7 +1847,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
goto out;
}
key_directory_n = strlen (key_directory);
-
+
key_path = xtrymalloc (key_directory_n + 46);
if (! key_path)
{
@@ -1879,7 +1879,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
xfree (cardsn);
if (err)
goto out;
-
+
key_counter++;
}
@@ -1919,7 +1919,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
err = file_to_buffer (key_path, &buffer, &buffer_n);
if (err)
goto out;
-
+
err = gcry_sexp_sscan (&key_secret, NULL, (char*)buffer, buffer_n);
if (err)
goto out;
@@ -1944,7 +1944,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
gcry_sexp_release (key_secret);
key_secret = NULL;
-
+
err = ssh_send_key_public (key_blobs, key_public, NULL);
if (err)
goto out;
@@ -1955,7 +1955,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
key_counter++;
}
}
-
+
ret = es_fseek (key_blobs, 0, SEEK_SET);
if (ret)
{
@@ -2149,15 +2149,15 @@ data_sign (ctrl_t ctrl, ssh_signature_encoder_t sig_encoder,
{
err = gpg_error_from_syserror ();
goto out;
- }
+ }
err = stream_read_data (stream, sig_blob, sig_blob_n);
if (err)
goto out;
-
+
*sig = sig_blob;
*sig_n = sig_blob_n;
-
+
out:
if (err)
@@ -2199,7 +2199,7 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
key = NULL;
/* Receive key. */
-
+
err = stream_read_string (request, 0, &key_blob, &key_blob_size);
if (err)
goto out;
@@ -2244,7 +2244,7 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
memcpy (ctrl->keygrip, key_grip, 20);
err = data_sign (ctrl, spec.signature_encoder, &sig, &sig_n);
-
+
out:
/* Done. */
@@ -2264,7 +2264,7 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
if (ret_err)
goto leave;
}
-
+
leave:
gcry_sexp_release (key);
@@ -2293,7 +2293,7 @@ ssh_key_extract_comment (gcry_sexp_t key, char **comment)
err = gpg_error (GPG_ERR_INV_SEXP);
goto out;
}
-
+
data = gcry_sexp_nth_data (comment_list, 1, &data_n);
if (! data)
{
@@ -2337,7 +2337,7 @@ ssh_key_to_protected_buffer (gcry_sexp_t key, const char *passphrase,
err = gpg_error_from_syserror ();
goto out;
}
-
+
gcry_sexp_sprint (key, GCRYSEXP_FMT_CANON, buffer_new, buffer_new_n);
/* FIXME: guarantee? */
@@ -2393,7 +2393,7 @@ ssh_identity_register (ctrl_t ctrl, gcry_sexp_t key, int ttl)
if ( !agent_key_available (key_grip_raw) )
goto out; /* Yes, key is available. */
-
+
err = ssh_key_extract_comment (key, &comment);
if (err)
goto out;
@@ -2469,7 +2469,7 @@ ssh_identity_register (ctrl_t ctrl, gcry_sexp_t key, int ttl)
xfree (pi);
xfree (buffer);
xfree (comment);
- xfree (description);
+ xfree (description);
return err;
}
@@ -2508,7 +2508,7 @@ ssh_handler_add_identity (ctrl_t ctrl, estream_t request, estream_t response)
unsigned char b;
int confirm;
int ttl;
-
+
confirm = 0;
key = NULL;
ttl = 0;
@@ -2586,7 +2586,7 @@ ssh_handler_remove_identity (ctrl_t ctrl,
key_blob = NULL;
key = NULL;
-
+
err = stream_read_string (request, 0, &key_blob, &key_blob_size);
if (err)
goto out;
@@ -2594,7 +2594,7 @@ ssh_handler_remove_identity (ctrl_t ctrl,
err = ssh_read_key_public_from_blob (key_blob, key_blob_size, &key, NULL);
if (err)
goto out;
-
+
err = ssh_identity_drop (key);
out:
@@ -2620,7 +2620,7 @@ ssh_identities_remove_all (void)
/* FIXME: shall we remove _all_ cache entries or only those
registered through the ssh emulation? */
-
+
return err;
}
@@ -2634,7 +2634,7 @@ ssh_handler_remove_all_identities (ctrl_t ctrl,
(void)ctrl;
(void)request;
-
+
err = ssh_identities_remove_all ();
if (! err)
@@ -2679,7 +2679,7 @@ ssh_handler_lock (ctrl_t ctrl, estream_t request, estream_t response)
(void)ctrl;
(void)request;
-
+
err = ssh_lock ();
if (! err)
@@ -2696,7 +2696,7 @@ ssh_handler_unlock (ctrl_t ctrl, estream_t request, estream_t response)
{
gpg_error_t ret_err;
gpg_error_t err;
-
+
(void)ctrl;
(void)request;
@@ -2761,7 +2761,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
/* Create memory streams for request/response data. The entire
request will be stored in secure memory, since it might contain
secret key material. The response does not have to be stored in
- secure memory, since we never give out secret keys.
+ secure memory, since we never give out secret keys.
Note: we only have little secure memory, but there is NO
possibility of DoS here; only trusted clients are allowed to
@@ -2912,7 +2912,7 @@ start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client)
the current TTY setting, we resort here to use those from startup
or those explictly set. */
{
- static const char *names[] =
+ static const char *names[] =
{"GPG_TTY", "DISPLAY", "TERM", "XAUTHORITY", "PINENTRY_USER_DATA", NULL};
int idx;
const char *value;
@@ -2921,7 +2921,7 @@ start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client)
if (!session_env_getenv (ctrl->session_env, names[idx])
&& (value = session_env_getenv (opt.startup_env, names[idx])))
err = session_env_setenv (ctrl->session_env, names[idx], value);
-
+
if (!err && !ctrl->lc_ctype && opt.startup_lc_ctype)
if (!(ctrl->lc_ctype = xtrystrdup (opt.startup_lc_ctype)))
err = gpg_error_from_syserror ();
@@ -2932,7 +2932,7 @@ start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client)
if (err)
{
- log_error ("error setting default session environment: %s\n",
+ log_error ("error setting default session environment: %s\n",
gpg_strerror (err));
goto out;
}
diff --git a/agent/command.c b/agent/command.c
index 8ae313e7a..330c85182 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -83,7 +83,7 @@ struct putval_item_s
struct putval_item_s *next;
size_t off; /* Offset to the value into DATA. */
size_t len; /* Length of the value. */
- char d[1]; /* Key | Nul | value. */
+ char d[1]; /* Key | Nul | value. */
};
@@ -97,14 +97,14 @@ static struct putval_item_s *putval_list;
integers and there should be no problem if they are overflowing as
callers need to check only whether a counter changed. The actual
values are not meaningful. */
-struct
+struct
{
/* Incremented if any of the other counters below changed. */
unsigned int any;
/* Incremented if a key is added or removed from the internal privat
key database. */
- unsigned int key;
+ unsigned int key;
/* Incremented if a change of the card readers stati has been
detected. */
@@ -195,7 +195,7 @@ reset_notify (assuan_context_t ctx, char *line)
}
-/* Skip over options.
+/* Skip over options.
Blanks after the options are also removed. */
static char *
skip_options (const char *line)
@@ -331,7 +331,7 @@ agent_write_status (ctrl_t ctrl, const char *keyword, ...)
va_start (arg_ptr, keyword);
- p = buf;
+ p = buf;
n = 0;
while ( (text = va_arg (arg_ptr, const char *)) )
{
@@ -372,7 +372,7 @@ agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid)
{
char line[100];
- if (!ctrl || !ctrl->server_local
+ if (!ctrl || !ctrl->server_local
|| !ctrl->server_local->allow_pinentry_notify)
return 0;
snprintf (line, DIM(line)-1, "PINENTRY_LAUNCHED %lu", pid);
@@ -417,7 +417,7 @@ leave_cmd (assuan_context_t ctx, gpg_error_t err)
-static const char hlp_geteventcounter[] =
+static const char hlp_geteventcounter[] =
"GETEVENTCOUNTER\n"
"\n"
"Return a a status line named EVENTCOUNTER with the current values\n"
@@ -475,7 +475,7 @@ bump_card_eventcounter (void)
-static const char hlp_istrusted[] =
+static const char hlp_istrusted[] =
"ISTRUSTED <hexstring_with_fingerprint>\n"
"\n"
"Return OK when we have an entry with this fingerprint in our\n"
@@ -512,7 +512,7 @@ cmd_istrusted (assuan_context_t ctx, char *line)
}
-static const char hlp_listtrusted[] =
+static const char hlp_listtrusted[] =
"LISTTRUSTED\n"
"\n"
"List all entries from the trustlist.";
@@ -520,7 +520,7 @@ static gpg_error_t
cmd_listtrusted (assuan_context_t ctx, char *line)
{
int rc;
-
+
(void)line;
rc = agent_listtrusted (ctx);
@@ -528,7 +528,7 @@ cmd_listtrusted (assuan_context_t ctx, char *line)
}
-static const char hlp_martrusted[] =
+static const char hlp_martrusted[] =
"MARKTRUSTED <hexstring_with_fingerprint> <flag> <display_name>\n"
"\n"
"Store a new key in into the trustlist.";
@@ -555,7 +555,7 @@ cmd_marktrusted (assuan_context_t ctx, char *line)
for (p=line; i < 40; p++, i++)
fpr[i] = *p >= 'a'? (*p & 0xdf): *p;
fpr[i] = 0;
-
+
while (spacep (p))
p++;
flag = *p++;
@@ -582,12 +582,12 @@ cmd_havekey (assuan_context_t ctx, char *line)
gpg_error_t err;
unsigned char buf[20];
- do
+ do
{
err = parse_keygrip (ctx, line, buf);
if (err)
return err;
-
+
if (!agent_key_available (buf))
return 0; /* Found. */
@@ -597,7 +597,7 @@ cmd_havekey (assuan_context_t ctx, char *line)
line++;
}
while (*line);
-
+
/* No leave_cmd() here because errors are expected and would clutter
the log. */
return gpg_error (GPG_ERR_NO_SECKEY);
@@ -623,7 +623,7 @@ cmd_sigkey (assuan_context_t ctx, char *line)
}
-static const char hlp_setkeydesc[] =
+static const char hlp_setkeydesc[] =
"SETKEYDESC plus_percent_escaped_string\n"
"\n"
"Set a description to be used for the next PKSIGN, PKDECRYPT, IMPORT_KEY\n"
@@ -710,7 +710,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
algo = 0;
line = skip_options (line);
-
+
if (!algo)
{
/* No hash option has been given: require an algo number instead */
@@ -731,7 +731,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
n /= 2;
if (algo == MD_USER_TLS_MD5SHA1 && n == 36)
;
- else if (n != 16 && n != 20 && n != 24
+ else if (n != 16 && n != 20 && n != 24
&& n != 28 && n != 32 && n != 48 && n != 64)
return set_error (GPG_ERR_ASS_PARAMETER, "unsupported length of hash");
@@ -748,7 +748,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
}
-static const char hlp_pksign[] =
+static const char hlp_pksign[] =
"PKSIGN [<options>] [<cache_nonce>]\n"
"\n"
"Perform the actual sign operation. Neither input nor output are\n"
@@ -762,9 +762,9 @@ cmd_pksign (assuan_context_t ctx, char *line)
membuf_t outbuf;
char *cache_nonce = NULL;
char *p;
-
+
line = skip_options (line);
-
+
p = line;
for (p=line; *p && *p != ' ' && *p != '\t'; p++)
;
@@ -793,7 +793,7 @@ cmd_pksign (assuan_context_t ctx, char *line)
}
-static const char hlp_pkdecrypt[] =
+static const char hlp_pkdecrypt[] =
"PKDECRYPT [<options>]\n"
"\n"
"Perform the actual decrypt operation. Input is not\n"
@@ -830,7 +830,7 @@ cmd_pkdecrypt (assuan_context_t ctx, char *line)
}
-static const char hlp_genkey[] =
+static const char hlp_genkey[] =
"GENKEY [--no-protection] [<cache_nonce>]\n"
"\n"
"Generate a new key, store the secret part and return the public\n"
@@ -855,7 +855,7 @@ cmd_genkey (assuan_context_t ctx, char *line)
membuf_t outbuf;
char *cache_nonce = NULL;
char *p;
-
+
no_protection = has_option (line, "--no-protection");
line = skip_options (line);
@@ -887,7 +887,7 @@ cmd_genkey (assuan_context_t ctx, char *line)
-static const char hlp_readkey[] =
+static const char hlp_readkey[] =
"READKEY <hexstring_with_keygrip>\n"
"\n"
"Return the public key for the given keygrip.";
@@ -929,7 +929,7 @@ cmd_readkey (assuan_context_t ctx, char *line)
-static const char hlp_keyinfo[] =
+static const char hlp_keyinfo[] =
"KEYINFO [--list] <keygrip>\n"
"\n"
"Return information about the key specified by the KEYGRIP. If the\n"
@@ -972,22 +972,22 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
/* Reformat the grip so that we use uppercase as good style. */
bin2hex (grip, 20, hexgrip);
-
- if (keytype == PRIVATE_KEY_CLEAR
+
+ if (keytype == PRIVATE_KEY_CLEAR
|| keytype == PRIVATE_KEY_PROTECTED)
keytypestr = "D";
else if (keytype == PRIVATE_KEY_SHADOWED)
keytypestr = "T";
- else
+ else
keytypestr = "-";
-
+
if (shadow_info)
{
err = parse_shadow_info (shadow_info, &serialno, &idstr);
if (err)
goto leave;
}
-
+
err = agent_write_status (ctrl, "KEYINFO",
hexgrip,
keytypestr,
@@ -1019,7 +1019,7 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
char *dirname;
struct dirent *dir_entry;
char hexgrip[41];
-
+
dirname = make_filename_try (opt.homedir, GNUPG_PRIVATE_KEYS_DIR, NULL);
if (!dirname)
{
@@ -1059,7 +1059,7 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
goto leave;
err = do_one_keyinfo (ctrl, grip);
}
-
+
leave:
if (dir)
closedir (dir);
@@ -1096,7 +1096,7 @@ send_back_passphrase (assuan_context_t ctx, int via_data, const char *pw)
}
-static const char hlp_get_passphrase[] =
+static const char hlp_get_passphrase[] =
"GET_PASSPHRASE [--data] [--check] [--no-ask] [--repeat[=N]]\n"
" [--qualitybar] <cache_id>\n"
" [<error_message> <prompt> <description>]\n"
@@ -1215,8 +1215,8 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
plus_to_blank (desc);
next_try:
- rc = agent_get_passphrase (ctrl, &response, desc, prompt,
- repeat_errtext? repeat_errtext:errtext,
+ rc = agent_get_passphrase (ctrl, &response, desc, prompt,
+ repeat_errtext? repeat_errtext:errtext,
opt_qualbar);
xfree (repeat_errtext);
repeat_errtext = NULL;
@@ -1241,7 +1241,7 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
{
xfree (response2);
xfree (response);
- repeat_errtext = try_percent_escape
+ repeat_errtext = try_percent_escape
(_("does not match - try again"), NULL);
if (!repeat_errtext)
{
@@ -1266,7 +1266,7 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
}
-static const char hlp_clear_passphrase[] =
+static const char hlp_clear_passphrase[] =
"CLEAR_PASSPHRASE <cache_id>\n"
"\n"
"may be used to invalidate the cache entry for a passphrase. The\n"
@@ -1292,7 +1292,7 @@ cmd_clear_passphrase (assuan_context_t ctx, char *line)
}
-static const char hlp_get_confirmation[] =
+static const char hlp_get_confirmation[] =
"GET_CONFIRMATION <description>\n"
"\n"
"This command may be used to ask for a simple confirmation.\n"
@@ -1355,7 +1355,7 @@ cmd_learn (assuan_context_t ctx, char *line)
-static const char hlp_passwd[] =
+static const char hlp_passwd[] =
"PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] <hexstring_with_keygrip>\n"
"\n"
"Change the passphrase/PIN for the key identified by keygrip in LINE.";
@@ -1413,7 +1413,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
ctrl->in_passwd++;
err = agent_key_from_file (ctrl, cache_nonce, ctrl->server_local->keydesc,
- grip, &shadow_info, CACHE_MODE_IGNORE, NULL,
+ grip, &shadow_info, CACHE_MODE_IGNORE, NULL,
&s_skey, &passphrase);
if (err)
;
@@ -1441,7 +1441,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
gcry_create_nonce (buf, 12);
cache_nonce = bin2hex (buf, 12, NULL);
}
- if (cache_nonce
+ if (cache_nonce
&& !agent_put_cache (cache_nonce, CACHE_MODE_NONCE,
passphrase, 120 /*seconds*/))
{
@@ -1461,7 +1461,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
gcry_create_nonce (buf, 12);
passwd_nonce = bin2hex (buf, 12, NULL);
}
- if (passwd_nonce
+ if (passwd_nonce
&& !agent_put_cache (passwd_nonce, CACHE_MODE_NONCE,
newpass, 120 /*seconds*/))
{
@@ -1488,7 +1488,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
}
-static const char hlp_preset_passphrase[] =
+static const char hlp_preset_passphrase[] =
"PRESET_PASSPHRASE <string_or_keygrip> <timeout> <hexstring>\n"
"\n"
"Set the cached passphrase/PIN for the key identified by the keygrip\n"
@@ -1517,7 +1517,7 @@ cmd_preset_passphrase (assuan_context_t ctx, char *line)
line++;
while (*line && (*line == ' ' || *line == '\t'))
line++;
-
+
/* Currently, only infinite timeouts are allowed. */
ttl = -1;
if (line[0] != '-' || line[1] != '1')
@@ -1554,7 +1554,7 @@ cmd_preset_passphrase (assuan_context_t ctx, char *line)
-static const char hlp_scd[] =
+static const char hlp_scd[] =
"SCD <commands to pass to the scdaemon>\n"
" \n"
"This is a general quote command to redirect everything to the\n"
@@ -1601,7 +1601,7 @@ cmd_keywrap_key (assuan_context_t ctx, char *line)
xfree (ctrl->server_local->import_key);
if (clearopt)
ctrl->server_local->import_key = NULL;
- else if (!(ctrl->server_local->import_key =
+ else if (!(ctrl->server_local->import_key =
gcry_random_bytes (KEYWRAP_KEYSIZE, GCRY_STRONG_RANDOM)))
err = gpg_error_from_syserror ();
else
@@ -1613,7 +1613,7 @@ cmd_keywrap_key (assuan_context_t ctx, char *line)
xfree (ctrl->server_local->export_key);
if (clearopt)
ctrl->server_local->export_key = NULL;
- else if (!(ctrl->server_local->export_key =
+ else if (!(ctrl->server_local->export_key =
gcry_random_bytes (KEYWRAP_KEYSIZE, GCRY_STRONG_RANDOM)))
err = gpg_error_from_syserror ();
else
@@ -1623,7 +1623,7 @@ cmd_keywrap_key (assuan_context_t ctx, char *line)
else
err = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for MODE");
assuan_end_confidential (ctx);
-
+
return leave_cmd (ctx, err);
}
@@ -1654,7 +1654,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
gcry_sexp_t openpgp_sexp = NULL;
char *cache_nonce = NULL;
char *p;
-
+
if (!ctrl->server_local->import_key)
{
err = gpg_error (GPG_ERR_MISSING_KEY);
@@ -1706,7 +1706,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
realkeylen = gcry_sexp_canon_len (key, keylen, NULL, &err);
if (!realkeylen)
goto leave; /* Invalid canonical encoded S-expression. */
-
+
err = keygrip_from_canon_sexp (key, realkeylen, grip);
if (err)
{
@@ -1717,7 +1717,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
{
const char *tag;
size_t taglen;
-
+
tag = gcry_sexp_nth_data (openpgp_sexp, 0, &taglen);
if (tag && taglen == 19 && !memcmp (tag, "openpgp-private-key", 19))
;
@@ -1739,7 +1739,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
ask for a passphrase. That passphrase will be returned and
used to protect the key using the same code as for regular
key import. */
-
+
err = convert_from_openpgp (ctrl, openpgp_sexp, grip,
ctrl->server_local->keydesc, cache_nonce,
&key, &passphrase);
@@ -1756,7 +1756,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
gcry_create_nonce (buf, 12);
cache_nonce = bin2hex (buf, 12, NULL);
}
- if (cache_nonce
+ if (cache_nonce
&& !agent_put_cache (cache_nonce, CACHE_MODE_NONCE,
passphrase, 120 /*seconds*/))
assuan_write_status (ctx, "CACHE_NONCE", cache_nonce);
@@ -1767,7 +1767,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
if (!agent_key_available (grip))
err = gpg_error (GPG_ERR_EEXIST);
else
- err = agent_ask_new_passphrase
+ err = agent_ask_new_passphrase
(ctrl, _("Please enter the passphrase to protect the "
"imported object within the GnuPG system."),
&passphrase);
@@ -1821,7 +1821,7 @@ cmd_export_key (assuan_context_t ctx, char *line)
int openpgp;
char *cache_nonce;
char *passphrase = NULL;
-
+
openpgp = has_option (line, "--openpgp");
cache_nonce = option_value (line, "--cache-nonce");
if (cache_nonce)
@@ -1870,7 +1870,7 @@ cmd_export_key (assuan_context_t ctx, char *line)
err = gpg_error (GPG_ERR_UNUSABLE_SECKEY);
goto leave;
}
-
+
if (openpgp)
{
/* The openpgp option changes the key format into the OpenPGP
@@ -1878,7 +1878,7 @@ cmd_export_key (assuan_context_t ctx, char *line)
canonical S-expression. */
if (!passphrase)
{
- err = agent_ask_new_passphrase
+ err = agent_ask_new_passphrase
(ctrl, _("This key (or subkey) is not protected with a passphrase."
" Please enter a new passphrase to export it."),
&passphrase);
@@ -1925,7 +1925,7 @@ cmd_export_key (assuan_context_t ctx, char *line)
assuan_begin_confidential (ctx);
err = assuan_send_data (ctx, wrappedkey, wrappedkeylen);
assuan_end_confidential (ctx);
-
+
leave:
xfree (cache_nonce);
@@ -1943,7 +1943,7 @@ cmd_export_key (assuan_context_t ctx, char *line)
-static const char hlp_getval[] =
+static const char hlp_getval[] =
"GETVAL <key>\n"
"\n"
"Return the value for KEY from the special environment as created by\n"
@@ -1962,7 +1962,7 @@ cmd_getval (assuan_context_t ctx, char *line)
p = strchr (key, ' ');
if (p)
{
- *p++ = 0;
+ *p++ = 0;
for (; *p == ' '; p++)
;
if (*p)
@@ -1985,7 +1985,7 @@ cmd_getval (assuan_context_t ctx, char *line)
}
-static const char hlp_putval[] =
+static const char hlp_putval[] =
"PUTVAL <key> [<percent_escaped_value>]\n"
"\n"
"The gpg-agent maintains a kind of environment which may be used to\n"
@@ -2019,7 +2019,7 @@ cmd_putval (assuan_context_t ctx, char *line)
p = strchr (key, ' ');
if (p)
{
- *p++ = 0;
+ *p++ = 0;
for (; *p == ' '; p++)
;
if (*p)
@@ -2048,7 +2048,7 @@ cmd_putval (assuan_context_t ctx, char *line)
xfree (vl);
}
- if (valuelen) /* Add entry. */
+ if (valuelen) /* Add entry. */
{
vl = xtrymalloc (sizeof *vl + strlen (key) + valuelen);
if (!vl)
@@ -2070,7 +2070,7 @@ cmd_putval (assuan_context_t ctx, char *line)
-static const char hlp_updatestartuptty[] =
+static const char hlp_updatestartuptty[] =
"UPDATESTARTUPTTY\n"
"\n"
"Set startup TTY and X11 DISPLAY variables to the values of this\n"
@@ -2080,7 +2080,7 @@ static const char hlp_updatestartuptty[] =
static gpg_error_t
cmd_updatestartuptty (assuan_context_t ctx, char *line)
{
- static const char *names[] =
+ static const char *names[] =
{ "GPG_TTY", "DISPLAY", "TERM", "XAUTHORITY", "PINENTRY_USER_DATA", NULL };
ctrl_t ctrl = assuan_get_pointer (ctx);
gpg_error_t err = 0;
@@ -2088,7 +2088,7 @@ cmd_updatestartuptty (assuan_context_t ctx, char *line)
int idx;
char *lc_ctype = NULL;
char *lc_messages = NULL;
-
+
(void)line;
se = session_env_new ();
@@ -2102,14 +2102,14 @@ cmd_updatestartuptty (assuan_context_t ctx, char *line)
err = session_env_setenv (se, names[idx], value);
}
- if (!err && ctrl->lc_ctype)
+ if (!err && ctrl->lc_ctype)
if (!(lc_ctype = xtrystrdup (ctrl->lc_ctype)))
err = gpg_error_from_syserror ();
if (!err && ctrl->lc_messages)
if (!(lc_messages = xtrystrdup (ctrl->lc_messages)))
err = gpg_error_from_syserror ();
-
+
if (err)
{
session_env_release (se);
@@ -2142,7 +2142,7 @@ cmd_killagent (assuan_context_t ctx, char *line)
ctrl_t ctrl = assuan_get_pointer (ctx);
(void)line;
-
+
if (!opt.use_standard_socket)
return set_error (GPG_ERR_NOT_SUPPORTED, "no --use-standard-socket");
@@ -2168,7 +2168,7 @@ cmd_reloadagent (assuan_context_t ctx, char *line)
-static const char hlp_getinfo[] =
+static const char hlp_getinfo[] =
"GETINFO <what>\n"
"\n"
"Multipurpose function to return a variety of information.\n"
@@ -2237,15 +2237,15 @@ cmd_getinfo (assuan_context_t ctx, char *line)
int iterator;
const char *name, *value;
char *string;
-
- iterator = 0;
+
+ iterator = 0;
while ((name = session_env_list_stdenvnames (&iterator, NULL)))
{
value = session_env_getenv_or_default
(line[5] == 't'? opt.startup_env:ctrl->session_env, name, NULL);
if (value)
{
- string = xtryasprintf ("%s=%s", name, value);
+ string = xtryasprintf ("%s=%s", name, value);
if (!string)
rc = gpg_error_from_syserror ();
else
@@ -2308,7 +2308,7 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
{
/* The value is a version string telling us of which agent
version the caller is aware of. */
- ctrl->server_local->allow_fully_canceled =
+ ctrl->server_local->allow_fully_canceled =
gnupg_compare_version (value, "2.1.0");
}
else if (!strcmp (key, "putenv"))
@@ -2378,7 +2378,7 @@ static void
post_cmd_notify (assuan_context_t ctx, gpg_error_t err)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
-
+
(void)err;
/* Switch off any I/O monitor controlled logging pausing. */
@@ -2395,7 +2395,7 @@ io_monitor (assuan_context_t ctx, void *hook, int direction,
const char *line, size_t linelen)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
-
+
(void) hook;
/* Note that we only check for the uppercase name. This allows to
@@ -2422,7 +2422,7 @@ command_has_option (const char *cmd, const char *cmdopt)
if (!strcmp (cmdopt, "repeat"))
return 1;
}
-
+
return 0;
}
@@ -2456,8 +2456,8 @@ register_commands (assuan_context_t ctx)
{ "MARKTRUSTED", cmd_marktrusted, hlp_martrusted },
{ "LEARN", cmd_learn, hlp_learn },
{ "PASSWD", cmd_passwd, hlp_passwd },
- { "INPUT", NULL },
- { "OUTPUT", NULL },
+ { "INPUT", NULL },
+ { "OUTPUT", NULL },
{ "SCD", cmd_scd, hlp_scd },
{ "KEYWRAP_KEY", cmd_keywrap_key, hlp_keywrap_key },
{ "IMPORT_KEY", cmd_import_key, hlp_import_key },
@@ -2478,7 +2478,7 @@ register_commands (assuan_context_t ctx)
table[i].help);
if (rc)
return rc;
- }
+ }
assuan_register_post_cmd_notify (ctx, post_cmd_notify);
assuan_register_reset_notify (ctx, reset_notify);
assuan_register_option_handler (ctx, option_handler);
@@ -2517,7 +2517,7 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
/* FIXME: Need to call assuan_sock_set_nonce for Windows. But
this branch is currently not used. */
}
- else
+ else
{
rc = assuan_init_socket_server (ctx, fd, ASSUAN_SOCKET_SERVER_ACCEPTED);
}
@@ -2556,7 +2556,7 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
log_info ("Assuan accept problem: %s\n", gpg_strerror (rc));
break;
}
-
+
rc = assuan_process (ctx);
if (rc)
{
@@ -2584,4 +2584,3 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
xfree (ctrl->server_local);
ctrl->server_local = NULL;
}
-
diff --git a/agent/cvt-openpgp.h b/agent/cvt-openpgp.h
index db06a3f6a..3c48d0319 100644
--- a/agent/cvt-openpgp.h
+++ b/agent/cvt-openpgp.h
@@ -19,12 +19,12 @@
#ifndef GNUPG_AGENT_CVT_OPENPGP_H
#define GNUPG_AGENT_CVT_OPENPGP_H
-gpg_error_t convert_from_openpgp (ctrl_t ctrl, gcry_sexp_t s_pgp,
+gpg_error_t convert_from_openpgp (ctrl_t ctrl, gcry_sexp_t s_pgp,
unsigned char *grip, const char *prompt,
const char *cache_nonce,
unsigned char **r_key, char **r_passphrase);
-gpg_error_t convert_to_openpgp (ctrl_t ctrl, gcry_sexp_t s_key,
+gpg_error_t convert_to_openpgp (ctrl_t ctrl, gcry_sexp_t s_key,
const char *passphrase,
unsigned char **r_transferkey,
size_t *r_transferkeylen);
diff --git a/agent/divert-scd.c b/agent/divert-scd.c
index bf07d0785..f4787b537 100644
--- a/agent/divert-scd.c
+++ b/agent/divert-scd.c
@@ -1,4 +1,4 @@
-/* divert-scd.c - divert operations to the scdaemon
+/* divert-scd.c - divert operations to the scdaemon
* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
@@ -140,7 +140,7 @@ encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo,
memcpy (frame+asnlen, digest, digestlen);
if (DBG_CRYPTO)
log_printhex ("encoded hash:", frame, asnlen+digestlen);
-
+
*r_val = frame;
*r_len = asnlen+digestlen;
return 0;
@@ -170,11 +170,11 @@ encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo,
Example:
"|AN|Please enter the new security officer's PIN"
-
+
The text "Please ..." will get displayed and the flags 'A' and 'N'
are considered.
*/
-static int
+static int
getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
{
struct pin_entry_info_s *pi;
@@ -291,7 +291,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
prompt, NULL, pi2);
if (!rc && strcmp (pi->pin, pi2->pin))
{
- again_text = (resetcode?
+ again_text = (resetcode?
N_("Reset Code not correctly repeated; try again"):
is_puk?
N_("PUK not correctly repeated; try again"):
@@ -307,7 +307,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
{
char *desc;
if ( asprintf (&desc,
- _("Please enter the PIN%s%s%s to unlock the card"),
+ _("Please enter the PIN%s%s%s to unlock the card"),
info? " (`":"",
info? info:"",
info? "')":"") < 0)
@@ -329,7 +329,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
int
-divert_pksign (ctrl_t ctrl,
+divert_pksign (ctrl_t ctrl,
const unsigned char *digest, size_t digestlen, int algo,
const unsigned char *shadow_info, unsigned char **r_sig)
{
@@ -376,7 +376,7 @@ divert_pksign (ctrl_t ctrl,
/* Decrypt the the value given asn an S-expression in CIPHER using the
key identified by SHADOW_INFO and return the plaintext in an
allocated buffer in R_BUF. */
-int
+int
divert_pkdecrypt (ctrl_t ctrl,
const unsigned char *cipher,
const unsigned char *shadow_info,
@@ -397,28 +397,28 @@ divert_pkdecrypt (ctrl_t ctrl,
s++;
n = snext (&s);
if (!n)
- return gpg_error (GPG_ERR_INV_SEXP);
+ return gpg_error (GPG_ERR_INV_SEXP);
if (!smatch (&s, n, "enc-val"))
- return gpg_error (GPG_ERR_UNKNOWN_SEXP);
+ return gpg_error (GPG_ERR_UNKNOWN_SEXP);
if (*s != '(')
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
s++;
n = snext (&s);
if (!n)
- return gpg_error (GPG_ERR_INV_SEXP);
+ return gpg_error (GPG_ERR_INV_SEXP);
if (!smatch (&s, n, "rsa"))
- return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
+ return gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
if (*s != '(')
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
s++;
n = snext (&s);
if (!n)
- return gpg_error (GPG_ERR_INV_SEXP);
+ return gpg_error (GPG_ERR_INV_SEXP);
if (!smatch (&s, n, "a"))
return gpg_error (GPG_ERR_UNKNOWN_SEXP);
n = snext (&s);
if (!n)
- return gpg_error (GPG_ERR_UNKNOWN_SEXP);
+ return gpg_error (GPG_ERR_UNKNOWN_SEXP);
ciphertext = s;
ciphertextlen = n;
@@ -439,13 +439,8 @@ divert_pkdecrypt (ctrl_t ctrl,
}
-int
+int
divert_generic_cmd (ctrl_t ctrl, const char *cmdline, void *assuan_context)
{
return agent_card_scd (ctrl, cmdline, getpin_cb, ctrl, assuan_context);
}
-
-
-
-
-
diff --git a/agent/findkey.c b/agent/findkey.c
index 108146693..7e1cefcb8 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -39,7 +39,7 @@
#endif
/* Helper to pass data to the check callback of the unprotect function. */
-struct try_unprotect_arg_s
+struct try_unprotect_arg_s
{
ctrl_t ctrl;
const unsigned char *protected_key;
@@ -59,7 +59,7 @@ agent_write_private_key (const unsigned char *grip,
char *fname;
estream_t fp;
char hexgrip[40+4+1];
-
+
bin2hex (grip, 20, hexgrip);
strcpy (hexgrip+40, ".key");
@@ -73,8 +73,8 @@ agent_write_private_key (const unsigned char *grip,
}
fp = es_fopen (fname, force? "wb,mode=-rw" : "wbx,mode=-rw");
- if (!fp)
- {
+ if (!fp)
+ {
gpg_error_t tmperr = gpg_error_from_syserror ();
log_error ("can't create `%s': %s\n", fname, gpg_strerror (tmperr));
xfree (fname);
@@ -143,7 +143,7 @@ try_unprotect_cb (struct pin_entry_info_s *pi)
if (strcmp (now, tmptime) > 0 )
{
/* Passphrase "expired". */
- desc = xtryasprintf
+ desc = xtryasprintf
(_("This passphrase has not been changed%%0A"
"since %.4s-%.2s-%.2s. Please change it now."),
protected_at, protected_at+4, protected_at+6);
@@ -254,7 +254,7 @@ modify_description (const char *in, const char *comment, char **result)
out_len++;
}
}
-
+
if (!pass)
{
*result = out = xtrymalloc (out_len + 1);
@@ -268,7 +268,7 @@ modify_description (const char *in, const char *comment, char **result)
return 0;
}
-
+
/* Unprotect the canconical encoded S-expression key in KEYBUF. GRIP
should be the hex encoded keygrip of that key to be used with the
@@ -281,7 +281,7 @@ modify_description (const char *in, const char *comment, char **result)
passphrase. */
static int
unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
- unsigned char **keybuf, const unsigned char *grip,
+ unsigned char **keybuf, const unsigned char *grip,
cache_mode_t cache_mode, lookup_ttl_t lookup_ttl,
char **r_passphrase)
{
@@ -294,14 +294,14 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
if (r_passphrase)
*r_passphrase = NULL;
-
+
bin2hex (grip, 20, hexgrip);
/* Initially try to get it using a cache nonce. */
if (cache_nonce)
{
char *pw;
-
+
pw = agent_get_cache (cache_nonce, CACHE_MODE_NONCE);
if (pw)
{
@@ -325,7 +325,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
if (cache_mode != CACHE_MODE_IGNORE)
{
char *pw;
-
+
retry:
pw = agent_get_cache (hexgrip, cache_mode);
if (pw)
@@ -362,7 +362,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
{
/* We need to give the other thread a chance to actually put
it into the cache. */
- pth_sleep (1);
+ pth_sleep (1);
goto retry;
}
/* Timeout - better call pinentry now the plain way. */
@@ -391,7 +391,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
{
size_t canlen, erroff;
gcry_sexp_t s_skey;
-
+
assert (arg.unprotected_key);
canlen = gcry_sexp_canon_len (arg.unprotected_key, 0, NULL, NULL);
rc = gcry_sexp_sscan (&s_skey, &erroff,
@@ -409,7 +409,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
gcry_sexp_release (s_skey);
if (rc)
{
- log_error ("changing the passphrase failed: %s\n",
+ log_error ("changing the passphrase failed: %s\n",
gpg_strerror (rc));
wipememory (arg.unprotected_key, canlen);
xfree (arg.unprotected_key);
@@ -419,7 +419,7 @@ unprotect (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
}
else
{
- agent_put_cache (hexgrip, cache_mode, pi->pin,
+ agent_put_cache (hexgrip, cache_mode, pi->pin,
lookup_ttl? lookup_ttl (hexgrip) : 0);
if (r_passphrase && *pi->pin)
*r_passphrase = xtrystrdup (pi->pin);
@@ -446,7 +446,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
size_t buflen, erroff;
gcry_sexp_t s_skey;
char hexgrip[40+4+1];
-
+
*result = NULL;
bin2hex (grip, 20, hexgrip);
@@ -462,7 +462,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
xfree (fname);
return rc;
}
-
+
if (fstat (es_fileno (fp), &st))
{
rc = gpg_error_from_syserror ();
@@ -489,7 +489,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
if (es_fread (buf, buflen, 1, fp) != 1)
{
rc = gpg_error_from_syserror ();
- log_error ("error reading %zu bytes from `%s': %s\n",
+ log_error ("error reading %zu bytes from `%s': %s\n",
buflen, fname, strerror (errno));
xfree (fname);
es_fclose (fp);
@@ -540,7 +540,7 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
size_t len, buflen, erroff;
gcry_sexp_t s_skey;
int got_shadow_info = 0;
-
+
*result = NULL;
if (shadow_info)
*shadow_info = NULL;
@@ -612,7 +612,7 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
log_error ("failed to unprotect the secret key: %s\n",
gpg_strerror (rc));
}
-
+
gcry_sexp_release (comment_sexp);
xfree (desc_text_final);
}
@@ -753,7 +753,7 @@ key_parms_from_sexp (gcry_sexp_t s_key, gcry_sexp_t *r_list,
if (strlen (algoname) >= algonamesize)
return gpg_error (GPG_ERR_BUFFER_TOO_SHORT);
strcpy (r_algoname, algoname);
- }
+ }
if (r_elems)
{
if (strlen (elems) >= elemssize)
@@ -765,14 +765,14 @@ key_parms_from_sexp (gcry_sexp_t s_key, gcry_sexp_t *r_list,
*r_list = list;
else
gcry_sexp_release (list);
-
+
return 0;
}
/* Return the public key algorithm number if S_KEY is a DSA style key.
If it is not a DSA style key, return 0. */
-int
+int
agent_is_dsa_key (gcry_sexp_t s_key)
{
char algoname[6];
@@ -798,7 +798,7 @@ agent_is_dsa_key (gcry_sexp_t s_key)
key database. On failure an error code is returned and NULL stored
at RESULT. */
gpg_error_t
-agent_public_key_from_file (ctrl_t ctrl,
+agent_public_key_from_file (ctrl_t ctrl,
const unsigned char *grip,
gcry_sexp_t *result)
{
@@ -826,7 +826,7 @@ agent_public_key_from_file (ctrl_t ctrl,
if (err)
return err;
- err = key_parms_from_sexp (s_skey, &list,
+ err = key_parms_from_sexp (s_skey, &list,
algoname, sizeof algoname,
elems, sizeof elems);
if (err)
@@ -846,7 +846,7 @@ agent_public_key_from_file (ctrl_t ctrl,
return err;
}
- for (idx=0, s=elems; *s; s++, idx++ )
+ for (idx=0, s=elems; *s; s++, idx++ )
{
l2 = gcry_sexp_find_token (list, s, 1);
if (!l2)
@@ -913,7 +913,7 @@ agent_public_key_from_file (ctrl_t ctrl,
argidx = 0;
p = stpcpy (stpcpy (format, "(public-key("), algoname);
- for (idx=0, s=elems; *s; s++, idx++ )
+ for (idx=0, s=elems; *s; s++, idx++ )
{
*p++ = '(';
*p++ = *s;
@@ -940,7 +940,7 @@ agent_public_key_from_file (ctrl_t ctrl,
*p = 0;
assert (argidx < DIM (args));
args[argidx] = NULL;
-
+
err = gcry_sexp_build_array (&list, NULL, format, args);
xfree (format);
for (i=0; array[i]; i++)
@@ -964,7 +964,7 @@ agent_key_available (const unsigned char *grip)
int result;
char *fname;
char hexgrip[40+4+1];
-
+
bin2hex (grip, 20, hexgrip);
strcpy (hexgrip+40, ".key");
@@ -990,7 +990,7 @@ agent_key_info_from_file (ctrl_t ctrl, const unsigned char *grip,
int keytype;
(void)ctrl;
-
+
if (r_keytype)
*r_keytype = PRIVATE_KEY_UNKNOWN;
if (r_shadow_info)
@@ -998,7 +998,7 @@ agent_key_info_from_file (ctrl_t ctrl, const unsigned char *grip,
{
gcry_sexp_t sexp;
-
+
err = read_key_file (grip, &sexp);
if (err)
{
@@ -1012,12 +1012,12 @@ agent_key_info_from_file (ctrl_t ctrl, const unsigned char *grip,
if (err)
return err;
}
-
+
keytype = agent_private_key_type (buf);
switch (keytype)
{
case PRIVATE_KEY_CLEAR:
- break;
+ break;
case PRIVATE_KEY_PROTECTED:
/* If we ever require it we could retrieve the comment fields
from such a key. */
diff --git a/agent/genkey.c b/agent/genkey.c
index 2842448f2..f70526ddd 100644
--- a/agent/genkey.c
+++ b/agent/genkey.c
@@ -37,7 +37,7 @@ store_key (gcry_sexp_t private, const char *passphrase, int force)
unsigned char *buf;
size_t len;
unsigned char grip[20];
-
+
if ( !gcry_pk_get_keygrip (private, grip) )
{
log_error ("can't calculate keygrip\n");
@@ -146,7 +146,7 @@ check_passphrase_pattern (ctrl_t ctrl, const char *pw)
}
-static int
+static int
take_this_one_anyway2 (ctrl_t ctrl, const char *desc, const char *anyway_btn)
{
gpg_error_t err;
@@ -164,7 +164,7 @@ take_this_one_anyway2 (ctrl_t ctrl, const char *desc, const char *anyway_btn)
}
-static int
+static int
take_this_one_anyway (ctrl_t ctrl, const char *desc)
{
return take_this_one_anyway2 (ctrl, desc, _("Take this one anyway"));
@@ -185,18 +185,18 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw, int silent)
if (!pw)
pw = "";
- if (utf8_charcount (pw) < minlen )
+ if (utf8_charcount (pw) < minlen )
{
char *desc;
-
+
if (silent)
return gpg_error (GPG_ERR_INV_PASSPHRASE);
- desc = xtryasprintf
+ desc = xtryasprintf
( ngettext ("Warning: You have entered an insecure passphrase.%%0A"
- "A passphrase should be at least %u character long.",
+ "A passphrase should be at least %u character long.",
"Warning: You have entered an insecure passphrase.%%0A"
- "A passphrase should be at least %u characters long.",
+ "A passphrase should be at least %u characters long.",
minlen), minlen );
if (!desc)
return gpg_error_from_syserror ();
@@ -206,17 +206,17 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw, int silent)
return err;
}
- if (nonalpha_count (pw) < minnonalpha )
+ if (nonalpha_count (pw) < minnonalpha )
{
char *desc;
if (silent)
return gpg_error (GPG_ERR_INV_PASSPHRASE);
- desc = xtryasprintf
+ desc = xtryasprintf
( ngettext ("Warning: You have entered an insecure passphrase.%%0A"
"A passphrase should contain at least %u digit or%%0A"
- "special character.",
+ "special character.",
"Warning: You have entered an insecure passphrase.%%0A"
"A passphrase should contain at least %u digits or%%0A"
"special characters.",
@@ -259,7 +259,7 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw, int silent)
"this is in general a bad idea!%0A"
"Please confirm that you do not want to "
"have any protection on your key."));
-
+
if (silent)
return gpg_error (GPG_ERR_INV_PASSPHRASE);
@@ -300,7 +300,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
const char *text2 = _("Please re-enter this passphrase");
const char *initial_errtext = NULL;
struct pin_entry_info_s *pi, *pi2;
-
+
*r_passphrase = NULL;
pi = gcry_calloc_secure (2, sizeof (*pi) + 100);
@@ -336,7 +336,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
}
}
}
-
+
if (!err && *pi->pin)
{
/* User wants a passphrase. */
@@ -357,7 +357,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
int
agent_genkey (ctrl_t ctrl, const char *cache_nonce,
const char *keyparam, size_t keyparamlen, int no_protection,
- membuf_t *outbuf)
+ membuf_t *outbuf)
{
gcry_sexp_t s_keyparam, s_key, s_private, s_public;
char *passphrase;
@@ -375,13 +375,13 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
/* Get the passphrase now, cause key generation may take a while. */
if (no_protection || !cache_nonce)
passphrase = NULL;
- else
+ else
passphrase = agent_get_cache (cache_nonce, CACHE_MODE_NONCE);
if (passphrase || no_protection)
rc = 0;
else
- rc = agent_ask_new_passphrase (ctrl,
+ rc = agent_ask_new_passphrase (ctrl,
_("Please enter the passphrase to%0A"
"to protect your new key"),
&passphrase);
@@ -416,7 +416,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
return gpg_error (GPG_ERR_INV_DATA);
}
gcry_sexp_release (s_key); s_key = NULL;
-
+
/* store the secret key */
if (DBG_CRYPTO)
log_debug ("storing private key\n");
@@ -474,7 +474,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
passphrase at that address. */
gpg_error_t
agent_protect_and_store (ctrl_t ctrl, gcry_sexp_t s_skey,
- char **passphrase_addr)
+ char **passphrase_addr)
{
gpg_error_t err;
@@ -492,7 +492,7 @@ agent_protect_and_store (ctrl_t ctrl, gcry_sexp_t s_skey,
xfree (*passphrase_addr);
*passphrase_addr = NULL;
}
- err = agent_ask_new_passphrase (ctrl,
+ err = agent_ask_new_passphrase (ctrl,
_("Please enter the new passphrase"),
&pass);
if (!err)
@@ -502,6 +502,6 @@ agent_protect_and_store (ctrl_t ctrl, gcry_sexp_t s_skey,
else
xfree (pass);
}
-
+
return err;
}
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index db9039278..e5af91ed9 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -53,7 +53,7 @@
#include "asshelp.h"
#include "../include/cipher.h" /* for PUBKEY_ALGO_ECDSA, PUBKEY_ALGO_ECDH */
-enum cmd_and_opt_values
+enum cmd_and_opt_values
{ aNull = 0,
oCsh = 'c',
oQuiet = 'q',
@@ -118,8 +118,8 @@ static ARGPARSE_OPTS opts[] = {
{ aGPGConfList, "gpgconf-list", 256, "@" },
{ aGPGConfTest, "gpgconf-test", 256, "@" },
- { aUseStandardSocketP, "use-standard-socket-p", 256, "@" },
-
+ { aUseStandardSocketP, "use-standard-socket-p", 256, "@" },
+
{ 301, NULL, 0, N_("@Options:\n ") },
{ oServer, "server", 0, N_("run in server mode (foreground)") },
@@ -148,7 +148,7 @@ static ARGPARSE_OPTS opts[] = {
{ oFakedSystemTime, "faked-system-time", 2, "@" }, /* (epoch time) */
{ oBatch, "batch", 0, "@" },
- { oHomedir, "homedir", 2, "@"},
+ { oHomedir, "homedir", 2, "@"},
{ oDisplay, "display", 2, "@" },
{ oTTYname, "ttyname", 2, "@" },
@@ -190,8 +190,8 @@ static ARGPARSE_OPTS opts[] = {
#define DEFAULT_CACHE_TTL_SSH (30*60) /* 30 minutes */
#define MAX_CACHE_TTL (120*60) /* 2 hours */
#define MAX_CACHE_TTL_SSH (120*60) /* 2 hours */
-#define MIN_PASSPHRASE_LEN (8)
-#define MIN_PASSPHRASE_NONALPHA (1)
+#define MIN_PASSPHRASE_LEN (8)
+#define MIN_PASSPHRASE_NONALPHA (1)
#define MAX_PASSPHRASE_DAYS (0)
/* The timer tick used for housekeeping stuff. For Windows we use a
@@ -204,7 +204,7 @@ static ARGPARSE_OPTS opts[] = {
# define CHECK_OWN_SOCKET_INTERVAL (0) /* Never */
#elif defined(HAVE_W32_SYSTEM)
# define TIMERTICK_INTERVAL (4)
-# define CHECK_OWN_SOCKET_INTERVAL (60)
+# define CHECK_OWN_SOCKET_INTERVAL (60)
#else
# define TIMERTICK_INTERVAL (2)
# define CHECK_OWN_SOCKET_INTERVAL (60)
@@ -267,11 +267,11 @@ static pid_t parent_pid = (pid_t)(-1);
/*
- Local prototypes.
+ Local prototypes.
*/
static char *create_socket_name (char *standard_name, char *template);
-static gnupg_fd_t create_server_socket (char *name, int is_ssh,
+static gnupg_fd_t create_server_socket (char *name, int is_ssh,
assuan_sock_nonce_t *nonce);
static void create_directories (void);
@@ -303,7 +303,7 @@ static unsigned long pth_thread_id (void)
/*
- Functions.
+ Functions.
*/
static char *
@@ -311,7 +311,7 @@ make_libversion (const char *libname, const char *(*getfnc)(const char*))
{
const char *s;
char *result;
-
+
if (maybe_setuid)
{
gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
@@ -353,7 +353,7 @@ my_strusage (int level)
case 41: p = _("Syntax: gpg-agent [options] [command [args]]\n"
"Secret key management for GnuPG\n");
break;
-
+
default: p = NULL;
}
return p;
@@ -390,7 +390,7 @@ set_debug (void)
/* Unless the "guru" string has been used we don't want to allow
hashing debugging. The rationale is that people tend to
select the highest debug value and would then clutter their
- disk with debug files which may reveal confidential data. */
+ disk with debug files which may reveal confidential data. */
if (numok)
opt.debug &= ~(DBG_HASHING_VALUE);
}
@@ -414,16 +414,16 @@ set_debug (void)
if (opt.debug)
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s\n",
- (opt.debug & DBG_COMMAND_VALUE)? " command":"",
- (opt.debug & DBG_MPI_VALUE )? " mpi":"",
- (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
- (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
- (opt.debug & DBG_CACHE_VALUE )? " cache":"",
- (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
- (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
+ (opt.debug & DBG_COMMAND_VALUE)? " command":"",
+ (opt.debug & DBG_MPI_VALUE )? " mpi":"",
+ (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
+ (opt.debug & DBG_MEMORY_VALUE )? " memory":"",
+ (opt.debug & DBG_CACHE_VALUE )? " cache":"",
+ (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
+ (opt.debug & DBG_HASHING_VALUE)? " hashing":"",
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");
}
-
+
/* Helper for cleanup to remove one socket with NAME. */
static void
@@ -443,7 +443,7 @@ remove_socket (char *name)
}
*name = 0;
}
-}
+}
static void
cleanup (void)
@@ -452,7 +452,7 @@ cleanup (void)
if (done)
return;
- done = 1;
+ done = 1;
deinitialize_module_cache ();
remove_socket (socket_name);
remove_socket (socket_name_ssh);
@@ -515,7 +515,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
break;
case oNoGrab: opt.no_grab = 1; break;
-
+
case oPinentryProgram: opt.pinentry_program = pargs->r.ret_str; break;
case oPinentryTouchFile: opt.pinentry_touch_file = pargs->r.ret_str; break;
case oScdaemonProgram: opt.scdaemon_program = pargs->r.ret_str; break;
@@ -525,19 +525,19 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
case oDefCacheTTLSSH: opt.def_cache_ttl_ssh = pargs->r.ret_ulong; break;
case oMaxCacheTTL: opt.max_cache_ttl = pargs->r.ret_ulong; break;
case oMaxCacheTTLSSH: opt.max_cache_ttl_ssh = pargs->r.ret_ulong; break;
-
- case oEnforcePassphraseConstraints:
+
+ case oEnforcePassphraseConstraints:
opt.enforce_passphrase_constraints=1;
break;
case oMinPassphraseLen: opt.min_passphrase_len = pargs->r.ret_ulong; break;
- case oMinPassphraseNonalpha:
+ case oMinPassphraseNonalpha:
opt.min_passphrase_nonalpha = pargs->r.ret_ulong;
break;
case oCheckPassphrasePattern:
opt.check_passphrase_pattern = pargs->r.ret_str;
break;
case oMaxPassphraseDays:
- opt.max_passphrase_days = pargs->r.ret_ulong;
+ opt.max_passphrase_days = pargs->r.ret_ulong;
break;
case oEnablePassphraseHistory:
opt.enable_passhrase_history = 1;
@@ -599,7 +599,7 @@ main (int argc, char **argv )
/* Please note that we may running SUID(ROOT), so be very CAREFUL
when adding any stuff between here and the call to INIT_SECMEM()
somewhere after the option parsing */
- log_set_prefix ("gpg-agent", JNLIB_LOG_WITH_PREFIX|JNLIB_LOG_WITH_PID);
+ log_set_prefix ("gpg-agent", JNLIB_LOG_WITH_PREFIX|JNLIB_LOG_WITH_PID);
/* Make sure that our subsystems are ready. */
i18n_init ();
@@ -644,7 +644,7 @@ main (int argc, char **argv )
#ifdef USE_STANDARD_SOCKET
opt.use_standard_socket = 1;
#endif
-
+
shell = getenv ("SHELL");
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
csh_style = 1;
@@ -655,7 +655,7 @@ main (int argc, char **argv )
{
const char *s;
int idx;
- static const char *names[] =
+ static const char *names[] =
{ "DISPLAY", "TERM", "XAUTHORITY", "PINENTRY_USER_DATA", NULL };
err = 0;
@@ -677,10 +677,10 @@ main (int argc, char **argv )
if (err)
log_fatal ("error recording startup environment: %s\n",
gpg_strerror (err));
-
+
/* Fixme: Better use the locale function here. */
opt.startup_lc_ctype = getenv ("LC_CTYPE");
- if (opt.startup_lc_ctype)
+ if (opt.startup_lc_ctype)
opt.startup_lc_ctype = xstrdup (opt.startup_lc_ctype);
opt.startup_lc_messages = getenv ("LC_MESSAGES");
if (opt.startup_lc_messages)
@@ -713,13 +713,13 @@ main (int argc, char **argv )
gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
maybe_setuid = 0;
- /*
- Now we are now working under our real uid
+ /*
+ Now we are now working under our real uid
*/
if (default_config)
configname = make_filename (opt.homedir, "gpg-agent.conf", NULL );
-
+
argc = orig_argc;
argv = orig_argv;
pargs.argc = &argc;
@@ -750,7 +750,7 @@ main (int argc, char **argv )
configname, strerror(errno) );
exit(2);
}
- xfree (configname);
+ xfree (configname);
configname = NULL;
}
if (parse_debug && configname )
@@ -804,7 +804,7 @@ main (int argc, char **argv )
case oFakedSystemTime:
{
- time_t faked_time = isotime2epoch (pargs.r.ret_str);
+ time_t faked_time = isotime2epoch (pargs.r.ret_str);
if (faked_time == (time_t)(-1))
faked_time = (time_t)strtoul (pargs.r.ret_str, NULL, 10);
gnupg_set_time (faked_time, 0);
@@ -838,7 +838,7 @@ main (int argc, char **argv )
configname = NULL;
goto next_pass;
}
-
+
xfree (configname);
configname = NULL;
if (log_get_errorcount(0))
@@ -894,7 +894,7 @@ main (int argc, char **argv )
initialize_module_call_pinentry ();
initialize_module_call_scd ();
initialize_module_trustlist ();
-
+
/* Try to create missing directories. */
create_directories ();
@@ -905,7 +905,7 @@ main (int argc, char **argv )
gnupg_sleep (debug_wait);
log_debug ("... okay\n");
}
-
+
if (gpgconf_list == 3)
{
if (opt.use_standard_socket && !opt.quiet)
@@ -944,21 +944,21 @@ main (int argc, char **argv )
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME, MAX_CACHE_TTL );
es_printf ("max-cache-ttl-ssh:%lu:%d:\n",
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME, MAX_CACHE_TTL_SSH );
- es_printf ("enforce-passphrase-constraints:%lu:\n",
+ es_printf ("enforce-passphrase-constraints:%lu:\n",
GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME);
es_printf ("min-passphrase-len:%lu:%d:\n",
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME, MIN_PASSPHRASE_LEN );
es_printf ("min-passphrase-nonalpha:%lu:%d:\n",
- GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME,
+ GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME,
MIN_PASSPHRASE_NONALPHA);
es_printf ("check-passphrase-pattern:%lu:\n",
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME);
es_printf ("max-passphrase-days:%lu:%d:\n",
- GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME,
+ GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME,
MAX_PASSPHRASE_DAYS);
- es_printf ("enable-passphrase-history:%lu:\n",
+ es_printf ("enable-passphrase-history:%lu:\n",
GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME);
- es_printf ("no-grab:%lu:\n",
+ es_printf ("no-grab:%lu:\n",
GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME);
es_printf ("ignore-cache-for-signing:%lu:\n",
GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME);
@@ -988,7 +988,7 @@ main (int argc, char **argv )
if (pipe_server)
- {
+ {
/* This is the simple pipe based server */
ctrl_t ctrl;
@@ -1033,10 +1033,10 @@ main (int argc, char **argv )
/* Create the sockets. */
- socket_name = create_socket_name
+ socket_name = create_socket_name
("S.gpg-agent", "gpg-XXXXXX/S.gpg-agent");
if (opt.ssh_support)
- socket_name_ssh = create_socket_name
+ socket_name_ssh = create_socket_name
("S.gpg-agent.ssh", "gpg-XXXXXX/S.gpg-agent.ssh");
fd = create_server_socket (socket_name, 0, &socket_nonce);
@@ -1057,12 +1057,12 @@ main (int argc, char **argv )
es_printf ("set GPG_AGENT_INFO=%s;%lu;1\n", socket_name, (ulong)pid);
#else /*!HAVE_W32_SYSTEM*/
pid = fork ();
- if (pid == (pid_t)-1)
+ if (pid == (pid_t)-1)
{
log_fatal ("fork failed: %s\n", strerror (errno) );
exit (1);
}
- else if (pid)
+ else if (pid)
{ /* We are the parent */
char *infostr, *infostr_ssh_sock;
@@ -1081,7 +1081,7 @@ main (int argc, char **argv )
signal mask. */
if ( !pth_kill () )
log_error ("pth_kill failed in forked process\n");
-
+
#ifdef HAVE_SIGPROCMASK
if (startup_signal_mask_valid)
{
@@ -1091,7 +1091,7 @@ main (int argc, char **argv )
}
else
log_info ("no saved signal mask\n");
-#endif /*HAVE_SIGPROCMASK*/
+#endif /*HAVE_SIGPROCMASK*/
/* Create the info string: <name>:<pid>:<protocol_version> */
if (asprintf (&infostr, "GPG_AGENT_INFO=%s:%lu:1",
@@ -1120,7 +1120,7 @@ main (int argc, char **argv )
if (env_file_name)
{
estream_t fp;
-
+
fp = es_fopen (env_file_name, "w,mode=-rw");
if (!fp)
log_error (_("error creating `%s': %s\n"),
@@ -1139,7 +1139,7 @@ main (int argc, char **argv )
}
- if (argc)
+ if (argc)
{ /* Run the program given on the commandline. */
if (putenv (infostr))
{
@@ -1191,28 +1191,28 @@ main (int argc, char **argv )
infostr_ssh_sock);
}
}
- xfree (infostr);
+ xfree (infostr);
if (opt.ssh_support)
{
xfree (infostr_ssh_sock);
}
- exit (0);
+ exit (0);
}
/*NOTREACHED*/
} /* End parent */
- /*
+ /*
This is the child
*/
/* Detach from tty and put process into a new session */
if (!nodetach )
- {
+ {
int i;
unsigned int oldflags;
/* Close stdin, stdout and stderr unless it is the log stream */
- for (i=0; i <= 2; i++)
+ for (i=0; i <= 2; i++)
{
if (!log_test_fd (i) && i != fd )
{
@@ -1246,7 +1246,7 @@ main (int argc, char **argv )
{
struct sigaction sa;
-
+
sa.sa_handler = SIG_IGN;
sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
@@ -1258,7 +1258,7 @@ main (int argc, char **argv )
handle_connections (fd, opt.ssh_support ? fd_ssh : GNUPG_INVALID_FD);
assuan_sock_close (fd);
}
-
+
return 0;
}
@@ -1300,11 +1300,11 @@ agent_init_default_ctrl (ctrl_t ctrl)
session_env_setenv (ctrl->session_env, "TERM", default_ttytype);
session_env_setenv (ctrl->session_env, "XAUTHORITY", default_xauthority);
session_env_setenv (ctrl->session_env, "PINENTRY_USER_DATA", NULL);
-
+
if (ctrl->lc_ctype)
xfree (ctrl->lc_ctype);
ctrl->lc_ctype = default_lc_ctype? xtrystrdup (default_lc_ctype) : NULL;
-
+
if (ctrl->lc_messages)
xfree (ctrl->lc_messages);
ctrl->lc_messages = default_lc_messages? xtrystrdup (default_lc_messages)
@@ -1327,7 +1327,7 @@ agent_deinit_default_ctrl (ctrl_t ctrl)
/* Reread parts of the configuration. Note, that this function is
obviously not thread-safe and should only be called from the PTH
- signal handler.
+ signal handler.
Fixme: Due to the way the argument parsing works, we create a
memory leak here for all string type arguments. There is currently
@@ -1417,7 +1417,7 @@ get_agent_scd_notify_event (void)
log_error ("can't create scd notify event: %s\n", w32_strerror (-1) );
else if (!DuplicateHandle (GetCurrentProcess(), h,
GetCurrentProcess(), &h2,
- EVENT_MODIFY_STATE|SYNCHRONIZE, TRUE, 0))
+ EVENT_MODIFY_STATE|SYNCHRONIZE, TRUE, 0))
{
log_error ("setting syncronize for scd notify event failed: %s\n",
w32_strerror (-1) );
@@ -1509,7 +1509,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
agent_exit (2);
}
- serv_addr = xmalloc (sizeof (*serv_addr));
+ serv_addr = xmalloc (sizeof (*serv_addr));
memset (serv_addr, 0, sizeof *serv_addr);
serv_addr->sun_family = AF_UNIX;
if (strlen (name) + 1 >= sizeof (serv_addr->sun_path))
@@ -1523,7 +1523,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
/* Our error code mapping on W32CE returns EEXIST thus we also test
for this. */
- if (opt.use_standard_socket && rc == -1
+ if (opt.use_standard_socket && rc == -1
&& (errno == EADDRINUSE
#ifdef HAVE_W32_SYSTEM
|| errno == EEXIST
@@ -1540,7 +1540,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
a hang. */
if (!is_ssh && !check_for_running_agent (1, 1))
{
- log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
+ log_set_prefix (NULL, JNLIB_LOG_WITH_PREFIX);
log_set_file (NULL);
log_error (_("a gpg-agent is already running - "
"not starting a new one\n"));
@@ -1551,7 +1551,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
gnupg_remove (name);
rc = assuan_sock_bind (fd, (struct sockaddr*) serv_addr, len);
}
- if (rc != -1
+ if (rc != -1
&& (rc=assuan_sock_get_nonce ((struct sockaddr*)serv_addr, len, nonce)))
log_error (_("error getting nonce for the socket\n"));
if (rc == -1)
@@ -1559,9 +1559,9 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
/* We use gpg_strerror here because it allows us to get strings
for some W32 socket error codes. */
log_error (_("error binding socket to `%s': %s\n"),
- serv_addr->sun_path,
+ serv_addr->sun_path,
gpg_strerror (gpg_error_from_errno (errno)));
-
+
assuan_sock_close (fd);
if (opt.use_standard_socket)
*name = 0; /* Inhibit removal of the socket by cleanup(). */
@@ -1574,7 +1574,7 @@ create_server_socket (char *name, int is_ssh, assuan_sock_nonce_t *nonce)
assuan_sock_close (fd);
agent_exit (2);
}
-
+
if (opt.verbose)
log_info (_("listening on socket `%s'\n"), serv_addr->sun_path);
@@ -1636,7 +1636,7 @@ create_directories (void)
if (gnupg_mkdir (home, "-rwx"))
log_error (_("can't create directory `%s': %s\n"),
home, strerror (errno) );
- else
+ else
{
if (!opt.quiet)
log_info (_("directory `%s' created\n"), home);
@@ -1688,7 +1688,7 @@ handle_tick (void)
}
}
#endif /*HAVE_W32_SYSTEM*/
-
+
/* Code to be run from time to time. */
#if CHECK_OWN_SOCKET_INTERVAL > 0
if (last_minute + CHECK_OWN_SOCKET_INTERVAL <= time (NULL))
@@ -1733,7 +1733,7 @@ handle_signal (int signo)
case SIGHUP:
agent_sighup_action ();
break;
-
+
case SIGUSR1:
log_info ("SIGUSR1 received - printing internal information:\n");
/* Fixme: We need to see how to integrate pth dumping into our
@@ -1742,7 +1742,7 @@ handle_signal (int signo)
agent_query_dump_state ();
agent_scd_dump_state ();
break;
-
+
case SIGUSR2:
agent_sigusr2_action ();
break;
@@ -1762,7 +1762,7 @@ handle_signal (int signo)
agent_exit (0);
}
break;
-
+
case SIGINT:
log_info ("SIGINT received - immediate shutdown\n");
log_info( "%s %s stopped\n", strusage(11), strusage(13));
@@ -1778,12 +1778,12 @@ handle_signal (int signo)
/* Check the nonce on a new connection. This is a NOP unless we we
are using our Unix domain socket emulation under Windows. */
-static int
+static int
check_nonce (ctrl_t ctrl, assuan_sock_nonce_t *nonce)
{
if (assuan_sock_check_nonce (ctrl->thread_startup.fd, nonce))
{
- log_info (_("error reading nonce on fd %d: %s\n"),
+ log_info (_("error reading nonce on fd %d: %s\n"),
FD2INT(ctrl->thread_startup.fd), strerror (errno));
assuan_sock_close (ctrl->thread_startup.fd);
xfree (ctrl);
@@ -1808,14 +1808,14 @@ start_connection_thread (void *arg)
agent_init_default_ctrl (ctrl);
if (opt.verbose)
- log_info (_("handler 0x%lx for fd %d started\n"),
+ log_info (_("handler 0x%lx for fd %d started\n"),
pth_thread_id (), FD2INT(ctrl->thread_startup.fd));
start_command_handler (ctrl, GNUPG_INVALID_FD, ctrl->thread_startup.fd);
if (opt.verbose)
- log_info (_("handler 0x%lx for fd %d terminated\n"),
+ log_info (_("handler 0x%lx for fd %d terminated\n"),
pth_thread_id (), FD2INT(ctrl->thread_startup.fd));
-
+
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
return NULL;
@@ -1840,7 +1840,7 @@ start_connection_thread_ssh (void *arg)
if (opt.verbose)
log_info (_("ssh handler 0x%lx for fd %d terminated\n"),
pth_thread_id (), FD2INT(ctrl->thread_startup.fd));
-
+
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
return NULL;
@@ -1886,7 +1886,7 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
sigaction (mysigs[i], &sa, NULL);
-
+
sigaddset (&sigs, mysigs[i]);
}
}
@@ -2035,7 +2035,7 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
xfree (ctrl);
assuan_sock_close (fd);
}
- else
+ else
{
char threadname[50];
@@ -2055,7 +2055,7 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
fd = GNUPG_INVALID_FD;
}
- if (!shutdown_pending && listen_fd_ssh != GNUPG_INVALID_FD
+ if (!shutdown_pending && listen_fd_ssh != GNUPG_INVALID_FD
&& FD_ISSET ( FD2INT (listen_fd_ssh), &read_fdset))
{
ctrl_t ctrl;
@@ -2148,7 +2148,7 @@ check_own_socket_thread (void *arg)
log_error ("can't connect my own socket: %s\n", gpg_strerror (rc));
goto leave;
}
-
+
init_membuf (&mb, 100);
rc = assuan_transact (ctx, "GETINFO pid", check_own_socket_pid_cb, &mb,
NULL, NULL, NULL, NULL);
@@ -2156,7 +2156,7 @@ check_own_socket_thread (void *arg)
buffer = get_membuf (&mb, NULL);
if (rc || !buffer)
{
- log_error ("sending command \"%s\" to my own socket failed: %s\n",
+ log_error ("sending command \"%s\" to my own socket failed: %s\n",
"GETINFO pid", gpg_strerror (rc));
rc = 1;
}
@@ -2167,7 +2167,7 @@ check_own_socket_thread (void *arg)
}
else if (opt.verbose > 1)
log_error ("socket is still served by this server\n");
-
+
xfree (buffer);
leave:
diff --git a/agent/keyformat.txt b/agent/keyformat.txt
index da93f0c50..3ebba6e50 100644
--- a/agent/keyformat.txt
+++ b/agent/keyformat.txt
@@ -58,7 +58,7 @@ keys is in canonical representation[3]:
(u #304559a..[some bytes not shown]..9b#)
)
(uri http://foo.bar x-foo:whatever_you_want)
-)
+)
Protected Private Key Format
@@ -74,7 +74,7 @@ A protected key is like this:
)
(uri http://foo.bar x-foo:whatever_you_want)
(comment whatever)
-)
+)
In this scheme the encrypted_octet_string is encrypted according to
@@ -107,13 +107,13 @@ representation) after decryption:
(d #046129F..[some bytes not shown]..81#)
(p #00e861b..[some bytes not shown]..f1#)
(q #00f7a7c..[some bytes not shown]..61#)
- (u #304559a..[some bytes not shown]..9b#)
- )
+ (u #304559a..[some bytes not shown]..9b#)
+ )
(hash sha1 #...[hashvalue]...#)
)
For padding reasons, random bytes are appended to this list - they can
-easily be stripped by looking for the end of the list.
+easily be stripped by looking for the end of the list.
The hash is calculated on the concatenation of the public key and
secret key parameter lists: i.e it is required to hash the
@@ -150,7 +150,7 @@ to keys stored on a token:
)
(uri http://foo.bar x-foo:whatever_you_want)
(comment whatever)
-)
+)
The currently used protocol is "ti-v1" (token info version 1). The
second list with the information has this layout:
@@ -174,7 +174,7 @@ This format is used to transfer keys between gpg and gpg-agent.
* V is the packet version number (3 or 4).
-* PUBKEYALGO is a Libgcrypt algo name
+* PUBKEYALGO is a Libgcrypt algo name
* P1 .. PN are the parameters; the public parameters are never encrypted
the secrect key parameters are encrypted if the "protection" list is
given. To make this more explicit each parameter is preceded by a
@@ -215,7 +215,7 @@ for the passphrase storage the name "pw-default.dat" is suggested.
(protected mode (parms) encrypted_octet_string)
(protected-at <isotimestamp>)
)
-)
+)
After decryption the encrypted_octet_string yields this S-expression:
@@ -224,7 +224,7 @@ After decryption the encrypted_octet_string yields this S-expression:
(value key_1 value_1)
(value key_2 value_2)
(value key_n value_n)
- )
+ )
(hash sha1 #...[hashvalue]...#)
)
@@ -260,7 +260,7 @@ Example:
(protected mode (parms) encrypted_octet_string)
(protected-at "20100915T111722")
)
-)
+)
with "encrypted_octet_string" decoding to:
@@ -269,7 +269,7 @@ with "encrypted_octet_string" decoding to:
(value 4:1002 "signal flags at the lock")
(value 4:1001 "taocp")
(value 1:0 "premature optimization is the root of all evil")
- )
+ )
(hash sha1 #0102030405060708091011121314151617181920#)
)
diff --git a/agent/learncard.c b/agent/learncard.c
index 77f2bb09d..05476f617 100644
--- a/agent/learncard.c
+++ b/agent/learncard.c
@@ -32,7 +32,7 @@
/* Structures used by the callback mechanism to convey information
pertaining to key pairs. */
-struct keypair_info_s
+struct keypair_info_s
{
struct keypair_info_s *next;
int no_cert;
@@ -44,7 +44,7 @@ struct keypair_info_s
};
typedef struct keypair_info_s *KEYPAIR_INFO;
-struct kpinfo_cb_parm_s
+struct kpinfo_cb_parm_s
{
ctrl_t ctrl;
int error;
@@ -56,13 +56,13 @@ struct kpinfo_cb_parm_s
pertaining to certificates. */
struct certinfo_s {
struct certinfo_s *next;
- int type;
+ int type;
int done;
char id[1];
};
typedef struct certinfo_s *CERTINFO;
-struct certinfo_cb_parm_s
+struct certinfo_cb_parm_s
{
ctrl_t ctrl;
int error;
@@ -75,9 +75,9 @@ struct certinfo_cb_parm_s
struct sinfo_s {
struct sinfo_s *next;
char *data; /* Points into keyword. */
- char keyword[1];
+ char keyword[1];
};
-typedef struct sinfo_s *SINFO;
+typedef struct sinfo_s *SINFO;
struct sinfo_cb_parm_s {
int error;
@@ -172,7 +172,7 @@ kpinfo_cb (void *opaque, const char *line)
return;
}
*p = 0; /* ignore trailing stuff */
-
+
/* store it */
item->next = parm->info;
parm->info = item;
@@ -202,7 +202,7 @@ certinfo_cb (void *opaque, const char *line)
for (pend = p; *pend && !spacep (pend); pend++)
;
if (p == pend || !*p)
- {
+ {
parm->error = gpg_error (GPG_ERR_INV_RESPONSE);
return;
}
@@ -258,7 +258,7 @@ send_cert_back (ctrl_t ctrl, const char *id, void *assuan_context)
int rc;
char *derbuf;
size_t derbuflen;
-
+
rc = agent_card_readcert (ctrl, id, &derbuf, &derbuflen);
if (rc)
{
@@ -312,7 +312,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
unsigned char grip[20];
char *p;
int i;
- static int certtype_list[] = {
+ static int certtype_list[] = {
111, /* Root CA */
101, /* trusted */
102, /* useful */
@@ -344,7 +344,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
log_debug ("agent_card_learn failed: %s\n", gpg_strerror (rc));
goto leave;
}
-
+
log_info ("card has S/N: %s\n", serialno);
/* Pass on all the collected status information. */
@@ -368,7 +368,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
if (opt.verbose)
log_info (" id: %s (type=%d)\n",
citem->id, citem->type);
-
+
if (assuan_context)
{
rc = send_cert_back (ctrl, citem->id, assuan_context);
@@ -378,7 +378,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
}
}
}
-
+
for (item = parm.info; item; item = item->next)
{
unsigned char *pubkey, *shdkey;
@@ -398,10 +398,10 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
for (p=item->hexgrip, i=0; i < 20; p += 2, i++)
grip[i] = xtoi_2 (p);
-
+
if (!agent_key_available (grip))
continue; /* The key is already available. */
-
+
/* Unknown key - store it. */
rc = agent_card_readkey (ctrl, item->id, &pubkey);
if (rc)
@@ -440,11 +440,11 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
if (opt.verbose)
log_info ("stored\n");
-
+
if (assuan_context)
{
CERTINFO citem;
-
+
/* only send the certificate if we have not done so before */
for (citem = cparm.info; citem; citem = citem->next)
{
@@ -460,7 +460,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
}
}
-
+
leave:
xfree (serialno);
release_keypair_info (parm.info);
@@ -468,5 +468,3 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context)
release_sinfo (sparm.info);
return rc;
}
-
-
diff --git a/agent/pkdecrypt.c b/agent/pkdecrypt.c
index b9835f351..7df7f1d38 100644
--- a/agent/pkdecrypt.c
+++ b/agent/pkdecrypt.c
@@ -36,7 +36,7 @@
int
agent_pkdecrypt (ctrl_t ctrl, const char *desc_text,
const unsigned char *ciphertext, size_t ciphertextlen,
- membuf_t *outbuf)
+ membuf_t *outbuf)
{
gcry_sexp_t s_skey = NULL, s_cipher = NULL, s_plain = NULL;
unsigned char *shadow_info = NULL;
@@ -136,7 +136,7 @@ agent_pkdecrypt (ctrl_t ctrl, const char *desc_text,
put_membuf (outbuf, buf, len);
put_membuf (outbuf, ")", 2);
}
- }
+ }
leave:
@@ -147,5 +147,3 @@ agent_pkdecrypt (ctrl_t ctrl, const char *desc_text,
xfree (shadow_info);
return rc;
}
-
-
diff --git a/agent/pksign.c b/agent/pksign.c
index 0414bc347..988e3d3f0 100644
--- a/agent/pksign.c
+++ b/agent/pksign.c
@@ -43,13 +43,13 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash,
const char *s;
char tmp[16+1];
int i;
-
+
s = gcry_md_algo_name (algo);
if (s && strlen (s) < 16)
{
for (i=0; i < strlen (s); i++)
tmp[i] = tolower (s[i]);
- tmp[i] = '\0';
+ tmp[i] = '\0';
}
rc = gcry_sexp_build (&hash, NULL,
@@ -59,7 +59,7 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash,
else
{
gcry_mpi_t mpi;
-
+
rc = gcry_mpi_scan (&mpi, GCRYMPI_FMT_USG, md, mdlen, NULL);
if (! rc)
{
@@ -68,11 +68,11 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash,
mpi);
gcry_mpi_release (mpi);
}
-
+
}
-
+
*r_hash = hash;
- return rc;
+ return rc;
}
@@ -131,7 +131,7 @@ do_encode_dsa (const byte *md, size_t mdlen, int dsaalgo, gcry_sexp_t pkey,
qbits = get_dsa_qbits (pkey);
else
return gpg_error (GPG_ERR_WRONG_PUBKEY_ALGO);
-
+
if ((qbits%8))
{
log_error (_("DSA requires the hash length to be a"
@@ -164,7 +164,7 @@ do_encode_dsa (const byte *md, size_t mdlen, int dsaalgo, gcry_sexp_t pkey,
{
log_error (_("a %zu bit hash is not valid for a %u bit %s key\n"),
mdlen*8,
- gcry_pk_get_nbits (pkey),
+ gcry_pk_get_nbits (pkey),
gcry_pk_algo_name (pkalgo));
/* FIXME: we need to check the requirements for ECDSA. */
if (mdlen < 20 || pkalgo == GCRY_PK_DSA)
@@ -174,7 +174,7 @@ do_encode_dsa (const byte *md, size_t mdlen, int dsaalgo, gcry_sexp_t pkey,
/* Truncate. */
if (mdlen > qbits/8)
mdlen = qbits/8;
-
+
/* Create the S-expression. We need to convert to an MPI first
because we want an unsigned integer. Using %b directly is not
possible because libgcrypt assumes an mpi and uses
@@ -182,7 +182,7 @@ do_encode_dsa (const byte *md, size_t mdlen, int dsaalgo, gcry_sexp_t pkey,
value. */
{
gcry_mpi_t mpi;
-
+
err = gcry_mpi_scan (&mpi, GCRYMPI_FMT_USG, md, mdlen, NULL);
if (!err)
{
@@ -193,7 +193,7 @@ do_encode_dsa (const byte *md, size_t mdlen, int dsaalgo, gcry_sexp_t pkey,
}
if (!err)
*r_hash = hash;
- return err;
+ return err;
}
@@ -209,7 +209,7 @@ do_encode_raw_pkcs1 (const byte *md, size_t mdlen, unsigned int nbits,
gcry_sexp_t hash;
unsigned char *frame;
size_t i, n, nframe;
-
+
nframe = (nbits+7) / 8;
if ( !mdlen || mdlen + 8 + 4 > nframe )
{
@@ -220,7 +220,7 @@ do_encode_raw_pkcs1 (const byte *md, size_t mdlen, unsigned int nbits,
frame = xtrymalloc (nframe);
if (!frame)
return gpg_error_from_syserror ();
-
+
/* Assemble the pkcs#1 block type 1. */
n = 0;
frame[n++] = 0;
@@ -233,7 +233,7 @@ do_encode_raw_pkcs1 (const byte *md, size_t mdlen, unsigned int nbits,
memcpy (frame+n, md, mdlen );
n += mdlen;
assert (n == nframe);
-
+
/* Create the S-expression. */
rc = gcry_sexp_build (&hash, NULL,
"(data (flags raw) (value %b))",
@@ -241,7 +241,7 @@ do_encode_raw_pkcs1 (const byte *md, size_t mdlen, unsigned int nbits,
xfree (frame);
*r_hash = hash;
- return rc;
+ return rc;
}
@@ -280,8 +280,8 @@ agent_pksign_do (ctrl_t ctrl, const char *cache_nonce,
unsigned char *buf = NULL;
size_t len = 0;
- rc = divert_pksign (ctrl,
- ctrl->digest.value,
+ rc = divert_pksign (ctrl,
+ ctrl->digest.value,
ctrl->digest.valuelen,
ctrl->digest.algo,
shadow_info, &buf);
@@ -367,7 +367,7 @@ agent_pksign_do (ctrl_t ctrl, const char *cache_nonce,
tried to get a passphrase. */
int
agent_pksign (ctrl_t ctrl, const char *cache_nonce, const char *desc_text,
- membuf_t *outbuf, cache_mode_t cache_mode)
+ membuf_t *outbuf, cache_mode_t cache_mode)
{
gcry_sexp_t s_sig = NULL;
char *buf = NULL;
diff --git a/agent/preset-passphrase.c b/agent/preset-passphrase.c
index 2037d9571..f303d5b7f 100644
--- a/agent/preset-passphrase.c
+++ b/agent/preset-passphrase.c
@@ -48,14 +48,14 @@
#include "sysutils.h"
-enum cmd_and_opt_values
+enum cmd_and_opt_values
{ aNull = 0,
oVerbose = 'v',
oPassphrase = 'P',
oPreset = 'c',
oForget = 'f',
-
+
oNoVerbose = 500,
oHomedir,
@@ -67,7 +67,7 @@ static const char *opt_homedir;
static const char *opt_passphrase;
static ARGPARSE_OPTS opts[] = {
-
+
{ 301, NULL, 0, N_("@Options:\n ") },
{ oVerbose, "verbose", 0, "verbose" },
@@ -75,7 +75,7 @@ static ARGPARSE_OPTS opts[] = {
{ oPreset, "preset", 256, "preset passphrase"},
{ oForget, "forget", 256, "forget passphrase"},
- { oHomedir, "homedir", 2, "@" },
+ { oHomedir, "homedir", 2, "@" },
{0}
};
@@ -93,14 +93,14 @@ my_strusage (int level)
case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
case 1:
- case 40:
+ case 40:
p = _("Usage: gpg-preset-passphrase [options] KEYGRIP (-h for help)\n");
break;
case 41:
p = _("Syntax: gpg-preset-passphrase [options] KEYGRIP\n"
"Password cache maintenance\n");
break;
-
+
default: p = NULL;
}
return p;
@@ -111,7 +111,7 @@ my_strusage (int level)
/* Include the implementation of map_spwq_error. */
MAP_SPWQ_ERROR_IMPL
-
+
static void
preset_passphrase (const char *keygrip)
@@ -209,7 +209,7 @@ main (int argc, char **argv)
const char *keygrip = NULL;
set_strusage (my_strusage);
- log_set_prefix ("gpg-preset-passphrase", 1);
+ log_set_prefix ("gpg-preset-passphrase", 1);
/* Make sure that our subsystems are ready. */
i18n_init ();
@@ -230,7 +230,7 @@ main (int argc, char **argv)
case oPreset: cmd = oPreset; break;
case oForget: cmd = oForget; break;
case oPassphrase: opt_passphrase = pargs.r.ret_str; break;
-
+
default : pargs.err = 2; break;
}
}
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index c5e43a38b..512019b80 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -45,8 +45,8 @@
#include "sysutils.h"
-enum cmd_and_opt_values
-{
+enum cmd_and_opt_values
+{
aNull = 0,
oVerbose = 'v',
oArmor = 'a',
@@ -54,7 +54,7 @@ enum cmd_and_opt_values
oProtect = 'p',
oUnprotect = 'u',
-
+
oNoVerbose = 500,
oShadow,
oShowShadowInfo,
@@ -68,13 +68,13 @@ enum cmd_and_opt_values
oNoFailOnExist,
oHomedir,
oPrompt,
- oStatusMsg,
+ oStatusMsg,
oAgentProgram
};
-struct rsa_secret_key_s
+struct rsa_secret_key_s
{
gcry_mpi_t n; /* public modulus */
gcry_mpi_t e; /* public exponent */
@@ -95,7 +95,7 @@ static int opt_have_cert;
static const char *opt_passphrase;
static char *opt_prompt;
static int opt_status_msg;
-static const char *opt_agent_program;
+static const char *opt_agent_program;
static char *get_passphrase (int promptno);
static void release_passphrase (char *pw);
@@ -110,7 +110,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_c (oShowShadowInfo, "show-shadow-info", "return the shadow info"),
ARGPARSE_c (oShowKeygrip, "show-keygrip", "show the \"keygrip\""),
ARGPARSE_c (oS2Kcalibration, "s2k-calibration", "@"),
-
+
ARGPARSE_group (301, N_("@\nOptions:\n ")),
ARGPARSE_s_n (oVerbose, "verbose", "verbose"),
@@ -120,14 +120,14 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oPassphrase, "passphrase", "|STRING|use passphrase STRING"),
ARGPARSE_s_n (oHaveCert, "have-cert",
"certificate to export provided on STDIN"),
- ARGPARSE_s_n (oStore, "store",
+ ARGPARSE_s_n (oStore, "store",
"store the created key in the appropriate place"),
- ARGPARSE_s_n (oForce, "force",
+ ARGPARSE_s_n (oForce, "force",
"force overwriting"),
ARGPARSE_s_n (oNoFailOnExist, "no-fail-on-exist", "@"),
- ARGPARSE_s_s (oHomedir, "homedir", "@"),
- ARGPARSE_s_s (oPrompt, "prompt",
- "|ESCSTRING|use ESCSTRING as prompt in pinentry"),
+ ARGPARSE_s_s (oHomedir, "homedir", "@"),
+ ARGPARSE_s_s (oPrompt, "prompt",
+ "|ESCSTRING|use ESCSTRING as prompt in pinentry"),
ARGPARSE_s_n (oStatusMsg, "enable-status-msg", "@"),
ARGPARSE_s_s (oAgentProgram, "agent-program", "@"),
@@ -153,7 +153,7 @@ my_strusage (int level)
case 41: p = _("Syntax: gpg-protect-tool [options] [args]\n"
"Secret key maintenance tool\n");
break;
-
+
default: p = NULL;
}
return p;
@@ -234,7 +234,7 @@ read_file (const char *fname, size_t *r_length)
FILE *fp;
char *buf;
size_t buflen;
-
+
if (!strcmp (fname, "-"))
{
size_t nread, bufsize = 0;
@@ -246,7 +246,7 @@ read_file (const char *fname, size_t *r_length)
buf = NULL;
buflen = 0;
#define NCHUNK 8192
- do
+ do
{
bufsize += NCHUNK;
if (!buf)
@@ -277,14 +277,14 @@ read_file (const char *fname, size_t *r_length)
log_error ("can't open `%s': %s\n", fname, strerror (errno));
return NULL;
}
-
+
if (fstat (fileno(fp), &st))
{
log_error ("can't stat `%s': %s\n", fname, strerror (errno));
fclose (fp);
return NULL;
}
-
+
buflen = st.st_size;
buf = xmalloc (buflen+1);
if (fread (buf, buflen, 1, fp) != 1)
@@ -308,7 +308,7 @@ read_key (const char *fname)
char *buf;
size_t buflen;
unsigned char *key;
-
+
buf = read_file (fname, &buflen);
if (!buf)
return NULL;
@@ -327,7 +327,7 @@ read_and_protect (const char *fname)
unsigned char *result;
size_t resultlen;
char *pw;
-
+
key = read_key (fname);
if (!key)
return;
@@ -341,7 +341,7 @@ read_and_protect (const char *fname)
log_error ("protecting the key failed: %s\n", gpg_strerror (rc));
return;
}
-
+
if (opt_armor)
{
char *p = make_advanced (result, resultlen);
@@ -371,7 +371,7 @@ read_and_unprotect (const char *fname)
if (!key)
return;
- rc = agent_unprotect (key, (pw=get_passphrase (1)),
+ rc = agent_unprotect (key, (pw=get_passphrase (1)),
protected_at, &result, &resultlen);
release_passphrase (pw);
xfree (key);
@@ -412,7 +412,7 @@ read_and_shadow (const char *fname)
unsigned char *result;
size_t resultlen;
unsigned char dummy_info[] = "(8:313233342:43)";
-
+
key = read_key (fname);
if (!key)
return;
@@ -426,7 +426,7 @@ read_and_shadow (const char *fname)
}
resultlen = gcry_sexp_canon_len (result, 0, NULL,NULL);
assert (resultlen);
-
+
if (opt_armor)
{
char *p = make_advanced (result, resultlen);
@@ -448,7 +448,7 @@ show_shadow_info (const char *fname)
unsigned char *key;
const unsigned char *info;
size_t infolen;
-
+
key = read_key (fname);
if (!key)
return;
@@ -462,7 +462,7 @@ show_shadow_info (const char *fname)
}
infolen = gcry_sexp_canon_len (info, 0, NULL,NULL);
assert (infolen);
-
+
if (opt_armor)
{
char *p = make_advanced (info, infolen);
@@ -482,14 +482,14 @@ show_file (const char *fname)
unsigned char *key;
size_t keylen;
char *p;
-
+
key = read_key (fname);
if (!key)
return;
keylen = gcry_sexp_canon_len (key, 0, NULL,NULL);
assert (keylen);
-
+
if (opt_canonical)
{
fwrite (key, keylen, 1, stdout);
@@ -513,7 +513,7 @@ show_keygrip (const char *fname)
gcry_sexp_t private;
unsigned char grip[20];
int i;
-
+
key = read_key (fname);
if (!key)
return;
@@ -522,7 +522,7 @@ show_keygrip (const char *fname)
{
log_error ("gcry_sexp_new failed\n");
return;
- }
+ }
xfree (key);
if (!gcry_pk_get_keygrip (private, grip))
@@ -550,7 +550,7 @@ main (int argc, char **argv )
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
- log_set_prefix ("gpg-protect-tool", 1);
+ log_set_prefix ("gpg-protect-tool", 1);
/* Make sure that our subsystems are ready. */
i18n_init ();
@@ -597,7 +597,7 @@ main (int argc, char **argv )
case oHaveCert: opt_have_cert = 1; break;
case oPrompt: opt_prompt = pargs.r.ret_str; break;
case oStatusMsg: opt_status_msg = 1; break;
-
+
default: pargs.err = ARGPARSE_PRINT_ERROR; break;
}
}
@@ -667,7 +667,7 @@ get_passphrase (int promptno)
const char *desc;
char *orig_codeset;
int repeat = 0;
-
+
if (opt_passphrase)
return xstrdup (opt_passphrase);
@@ -727,4 +727,3 @@ release_passphrase (char *pw)
xfree (pw);
}
}
-
diff --git a/agent/t-protect.c b/agent/t-protect.c
index 7b80bcbbb..a14e5e1cc 100644
--- a/agent/t-protect.c
+++ b/agent/t-protect.c
@@ -137,7 +137,7 @@ test_agent_protect (void)
"\x9B\x7B\xE8\xDD\x1F\x87\x4E\x79\x7B\x50\x12\xA7\xB4\x8B\x52\x38\xEC\x7C\xBB\xB9"
"\x55\x87\x11\x1C\x74\xE7\x7F\xA0\xBA\xE3\x34\x5D\x61\xBF\x29\x29\x29\x00"
};
-
+
struct
{
const char *key;
@@ -182,7 +182,7 @@ test_agent_protect (void)
specs[i].ret_expected, gpg_strerror (specs[i].ret_expected));
abort ();
}
-
+
if (specs[i].no_result_expected)
{
assert (! specs[i].result);
@@ -234,14 +234,14 @@ static void
test_make_shadow_info (void)
{
#if 0
- static struct
+ static struct
{
- const char *snstr;
+ const char *snstr;
const char *idstr;
const char *expected;
} data[] = {
{ "", "", NULL },
-
+
};
int i;
unsigned char *result;
@@ -305,7 +305,7 @@ main (int argc, char **argv)
(void)argv;
gcry_control (GCRYCTL_DISABLE_SECMEM);
-
+
test_agent_protect ();
test_agent_unprotect ();
test_agent_private_key_type ();
diff --git a/agent/trustlist.c b/agent/trustlist.c
index d56598245..68dd83364 100644
--- a/agent/trustlist.c
+++ b/agent/trustlist.c
@@ -50,8 +50,8 @@ struct trustitem_s
typedef struct trustitem_s trustitem_t;
/* Malloced table and its allocated size with all trust items. */
-static trustitem_t *trusttable;
-static size_t trusttablesize;
+static trustitem_t *trusttable;
+static size_t trusttablesize;
/* A mutex used to protect the table. */
static pth_mutex_t trusttable_lock;
@@ -111,7 +111,7 @@ unlock_trusttable (void)
static gpg_error_t
read_one_trustfile (const char *fname, int allow_include,
- trustitem_t **addr_of_table,
+ trustitem_t **addr_of_table,
size_t *addr_of_tablesize,
int *addr_of_tableidx)
{
@@ -123,7 +123,7 @@ read_one_trustfile (const char *fname, int allow_include,
int tableidx;
size_t tablesize;
int lnr = 0;
-
+
table = *addr_of_table;
tablesize = *addr_of_tablesize;
tableidx = *addr_of_tableidx;
@@ -155,13 +155,13 @@ read_one_trustfile (const char *fname, int allow_include,
line[--n] = 0; /* Chop the LF. */
if (n && line[n-1] == '\r')
line[--n] = 0; /* Chop an optional CR. */
-
+
/* Allow for empty lines and spaces */
for (p=line; spacep (p); p++)
;
if (!*p || *p == '#')
continue;
-
+
if (!strncmp (p, "include-default", 15)
&& (!p[15] || spacep (p+15)))
{
@@ -194,7 +194,7 @@ read_one_trustfile (const char *fname, int allow_include,
err = err2;
}
xfree (etcname);
-
+
continue;
}
@@ -202,7 +202,7 @@ read_one_trustfile (const char *fname, int allow_include,
{
trustitem_t *tmp;
size_t tmplen;
-
+
tmplen = tablesize + 20;
tmp = xtryrealloc (table, tmplen * sizeof *table);
if (!tmp)
@@ -229,13 +229,13 @@ read_one_trustfile (const char *fname, int allow_include,
if (n < 0)
{
log_error (_("bad fingerprint in `%s', line %d\n"), fname, lnr);
- err = gpg_error (GPG_ERR_BAD_DATA);
+ err = gpg_error (GPG_ERR_BAD_DATA);
continue;
}
p += n;
for (; spacep (p); p++)
;
-
+
/* Process the first flag which needs to be the first for
backward compatibility. */
if (!*p || *p == '*' )
@@ -379,7 +379,7 @@ read_trustfiles (void)
/* Check whether the given fpr is in our trustdb. We expect FPR to be
an all uppercase hexstring of 40 characters. */
-gpg_error_t
+gpg_error_t
agent_istrusted (ctrl_t ctrl, const char *fpr, int *r_disabled)
{
gpg_error_t err;
@@ -414,7 +414,7 @@ agent_istrusted (ctrl_t ctrl, const char *fpr, int *r_disabled)
if (ti->flags.relax)
{
err = agent_write_status (ctrl,
- "TRUSTLISTFLAG", "relax",
+ "TRUSTLISTFLAG", "relax",
NULL);
if (err)
return err;
@@ -422,7 +422,7 @@ agent_istrusted (ctrl_t ctrl, const char *fpr, int *r_disabled)
else if (ti->flags.cm)
{
err = agent_write_status (ctrl,
- "TRUSTLISTFLAG", "cm",
+ "TRUSTLISTFLAG", "cm",
NULL);
if (err)
return err;
@@ -435,7 +435,7 @@ agent_istrusted (ctrl_t ctrl, const char *fpr, int *r_disabled)
/* Write all trust entries to FP. */
-gpg_error_t
+gpg_error_t
agent_listtrusted (void *assuan_context)
{
trustitem_t *ti;
@@ -532,7 +532,7 @@ reformat_name (const char *name, const char *replstring)
count++;
newname = xtrymalloc (strlen (name) + count*replstringlen + 1);
if (!newname)
- return NULL;
+ return NULL;
for (s=name+1, d=newname; *s; s++)
if (*s == '/')
d = stpcpy (d, replstring);
@@ -571,7 +571,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
{
xfree (fname);
return gpg_error (GPG_ERR_EPERM);
- }
+ }
xfree (fname);
if (!agent_istrusted (ctrl, fpr, &is_disabled))
@@ -579,7 +579,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
return 0; /* We already got this fingerprint. Silently return
success. */
}
-
+
/* This feature must explicitly been enabled. */
if (!opt.allow_mark_trusted)
return gpg_error (GPG_ERR_NOT_SUPPORTED);
@@ -629,7 +629,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
xfree (nameformatted);
return err;
}
-
+
fprformatted = insert_colons (fpr);
if (!fprformatted)
@@ -642,7 +642,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
fingerprint of course. */
if (yes_i_trust)
{
- desc = xtryasprintf
+ desc = xtryasprintf
(
/* TRANSLATORS: This prompt is shown by the Pinentry and has
one special property: A "%%0A" is used by Pinentry to
@@ -662,7 +662,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
xfree (nameformatted);
return out_of_core ();
}
-
+
/* TRANSLATORS: "Correct" is the label of a button and intended
to be hit if the fingerprint matches the one of the CA. The
other button is "the default "Cancel" of the Pinentry. */
@@ -688,7 +688,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
unlock_trusttable ();
xfree (fprformatted);
xfree (nameformatted);
- return is_disabled? gpg_error (GPG_ERR_NOT_TRUSTED) : 0;
+ return is_disabled? gpg_error (GPG_ERR_NOT_TRUSTED) : 0;
}
fname = make_filename (opt.homedir, "trustlist.txt", NULL);
@@ -735,7 +735,7 @@ agent_marktrusted (ctrl_t ctrl, const char *name, const char *fpr, int flag)
es_fprintf (fp, "\n%s%s %c\n", yes_i_trust?"":"!", fprformatted, flag);
if (es_ferror (fp))
err = gpg_error_from_syserror ();
-
+
if (es_fclose (fp))
err = gpg_error_from_syserror ();
diff --git a/agent/w32main.c b/agent/w32main.c
index 9fc3abbef..06ad72610 100644
--- a/agent/w32main.c
+++ b/agent/w32main.c
@@ -67,12 +67,12 @@ build_argv (char *cmdline_arg, int reserved)
{
argc++;
/* Skip the remaining spaces. */
- while (*s==' ' || *s=='\t')
+ while (*s==' ' || *s=='\t')
s++;
if (!*s)
break;
bs_count = 0;
- }
+ }
else if (*s=='\\')
{
bs_count++;
@@ -84,7 +84,7 @@ build_argv (char *cmdline_arg, int reserved)
in_quotes = !in_quotes;
bs_count=0;
s++;
- }
+ }
else /* A regular character. */
{
bs_count = 0;
@@ -113,20 +113,20 @@ build_argv (char *cmdline_arg, int reserved)
argv[argc++] = arg;
/* Skip the remaining spaces. */
- do
+ do
s++;
while (*s==' ' || *s=='\t');
/* Start with a new argument */
arg = d = s;
bs_count = 0;
- }
- else if (*s=='\\')
+ }
+ else if (*s=='\\')
{
*d++ = *s++;
bs_count++;
- }
- else if (*s=='\"')
+ }
+ else if (*s=='\"')
{
if ( !(bs_count & 1) )
{
@@ -137,7 +137,7 @@ build_argv (char *cmdline_arg, int reserved)
s++;
in_quotes = !in_quotes;
}
- else
+ else
{
/* Preceded by an odd number of backslashes, this is
half that number of backslashes followed by a '\"'. */
@@ -146,7 +146,7 @@ build_argv (char *cmdline_arg, int reserved)
s++;
}
bs_count=0;
- }
+ }
else /* A regular character. */
{
*d++ = *s++;
@@ -167,9 +167,9 @@ build_argv (char *cmdline_arg, int reserved)
/* Our window message processing function. */
-static LRESULT CALLBACK
+static LRESULT CALLBACK
wndw_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
-{
+{
switch (msg)
{
@@ -239,8 +239,8 @@ handle_taskbar (void *ctx)
DestroyIcon (nid.hIcon);
fprintf (stderr, "%s: enter\n", __func__);
- while ( (rc=GetMessage (&msg, hwnd, 0, 0)) )
- {
+ while ( (rc=GetMessage (&msg, hwnd, 0, 0)) )
+ {
if (rc == -1)
{
log_error ("getMessage failed: %s\n", w32_strerror (-1));