GNUPG-1-9-BRANCH gnupg/agent (ChangeLog command-ssh.c gpg-agent.c)
cvs user mo
cvs at cvs.gnupg.org
Mon Feb 14 21:33:54 CET 2005
Date: Monday, February 14, 2005 @ 21:44:22
Author: mo
Path: /cvs/gnupg/gnupg/agent
Tag: GNUPG-1-9-BRANCH
Modified: ChangeLog command-ssh.c gpg-agent.c
2005-02-14 Moritz Schulte <moritz at g10code.com>
* command-ssh.c (uint32_construct): New macro ...
(stream_read_uint32): ... use it; removed unnecessary cast.
---------------+
ChangeLog | 2 ++
command-ssh.c | 29 ++++++++++++-----------------
gpg-agent.c | 2 +-
3 files changed, 15 insertions(+), 18 deletions(-)
Index: gnupg/agent/ChangeLog
diff -u gnupg/agent/ChangeLog:1.59.2.62 gnupg/agent/ChangeLog:1.59.2.63
--- gnupg/agent/ChangeLog:1.59.2.62 Mon Feb 14 21:07:01 2005
+++ gnupg/agent/ChangeLog Mon Feb 14 21:44:22 2005
@@ -32,6 +32,8 @@
changed code to use asprintf for description.
(stream_write_uint32): Do not filter out the last byte of shift
expression.
+ (uint32_construct): New macro ...
+ (stream_read_uint32): ... use it; removed unnecessary cast.
2005-02-03 Werner Koch <wk at g10code.com>
Index: gnupg/agent/command-ssh.c
diff -u gnupg/agent/command-ssh.c:1.1.4.6 gnupg/agent/command-ssh.c:1.1.4.7
--- gnupg/agent/command-ssh.c:1.1.4.6 Mon Feb 14 21:07:01 2005
+++ gnupg/agent/command-ssh.c Mon Feb 14 21:44:22 2005
@@ -63,7 +63,14 @@
#define SSH_DSA_SIGNATURE_ELEMS 2
#define SPEC_FLAG_USE_PKCS1V2 (1 << 0)
+
+
+/* Macros. */
+/* Return a new uint32 with b0 being the most significant byte and b3
+ being the least significant byte. */
+#define uint32_construct(b0, b1, b2, b3) \
+ ((b0 << 24) | (b1 << 16) | (b2 << 8) | b3)
@@ -283,18 +290,7 @@
{
u32 n;
- /* FIXME: For what is the cast good for? The proper way of
- wrinting it - assuming an unsigned buffer - is:
-
- n = (buffer[0]<< 24)|(buffer[0]<< 16)|(buffer[0]<<8)|(buffer[0]);
-
- -wk
- */
- n = (0
- | ((u32) (buffer[0] << 24))
- | ((u32) (buffer[1] << 16))
- | ((u32) (buffer[2] << 8))
- | ((u32) (buffer[3] << 0)));
+ n = uint32_construct (buffer[0], buffer[1], buffer[2], buffer[3]);
*uint32 = n;
err = 0;
}
@@ -311,11 +307,10 @@
gpg_error_t err;
int ret;
- /* Fixme: The 0xFF mask is superfluous. */
- buffer[0] = (uint32 >> 24) & 0xFF;
- buffer[1] = (uint32 >> 16) & 0xFF;
- buffer[2] = (uint32 >> 8) & 0xFF;
- buffer[3] = (uint32 >> 0) & 0xFF;
+ buffer[0] = uint32 >> 24;
+ buffer[1] = uint32 >> 16;
+ buffer[2] = uint32 >> 8;
+ buffer[3] = uint32 >> 0;
ret = es_write (stream, buffer, sizeof (buffer), NULL);
if (ret)
Index: gnupg/agent/gpg-agent.c
diff -u gnupg/agent/gpg-agent.c:1.31.2.32 gnupg/agent/gpg-agent.c:1.31.2.33
--- gnupg/agent/gpg-agent.c:1.31.2.32 Thu Feb 3 18:40:02 2005
+++ gnupg/agent/gpg-agent.c Mon Feb 14 21:44:22 2005
@@ -1168,7 +1168,7 @@
agent_exit (2);
}
-
+ serv_addr = malloc (sizeof (*serv_addr)); /* FIXME. */
memset (serv_addr, 0, sizeof *serv_addr);
serv_addr->sun_family = AF_UNIX;
assert (strlen (name) + 1 < sizeof (serv_addr->sun_path));
More information about the Gnupg-commits
mailing list