File: 30_0006-cipher-aria-Fix-compiler-error-on-NetBSD.patch

package info (click to toggle)
libgcrypt20 1.11.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 19,224 kB
  • sloc: ansic: 181,767; asm: 57,270; sh: 13,057; makefile: 880; sed: 37
file content (65 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 06b590e6e5370d0b148a1c4c17ee2b54d617baaf Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Fri, 2 May 2025 10:53:49 -0700
Subject: [PATCH 6/6] cipher:aria: Fix compiler error on NetBSD.

* cipher/aria.c (bswap32): Remove function that conflicts with system
definitions on NetBSD.
(aria_diff_byte): Use _gcry_bswap32.

--

Cherry pick the master commit of:
	df684aca7407a4179771d79b5ef04ef8e4bedcc6

GnuPG-bug-id: 7633
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
---
 cipher/aria.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/cipher/aria.c b/cipher/aria.c
index bc2d4384..26546a63 100644
--- a/cipher/aria.c
+++ b/cipher/aria.c
@@ -637,20 +637,14 @@ prefetch_sboxes(void)
 
 static ALWAYS_INLINE
 u32 rotr32(u32 v, u32 r)
 {
   return ror(v, r);
 }
 
-static ALWAYS_INLINE
-u32 bswap32(u32 v)
-{
-  return _gcry_bswap32(v);
-}
-
 static ALWAYS_INLINE u32
 get_u8(u32 x, u32 y)
 {
   return (x >> ((3 - y) * 8)) & 0xFF;
 }
 
 static ALWAYS_INLINE u32
@@ -723,15 +717,15 @@ aria_diff_word(u32 *t0, u32 *t1, u32 *t2, u32 *t3)
 }
 
 /* Byte-level diffusion */
 static inline void aria_diff_byte(u32 *t1, u32 *t2, u32 *t3)
 {
   *t1 = ((*t1 << 8) & 0xff00ff00) ^ ((*t1 >> 8) & 0x00ff00ff);
   *t2 = rotr32(*t2, 16);
-  *t3 = bswap32(*t3);
+  *t3 = _gcry_bswap32(*t3);
 }
 
 /* Key XOR Layer */
 static ALWAYS_INLINE void
 aria_add_round_key(u32 *rk, u32 *t0, u32 *t1, u32 *t2, u32 *t3)
 {
   *t0 ^= rk[0];
-- 
2.51.0