View | Details | Raw Unified | Return to bug 198368
Collapse All | Expand All

(-)databases/virtuoso/files/patch-libsrc_Wi_xmlenc.c (+187 lines)
Line 0 Link Here
1
--- libsrc/Wi/xmlenc.c.orig	2014-02-17 18:33:14.000000000 +0100
2
+++ libsrc/Wi/xmlenc.c	2015-02-27 20:50:15.729249333 +0100
3
@@ -1775,7 +1775,7 @@
4
   if (!algo)
5
     len = 0;
6
   else if (!strcmp (algo, XENC_TRIPLEDES_ALGO))
7
-    len = 3 * sizeof (des_cblock);
8
+    len = 3 * sizeof (DES_cblock);
9
   else if (!strcmp (algo, XENC_AES128_ALGO))
10
     len = 128;
11
   else if (!strcmp (algo, XENC_AES256_ALGO))
12
@@ -1826,7 +1826,7 @@
13
 {
14
   xenc_key_t * key;
15
   P_SHA1_CTX * psha1;
16
-  des_cblock _key[5];
17
+  DES_cblock _key[5];
18
   int key_len = 0;
19
   caddr_t * utok_opts = (caddr_t *) xenc_get_option (ctx->wc_opts, "UsernameToken", NULL);
20
   caddr_t key_algo = xenc_get_option (utok_opts, "keyAlgorithm", XENC_TRIPLEDES_ALGO);
21
@@ -1855,13 +1855,13 @@
22
 	      memset (&key->ki.triple_des.ks3, 0, sizeof (key->ki.triple_des.ks3));
23
 	      memset (&key->ki.triple_des.iv,  0, sizeof (key->ki.triple_des.iv));
24
 
25
-	      des_set_key_unchecked(&_key[0], key->ki.triple_des.ks1);
26
-	      des_set_key_unchecked(&_key[1], key->ki.triple_des.ks2);
27
-	      des_set_key_unchecked(&_key[2], key->ki.triple_des.ks3);
28
-
29
-	      memcpy (key->ki.triple_des.k1, &_key[0], sizeof (des_cblock));
30
-	      memcpy (key->ki.triple_des.k2, &_key[1], sizeof (des_cblock));
31
-	      memcpy (key->ki.triple_des.k3, &_key[2], sizeof (des_cblock));
32
+	      DES_set_key_unchecked(&_key[0], &key->ki.triple_des.ks1);
33
+	      DES_set_key_unchecked(&_key[1], &key->ki.triple_des.ks2);
34
+	      DES_set_key_unchecked(&_key[2], &key->ki.triple_des.ks3);
35
+
36
+	      memcpy (key->ki.triple_des.k1, &_key[0], sizeof (DES_cblock));
37
+	      memcpy (key->ki.triple_des.k2, &_key[1], sizeof (DES_cblock));
38
+	      memcpy (key->ki.triple_des.k3, &_key[2], sizeof (DES_cblock));
39
 	      break;
40
 	    }
41
 #ifdef AES_ENC_ENABLE
42
@@ -2084,7 +2084,7 @@
43
 int __xenc_key_3des_init (char *name, char *pwd, int lock)
44
 {
45
   char _key[KEYSIZB+1];
46
-  des_cblock key[3];
47
+  DES_cblock key[3];
48
 
49
   xenc_key_t * pkey = xenc_get_key_by_name (name, lock);
50
   if (NULL == pkey)
51
@@ -2104,13 +2104,13 @@
52
 	(unsigned char *)_key,
53
 	strlen(_key), 1, (unsigned char*) &key[0], pkey->ki.triple_des.iv);
54
 
55
-  des_set_key_unchecked(&key[0], pkey->ki.triple_des.ks1);
56
-  des_set_key_unchecked(&key[1], pkey->ki.triple_des.ks2);
57
-  des_set_key_unchecked(&key[2], pkey->ki.triple_des.ks3);
58
-
59
-  memcpy (pkey->ki.triple_des.k1, &key[0], sizeof (des_cblock));
60
-  memcpy (pkey->ki.triple_des.k2, &key[1], sizeof (des_cblock));
61
-  memcpy (pkey->ki.triple_des.k3, &key[2], sizeof (des_cblock));
62
+  DES_set_key_unchecked(&key[0], &pkey->ki.triple_des.ks1);
63
+  DES_set_key_unchecked(&key[1], &pkey->ki.triple_des.ks2);
64
+  DES_set_key_unchecked(&key[2], &pkey->ki.triple_des.ks3);
65
+
66
+  memcpy (pkey->ki.triple_des.k1, &key[0], sizeof (DES_cblock));
67
+  memcpy (pkey->ki.triple_des.k2, &key[1], sizeof (DES_cblock));
68
+  memcpy (pkey->ki.triple_des.k3, &key[2], sizeof (DES_cblock));
69
 
70
   xenc_store_key (pkey, lock);
71
   return 0;
72
@@ -2118,13 +2118,13 @@
73
 
74
 void xenc_key_3des_init (xenc_key_t * pkey, unsigned char * k1, unsigned char * k2, unsigned char * k3)
75
 {
76
-  memcpy (pkey->ki.triple_des.k1, k1, sizeof (des_cblock));
77
-  memcpy (pkey->ki.triple_des.k2, k2, sizeof (des_cblock));
78
-  memcpy (pkey->ki.triple_des.k3, k3, sizeof (des_cblock));
79
-
80
-  des_set_key_unchecked((const_des_cblock*) k1, pkey->ki.triple_des.ks1);
81
-  des_set_key_unchecked((const_des_cblock*) k2, pkey->ki.triple_des.ks2);
82
-  des_set_key_unchecked((const_des_cblock*) k3, pkey->ki.triple_des.ks3);
83
+  memcpy (pkey->ki.triple_des.k1, k1, sizeof (DES_cblock));
84
+  memcpy (pkey->ki.triple_des.k2, k2, sizeof (DES_cblock));
85
+  memcpy (pkey->ki.triple_des.k3, k3, sizeof (DES_cblock));
86
+
87
+  DES_set_key_unchecked((const_DES_cblock*) k1, &pkey->ki.triple_des.ks1);
88
+  DES_set_key_unchecked((const_DES_cblock*) k2, &pkey->ki.triple_des.ks2);
89
+  DES_set_key_unchecked((const_DES_cblock*) k3, &pkey->ki.triple_des.ks3);
90
 }
91
 
92
 
93
@@ -2156,20 +2156,20 @@
94
 {
95
   caddr_t name = bif_key_name_arg (qst, args, 0, "xenc_key_3DES_rand_create");
96
   xenc_key_t * k = 0;
97
-  des_cblock k1;
98
-  des_cblock k2;
99
-  des_cblock k3;
100
-  des_key_schedule ks1;
101
-  des_key_schedule ks2;
102
-  des_key_schedule ks3;
103
-
104
-  des_random_key (&k1);
105
-  des_random_key (&k2);
106
-  des_random_key (&k3);
107
-
108
-  if ( (des_set_key_checked (&k1, ks1) < 0) ||
109
-       (des_set_key_checked (&k2, ks2) < 0) ||
110
-       (des_set_key_checked (&k3, ks3) < 0) )
111
+  DES_cblock k1;
112
+  DES_cblock k2;
113
+  DES_cblock k3;
114
+  DES_key_schedule ks1;
115
+  DES_key_schedule ks2;
116
+  DES_key_schedule ks3;
117
+
118
+  DES_random_key (&k1);
119
+  DES_random_key (&k2);
120
+  DES_random_key (&k3);
121
+
122
+  if ( (DES_set_key_checked (&k1, &ks1) < 0) ||
123
+       (DES_set_key_checked (&k2, &ks2) < 0) ||
124
+       (DES_set_key_checked (&k3, &ks3) < 0) )
125
     GPF_T; /* parity check failed, library error - could not check result of it's own work */
126
 
127
   mutex_enter (xenc_keys_mtx);
128
@@ -2180,13 +2180,13 @@
129
       mutex_leave (xenc_keys_mtx);
130
       SQLR_NEW_KEY_EXIST_ERROR (name);
131
     }
132
-  memcpy (&k->ki.triple_des.k1, &k1, sizeof (des_cblock));
133
-  memcpy (&k->ki.triple_des.k2, &k2, sizeof (des_cblock));
134
-  memcpy (&k->ki.triple_des.k3, &k3, sizeof (des_cblock));
135
-
136
-  memcpy (&k->ki.triple_des.ks1, &ks1, sizeof (des_key_schedule));
137
-  memcpy (&k->ki.triple_des.ks2, &ks2, sizeof (des_key_schedule));
138
-  memcpy (&k->ki.triple_des.ks3, &ks3, sizeof (des_key_schedule));
139
+  memcpy (&k->ki.triple_des.k1, &k1, sizeof (DES_cblock));
140
+  memcpy (&k->ki.triple_des.k2, &k2, sizeof (DES_cblock));
141
+  memcpy (&k->ki.triple_des.k3, &k3, sizeof (DES_cblock));
142
+
143
+  memcpy (&k->ki.triple_des.ks1, &ks1, sizeof (DES_key_schedule));
144
+  memcpy (&k->ki.triple_des.ks2, &ks2, sizeof (DES_key_schedule));
145
+  memcpy (&k->ki.triple_des.ks3, &ks3, sizeof (DES_key_schedule));
146
 
147
   mutex_leave (xenc_keys_mtx);
148
 
149
@@ -2594,9 +2594,9 @@
150
 
151
   if (k->xek_type == DSIG_KEY_3DES)
152
     {
153
-      memcpy (in_buf, k->ki.triple_des.k1, sizeof (des_cblock));
154
-      memcpy (in_buf + sizeof (des_cblock), k->ki.triple_des.k2, sizeof (des_cblock));
155
-      memcpy (in_buf + 2*sizeof (des_cblock), k->ki.triple_des.k3, sizeof (des_cblock));
156
+      memcpy (in_buf, k->ki.triple_des.k1, sizeof (DES_cblock));
157
+      memcpy (in_buf + sizeof (DES_cblock), k->ki.triple_des.k2, sizeof (DES_cblock));
158
+      memcpy (in_buf + 2*sizeof (DES_cblock), k->ki.triple_des.k3, sizeof (DES_cblock));
159
     }
160
   else if (k->xek_type == DSIG_KEY_RSA)
161
     {
162
@@ -6018,7 +6018,7 @@
163
       xenc_des3_decryptor (out, strses_length (out), in, key, &t);
164
       key_data_2 = strses_string (in);
165
 
166
-      if (memcmp (key_data, key_data_2, 3 * sizeof (des_cblock)))
167
+      if (memcmp (key_data, key_data_2, 3 * sizeof (DES_cblock)))
168
 	xenc_assert (0);
169
       dk_free_box (key_data_2);
170
       dk_free_box (key_data);
171
@@ -6026,13 +6026,13 @@
172
       new_key = xenc_build_encrypted_key ("virtdev_test_rest", in, XENC_TRIPLEDES_ALGO, &t);
173
 
174
       if (memcmp (new_key->ki.triple_des.k1,
175
-		  key->ki.triple_des.k1, sizeof (des_cblock)))
176
+		  key->ki.triple_des.k1, sizeof (DES_cblock)))
177
 	xenc_assert (0);
178
       if (memcmp (new_key->ki.triple_des.k2,
179
-		  key->ki.triple_des.k2, sizeof (des_cblock)))
180
+		  key->ki.triple_des.k2, sizeof (DES_cblock)))
181
 	xenc_assert (0);
182
       if (memcmp (new_key->ki.triple_des.k3,
183
-		  key->ki.triple_des.k3, sizeof (des_cblock)))
184
+		  key->ki.triple_des.k3, sizeof (DES_cblock)))
185
 	xenc_assert (0);
186
 
187
       strses_flush (in);
(-)databases/virtuoso/files/patch-libsrc_Wi_xmlenc.h (+26 lines)
Line 0 Link Here
1
--- libsrc/Wi/xmlenc.h.orig	2014-02-17 18:33:14.000000000 +0100
2
+++ libsrc/Wi/xmlenc.h	2015-02-25 21:57:27.433398091 +0100
3
@@ -312,15 +312,15 @@
4
     } dsa;
5
     struct dsig_des3_keyinfo_s
6
     {
7
-      des_cblock k1;
8
-      des_cblock k2;
9
-      des_cblock k3;
10
-
11
-      des_key_schedule ks1;/* key schedule */
12
-      des_key_schedule ks2;/* key schedule (for ede) */
13
-      des_key_schedule ks3;/* key schedule (for ede3) */
14
+      DES_cblock k1;
15
+      DES_cblock k2;
16
+      DES_cblock k3;
17
+
18
+      DES_key_schedule ks1;/* key schedule */
19
+      DES_key_schedule ks2;/* key schedule (for ede) */
20
+      DES_key_schedule ks3;/* key schedule (for ede3) */
21
 
22
-      des_cblock iv;
23
+      DES_cblock iv;
24
 #define PKCS5_SALT_LEN			8
25
       unsigned char salt[PKCS5_SALT_LEN];
26
     } triple_des;
(-)databases/virtuoso/files/patch-libsrc_Wi_xmlenc_algos.c (+133 lines)
Line 0 Link Here
1
--- libsrc/Wi/xmlenc_algos.c.orig	2014-02-17 18:33:14.000000000 +0100
2
+++ libsrc/Wi/xmlenc_algos.c	2015-02-27 20:33:18.743456726 +0100
3
@@ -1162,10 +1162,10 @@
4
   switch (key->xek_type)
5
     {
6
       case DSIG_KEY_3DES:
7
-	  memcpy (key_data, key->ki.triple_des.k1, sizeof (des_cblock));
8
-	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (des_cblock));
9
-	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (des_cblock));
10
-	  key_len = 3 * sizeof (des_cblock);
11
+	  memcpy (key_data, key->ki.triple_des.k1, sizeof (DES_cblock));
12
+	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (DES_cblock));
13
+	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (DES_cblock));
14
+	  key_len = 3 * sizeof (DES_cblock);
15
 	  break;
16
 #ifdef AES_ENC_ENABLE
17
       case DSIG_KEY_AES:
18
@@ -1234,10 +1234,10 @@
19
   switch (key->xek_type)
20
     {
21
       case DSIG_KEY_3DES:
22
-	  memcpy (key_data, key->ki.triple_des.k1, sizeof (des_cblock));
23
-	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (des_cblock));
24
-	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (des_cblock));
25
-	  key_len = 3 * sizeof (des_cblock);
26
+	  memcpy (key_data, key->ki.triple_des.k1, sizeof (DES_cblock));
27
+	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (DES_cblock));
28
+	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (DES_cblock));
29
+	  key_len = 3 * sizeof (DES_cblock);
30
 	  break;
31
 #ifdef AES_ENC_ENABLE
32
       case DSIG_KEY_AES:
33
@@ -1599,10 +1599,10 @@
34
   switch (key->xek_type)
35
     {
36
       case DSIG_KEY_3DES:
37
-	  memcpy (key_data, key->ki.triple_des.k1, sizeof (des_cblock));
38
-	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (des_cblock));
39
-	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (des_cblock));
40
-	  key_len = 3 * sizeof (des_cblock);
41
+	  memcpy (key_data, key->ki.triple_des.k1, sizeof (DES_cblock));
42
+	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (DES_cblock));
43
+	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (DES_cblock));
44
+	  key_len = 3 * sizeof (DES_cblock);
45
 	  break;
46
 #ifdef AES_ENC_ENABLE
47
       case DSIG_KEY_AES:
48
@@ -1671,10 +1671,10 @@
49
   switch (key->xek_type)
50
     {
51
       case DSIG_KEY_3DES:
52
-	  memcpy (key_data, key->ki.triple_des.k1, sizeof (des_cblock));
53
-	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (des_cblock));
54
-	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (des_cblock));
55
-	  key_len = 3 * sizeof (des_cblock);
56
+	  memcpy (key_data, key->ki.triple_des.k1, sizeof (DES_cblock));
57
+	  memcpy (key_data + 8, key->ki.triple_des.k2, sizeof (DES_cblock));
58
+	  memcpy (key_data + 16, key->ki.triple_des.k3, sizeof (DES_cblock));
59
+	  key_len = 3 * sizeof (DES_cblock);
60
 	  break;
61
 #ifdef AES_ENC_ENABLE
62
       case DSIG_KEY_AES:
63
@@ -2245,13 +2245,13 @@
64
 	}
65
 
66
 
67
-      des_ede3_cbc_encrypt ((const unsigned char *)buf,
68
+      DES_ede3_cbc_encrypt ((const unsigned char *)buf,
69
 		(unsigned char *)out_buf,
70
 		(long)DES_BLOCK_LEN,
71
-		key->ki.triple_des.ks1,
72
-		key->ki.triple_des.ks2,
73
-		key->ki.triple_des.ks3,
74
-		(des_cblock*) _iv,
75
+		&key->ki.triple_des.ks1,
76
+		&key->ki.triple_des.ks2,
77
+		&key->ki.triple_des.ks3,
78
+		(DES_cblock*) _iv,
79
 		DES_ENCRYPT);
80
       total_blocks++;
81
 
82
@@ -2315,7 +2315,7 @@
83
   char *text, *text_beg;
84
   dk_session_t *ses_in;
85
   long text_len;
86
-  des_cblock iv;
87
+  DES_cblock iv;
88
 
89
   if (!seslen)
90
     return 0;
91
@@ -2357,12 +2357,12 @@
92
   END_READ_FAIL (ses_in);
93
   for (;!failed;)
94
     {
95
-      des_ede3_cbc_encrypt ((const unsigned char *)buf,
96
+      DES_ede3_cbc_encrypt ((const unsigned char *)buf,
97
 	(unsigned char *)out_buf,
98
 	(long)DES_BLOCK_LEN,
99
-	key->ki.triple_des.ks1,
100
-	key->ki.triple_des.ks2,
101
-	key->ki.triple_des.ks3,
102
+	&key->ki.triple_des.ks1,
103
+	&key->ki.triple_des.ks2,
104
+	&key->ki.triple_des.ks3,
105
 	&iv,
106
 	DES_DECRYPT);
107
       CATCH_READ_FAIL (ses_in)
108
@@ -2409,7 +2409,7 @@
109
   char out_buf[DES_BLOCK_LEN + 1];
110
   char *text, *text_beg;
111
   long text_len;
112
-  des_cblock iv;
113
+  DES_cblock iv;
114
   int blocks;
115
 
116
   if (!seslen)
117
@@ -2445,12 +2445,12 @@
118
       memcpy (buf, text, DES_BLOCK_LEN);
119
       text += DES_BLOCK_LEN;
120
 
121
-      des_ede3_cbc_encrypt ((const unsigned char *)buf,
122
+      DES_ede3_cbc_encrypt ((const unsigned char *)buf,
123
 	(unsigned char *)out_buf,
124
 	(long)DES_BLOCK_LEN,
125
-	key->ki.triple_des.ks1,
126
-	key->ki.triple_des.ks2,
127
-	key->ki.triple_des.ks3,
128
+	&key->ki.triple_des.ks1,
129
+	&key->ki.triple_des.ks2,
130
+	&key->ki.triple_des.ks3,
131
 	&iv,
132
 	DES_DECRYPT);
133
 

Return to bug 198368