[svn] GnuPG - r4306 - trunk/g10
svn author wk
cvs at cvs.gnupg.org
Wed Oct 18 17:34:55 CEST 2006
Author: wk
Date: 2006-10-18 17:34:54 +0200 (Wed, 18 Oct 2006)
New Revision: 4306
Modified:
trunk/g10/ChangeLog
trunk/g10/keyid.c
Log:
Fixed v3 keyids.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2006-10-18 14:28:52 UTC (rev 4305)
+++ trunk/g10/ChangeLog 2006-10-18 15:34:54 UTC (rev 4306)
@@ -1,5 +1,8 @@
2006-10-18 Werner Koch <wk at g10code.com>
+ * keyid.c (v3_keyid): Don't use mempcy as we need to hold the
+ keyids in the native endian format.
+
* import.c (import_print_stats): Use log_printf.
* build-packet.c (do_public_key): Care about mpi_write errors.
Modified: trunk/g10/keyid.c
===================================================================
--- trunk/g10/keyid.c 2006-10-18 14:28:52 UTC (rev 4305)
+++ trunk/g10/keyid.c 2006-10-18 15:34:54 UTC (rev 4306)
@@ -159,7 +159,7 @@
u32
v3_keyid (gcry_mpi_t a, u32 *ki)
{
- byte *buffer;
+ byte *buffer, *p;
size_t nbytes;
if (gcry_mpi_print (GCRYMPI_FMT_USG, NULL, 0, &nbytes, a ))
@@ -172,8 +172,10 @@
ki[0] = ki[1] = 0;
else
{
- memcpy (ki+0, buffer+nbytes-8, 4);
- memcpy (ki+1, buffer+nbytes-4, 4);
+ p = buffer + nbytes - 8;
+ ki[0] = (p[0] << 24) | (p[1] <<16) | (p[2] << 8) | p[3];
+ p += 4;
+ ki[1] = (p[0] << 24) | (p[1] <<16) | (p[2] << 8) | p[3];
}
xfree (buffer);
return ki[1];
More information about the Gnupg-commits
mailing list