Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 magnus 1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## nettle_2.0.dpatch by Magnus Holmgren <holmgren@debian.org>
3
##
4
## DP: Adapt to Nettle 2.0
5
 
6
@DPATCH@
7
diff -ur lsh-2.0.4/src/crypto.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/crypto.c
8
--- lsh-2.0.4/src/crypto.c	2005-11-26 18:13:55.000000000 +0100
9
+++ lsh-utils-2.0.4-dfsg/src/crypto.c	2009-08-04 23:57:22.000000000 +0200
10
@@ -71,7 +71,7 @@
11
   assert(!(length % 8));
12
 
13
   lsh_string_crypt(dst, di, src, si, length,
14
-		   (nettle_crypt_func) arcfour_crypt, &self->ctx);
15
+		   (nettle_crypt_func*) arcfour_crypt, &self->ctx);
16
 }
17
 
18
 static struct crypto_instance *
19
@@ -114,7 +114,7 @@
20
 
21
   lsh_string_cbc_encrypt(dst, di, src, si, length,
22
 			 AES_BLOCK_SIZE, self->ctx.iv,
23
-			 (nettle_crypt_func) aes_encrypt,
24
+			 (nettle_crypt_func*) aes_encrypt,
25
 			 &self->ctx.ctx);
26
 }
27
 
28
@@ -128,7 +128,7 @@
29
 
30
   lsh_string_cbc_decrypt(dst, di, src, si, length,
31
 			 AES_BLOCK_SIZE, self->ctx.iv,
32
-			 (nettle_crypt_func) aes_decrypt,
33
+			 (nettle_crypt_func*) aes_decrypt,
34
 			 &self->ctx.ctx);
35
 }
36
 
37
@@ -185,7 +185,7 @@
38
 
39
   lsh_string_ctr_crypt(dst, di, src, si, length,
40
 		       AES_BLOCK_SIZE, self->ctx.ctr,
41
-		       (nettle_crypt_func) aes_encrypt,
42
+		       (nettle_crypt_func*) aes_encrypt,
43
 		       &self->ctx.ctx);
44
 }
45
 
46
@@ -227,7 +227,7 @@
47
 
48
   lsh_string_cbc_encrypt(dst, di, src, si, length,
49
 			 DES3_BLOCK_SIZE, self->ctx.iv,
50
-			 (nettle_crypt_func) des3_encrypt,
51
+			 (nettle_crypt_func*) des3_encrypt,
52
 			 &self->ctx.ctx);
53
 }
54
 
55
@@ -241,7 +241,7 @@
56
 
57
   lsh_string_cbc_decrypt(dst, di, src, si, length,
58
 			 DES3_BLOCK_SIZE, self->ctx.iv,
59
-			 (nettle_crypt_func) des3_decrypt,
60
+			 (nettle_crypt_func*) des3_decrypt,
61
 			 &self->ctx.ctx);
62
 }
63
 
64
@@ -303,7 +303,7 @@
65
 
66
   lsh_string_cbc_encrypt(dst, di, src, si, length,
67
 			 CAST128_BLOCK_SIZE, self->ctx.iv,
68
-			 (nettle_crypt_func) cast128_encrypt,
69
+			 (nettle_crypt_func*) cast128_encrypt,
70
 			 &self->ctx.ctx);
71
 }
72
 
73
@@ -317,7 +317,7 @@
74
 
75
   lsh_string_cbc_decrypt(dst, di, src, si, length,
76
 			 CAST128_BLOCK_SIZE, self->ctx.iv,
77
-			 (nettle_crypt_func) cast128_decrypt,
78
+			 (nettle_crypt_func*) cast128_decrypt,
79
 			 &self->ctx.ctx);
80
 }
81
 
82
@@ -363,7 +363,7 @@
83
 
84
   lsh_string_cbc_encrypt(dst, di, src, si, length,
85
 			 TWOFISH_BLOCK_SIZE, self->ctx.iv,
86
-			 (nettle_crypt_func) twofish_encrypt,
87
+			 (nettle_crypt_func*) twofish_encrypt,
88
 			 &self->ctx.ctx);
89
 }
90
 
91
@@ -377,7 +377,7 @@
92
 
93
   lsh_string_cbc_decrypt(dst, di, src, si, length,
94
 			 TWOFISH_BLOCK_SIZE, self->ctx.iv,
95
-			 (nettle_crypt_func) twofish_decrypt,
96
+			 (nettle_crypt_func*) twofish_decrypt,
97
 			 &self->ctx.ctx);
98
 }
99
 
100
@@ -422,7 +422,7 @@
101
 
102
   lsh_string_cbc_encrypt(dst, di, src, si, length,
103
 			 BLOWFISH_BLOCK_SIZE, self->ctx.iv,
104
-			 (nettle_crypt_func) blowfish_encrypt,
105
+			 (nettle_crypt_func*) blowfish_encrypt,
106
 			 &self->ctx.ctx);
107
 }
108
 
109
@@ -436,7 +436,7 @@
110
 
111
   lsh_string_cbc_decrypt(dst, di, src, si, length,
112
 			 BLOWFISH_BLOCK_SIZE, self->ctx.iv,
113
-			 (nettle_crypt_func) blowfish_decrypt,
114
+			 (nettle_crypt_func*) blowfish_decrypt,
115
 			 &self->ctx.ctx);
116
 }
117
 
118
@@ -488,7 +488,7 @@
119
 
120
   lsh_string_cbc_encrypt(dst, di, src, si, length,
121
 			 SERPENT_BLOCK_SIZE, self->ctx.iv,
122
-			 (nettle_crypt_func) serpent_encrypt,
123
+			 (nettle_crypt_func*) serpent_encrypt,
124
 			 &self->ctx.ctx);
125
 }
126
 
127
@@ -502,7 +502,7 @@
128
 
129
   lsh_string_cbc_decrypt(dst, di, src, si, length,
130
 			 SERPENT_BLOCK_SIZE, self->ctx.iv,
131
-			 (nettle_crypt_func) serpent_decrypt,
132
+			 (nettle_crypt_func*) serpent_decrypt,
133
 			 &self->ctx.ctx);
134
 }
135
 
136
diff -ur lsh-2.0.4/src/lsh-make-seed.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/lsh-make-seed.c
137
--- lsh-2.0.4/src/lsh-make-seed.c	2006-01-23 18:51:06.000000000 +0100
138
+++ lsh-utils-2.0.4-dfsg/src/lsh-make-seed.c	2009-08-05 00:24:58.000000000 +0200
139
@@ -1219,6 +1219,7 @@
140
 
141
   struct yarrow256_ctx yarrow;
142
   struct yarrow_source sources[NSOURCES];
143
+  uint8_t seed[YARROW256_SEED_FILE_SIZE];
144
 
145
   argp_parse(&main_argp, argc, argv, 0, NULL, options);
146
 
147
@@ -1371,7 +1372,8 @@
148
 	}
149
     }
150
 
151
-  e = write_raw(fd, sizeof(yarrow.seed_file), yarrow.seed_file);
152
+  yarrow256_random(&yarrow, sizeof(seed), seed);
153
+  e = write_raw(fd, sizeof(seed), seed);
154
 
155
   if (e)
156
     {
157
diff -ur lsh-2.0.4/src/unix_random.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/unix_random.c
158
--- lsh-2.0.4/src/unix_random.c	2006-01-23 18:47:10.000000000 +0100
159
+++ lsh-utils-2.0.4-dfsg/src/unix_random.c	2009-08-05 00:28:31.000000000 +0200
160
@@ -81,6 +81,7 @@
161
 	       int fd)
162
 {
163
   const struct exception *e;
164
+  uint8_t seed[YARROW256_SEED_FILE_SIZE];
165
 
166
   if (lseek(fd, 0, SEEK_SET) < 0)
167
     {
168
@@ -88,7 +89,8 @@
169
       return 0;
170
     }
171
 
172
-  e = write_raw(fd, YARROW256_SEED_FILE_SIZE, ctx->seed_file);
173
+  yarrow256_random(ctx, sizeof(seed), seed);
174
+  e = write_raw(fd, sizeof(seed), seed);
175
 
176
   if (e)
177
     {
178
@@ -183,17 +183,19 @@
179
     {
180
       struct lsh_string *s = read_seed_file(self->seed_file_fd);
181
 
182
-      write_seed_file(&self->yarrow, self->seed_file_fd);
183
-      KILL_RESOURCE(lock);
184
-
185
       /* Mix in the old seed file, it might have picked up
186
        * some randomness. */
187
       if (s)
188
 	{
189
+	  self->yarrow.sources[RANDOM_SOURCE_NEW_SEED].next = YARROW_FAST;
190
 	  yarrow256_update(&self->yarrow, RANDOM_SOURCE_NEW_SEED,
191
 			   0, STRING_LD(s));
192
 	  lsh_string_free(s);
193
+	  yarrow256_fast_reseed(&self->yarrow);
194
 	}
195
+
196
+      write_seed_file(&self->yarrow, self->seed_file_fd);
197
+      KILL_RESOURCE(lock);
198
     }
199
 }
200