Subversion Repositories

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

Rev 133 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
131 magnus 1
Description: Support Nettle 3.x
2
Author: Magnus Holmgren <holmgren@debian.org>
3
Forwarded: yes
4
 
5
--- a/src/spki/verify.c
6
+++ b/src/spki/verify.c
7
@@ -25,7 +25,7 @@
8
 #endif
9
 
10
 #include <nettle/bignum.h>
11
-#include <nettle/dsa.h>
12
+#include <nettle/dsa-compat.h>
13
 #include <nettle/rsa.h>
14
 
15
 #include "certificate.h"
16
@@ -74,7 +74,7 @@ spki_verify_dsa(const uint8_t *digest,
17
   dsa_public_key_init(&dsa);
18
   dsa_signature_init(&rs);
19
 
20
-  res = (dsa_keypair_from_sexp_alist(&dsa, NULL,
133 magnus 21
+  res = (dsa_keypair_from_sexp_alist((struct dsa_params *)&dsa, dsa.y, NULL,
131 magnus 22
                                     RSA_KEYSIZE_LIMIT, DSA_SHA1_Q_BITS, &key->sexp)
23
         && spki_parse_type(key)
24
         && dsa_signature_from_sexp(&rs, &signature->sexp, DSA_SHA1_Q_BITS)
25
--- a/src/crypto.c
26
+++ b/src/crypto.c
27
@@ -322,7 +322,7 @@ make_cast128_cbc_instance(struct crypto_
28
                        ? do_cast128_encrypt
29
                        : do_cast128_decrypt);
30
 
31
-  cast128_set_key(&self->ctx.ctx, algorithm->key_size, key);
32
+  cast5_set_key(&self->ctx.ctx, algorithm->key_size, key);
33
   CBC_SET_IV(&self->ctx, iv);
34
 
35
   return(&self->super);
36
--- a/src/dsa.c
37
+++ b/src/dsa.c
38
@@ -28,7 +28,7 @@
39
 #include <assert.h>
40
 
41
 #include <nettle/bignum.h>
42
-#include <nettle/dsa.h>
43
+#include <nettle/dsa-compat.h>
44
 #include <nettle/sexp.h>
45
 #include <nettle/sha.h>
46
 
47
@@ -322,7 +322,7 @@ make_dsa_verifier(struct signature_algor
48
   NEW(dsa_verifier, res);
49
   init_dsa_verifier(res);
50
 
51
-  if (dsa_keypair_from_sexp_alist(&res->key, NULL, DSA_MAX_BITS, DSA_SHA1_Q_BITS, i))
52
+  if (dsa_keypair_from_sexp_alist((struct dsa_params *)&res->key, res->key.y, NULL, DSA_MAX_BITS, DSA_SHA1_Q_BITS, i))
53
     return &res->super;
54
 
55
   KILL(res);
56
@@ -341,7 +341,7 @@ make_dsa_signer(struct signature_algorit
57
 
58
   dsa_private_key_init(&res->key);
59
 
60
-  if (dsa_keypair_from_sexp_alist(&verifier->key, &res->key, DSA_MAX_BITS, DSA_SHA1_Q_BITS, i))
61
+  if (dsa_keypair_from_sexp_alist((struct dsa_params *)&verifier->key, verifier->key.y, res->key.x, DSA_MAX_BITS, DSA_SHA1_Q_BITS, i))
62
     {
63
       res->random = self->random;
64
       res->verifier = verifier;
65
--- a/src/dummy.c
66
+++ b/src/dummy.c
67
@@ -41,84 +41,84 @@
68
 #include "lsh.h"
69
 
70
 /* Referenced by ssh_format.c */
71
-unsigned
72
+size_t
73
 nettle_mpz_sizeinbase_256_s(const mpz_t x UNUSED)
74
 { abort(); }
75
 
76
-unsigned
77
+size_t
78
 nettle_mpz_sizeinbase_256_u(const mpz_t x UNUSED)
79
 { abort(); }
80
 
81
 void
82
-cbc_encrypt(void *ctx UNUSED, nettle_crypt_func f UNUSED,
83
-           unsigned block_size UNUSED, uint8_t *iv UNUSED,
84
-           unsigned length UNUSED, uint8_t *dst UNUSED,
85
+cbc_encrypt(const void *ctx UNUSED, nettle_cipher_func *f UNUSED,
86
+           size_t block_size UNUSED, uint8_t *iv UNUSED,
87
+           size_t length UNUSED, uint8_t *dst UNUSED,
88
            const uint8_t *src UNUSED)
89
 { abort(); }
90
 
91
 void
92
-cbc_decrypt(void *ctx UNUSED, nettle_crypt_func f UNUSED,
93
-           unsigned block_size UNUSED, uint8_t *iv UNUSED,
94
-           unsigned length UNUSED, uint8_t *dst UNUSED,
95
+cbc_decrypt(const void *ctx UNUSED, nettle_cipher_func *f UNUSED,
96
+           size_t block_size UNUSED, uint8_t *iv UNUSED,
97
+           size_t length UNUSED, uint8_t *dst UNUSED,
98
            const uint8_t *src UNUSED)
99
 { abort(); }
100
 
101
 void
102
-ctr_crypt(void *ctx UNUSED, nettle_crypt_func f UNUSED,
103
-         unsigned block_size UNUSED, uint8_t *iv UNUSED,
104
-         unsigned length UNUSED, uint8_t *dst UNUSED,
105
+ctr_crypt(const void *ctx UNUSED, nettle_cipher_func *f UNUSED,
106
+         size_t block_size UNUSED, uint8_t *iv UNUSED,
107
+         size_t length UNUSED, uint8_t *dst UNUSED,
108
          const uint8_t *src UNUSED)
109
 { abort(); }
110
 
111
 void
112
 hmac_digest(const void *outer UNUSED, const void *inner UNUSED, void *state UNUSED,
113
            const struct nettle_hash *hash UNUSED,
114
-           unsigned length UNUSED, uint8_t *digest UNUSED)
115
+           size_t length UNUSED, uint8_t *digest UNUSED)
116
 { abort(); }
117
 
118
-unsigned
119
+size_t
120
 sexp_vformat(struct nettle_buffer *buffer UNUSED,
121
             const char *format UNUSED, va_list args UNUSED)
122
 { abort(); }
123
 
124
-unsigned
125
+size_t
126
 sexp_transport_vformat(struct nettle_buffer *buffer UNUSED,
127
                       const char *format UNUSED, va_list args UNUSED)
128
 { abort(); }
129
 
130
 int
131
 sexp_transport_iterator_first(struct sexp_iterator *iterator UNUSED,
132
-                             unsigned length UNUSED, uint8_t *input UNUSED)
133
+                             size_t length UNUSED, uint8_t *input UNUSED)
134
 { abort(); }
135
 
136
 void
137
 nettle_buffer_init_size(struct nettle_buffer *buffer UNUSED,
138
-                       unsigned length UNUSED, uint8_t *space UNUSED)
139
+                       size_t length UNUSED, uint8_t *space UNUSED)
140
 
141
 { abort(); }
142
 
143
 
144
 /* Referenced by lsh_string.c */
145
-uint8_t *
146
-memxor(uint8_t *dst UNUSED, const uint8_t *src UNUSED, size_t n UNUSED)
147
+void *
148
+memxor(void *dst UNUSED, const void *src UNUSED, size_t n UNUSED)
149
 { abort(); }
150
 
151
 void
152
-nettle_mpz_get_str_256(unsigned length UNUSED, uint8_t *s UNUSED, const mpz_t x UNUSED)
153
+nettle_mpz_get_str_256(size_t length UNUSED, uint8_t *s UNUSED, const mpz_t x UNUSED)
154
 { abort(); }
155
 
156
 void
157
 base64_encode_init(struct base64_encode_ctx *ctx UNUSED)
158
 { abort(); }
159
 
160
-unsigned
161
+size_t
162
 base64_encode_update(struct base64_encode_ctx *ctx UNUSED,
163
                     uint8_t *dst UNUSED,
164
-                    unsigned length UNUSED,
165
+                    size_t length UNUSED,
166
                     const uint8_t *src UNUSED)
167
 { abort(); }
168
 
169
-unsigned
170
+size_t
171
 base64_encode_final(struct base64_encode_ctx *ctx UNUSED,
172
                    uint8_t *dst UNUSED)
173
 { abort(); }
174
@@ -129,9 +129,9 @@ base64_decode_init(struct base64_decode_
175
 
176
 int
177
 base64_decode_update(struct base64_decode_ctx *ctx UNUSED,
178
-                    unsigned *dst_length UNUSED,
179
+                    size_t *dst_length UNUSED,
180
                     uint8_t *dst UNUSED,
181
-                    unsigned src_length UNUSED,
182
+                    size_t src_length UNUSED,
183
                     const uint8_t *src UNUSED)
184
 { abort(); }
185
 
186
@@ -142,7 +142,7 @@ base64_decode_final(struct base64_decode
187
 /* Referenced by parse.c */
188
 void
189
 nettle_mpz_set_str_256_s(mpz_t x UNUSED,
190
-                        unsigned length UNUSED, const uint8_t *s UNUSED)
191
+                        size_t length UNUSED, const uint8_t *s UNUSED)
192
 { abort(); }
193
 
194
 /* Referenced by werror.c */
195
--- a/src/lsh-keygen.c
196
+++ b/src/lsh-keygen.c
197
@@ -39,7 +39,7 @@
198
 #include <unistd.h>
199
 #endif
200
 
201
-#include <nettle/dsa.h>
202
+#include <nettle/dsa-compat.h>
203
 #include <nettle/rsa.h>
204
 
205
 #include "crypto.h"
206
@@ -214,7 +214,7 @@ dsa_generate_key(struct randomness *r, u
207
 
208
   assert(r->quality == RANDOM_GOOD);
209
 
210
-  if (dsa_generate_keypair(&public, &private,
211
+  if (dsa_compat_generate_keypair(&public, &private,
212
                           r, lsh_random,
213
                           NULL, progress,
214
                           512 + 64 * level, DSA_SHA1_Q_BITS))
133 magnus 215
--- a/src/lsh_string.c
216
+++ b/src/lsh_string.c
217
@@ -367,10 +367,10 @@ lsh_string_format_sexp(int transport, co
218
 {
219
   struct lsh_string *s;
220
   va_list args;
221
-  unsigned length;
222
+  size_t length;
223
   struct nettle_buffer buffer;
224
 
225
-  unsigned (*vformat)(struct nettle_buffer *, const char *, va_list)
226
+  size_t (*vformat)(struct nettle_buffer *, const char *, va_list)
227
     = transport ? sexp_transport_vformat : sexp_vformat;
228
 
229
   va_start(args, format);
230
@@ -415,7 +415,7 @@ int
231
 lsh_string_base64_decode(struct lsh_string *s)
232
 {
233
   struct base64_decode_ctx ctx;
234
-  uint32_t done = s->length;
235
+  size_t done = s->length;
236
 
237
   base64_decode_init(&ctx);
238
 
239
--- a/src/randomness.c
240
+++ b/src/randomness.c
241
@@ -35,7 +35,7 @@
242
 /* Wrapper for using lsh's randomness generator with nettle
243
  * functions. */
244
 void
245
-lsh_random(void *x, unsigned length, uint8_t *data)
246
+lsh_random(void *x, size_t length, uint8_t *data)
247
 {
248
   CAST_SUBTYPE(randomness, r, x);
249
   RANDOM(r, length, data);
250
--- a/src/randomness.h
251
+++ b/src/randomness.h
252
@@ -84,6 +84,6 @@ make_system_random(void);
253
 
254
 /* Randomness function matching nettle's expectations. */
255
 void
256
-lsh_random(void *x, unsigned length, uint8_t *data);
257
+lsh_random(void *x, size_t length, uint8_t *data);
258
 
259
 #endif /* LSH_RANDOMNESS_H_INCLUDED */
260
--- a/src/sexp.c
261
+++ b/src/sexp.c
262
@@ -97,7 +97,7 @@ lsh_sexp_to_string(struct sexp_iterator
263
 struct lsh_string *
264
 lsh_sexp_copy(struct sexp_iterator *i)
265
 {
266
-  unsigned length;
267
+  size_t length;
268
   const uint8_t *subexpr = sexp_iterator_subexpr(i, &length);
269
 
270
   return subexpr ? ssh_format("%ls", length, subexpr) : NULL;
138 magnus 271
--- a/src/lsh.c
272
+++ b/src/lsh.c
273
@@ -524,8 +524,8 @@ do_lsh_lookup(struct lookup_verifier *c,
274
        }
275
 
276
       acl = lsh_string_format_sexp(0, "(acl(entry(subject%l)%l))",
277
-                                  subject->key_length, subject->key,
278
-                                  STRING_LD(self->access));
279
+                                  (size_t)subject->key_length, subject->key,
280
+                                  (size_t)STRING_LD(self->access));
281
 
282
       /* FIXME: Seems awkward to pick the acl apart again. */
283
       if (!spki_iterator_first(&i, STRING_LD(acl)))
284
@@ -540,7 +540,7 @@ do_lsh_lookup(struct lookup_verifier *c,
285
          A_WRITE(self->file,
286
                  ssh_format("\n; ACL for host %lz\n"
287
                             "%lfS\n",
288
-                            self->host, lsh_string_format_sexp(1, "%l", STRING_LD(acl))));
289
+                            self->host, lsh_string_format_sexp(1, "%l", (size_t)STRING_LD(acl))));
290
 
291
          lsh_string_free(acl);
292
        }
293
--- a/src/spki.c
294
+++ b/src/spki.c
295
@@ -98,7 +98,7 @@ make_ssh_hostkey_tag(const char *host)
296
     }
297
 
298
   tag = lsh_string_format_sexp(0, "(tag(ssh-hostkey%s))",
299
-                              STRING_LD(reversed));
300
+                              (size_t)STRING_LD(reversed));
301
   lsh_string_free(reversed);
302
 
303
   return tag;
304
@@ -207,7 +207,7 @@ spki_hash_data(const struct hash_algorit
305
 
306
   out = lsh_string_format_sexp(0, "(hash%0s%s)",
307
                               "hash", get_atom_name(algorithm_name),
308
-                              STRING_LD(digest));
309
+                              (size_t)STRING_LD(digest));
310
   KILL(hash);
311
   lsh_string_free(digest);
312
 
313
@@ -376,13 +376,13 @@ spki_pkcs5_encrypt(struct randomness *r,
314
   value = lsh_string_format_sexp(0, "(password-encrypted%s(Xpkcs5v2%0s"
315
                                 "(iterations%i)(salt%s))"
316
                                 "(%0s(iv%s)(data%s)))",
317
-                                STRING_LD(label),
318
+                                (size_t)STRING_LD(label),
319
                                 get_atom_name(prf_name),
320
                                 iterations,
321
-                                STRING_LD(salt),
322
+                                (size_t)STRING_LD(salt),
323
                                 get_atom_name(crypto_name),
324
-                                STRING_LD(iv),
325
-                                STRING_LD(encrypted));
326
+                                (size_t)STRING_LD(iv),
327
+                                (size_t)STRING_LD(encrypted));
328
 
329
   lsh_string_free(key);
330
   lsh_string_free(salt);
331
--- a/src/srp_exchange.c
332
+++ b/src/srp_exchange.c
333
@@ -112,7 +112,7 @@ srp_make_verifier(const struct zn_group
334
   zn_exp(G, x, G->generator, x);
335
 
336
   expr = lsh_string_format_sexp(0, "(srp-verifier ssh-ring1%s%b)",
337
-                               STRING_LD(salt),
338
+                               (size_t)STRING_LD(salt),
339
                                x);
340
 
341
   mpz_clear(x);