[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2441] 2009-07-23 Pavel Roskin <address@hidden>
From: |
Pavel Roskin |
Subject: |
[2441] 2009-07-23 Pavel Roskin <address@hidden> |
Date: |
Fri, 24 Jul 2009 01:43:10 +0000 |
Revision: 2441
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2441
Author: proski
Date: 2009-07-24 01:43:10 +0000 (Fri, 24 Jul 2009)
Log Message:
-----------
2009-07-23 Pavel Roskin <address@hidden>
* commands/xnu_uuid.c (transform): Use GRUB_CPU_WORDS_BIGENDIAN
instead of WORDS_BIGENDIAN. Use grub_le_to_cpu32(), so that the
case of little endian words becomes just an optimization.
Respect const modifier.
(md5_final): Use code that doesn't depend on endianess.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/commands/xnu_uuid.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-07-23 16:41:29 UTC (rev 2440)
+++ trunk/grub2/ChangeLog 2009-07-24 01:43:10 UTC (rev 2441)
@@ -1,5 +1,11 @@
2009-07-23 Pavel Roskin <address@hidden>
+ * commands/xnu_uuid.c (transform): Use GRUB_CPU_WORDS_BIGENDIAN
+ instead of WORDS_BIGENDIAN. Use grub_le_to_cpu32(), so that the
+ case of little endian words becomes just an optimization.
+ Respect const modifier.
+ (md5_final): Use code that doesn't depend on endianess.
+
* include/grub/misc.h (ALIGN_UP): Cast align to the type of addr
to avoid loss of upper bits if align is unsigned and shorter
than addr.
Modified: trunk/grub2/commands/xnu_uuid.c
===================================================================
--- trunk/grub2/commands/xnu_uuid.c 2009-07-23 16:41:29 UTC (rev 2440)
+++ trunk/grub2/commands/xnu_uuid.c 2009-07-24 01:43:10 UTC (rev 2441)
@@ -91,20 +91,16 @@
register grub_uint32_t D = ctx->D;
grub_uint32_t *cwp = correct_words;
-#ifdef WORDS_BIGENDIAN
- {
+#ifdef GRUB_CPU_WORDS_BIGENDIAN
+ {
int i;
- grub_uint8_t *p2, *p1;
- for(i=0, p1=data, p2=(grub_uint8_t*)correct_words; i < 16; i++, p2 += 4 )
- {
- p2[3] = *p1++;
- p2[2] = *p1++;
- p2[1] = *p1++;
- p2[0] = *p1++;
- }
+ const grub_uint32_t *p = (const grub_uint32_t *) data;
+
+ for (i = 0; i < 16; i++)
+ correct_words[i] = grub_le_to_cpu32 (p[i]);
}
#else
- memcpy( correct_words, data, 64 );
+ memcpy (correct_words, data, 64);
#endif
#define OP(a, b, c, d, s, T) \
@@ -266,7 +262,7 @@
{
MD5_CONTEXT *hd = context;
grub_uint32_t t, msb, lsb;
- grub_uint8_t *p;
+ grub_uint32_t *p;
md5_write(hd, NULL, 0); /* flush */;
@@ -310,13 +306,8 @@
transform( hd, hd->buf );
// _gcry_burn_stack (80+6*sizeof(void*));
- p = hd->buf;
-#ifdef WORDS_BIGENDIAN
-#define X(a) do { *p++ = hd->a ; *p++ = hd->a >> 8; \
- *p++ = hd->a >> 16; *p++ = hd->a >> 24; } while(0)
-#else /* little endian */
-#define X(a) do { *(grub_uint32_t*)p = (*hd).a ; p += 4; } while(0)
-#endif
+ p = (grub_uint32_t *) hd->buf;
+#define X(a) do { *p = grub_le_to_cpu32 (hd->a); p++; } while (0)
X(A);
X(B);
X(C);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [2441] 2009-07-23 Pavel Roskin <address@hidden>,
Pavel Roskin <=