summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2021-02-28 16:36:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-02 14:15:33 +0000
commit31421cc447f15fdcd5ad023bebca451282764750 (patch)
tree0d9ea946902d063efa12f39a961dad8b230f190a /meta
parentde8475d206d6b17c6b7907ed06f73c6586cf4f48 (diff)
downloadpoky-31421cc447f15fdcd5ad023bebca451282764750.tar.gz
libgcrypt: update 1.8.7 -> 1.9.2
Drop backports. Add a patch that inserts missing spaces in Makefiles. Drop determinism.patch: upstream has moved the git stuff to an external script, which has a guard that checkes for presence of .git/ in source tree. License-Update: additional source file listed (From OE-Core rev: ad2eae801c7809db3f4830f19efdad78d1a62d59) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/libgcrypt/files/0001-Makefile.am-add-a-missing-space.patch41
-rw-r--r--meta/recipes-support/libgcrypt/files/0001-Prefetch-GCM-look-up-tables.patch90
-rw-r--r--meta/recipes-support/libgcrypt/files/0001-libgcrypt-fix-m4-file-for-oe-core.patch9
-rw-r--r--meta/recipes-support/libgcrypt/files/0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch332
-rw-r--r--meta/recipes-support/libgcrypt/files/0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch16
-rw-r--r--meta/recipes-support/libgcrypt/files/0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch178
-rw-r--r--meta/recipes-support/libgcrypt/files/0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch21
-rw-r--r--meta/recipes-support/libgcrypt/files/determinism.patch32
-rw-r--r--meta/recipes-support/libgcrypt/libgcrypt_1.9.2.bb (renamed from meta/recipes-support/libgcrypt/libgcrypt_1.8.7.bb)12
9 files changed, 67 insertions, 664 deletions
diff --git a/meta/recipes-support/libgcrypt/files/0001-Makefile.am-add-a-missing-space.patch b/meta/recipes-support/libgcrypt/files/0001-Makefile.am-add-a-missing-space.patch
new file mode 100644
index 0000000000..8fbed9add6
--- /dev/null
+++ b/meta/recipes-support/libgcrypt/files/0001-Makefile.am-add-a-missing-space.patch
@@ -0,0 +1,41 @@
1From b8192ff67ed46ea2cc4282fa1856ce2868223737 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Wed, 24 Feb 2021 19:43:07 +0000
4Subject: [PATCH] Makefile.am: add a missing space
5
6Upstream-Status: Pending
7Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
8---
9 cipher/Makefile.am | 2 +-
10 doc/Makefile.am | 2 +-
11 2 files changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/cipher/Makefile.am b/cipher/Makefile.am
14index 1cf5072..b3ca225 100644
15--- a/cipher/Makefile.am
16+++ b/cipher/Makefile.am
17@@ -143,7 +143,7 @@ gost-sb.h: gost-s-box
18
19 gost-s-box: gost-s-box.c
20 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
21- $(CPPFLAGS_FOR_BUILD)-o $@ $(srcdir)/gost-s-box.c
22+ $(CPPFLAGS_FOR_BUILD) -o $@ $(srcdir)/gost-s-box.c
23
24
25 if ENABLE_O_FLAG_MUNGING
26diff --git a/doc/Makefile.am b/doc/Makefile.am
27index fd7aac2..1703bd9 100644
28--- a/doc/Makefile.am
29+++ b/doc/Makefile.am
30@@ -43,7 +43,7 @@ man_MANS = $(myman_pages)
31
32 yat2m: yat2m.c
33 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
34- $(CPPFLAGS_FOR_BUILD)-o $@ $(srcdir)/yat2m.c
35+ $(CPPFLAGS_FOR_BUILD) -o $@ $(srcdir)/yat2m.c
36
37 .fig.png:
38 fig2dev -L png `test -f '$<' || echo '$(srcdir)/'`$< $@
39--
402.17.1
41
diff --git a/meta/recipes-support/libgcrypt/files/0001-Prefetch-GCM-look-up-tables.patch b/meta/recipes-support/libgcrypt/files/0001-Prefetch-GCM-look-up-tables.patch
deleted file mode 100644
index 4df96f0011..0000000000
--- a/meta/recipes-support/libgcrypt/files/0001-Prefetch-GCM-look-up-tables.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1From 1374254c2904ab5b18ba4a890856824a102d4705 Mon Sep 17 00:00:00 2001
2From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
3Date: Sat, 27 Apr 2019 19:33:28 +0300
4Subject: [PATCH 1/3] Prefetch GCM look-up tables
5
6* cipher/cipher-gcm.c (prefetch_table, do_prefetch_tables)
7(prefetch_tables): New.
8(ghash_internal): Call prefetch_tables.
9--
10
11Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
12
13Upstream-Status: Backport
14[https://github.com/gpg/libgcrypt/commit/1374254c2904ab5b18ba4a890856824a102d4705]
15
16CVE: CVE-2019-12904
17
18Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
19---
20 cipher/cipher-gcm.c | 33 +++++++++++++++++++++++++++++++++
21 1 file changed, 33 insertions(+)
22
23diff --git a/cipher/cipher-gcm.c b/cipher/cipher-gcm.c
24index c19f09f..11f119a 100644
25--- a/cipher/cipher-gcm.c
26+++ b/cipher/cipher-gcm.c
27@@ -118,6 +118,34 @@ static const u16 gcmR[256] = {
28 0xbbf0, 0xba32, 0xb874, 0xb9b6, 0xbcf8, 0xbd3a, 0xbf7c, 0xbebe,
29 };
30
31+static inline
32+void prefetch_table(const void *tab, size_t len)
33+{
34+ const volatile byte *vtab = tab;
35+ size_t i;
36+
37+ for (i = 0; i < len; i += 8 * 32)
38+ {
39+ (void)vtab[i + 0 * 32];
40+ (void)vtab[i + 1 * 32];
41+ (void)vtab[i + 2 * 32];
42+ (void)vtab[i + 3 * 32];
43+ (void)vtab[i + 4 * 32];
44+ (void)vtab[i + 5 * 32];
45+ (void)vtab[i + 6 * 32];
46+ (void)vtab[i + 7 * 32];
47+ }
48+
49+ (void)vtab[len - 1];
50+}
51+
52+static inline void
53+do_prefetch_tables (const void *gcmM, size_t gcmM_size)
54+{
55+ prefetch_table(gcmM, gcmM_size);
56+ prefetch_table(gcmR, sizeof(gcmR));
57+}
58+
59 #ifdef GCM_TABLES_USE_U64
60 static void
61 bshift (u64 * b0, u64 * b1)
62@@ -365,6 +393,8 @@ do_ghash (unsigned char *result, const unsigned char *buf, const u32 *gcmM)
63 #define fillM(c) \
64 do_fillM (c->u_mode.gcm.u_ghash_key.key, c->u_mode.gcm.gcm_table)
65 #define GHASH(c, result, buf) do_ghash (result, buf, c->u_mode.gcm.gcm_table)
66+#define prefetch_tables(c) \
67+ do_prefetch_tables(c->u_mode.gcm.gcm_table, sizeof(c->u_mode.gcm.gcm_table))
68
69 #else
70
71@@ -430,6 +460,7 @@ do_ghash (unsigned char *hsub, unsigned char *result, const unsigned char *buf)
72
73 #define fillM(c) do { } while (0)
74 #define GHASH(c, result, buf) do_ghash (c->u_mode.gcm.u_ghash_key.key, result, buf)
75+#define prefetch_tables(c) do {} while (0)
76
77 #endif /* !GCM_USE_TABLES */
78
79@@ -441,6 +472,8 @@ ghash_internal (gcry_cipher_hd_t c, byte *result, const byte *buf,
80 const unsigned int blocksize = GCRY_GCM_BLOCK_LEN;
81 unsigned int burn = 0;
82
83+ prefetch_tables (c);
84+
85 while (nblocks)
86 {
87 burn = GHASH (c, result, buf);
88--
892.7.4
90
diff --git a/meta/recipes-support/libgcrypt/files/0001-libgcrypt-fix-m4-file-for-oe-core.patch b/meta/recipes-support/libgcrypt/files/0001-libgcrypt-fix-m4-file-for-oe-core.patch
index cd8a5993b4..c873e24ed5 100644
--- a/meta/recipes-support/libgcrypt/files/0001-libgcrypt-fix-m4-file-for-oe-core.patch
+++ b/meta/recipes-support/libgcrypt/files/0001-libgcrypt-fix-m4-file-for-oe-core.patch
@@ -1,4 +1,4 @@
1From bee26d7c4ea0b4a397c289b819b89e78bc325ba0 Mon Sep 17 00:00:00 2001 1From 839f38e5ecc22b7f1b837284bbbffac8cb32ab1e Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <trevor.gamblin@windriver.com> 2From: Trevor Gamblin <trevor.gamblin@windriver.com>
3Date: Tue, 29 Oct 2019 14:08:32 -0400 3Date: Tue, 29 Oct 2019 14:08:32 -0400
4Subject: [PATCH] libgcrypt: fix m4 file for oe-core 4Subject: [PATCH] libgcrypt: fix m4 file for oe-core
@@ -17,7 +17,7 @@ Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
17 1 file changed, 4 insertions(+), 86 deletions(-) 17 1 file changed, 4 insertions(+), 86 deletions(-)
18 18
19diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4 19diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4
20index 37dfbea2..3d2e90a8 100644 20index 19d514f..21125c7 100644
21--- a/src/libgcrypt.m4 21--- a/src/libgcrypt.m4
22+++ b/src/libgcrypt.m4 22+++ b/src/libgcrypt.m4
23@@ -29,41 +29,6 @@ dnl is added to the gpg_config_script_warn variable. 23@@ -29,41 +29,6 @@ dnl is added to the gpg_config_script_warn variable.
@@ -25,7 +25,7 @@ index 37dfbea2..3d2e90a8 100644
25 AC_DEFUN([AM_PATH_LIBGCRYPT], 25 AC_DEFUN([AM_PATH_LIBGCRYPT],
26 [ AC_REQUIRE([AC_CANONICAL_HOST]) 26 [ AC_REQUIRE([AC_CANONICAL_HOST])
27- AC_ARG_WITH(libgcrypt-prefix, 27- AC_ARG_WITH(libgcrypt-prefix,
28- AC_HELP_STRING([--with-libgcrypt-prefix=PFX], 28- AS_HELP_STRING([--with-libgcrypt-prefix=PFX],
29- [prefix where LIBGCRYPT is installed (optional)]), 29- [prefix where LIBGCRYPT is installed (optional)]),
30- libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") 30- libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
31- if test x"${LIBGCRYPT_CONFIG}" = x ; then 31- if test x"${LIBGCRYPT_CONFIG}" = x ; then
@@ -144,6 +144,3 @@ index 37dfbea2..3d2e90a8 100644
144 ifelse([$3], , :, [$3]) 144 ifelse([$3], , :, [$3])
145 fi 145 fi
146 AC_SUBST(LIBGCRYPT_CFLAGS) 146 AC_SUBST(LIBGCRYPT_CFLAGS)
147--
1482.17.1
149
diff --git a/meta/recipes-support/libgcrypt/files/0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch b/meta/recipes-support/libgcrypt/files/0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch
deleted file mode 100644
index c82c5b5c8a..0000000000
--- a/meta/recipes-support/libgcrypt/files/0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch
+++ /dev/null
@@ -1,332 +0,0 @@
1From 119348dd9aa52ab229afb5e2d3342d2b76fe81bf Mon Sep 17 00:00:00 2001
2From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
3Date: Fri, 31 May 2019 17:18:09 +0300
4Subject: [PATCH 2/3] AES: move look-up tables to .data section and unshare between
5 processes
6
7* cipher/rijndael-internal.h (ATTR_ALIGNED_64): New.
8* cipher/rijndael-tables.h (encT): Move to 'enc_tables' structure.
9(enc_tables): New structure for encryption table with counters before
10and after.
11(encT): New macro.
12(dec_tables): Add counters before and after encryption table; Move
13from .rodata to .data section.
14(do_encrypt): Change 'encT' to 'enc_tables.T'.
15(do_decrypt): Change '&dec_tables' to 'dec_tables.T'.
16* cipher/cipher-gcm.c (prefetch_table): Make inline; Handle input
17with length not multiple of 256.
18(prefetch_enc, prefetch_dec): Modify pre- and post-table counters
19to unshare look-up table pages between processes.
20--
21
22GnuPG-bug-id: 4541
23Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
24
25Upstream-Status: Backport
26[https://github.com/gpg/libgcrypt/commit/daedbbb5541cd8ecda1459d3b843ea4d92788762]
27
28CVE: CVE-2019-12904
29
30Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
31---
32 cipher/rijndael-internal.h | 4 +-
33 cipher/rijndael-tables.h | 155 +++++++++++++++++++++++++--------------------
34 cipher/rijndael.c | 35 ++++++++--
35 3 files changed, 118 insertions(+), 76 deletions(-)
36
37diff --git a/cipher/rijndael-internal.h b/cipher/rijndael-internal.h
38index 160fb8c..a62d4b7 100644
39--- a/cipher/rijndael-internal.h
40+++ b/cipher/rijndael-internal.h
41@@ -29,11 +29,13 @@
42 #define BLOCKSIZE (128/8)
43
44
45-/* Helper macro to force alignment to 16 bytes. */
46+/* Helper macro to force alignment to 16 or 64 bytes. */
47 #ifdef HAVE_GCC_ATTRIBUTE_ALIGNED
48 # define ATTR_ALIGNED_16 __attribute__ ((aligned (16)))
49+# define ATTR_ALIGNED_64 __attribute__ ((aligned (64)))
50 #else
51 # define ATTR_ALIGNED_16
52+# define ATTR_ALIGNED_64
53 #endif
54
55
56diff --git a/cipher/rijndael-tables.h b/cipher/rijndael-tables.h
57index 8359470..b54d959 100644
58--- a/cipher/rijndael-tables.h
59+++ b/cipher/rijndael-tables.h
60@@ -21,80 +21,98 @@
61 /* To keep the actual implementation at a readable size we use this
62 include file to define the tables. */
63
64-static const u32 encT[256] =
65+static struct
66+{
67+ volatile u32 counter_head;
68+ u32 cacheline_align[64 / 4 - 1];
69+ u32 T[256];
70+ volatile u32 counter_tail;
71+} enc_tables ATTR_ALIGNED_64 =
72 {
73- 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6,
74- 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591,
75- 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56,
76- 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec,
77- 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa,
78- 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb,
79- 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45,
80- 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b,
81- 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c,
82- 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83,
83- 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9,
84- 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a,
85- 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d,
86- 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f,
87- 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df,
88- 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea,
89- 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34,
90- 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b,
91- 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d,
92- 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413,
93- 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1,
94- 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6,
95- 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972,
96- 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85,
97- 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed,
98- 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511,
99- 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe,
100- 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b,
101- 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05,
102- 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1,
103- 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142,
104- 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf,
105- 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3,
106- 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e,
107- 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a,
108- 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6,
109- 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3,
110- 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b,
111- 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428,
112- 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad,
113- 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14,
114- 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8,
115- 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4,
116- 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2,
117- 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda,
118- 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949,
119- 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf,
120- 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810,
121- 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c,
122- 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697,
123- 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e,
124- 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f,
125- 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc,
126- 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c,
127- 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969,
128- 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27,
129- 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122,
130- 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433,
131- 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9,
132- 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5,
133- 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a,
134- 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0,
135- 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e,
136- 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c
137+ 0,
138+ { 0, },
139+ {
140+ 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6,
141+ 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591,
142+ 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56,
143+ 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec,
144+ 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa,
145+ 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb,
146+ 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45,
147+ 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b,
148+ 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c,
149+ 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83,
150+ 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9,
151+ 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a,
152+ 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d,
153+ 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f,
154+ 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df,
155+ 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea,
156+ 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34,
157+ 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b,
158+ 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d,
159+ 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413,
160+ 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1,
161+ 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6,
162+ 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972,
163+ 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85,
164+ 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed,
165+ 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511,
166+ 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe,
167+ 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b,
168+ 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05,
169+ 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1,
170+ 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142,
171+ 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf,
172+ 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3,
173+ 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e,
174+ 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a,
175+ 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6,
176+ 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3,
177+ 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b,
178+ 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428,
179+ 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad,
180+ 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14,
181+ 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8,
182+ 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4,
183+ 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2,
184+ 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda,
185+ 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949,
186+ 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf,
187+ 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810,
188+ 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c,
189+ 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697,
190+ 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e,
191+ 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f,
192+ 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc,
193+ 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c,
194+ 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969,
195+ 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27,
196+ 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122,
197+ 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433,
198+ 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9,
199+ 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5,
200+ 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a,
201+ 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0,
202+ 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e,
203+ 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c
204+ },
205+ 0
206 };
207
208-static const struct
209+#define encT enc_tables.T
210+
211+static struct
212 {
213+ volatile u32 counter_head;
214+ u32 cacheline_align[64 / 4 - 1];
215 u32 T[256];
216 byte inv_sbox[256];
217-} dec_tables =
218+ volatile u32 counter_tail;
219+} dec_tables ATTR_ALIGNED_64 =
220 {
221+ 0,
222+ { 0, },
223 {
224 0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a,
225 0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b,
226@@ -194,7 +212,8 @@ static const struct
227 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61,
228 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26,
229 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
230- }
231+ },
232+ 0
233 };
234
235 #define decT dec_tables.T
236diff --git a/cipher/rijndael.c b/cipher/rijndael.c
237index 8637195..d0edab2 100644
238--- a/cipher/rijndael.c
239+++ b/cipher/rijndael.c
240@@ -227,11 +227,11 @@ static const char *selftest(void);
241
242
243 /* Prefetching for encryption/decryption tables. */
244-static void prefetch_table(const volatile byte *tab, size_t len)
245+static inline void prefetch_table(const volatile byte *tab, size_t len)
246 {
247 size_t i;
248
249- for (i = 0; i < len; i += 8 * 32)
250+ for (i = 0; len - i >= 8 * 32; i += 8 * 32)
251 {
252 (void)tab[i + 0 * 32];
253 (void)tab[i + 1 * 32];
254@@ -242,17 +242,37 @@ static void prefetch_table(const volatile byte *tab, size_t len)
255 (void)tab[i + 6 * 32];
256 (void)tab[i + 7 * 32];
257 }
258+ for (; i < len; i += 32)
259+ {
260+ (void)tab[i];
261+ }
262
263 (void)tab[len - 1];
264 }
265
266 static void prefetch_enc(void)
267 {
268- prefetch_table((const void *)encT, sizeof(encT));
269+ /* Modify counters to trigger copy-on-write and unsharing if physical pages
270+ * of look-up table are shared between processes. Modifying counters also
271+ * causes checksums for pages to change and hint same-page merging algorithm
272+ * that these pages are frequently changing. */
273+ enc_tables.counter_head++;
274+ enc_tables.counter_tail++;
275+
276+ /* Prefetch look-up tables to cache. */
277+ prefetch_table((const void *)&enc_tables, sizeof(enc_tables));
278 }
279
280 static void prefetch_dec(void)
281 {
282+ /* Modify counters to trigger copy-on-write and unsharing if physical pages
283+ * of look-up table are shared between processes. Modifying counters also
284+ * causes checksums for pages to change and hint same-page merging algorithm
285+ * that these pages are frequently changing. */
286+ dec_tables.counter_head++;
287+ dec_tables.counter_tail++;
288+
289+ /* Prefetch look-up tables to cache. */
290 prefetch_table((const void *)&dec_tables, sizeof(dec_tables));
291 }
292
293@@ -737,7 +757,7 @@ do_encrypt (const RIJNDAEL_context *ctx,
294 #ifdef USE_AMD64_ASM
295 # ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
296 return _gcry_aes_amd64_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds,
297- encT);
298+ enc_tables.T);
299 # else
300 /* Call SystemV ABI function without storing non-volatile XMM registers,
301 * as target function does not use vector instruction sets. */
302@@ -757,7 +777,8 @@ do_encrypt (const RIJNDAEL_context *ctx,
303 return ret;
304 # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */
305 #elif defined(USE_ARM_ASM)
306- return _gcry_aes_arm_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds, encT);
307+ return _gcry_aes_arm_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds,
308+ enc_tables.T);
309 #else
310 return do_encrypt_fn (ctx, bx, ax);
311 #endif /* !USE_ARM_ASM && !USE_AMD64_ASM*/
312@@ -1120,7 +1141,7 @@ do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
313 #ifdef USE_AMD64_ASM
314 # ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
315 return _gcry_aes_amd64_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds,
316- &dec_tables);
317+ dec_tables.T);
318 # else
319 /* Call SystemV ABI function without storing non-volatile XMM registers,
320 * as target function does not use vector instruction sets. */
321@@ -1141,7 +1162,7 @@ do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
322 # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */
323 #elif defined(USE_ARM_ASM)
324 return _gcry_aes_arm_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds,
325- &dec_tables);
326+ dec_tables.T);
327 #else
328 return do_decrypt_fn (ctx, bx, ax);
329 #endif /*!USE_ARM_ASM && !USE_AMD64_ASM*/
330--
3312.7.4
332
diff --git a/meta/recipes-support/libgcrypt/files/0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch b/meta/recipes-support/libgcrypt/files/0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch
index d7554f38af..f9c362431c 100644
--- a/meta/recipes-support/libgcrypt/files/0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch
+++ b/meta/recipes-support/libgcrypt/files/0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch
@@ -1,7 +1,7 @@
1From 97570ef271ea1fb7b5ca903eec88f68407b0ec76 Mon Sep 17 00:00:00 2001 1From 3c6c10eae0993c8ca60879494c6650f7b8f54ebe Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 16 Aug 2017 10:44:41 +0800 3Date: Wed, 16 Aug 2017 10:44:41 +0800
4Subject: [PATCH 2/4] libgcrypt: fix building error with '-O2' in sysroot path 4Subject: [PATCH] libgcrypt: fix building error with '-O2' in sysroot path
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7 7
@@ -19,23 +19,21 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19 19
20Rebase to 1.8.0 20Rebase to 1.8.0
21Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 21Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
22
22--- 23---
23 cipher/Makefile.am | 2 +- 24 cipher/Makefile.am | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-) 25 1 file changed, 1 insertion(+), 1 deletion(-)
25 26
26diff --git a/cipher/Makefile.am b/cipher/Makefile.am 27diff --git a/cipher/Makefile.am b/cipher/Makefile.am
27index 95c4510..bd52ec7 100644 28index d644005..1cf5072 100644
28--- a/cipher/Makefile.am 29--- a/cipher/Makefile.am
29+++ b/cipher/Makefile.am 30+++ b/cipher/Makefile.am
30@@ -116,7 +116,7 @@ gost-s-box: gost-s-box.c 31@@ -147,7 +147,7 @@ gost-s-box: gost-s-box.c
31 32
32 33
33 if ENABLE_O_FLAG_MUNGING 34 if ENABLE_O_FLAG_MUNGING
34-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g' 35-o_flag_munging = sed -e 's/-O\([2-9sg][2-9sg]*\)/-O1/' -e 's/-Ofast/-O1/g'
35+o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g' 36+o_flag_munging = sed -e 's/ -O\([2-9sg][2-9sg]*\) / -O1 /' -e 's/ -Ofast / -O1 /g'
36 else 37 else
37 o_flag_munging = cat 38 o_flag_munging = cat
38 endif 39 endif
39--
401.8.3.1
41
diff --git a/meta/recipes-support/libgcrypt/files/0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch b/meta/recipes-support/libgcrypt/files/0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch
deleted file mode 100644
index b580b7b13c..0000000000
--- a/meta/recipes-support/libgcrypt/files/0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch
+++ /dev/null
@@ -1,178 +0,0 @@
1From a4c561aab1014c3630bc88faf6f5246fee16b020 Mon Sep 17 00:00:00 2001
2From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
3Date: Fri, 31 May 2019 17:27:25 +0300
4Subject: [PATCH 3/3] GCM: move look-up table to .data section and unshare
5 between processes
6
7* cipher/cipher-gcm.c (ATTR_ALIGNED_64): New.
8(gcmR): Move to 'gcm_table' structure.
9(gcm_table): New structure for look-up table with counters before and
10after.
11(gcmR): New macro.
12(prefetch_table): Handle input with length not multiple of 256.
13(do_prefetch_tables): Modify pre- and post-table counters to unshare
14look-up table pages between processes.
15--
16
17GnuPG-bug-id: 4541
18Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
19
20Upstream-Status: Backport
21[https://github.com/gpg/libgcrypt/commit/a4c561aab1014c3630bc88faf6f5246fee16b020]
22
23CVE: CVE-2019-12904
24
25Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
26---
27 cipher/cipher-gcm.c | 106 ++++++++++++++++++++++++++++++++++------------------
28 1 file changed, 70 insertions(+), 36 deletions(-)
29
30diff --git a/cipher/cipher-gcm.c b/cipher/cipher-gcm.c
31index 11f119a..194e2ec 100644
32--- a/cipher/cipher-gcm.c
33+++ b/cipher/cipher-gcm.c
34@@ -30,6 +30,14 @@
35 #include "./cipher-internal.h"
36
37
38+/* Helper macro to force alignment to 16 or 64 bytes. */
39+#ifdef HAVE_GCC_ATTRIBUTE_ALIGNED
40+# define ATTR_ALIGNED_64 __attribute__ ((aligned (64)))
41+#else
42+# define ATTR_ALIGNED_64
43+#endif
44+
45+
46 #ifdef GCM_USE_INTEL_PCLMUL
47 extern void _gcry_ghash_setup_intel_pclmul (gcry_cipher_hd_t c);
48
49@@ -83,40 +91,54 @@ ghash_armv7_neon (gcry_cipher_hd_t c, byte *result, const byte *buf,
50
51
52 #ifdef GCM_USE_TABLES
53-static const u16 gcmR[256] = {
54- 0x0000, 0x01c2, 0x0384, 0x0246, 0x0708, 0x06ca, 0x048c, 0x054e,
55- 0x0e10, 0x0fd2, 0x0d94, 0x0c56, 0x0918, 0x08da, 0x0a9c, 0x0b5e,
56- 0x1c20, 0x1de2, 0x1fa4, 0x1e66, 0x1b28, 0x1aea, 0x18ac, 0x196e,
57- 0x1230, 0x13f2, 0x11b4, 0x1076, 0x1538, 0x14fa, 0x16bc, 0x177e,
58- 0x3840, 0x3982, 0x3bc4, 0x3a06, 0x3f48, 0x3e8a, 0x3ccc, 0x3d0e,
59- 0x3650, 0x3792, 0x35d4, 0x3416, 0x3158, 0x309a, 0x32dc, 0x331e,
60- 0x2460, 0x25a2, 0x27e4, 0x2626, 0x2368, 0x22aa, 0x20ec, 0x212e,
61- 0x2a70, 0x2bb2, 0x29f4, 0x2836, 0x2d78, 0x2cba, 0x2efc, 0x2f3e,
62- 0x7080, 0x7142, 0x7304, 0x72c6, 0x7788, 0x764a, 0x740c, 0x75ce,
63- 0x7e90, 0x7f52, 0x7d14, 0x7cd6, 0x7998, 0x785a, 0x7a1c, 0x7bde,
64- 0x6ca0, 0x6d62, 0x6f24, 0x6ee6, 0x6ba8, 0x6a6a, 0x682c, 0x69ee,
65- 0x62b0, 0x6372, 0x6134, 0x60f6, 0x65b8, 0x647a, 0x663c, 0x67fe,
66- 0x48c0, 0x4902, 0x4b44, 0x4a86, 0x4fc8, 0x4e0a, 0x4c4c, 0x4d8e,
67- 0x46d0, 0x4712, 0x4554, 0x4496, 0x41d8, 0x401a, 0x425c, 0x439e,
68- 0x54e0, 0x5522, 0x5764, 0x56a6, 0x53e8, 0x522a, 0x506c, 0x51ae,
69- 0x5af0, 0x5b32, 0x5974, 0x58b6, 0x5df8, 0x5c3a, 0x5e7c, 0x5fbe,
70- 0xe100, 0xe0c2, 0xe284, 0xe346, 0xe608, 0xe7ca, 0xe58c, 0xe44e,
71- 0xef10, 0xeed2, 0xec94, 0xed56, 0xe818, 0xe9da, 0xeb9c, 0xea5e,
72- 0xfd20, 0xfce2, 0xfea4, 0xff66, 0xfa28, 0xfbea, 0xf9ac, 0xf86e,
73- 0xf330, 0xf2f2, 0xf0b4, 0xf176, 0xf438, 0xf5fa, 0xf7bc, 0xf67e,
74- 0xd940, 0xd882, 0xdac4, 0xdb06, 0xde48, 0xdf8a, 0xddcc, 0xdc0e,
75- 0xd750, 0xd692, 0xd4d4, 0xd516, 0xd058, 0xd19a, 0xd3dc, 0xd21e,
76- 0xc560, 0xc4a2, 0xc6e4, 0xc726, 0xc268, 0xc3aa, 0xc1ec, 0xc02e,
77- 0xcb70, 0xcab2, 0xc8f4, 0xc936, 0xcc78, 0xcdba, 0xcffc, 0xce3e,
78- 0x9180, 0x9042, 0x9204, 0x93c6, 0x9688, 0x974a, 0x950c, 0x94ce,
79- 0x9f90, 0x9e52, 0x9c14, 0x9dd6, 0x9898, 0x995a, 0x9b1c, 0x9ade,
80- 0x8da0, 0x8c62, 0x8e24, 0x8fe6, 0x8aa8, 0x8b6a, 0x892c, 0x88ee,
81- 0x83b0, 0x8272, 0x8034, 0x81f6, 0x84b8, 0x857a, 0x873c, 0x86fe,
82- 0xa9c0, 0xa802, 0xaa44, 0xab86, 0xaec8, 0xaf0a, 0xad4c, 0xac8e,
83- 0xa7d0, 0xa612, 0xa454, 0xa596, 0xa0d8, 0xa11a, 0xa35c, 0xa29e,
84- 0xb5e0, 0xb422, 0xb664, 0xb7a6, 0xb2e8, 0xb32a, 0xb16c, 0xb0ae,
85- 0xbbf0, 0xba32, 0xb874, 0xb9b6, 0xbcf8, 0xbd3a, 0xbf7c, 0xbebe,
86-};
87+static struct
88+{
89+ volatile u32 counter_head;
90+ u32 cacheline_align[64 / 4 - 1];
91+ u16 R[256];
92+ volatile u32 counter_tail;
93+} gcm_table ATTR_ALIGNED_64 =
94+ {
95+ 0,
96+ { 0, },
97+ {
98+ 0x0000, 0x01c2, 0x0384, 0x0246, 0x0708, 0x06ca, 0x048c, 0x054e,
99+ 0x0e10, 0x0fd2, 0x0d94, 0x0c56, 0x0918, 0x08da, 0x0a9c, 0x0b5e,
100+ 0x1c20, 0x1de2, 0x1fa4, 0x1e66, 0x1b28, 0x1aea, 0x18ac, 0x196e,
101+ 0x1230, 0x13f2, 0x11b4, 0x1076, 0x1538, 0x14fa, 0x16bc, 0x177e,
102+ 0x3840, 0x3982, 0x3bc4, 0x3a06, 0x3f48, 0x3e8a, 0x3ccc, 0x3d0e,
103+ 0x3650, 0x3792, 0x35d4, 0x3416, 0x3158, 0x309a, 0x32dc, 0x331e,
104+ 0x2460, 0x25a2, 0x27e4, 0x2626, 0x2368, 0x22aa, 0x20ec, 0x212e,
105+ 0x2a70, 0x2bb2, 0x29f4, 0x2836, 0x2d78, 0x2cba, 0x2efc, 0x2f3e,
106+ 0x7080, 0x7142, 0x7304, 0x72c6, 0x7788, 0x764a, 0x740c, 0x75ce,
107+ 0x7e90, 0x7f52, 0x7d14, 0x7cd6, 0x7998, 0x785a, 0x7a1c, 0x7bde,
108+ 0x6ca0, 0x6d62, 0x6f24, 0x6ee6, 0x6ba8, 0x6a6a, 0x682c, 0x69ee,
109+ 0x62b0, 0x6372, 0x6134, 0x60f6, 0x65b8, 0x647a, 0x663c, 0x67fe,
110+ 0x48c0, 0x4902, 0x4b44, 0x4a86, 0x4fc8, 0x4e0a, 0x4c4c, 0x4d8e,
111+ 0x46d0, 0x4712, 0x4554, 0x4496, 0x41d8, 0x401a, 0x425c, 0x439e,
112+ 0x54e0, 0x5522, 0x5764, 0x56a6, 0x53e8, 0x522a, 0x506c, 0x51ae,
113+ 0x5af0, 0x5b32, 0x5974, 0x58b6, 0x5df8, 0x5c3a, 0x5e7c, 0x5fbe,
114+ 0xe100, 0xe0c2, 0xe284, 0xe346, 0xe608, 0xe7ca, 0xe58c, 0xe44e,
115+ 0xef10, 0xeed2, 0xec94, 0xed56, 0xe818, 0xe9da, 0xeb9c, 0xea5e,
116+ 0xfd20, 0xfce2, 0xfea4, 0xff66, 0xfa28, 0xfbea, 0xf9ac, 0xf86e,
117+ 0xf330, 0xf2f2, 0xf0b4, 0xf176, 0xf438, 0xf5fa, 0xf7bc, 0xf67e,
118+ 0xd940, 0xd882, 0xdac4, 0xdb06, 0xde48, 0xdf8a, 0xddcc, 0xdc0e,
119+ 0xd750, 0xd692, 0xd4d4, 0xd516, 0xd058, 0xd19a, 0xd3dc, 0xd21e,
120+ 0xc560, 0xc4a2, 0xc6e4, 0xc726, 0xc268, 0xc3aa, 0xc1ec, 0xc02e,
121+ 0xcb70, 0xcab2, 0xc8f4, 0xc936, 0xcc78, 0xcdba, 0xcffc, 0xce3e,
122+ 0x9180, 0x9042, 0x9204, 0x93c6, 0x9688, 0x974a, 0x950c, 0x94ce,
123+ 0x9f90, 0x9e52, 0x9c14, 0x9dd6, 0x9898, 0x995a, 0x9b1c, 0x9ade,
124+ 0x8da0, 0x8c62, 0x8e24, 0x8fe6, 0x8aa8, 0x8b6a, 0x892c, 0x88ee,
125+ 0x83b0, 0x8272, 0x8034, 0x81f6, 0x84b8, 0x857a, 0x873c, 0x86fe,
126+ 0xa9c0, 0xa802, 0xaa44, 0xab86, 0xaec8, 0xaf0a, 0xad4c, 0xac8e,
127+ 0xa7d0, 0xa612, 0xa454, 0xa596, 0xa0d8, 0xa11a, 0xa35c, 0xa29e,
128+ 0xb5e0, 0xb422, 0xb664, 0xb7a6, 0xb2e8, 0xb32a, 0xb16c, 0xb0ae,
129+ 0xbbf0, 0xba32, 0xb874, 0xb9b6, 0xbcf8, 0xbd3a, 0xbf7c, 0xbebe,
130+ },
131+ 0
132+ };
133+
134+#define gcmR gcm_table.R
135
136 static inline
137 void prefetch_table(const void *tab, size_t len)
138@@ -124,7 +146,7 @@ void prefetch_table(const void *tab, size_t len)
139 const volatile byte *vtab = tab;
140 size_t i;
141
142- for (i = 0; i < len; i += 8 * 32)
143+ for (i = 0; len - i >= 8 * 32; i += 8 * 32)
144 {
145 (void)vtab[i + 0 * 32];
146 (void)vtab[i + 1 * 32];
147@@ -135,6 +157,10 @@ void prefetch_table(const void *tab, size_t len)
148 (void)vtab[i + 6 * 32];
149 (void)vtab[i + 7 * 32];
150 }
151+ for (; i < len; i += 32)
152+ {
153+ (void)vtab[i];
154+ }
155
156 (void)vtab[len - 1];
157 }
158@@ -142,8 +168,16 @@ void prefetch_table(const void *tab, size_t len)
159 static inline void
160 do_prefetch_tables (const void *gcmM, size_t gcmM_size)
161 {
162+ /* Modify counters to trigger copy-on-write and unsharing if physical pages
163+ * of look-up table are shared between processes. Modifying counters also
164+ * causes checksums for pages to change and hint same-page merging algorithm
165+ * that these pages are frequently changing. */
166+ gcm_table.counter_head++;
167+ gcm_table.counter_tail++;
168+
169+ /* Prefetch look-up tables to cache. */
170 prefetch_table(gcmM, gcmM_size);
171- prefetch_table(gcmR, sizeof(gcmR));
172+ prefetch_table(&gcm_table, sizeof(gcm_table));
173 }
174
175 #ifdef GCM_TABLES_USE_U64
176--
1772.7.4
178
diff --git a/meta/recipes-support/libgcrypt/files/0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch b/meta/recipes-support/libgcrypt/files/0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch
index 8622df3ea8..5bf0c7f8a3 100644
--- a/meta/recipes-support/libgcrypt/files/0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch
+++ b/meta/recipes-support/libgcrypt/files/0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch
@@ -1,7 +1,7 @@
1From e20dbdb0b8f0af840ef90b299c4e2277c52ddf87 Mon Sep 17 00:00:00 2001 1From cb06d218ee36e303a64f27c690f30040d5d87960 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sun, 12 Jun 2016 04:44:29 -0400 3Date: Sun, 12 Jun 2016 04:44:29 -0400
4Subject: [PATCH 4/4] tests/Makefile.am: fix undefined reference to 4Subject: [PATCH] tests/Makefile.am: fix undefined reference to
5 `pthread_create' 5 `pthread_create'
6 6
7Add missing '-lpthread' to CFLAGS 7Add missing '-lpthread' to CFLAGS
@@ -9,20 +9,21 @@ Add missing '-lpthread' to CFLAGS
9Upstream-Status: Pending 9Upstream-Status: Pending
10 10
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12
12--- 13---
13 tests/Makefile.am | 2 +- 14 tests/Makefile.am | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-) 15 1 file changed, 1 insertion(+), 1 deletion(-)
15 16
16diff --git a/tests/Makefile.am b/tests/Makefile.am 17diff --git a/tests/Makefile.am b/tests/Makefile.am
17index 1744ea7..04cf425 100644 18index ab201f0..1cf82d0 100644
18--- a/tests/Makefile.am 19--- a/tests/Makefile.am
19+++ b/tests/Makefile.am 20+++ b/tests/Makefile.am
20@@ -64,4 +64,4 @@ EXTRA_DIST = README rsa-16k.key cavs_tests.sh cavs_driver.pl \ 21@@ -75,7 +75,7 @@ t_mpi_bit_LDADD = $(standard_ldadd) @LDADD_FOR_TESTS_KLUDGE@
21 22 t_secmem_LDADD = $(standard_ldadd) @LDADD_FOR_TESTS_KLUDGE@
22 LDADD = $(standard_ldadd) $(GPG_ERROR_LIBS) 23 testapi_LDADD = $(standard_ldadd) @LDADD_FOR_TESTS_KLUDGE@
23 t_lock_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) 24 t_lock_LDADD = $(standard_ldadd) $(GPG_ERROR_MT_LIBS) @LDADD_FOR_TESTS_KLUDGE@
24-t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS) 25-t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS)
25+t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS) -lpthread 26+t_lock_CFLAGS = $(GPG_ERROR_MT_CFLAGS) -lpthread
26-- 27 testdrv_LDADD = $(LDADD_FOR_TESTS_KLUDGE)
271.8.3.1 28
28 29 # Build a version of the test driver for the build platform.
diff --git a/meta/recipes-support/libgcrypt/files/determinism.patch b/meta/recipes-support/libgcrypt/files/determinism.patch
deleted file mode 100644
index ad0b8c7950..0000000000
--- a/meta/recipes-support/libgcrypt/files/determinism.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1gnutls detects our outer git trees and injects that revision into its objects.
2That isn't deterministic so stop it. Also ensure we're not marked as a development
3build as its git detection is faulty.
4
5RP 2020/2/6
6
7Upstream-Status: Pending
8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9
10
11Index: libgcrypt-1.8.5/configure.ac
12===================================================================
13--- libgcrypt-1.8.5.orig/configure.ac
14+++ libgcrypt-1.8.5/configure.ac
15@@ -45,7 +45,7 @@ m4_define([mym4_revision_dec],
16 m4_define([mym4_betastring],
17 m4_esyscmd_s([git describe --match 'libgcrypt-[0-9].*[0-9]' --long|\
18 awk -F- '$3!=0{print"-beta"$3}']))
19-m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
20+m4_define([mym4_isgit],[no])
21 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
22
23 AC_INIT([libgcrypt],[mym4_full_version],[http://bugs.gnupg.org])
24@@ -2575,7 +2575,7 @@ AM_CONDITIONAL([BUILD_DOC], [test "x$bui
25 #
26 # Provide information about the build.
27 #
28-BUILD_REVISION="mym4_revision"
29+BUILD_REVISION="None"
30 AC_SUBST(BUILD_REVISION)
31 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
32 [GIT commit id revision used to build this package])
diff --git a/meta/recipes-support/libgcrypt/libgcrypt_1.8.7.bb b/meta/recipes-support/libgcrypt/libgcrypt_1.9.2.bb
index 7db624a09b..df49177f16 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt_1.8.7.bb
+++ b/meta/recipes-support/libgcrypt/libgcrypt_1.9.2.bb
@@ -11,7 +11,8 @@ LICENSE_dumpsexp-dev = "GPLv3+"
11 11
12LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ 12LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
13 file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff \ 13 file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff \
14 file://LICENSES;md5=840e3bcb754e5046ffeda7619034cbd8" 14 file://LICENSES;md5=2dae15d91a37cfde72fe9eae75f8ea14 \
15 "
15 16
16DEPENDS = "libgpg-error" 17DEPENDS = "libgpg-error"
17 18
@@ -21,12 +22,9 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.bz2 \
21 file://0003-tests-bench-slope.c-workaround-ICE-failure-on-mips-w.patch \ 22 file://0003-tests-bench-slope.c-workaround-ICE-failure-on-mips-w.patch \
22 file://0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \ 23 file://0002-libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \
23 file://0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch \ 24 file://0004-tests-Makefile.am-fix-undefined-reference-to-pthread.patch \
24 file://0001-Prefetch-GCM-look-up-tables.patch \ 25 file://0001-Makefile.am-add-a-missing-space.patch \
25 file://0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch \ 26 "
26 file://0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch \ 27SRC_URI[sha256sum] = "b2c10d091513b271e47177274607b1ffba3d95b188bbfa8797f948aec9053c5a"
27 file://determinism.patch \
28"
29SRC_URI[sha256sum] = "03b70f028299561b7034b8966d7dd77ef16ed139c43440925fe8782561974748"
30 28
31# Below whitelisted CVEs are disputed and not affecting crypto libraries for any distro. 29# Below whitelisted CVEs are disputed and not affecting crypto libraries for any distro.
32CVE_CHECK_WHITELIST += "CVE-2018-12433 CVE-2018-12438" 30CVE_CHECK_WHITELIST += "CVE-2018-12433 CVE-2018-12438"