2016-08-22 11:21:16 +02:00
|
|
|
Index: libgcrypt-1.7.2/cipher/bufhelp.h
|
|
|
|
===================================================================
|
|
|
|
--- libgcrypt-1.7.2.orig/cipher/bufhelp.h
|
|
|
|
+++ libgcrypt-1.7.2/cipher/bufhelp.h
|
|
|
|
@@ -91,7 +91,7 @@ do_bytes:
|
2015-06-24 09:39:00 +02:00
|
|
|
for (; len; len--)
|
|
|
|
*dst++ = *src++;
|
|
|
|
#endif /*__GNUC__ >= 4 && (__x86_64__ || __i386__)*/
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
|
|
|
|
/* Optimized function for buffer xoring */
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -128,7 +128,7 @@ do_bytes:
|
2015-06-24 09:39:00 +02:00
|
|
|
/* Handle tail. */
|
|
|
|
for (; len; len--)
|
|
|
|
*dst++ = *src1++ ^ *src2++;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
|
2016-08-22 11:21:16 +02:00
|
|
|
/* Optimized function for in-place buffer xoring. */
|
|
|
|
@@ -200,7 +200,7 @@ do_bytes:
|
2015-06-24 09:39:00 +02:00
|
|
|
/* Handle tail. */
|
|
|
|
for (; len; len--)
|
|
|
|
*dst1++ = (*dst2++ ^= *src++);
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
|
|
|
|
/* Optimized function for combined buffer xoring and copying. Used by mainly
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -253,7 +253,7 @@ do_bytes:
|
2015-06-24 09:39:00 +02:00
|
|
|
*dst_xor++ = *srcdst_cpy ^ *src_xor++;
|
|
|
|
*srcdst_cpy++ = temp;
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
|
|
|
|
/* Optimized function for combined buffer xoring and copying. Used by mainly
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -279,7 +279,7 @@ buf_eq_const(const void *_a, const void
|
2015-06-24 09:39:00 +02:00
|
|
|
diff -= !!(a[i] - b[i]);
|
|
|
|
|
|
|
|
return !diff;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef BUFHELP_FAST_UNALIGNED_ACCESS
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -291,14 +291,14 @@ static inline u32 buf_get_be32(const voi
|
2015-06-24 09:39:00 +02:00
|
|
|
const byte *in = _buf;
|
|
|
|
return ((u32)in[0] << 24) | ((u32)in[1] << 16) | \
|
|
|
|
((u32)in[2] << 8) | (u32)in[3];
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline u32 buf_get_le32(const void *_buf)
|
|
|
|
{
|
|
|
|
const byte *in = _buf;
|
|
|
|
return ((u32)in[3] << 24) | ((u32)in[2] << 16) | \
|
|
|
|
((u32)in[1] << 8) | (u32)in[0];
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_be32(void *_buf, u32 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -307,7 +307,7 @@ static inline void buf_put_be32(void *_b
|
2015-06-24 09:39:00 +02:00
|
|
|
out[1] = val >> 16;
|
|
|
|
out[2] = val >> 8;
|
|
|
|
out[3] = val;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_le32(void *_buf, u32 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -316,7 +316,7 @@ static inline void buf_put_le32(void *_b
|
2015-06-24 09:39:00 +02:00
|
|
|
out[2] = val >> 16;
|
|
|
|
out[1] = val >> 8;
|
|
|
|
out[0] = val;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
2016-08-22 11:21:16 +02:00
|
|
|
|
2015-06-24 09:39:00 +02:00
|
|
|
/* Functions for loading and storing unaligned u64 values of different
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -328,7 +328,7 @@ static inline u64 buf_get_be64(const voi
|
2015-06-24 09:39:00 +02:00
|
|
|
((u64)in[2] << 40) | ((u64)in[3] << 32) | \
|
|
|
|
((u64)in[4] << 24) | ((u64)in[5] << 16) | \
|
|
|
|
((u64)in[6] << 8) | (u64)in[7];
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline u64 buf_get_le64(const void *_buf)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -337,7 +337,7 @@ static inline u64 buf_get_le64(const voi
|
2015-06-24 09:39:00 +02:00
|
|
|
((u64)in[5] << 40) | ((u64)in[4] << 32) | \
|
|
|
|
((u64)in[3] << 24) | ((u64)in[2] << 16) | \
|
|
|
|
((u64)in[1] << 8) | (u64)in[0];
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_be64(void *_buf, u64 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -350,7 +350,7 @@ static inline void buf_put_be64(void *_b
|
2015-06-24 09:39:00 +02:00
|
|
|
out[5] = val >> 16;
|
|
|
|
out[6] = val >> 8;
|
|
|
|
out[7] = val;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_le64(void *_buf, u64 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
@@ -363,7 +363,7 @@ static inline void buf_put_le64(void *_b
|
2015-06-24 09:39:00 +02:00
|
|
|
out[2] = val >> 16;
|
|
|
|
out[1] = val >> 8;
|
|
|
|
out[0] = val;
|
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
#else /*BUFHELP_FAST_UNALIGNED_ACCESS*/
|
2016-08-22 11:21:16 +02:00
|
|
|
|
|
|
|
@@ -377,24 +377,24 @@ typedef struct bufhelp_u32_s
|
2015-06-24 09:39:00 +02:00
|
|
|
static inline u32 buf_get_be32(const void *_buf)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
return be_bswap32(((const bufhelp_u32_t *)_buf)->a);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline u32 buf_get_le32(const void *_buf)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_be32(void *_buf, u32 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
bufhelp_u32_t *out = _buf;
|
|
|
|
out->a = be_bswap32(val);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_le32(void *_buf, u32 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
bufhelp_u32_t *out = _buf;
|
|
|
|
out->a = le_bswap32(val);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
2016-08-22 11:21:16 +02:00
|
|
|
|
|
|
|
typedef struct bufhelp_u64_s
|
|
|
|
@@ -407,24 +407,24 @@ typedef struct bufhelp_u64_s
|
2015-06-24 09:39:00 +02:00
|
|
|
static inline u64 buf_get_be64(const void *_buf)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
return be_bswap64(((const bufhelp_u64_t *)_buf)->a);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline u64 buf_get_le64(const void *_buf)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
return le_bswap64(((const bufhelp_u64_t *)_buf)->a);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_be64(void *_buf, u64 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
bufhelp_u64_t *out = _buf;
|
|
|
|
out->a = be_bswap64(val);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
|
|
|
|
|
|
|
static inline void buf_put_le64(void *_buf, u64 val)
|
|
|
|
{
|
2016-08-22 11:21:16 +02:00
|
|
|
bufhelp_u64_t *out = _buf;
|
|
|
|
out->a = le_bswap64(val);
|
2015-06-24 09:39:00 +02:00
|
|
|
-}
|
|
|
|
+} __attribute__ ((optimize("no-strict-aliasing")))
|
2016-08-22 11:21:16 +02:00
|
|
|
|
2015-06-24 09:39:00 +02:00
|
|
|
|
|
|
|
#endif /*BUFHELP_FAST_UNALIGNED_ACCESS*/
|