summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-02 12:04:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-07 20:05:31 +0000
commit2345af9b4829ed3eed5abf60f2483055649f8af7 (patch)
tree96a9a31e4b1957b93c4fe3eb669117d2752caf0d /meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch
parentc4901328fe5cf912c0965e5b011b64a95a9bcb9d (diff)
downloadpoky-uninative-1.5.tar.gz
recipes: Move out stale GPLv2 versions to a seperate layeruninative-1.5
These are recipes where the upstream has moved to GPLv3 and these old versions are the last ones under the GPLv2 license. There are several reasons for making this move. There is a different quality of service with these recipes in that they don't get security fixes and upstream no longer care about them, in fact they're actively hostile against people using old versions. The recipes tend to need a different kind of maintenance to work with changes in the wider ecosystem and there needs to be isolation between changes made in the v3 versions and those in the v2 versions. There are probably better ways to handle a "non-GPLv3" system but right now having these in OE-Core makes them look like a first class citizen when I believe they have potential for a variety of undesireable issues. Moving them into a separate layer makes their different needs clearer, it also makes it clear how many of these there are. Some are probably not needed (e.g. mc), I also wonder whether some are useful (e.g. gmp) since most things that use them are GPLv3 only already. Someone could now more clearly see how to streamline the list of recipes here. I'm proposing we mmove to this separate layer for 2.3 with its future maintinership and testing to be determined in 2.4 and beyond. (From OE-Core rev: 19b7e950346fb1dde6505c45236eba6cd9b33b4b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch')
-rw-r--r--meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch154
1 files changed, 0 insertions, 154 deletions
diff --git a/meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch b/meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch
deleted file mode 100644
index 5dcde1f9cb..0000000000
--- a/meta/recipes-support/gnupg/gnupg-1.4.7/CVE-2013-4576.patch
+++ /dev/null
@@ -1,154 +0,0 @@
1Upstream-Status: Backport
2CVE: CVE-2013-4576
3
4Index: gnupg-1.4.7/cipher/dsa.c
5===================================================================
6--- gnupg-1.4.7.orig/cipher/dsa.c 2006-12-12 02:27:21.000000000 +0800
7+++ gnupg-1.4.7/cipher/dsa.c 2014-01-23 11:30:17.300915919 +0800
8@@ -287,6 +287,8 @@
9 MPI kinv;
10 MPI tmp;
11
12+ mpi_normalize (hash);
13+
14 /* select a random k with 0 < k < q */
15 k = gen_k( skey->q );
16
17Index: gnupg-1.4.7/cipher/elgamal.c
18===================================================================
19--- gnupg-1.4.7.orig/cipher/elgamal.c 2006-12-12 03:08:05.000000000 +0800
20+++ gnupg-1.4.7/cipher/elgamal.c 2014-01-23 11:30:17.300915919 +0800
21@@ -376,6 +376,9 @@
22 {
23 MPI t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) );
24
25+ mpi_normalize (a);
26+ mpi_normalize (b);
27+
28 /* output = b/(a^x) mod p */
29 mpi_powm( t1, a, skey->x, skey->p );
30 mpi_invm( t1, t1, skey->p );
31Index: gnupg-1.4.7/cipher/random.c
32===================================================================
33--- gnupg-1.4.7.orig/cipher/random.c 2006-11-03 18:09:39.000000000 +0800
34+++ gnupg-1.4.7/cipher/random.c 2014-01-23 11:31:53.993495462 +0800
35@@ -273,6 +273,18 @@
36 }
37
38
39+/* Randomize the MPI */
40+void
41+randomize_mpi (MPI mpi, size_t nbits, int level)
42+{
43+ unsigned char *buffer;
44+
45+ buffer = get_random_bits (nbits, level, mpi_is_secure (mpi));
46+ mpi_set_buffer (mpi, buffer, (nbits+7)/8, 0);
47+ xfree (buffer);
48+}
49+
50+
51 int
52 random_is_faked()
53 {
54Index: gnupg-1.4.7/cipher/random.h
55===================================================================
56--- gnupg-1.4.7.orig/cipher/random.h 2006-02-09 19:29:29.000000000 +0800
57+++ gnupg-1.4.7/cipher/random.h 2014-01-23 11:30:17.300915919 +0800
58@@ -32,6 +32,7 @@
59 int random_is_faked(void);
60 void random_disable_locking (void);
61 void randomize_buffer( byte *buffer, size_t length, int level );
62+void randomize_mpi (MPI mpi, size_t nbits, int level);
63 byte *get_random_bits( size_t nbits, int level, int secure );
64 void fast_random_poll( void );
65
66Index: gnupg-1.4.7/cipher/rsa.c
67===================================================================
68--- gnupg-1.4.7.orig/cipher/rsa.c 2006-12-12 03:09:00.000000000 +0800
69+++ gnupg-1.4.7/cipher/rsa.c 2014-01-23 11:35:04.330639125 +0800
70@@ -301,9 +301,26 @@
71 #if 0
72 mpi_powm( output, input, skey->d, skey->n );
73 #else
74- MPI m1 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
75- MPI m2 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
76- MPI h = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
77+ int nlimbs = mpi_get_nlimbs (skey->n)+1;
78+ MPI m1 = mpi_alloc_secure (nlimbs);
79+ MPI m2 = mpi_alloc_secure (nlimbs);
80+ MPI h = mpi_alloc_secure (nlimbs);
81+# if 1
82+ MPI bdata= mpi_alloc_secure (nlimbs);
83+ MPI r = mpi_alloc_secure (nlimbs);
84+# endif
85+
86+ /* Remove superfluous leading zeroes from INPUT. */
87+ mpi_normalize (input);
88+
89+# if 1
90+ /* Blind: bdata = (data * r^e) mod n */
91+ randomize_mpi (r, mpi_get_nbits (skey->n), 0);
92+ mpi_fdiv_r (r, r, skey->n);
93+ mpi_powm (bdata, r, skey->e, skey->n);
94+ mpi_mulm (bdata, bdata, input, skey->n);
95+ input = bdata;
96+# endif
97
98 /* m1 = c ^ (d mod (p-1)) mod p */
99 mpi_sub_ui( h, skey->p, 1 );
100@@ -321,8 +338,15 @@
101 /* m = m2 + h * p */
102 mpi_mul ( h, h, skey->p );
103 mpi_add ( output, m1, h );
104- /* ready */
105-
106+
107+# if 1
108+ mpi_free (bdata);
109+ /* Unblind: output = (output * r^(-1)) mod n */
110+ mpi_invm (r, r, skey->n);
111+ mpi_mulm (output, output, r, skey->n);
112+ mpi_free (r);
113+# endif
114+
115 mpi_free ( h );
116 mpi_free ( m1 );
117 mpi_free ( m2 );
118@@ -397,6 +421,7 @@
119 rsa_decrypt( int algo, MPI *result, MPI *data, MPI *skey )
120 {
121 RSA_secret_key sk;
122+ MPI input;
123
124 if( algo != 1 && algo != 2 )
125 return G10ERR_PUBKEY_ALGO;
126@@ -407,8 +432,14 @@
127 sk.p = skey[3];
128 sk.q = skey[4];
129 sk.u = skey[5];
130- *result = mpi_alloc_secure( mpi_get_nlimbs( sk.n ) );
131- secret( *result, data[0], &sk );
132+
133+ /* Mitigates side-channel attacks (CVE-2013-4576). */
134+ input = mpi_alloc (0);
135+ mpi_normalize (data[0]);
136+ mpi_fdiv_r (input, data[0], sk.n);
137+ *result = mpi_alloc_secure (mpi_get_nlimbs (sk.n));
138+ secret (*result, input, &sk);
139+ mpi_free (input);
140 return 0;
141 }
142
143Index: gnupg-1.4.7/g10/gpgv.c
144===================================================================
145--- gnupg-1.4.7.orig/g10/gpgv.c 2006-12-13 19:25:04.000000000 +0800
146+++ gnupg-1.4.7/g10/gpgv.c 2014-01-23 11:30:17.300915919 +0800
147@@ -390,6 +390,7 @@
148 void random_dump_stats(void) {}
149 int quick_random_gen( int onoff ) { return -1;}
150 void randomize_buffer( byte *buffer, size_t length, int level ) {}
151+void randomize_mpi (MPI mpi, size_t nbits, int level) {}
152 int random_is_faked() { return -1;}
153 byte *get_random_bits( size_t nbits, int level, int secure ) { return NULL;}
154 void set_random_seed_file( const char *name ) {}