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