mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
2005-02-14 Moritz Schulte <moritz@g10code.com>
* command-ssh.c (uint32_construct): New macro ... (stream_read_uint32): ... use it; removed unnecessary cast.
This commit is contained in:
parent
c4b986c731
commit
fce56851f0
@ -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@g10code.com>
|
||||
|
||||
|
@ -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 @@ stream_read_uint32 (estream_t stream, u32 *uint32)
|
||||
{
|
||||
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 @@ stream_write_uint32 (estream_t stream, u32 uint32)
|
||||
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)
|
||||
|
@ -1168,7 +1168,7 @@ create_server_socket (int is_standard_name, const char *name)
|
||||
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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user