New functions mpn_set_base256_le and mpn_get_base256_le.
[gd/nettle] / ChangeLog
1 2014-08-06  Niels Möller  <nisse@lysator.liu.se>
2
3         * gmp-glue.c (mpn_set_base256_le, mpn_get_base256_le): New functions.
4         * gmp-glue.h: Declare them.
5
6 2014-08-02  Niels Möller  <nisse@lysator.liu.se>
7
8         * testsuite/curve25519-dh-test.c (curve25519_sqrt): Fixed memory
9         leak, a mpz_clear call was missing.
10
11         * ecc-internal.h (ECC_MUL_A_EH_WBITS): Set to 4, to enable
12         window-based scalar multiplication.
13
14         * ecc-mul-a-eh.c (table_init) [ECC_MUL_A_EH_WBITS > 0]: Fixed
15         initialization of TABLE(1).
16
17 2014-07-29  Niels Möller  <nisse@lysator.liu.se>
18
19         * ecc-internal.h (ECC_MUL_A_EH_WBITS): New constant.
20         (ECC_A_TO_EH_ITCH, ECC_MUL_A_EH_ITCH): New macros.
21         * ecc-a-to-eh.c (ecc_a_to_eh, ecc_a_to_eh_itch): New file, new
22         functions.
23         * ecc-mul-a-eh.c: New file.
24         (ecc_mul_a_eh): New function. The case [ECC_MUL_A_EH_WBITS > 0]
25         not yet working).
26         (ecc_mul_a_eh_itch): New function.
27         * ecc.h: Declare new functions.
28         * Makefile.in (hogweed_SOURCES): Added ecc-a-to-eh.c and
29         ecc-mul-a-eh.c.
30
31         * testsuite/curve25519-dh-test.c (curve25519_sqrt): New function.
32         (curve_25519): Use ecc_mul_a_eh.
33         (test_a): New function.
34         (test_main): Test construction of shared secret, using scalar
35         multiplication with points other than the fix generator.
36
37 2014-07-26  Niels Möller  <nisse@lysator.liu.se>
38
39         * ecc-add-ehh.c (ecc_add_ehh): Reduce scratch need.
40         * ecc-internal.h (ECC_ADD_EHH_ITCH): Reduced to 7*size.
41
42 2014-07-23  Niels Möller  <nisse@lysator.liu.se>
43
44         * testsuite/curve25519-dh-test.c: New test case, based on
45         draft-josefsson-tls-curve25519-05 test vectors.
46         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added curve25519-dh-test.c.
47
48 2014-07-18  Niels Möller  <nisse@lysator.liu.se>
49
50         * ecc-mul-g-eh.c (ecc_mul_g_eh, ecc_mul_g_eh_itch): New file and
51         functions. Untested.
52         * ecc.h (ecc_mul_g_eh_itch): Declare new functions.
53         * ecc-internal.h (ECC_MUL_G_EH_ITCH): New macro.
54         * Makefile.in (hogweed_SOURCES): Added ecc-mul-g-eh.c.
55
56 2014-07-17  Niels Möller  <nisse@lysator.liu.se>
57
58         * ecc-add-eh.c (ecc_add_eh): Reduce scratch need.
59         * ecc-internal.h (ECC_ADD_EH_ITCH): Reduced to 6*size.
60
61         * testsuite/curve25519-dup-test.c (test_main): Free allocated
62         storage.
63
64 2014-07-15  Niels Möller  <nisse@lysator.liu.se>
65
66         * ecc-add-eh.c (ecc_add_eh, ecc_add_eh_itch): New file, new
67         functions.
68         * ecc.h: Declare new functions.
69         * ecc-internal.h (ECC_ADD_EH_ITCH): New macro.
70         * Makefile.in (hogweed_SOURCES): Added ecc-add-eh.c.
71         * testsuite/curve25519-add-test.c (test_main): Test ecc_add_eh.
72         Additional test for g2+g2. Free allocated storage.
73
74 2014-07-14  Niels Möller  <nisse@lysator.liu.se>
75
76         * testsuite/curve25519-add-test.c: New test case.
77         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
78         curve25519-add-test.c.
79
80         * ecc-add-ehh.c (ecc_add_ehh, ecc_add_ehh_itch): New file, new
81         functions.
82         * ecc.h (ecc_add_ehh, ecc_add_ehh_itch): Declare them.
83         * ecc-internal.h (ECC_ADD_EHH_ITCH): New macro.
84         * Makefile.in (hogweed_SOURCES): Added ecc-add-ehh.c.
85
86         * ecc-25519.c (nettle_curve25519): Use ecc_d instead of ecc_b.
87
88         * eccdata.c: For curve25519, output the Edwards curve constant,
89         ecc_d = (121665/121666) mod p.
90
91         * testsuite/curve25519-dup-test.c (test_main): Add test for 4g.
92         Delete some left-over debug output.
93
94 2014-07-11  Niels Möller  <nisse@lysator.liu.se>
95
96         * misc/ecc-formulas.tex: Some ECC notes.
97
98         * testsuite/curve25519-dup-test.c: New testcase.
99         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
100         curve25519-dup-test.c.
101
102         * testsuite/testutils.c (test_ecc_point): Made non-static.
103         * testsuite/testutils.h (struct ecc_ref_point): Moved here, from
104         testutils.h.
105         (test_ecc_point): Declare it.
106
107         * ecc-dup-eh.c (ecc_dup_eh, ecc_dup_eh_itch): New file, new functions.
108         * ecc-eh-to-a.c (ecc_eh_to_a, ecc_eh_to_a_itch): New file, new
109         functions.
110         * ecc.h: Declare new functions.
111         * ecc-internal.h (ECC_EH_TO_A_ITCH, ECC_DUP_EH_ITCH): New macros.
112         * Makefile.in (hogweed_SOURCES): Added ecc-dup-eh.c and
113         ecc-eh-to-a.c.
114
115         * ecc-internal.h (struct ecc_curve): New constant edwards_root.
116         * ecc-192.c (nettle_secp_192r1): Updated accordingly, additional
117         NULL pointer.
118         * ecc-224.c (nettle_secp_224r1): Likewise.
119         * ecc-256.c (nettle_secp_256r1): Likewise.
120         * ecc-384.c (nettle_secp_384r1): Likewise.
121         * ecc-521.c (nettle_secp_521r1): Likewise.
122         * ecc-25519.c (nettle_curve25519): Initialize new constant.
123
124         * eccdata.c (ecc_curve_init): For curve 25519, use correct
125         constant for edwards coordinate transform, and output the constant
126         as ecc_edwards.
127
128 2014-07-06  Niels Möller  <nisse@lysator.liu.se>
129
130         * eccdata.c: Use separate is_zero flag to represent the neutral
131         element.
132         (output_point, output_point_redc): Unified to a single function,
133         with a use_redc flag argument. Also support conversion to Edwards
134         form.
135         (ecc_curve_init_str): New argument for Edwards curve conversion
136         constant.
137
138 2014-07-04  Niels Möller  <nisse@lysator.liu.se>
139
140         * ecc-25519.c: New file.
141         (ecc_25519_modp): New function.
142         (nettle_curve25519): New curve.
143
144         * ecc-curve.h (nettle_curve25519): Declare it.
145
146         * Makefile.in (hogweed_SOURCES): Added ecc-25519.c.
147         (ecc-25519.h): New generated file. Add as explicit dependency for
148         ecc-25519.o.
149
150         * testsuite/ecc-mod-test.c (test_curve): New function, extracted
151         from test_main. Tolerate NULL modq function pointer.
152         (test_main): Use test_curve, iterate over supported curves, and
153         also test curve_25519 for the new modp function.
154
155 2014-07-02  Niels Möller  <nisse@lysator.liu.se>
156
157         * eccdata.c (ecc_dup): Use mpz_submul_ui, now available in
158         mini-gmp.
159         (ecc_type): New enum, for Weierstrass and Montgomery curves
160         (ecc_curve): New field type.
161         (ecc_dup): Support montgomery curves.
162         (ecc_add): Likewise.
163         (ecc_curve_init_str): New argument, for the curve type.
164         (ecc_curve_init): Pass curve type to all ecc_curve_init_str calls.
165         Recognize curve25519, for bit_size 255.
166         (output_modulo): Deleted assert, which isn't true for curve25519.
167
168 2014-06-30  Niels Möller  <nisse@lysator.liu.se>
169
170         * camellia-absorb.c: Include <limits.h>, needed for correct use of
171         HAVE_NATIVE_64_BIT. Reported and debugged by Magnus Holmgren.
172         Fixes debian build failure on s390x.
173
174 2014-06-26  Niels Möller  <nisse@lysator.liu.se>
175
176         From Martin Storsjö:
177         * configure.ac (IF_NOT_SHARED): New substituted variable.
178         * hogweed.pc.in: Use @LIBS@, instead of hardcoding -lgmp. When
179         shared libraries are disabled, move needed libraries from
180         Requires.private: to Requires: and from Libs.private: to Libs:.
181
182         From Nikos Mavrogiannopoulos.
183         * examples/hogweed-benchmark.c (bench_alg): Tolerate alg->init
184         returning NULL.
185         (bench_openssl_ecdsa_init): Return NULL if
186         EC_KEY_new_by_curve_name fails, indicating the curve is not
187         supported.
188
189 2014-06-25  Niels Möller  <nisse@lysator.liu.se>
190
191         Support for building with mini-gmp instead of the real GMP. Loosely
192         based on work by Nikos Mavrogiannopoulos.
193         * configure.ac: New command line option --enable-mini-gmp. Also
194         disable all libgmp-related checks when enabled.
195         (NETTLE_USE_MINI_GMP): New substituted variable.
196         (LIBHOGWEED_LIBS): Use $(LIBS) instead of -lgmp.
197         (IF_MINI_GMP): New Makefile conditional.
198         (GMP_NUMB_BITS): Alternative test for the mini-gmp case.
199         Substituted also in bignum.h.
200         (HAVE_MPZ_POWM_SEC): Drop this unused check.
201
202         * bignum.h: Renamed, to...
203         * bignum.h.in: New name.
204         (NETTLE_USE_MINI_GMP): Substituted by configure.
205         (GMP_NUMB_BITS): Substituted by configure, for the mini-gmp case.
206
207         * Makefile.in (OPT_HOGWEED_SOURCES): New variable, value
208         conditional on @IF_MINI_GMP@.
209         (hogweed_SOURCES): Add $(OPT_HOGWEED_SOURCES).
210         (PRE_CPPFLAGS): Add -I$(srcdir).
211         (HEADERS): Delete bignum.h.
212         (INSTALL_HEADERS): Add bignum.h. Also add mini-gmp.h, if mini-gmp
213         is enabled.
214         (DISTFILES): Added bignum.h.in.
215         (bignum.h): New target.
216         (distclean-here): Delete bignum.h.
217
218         * examples/ecc-benchmark.c (modinv_gcd) [NETTLE_USE_MINI_GMP]:
219         Disable this benchmark.
220         (mpn_random) [NETTLE_USE_MINI_GMP]: Provide a simple implementation.
221
222         * testsuite/ecc-mod-test.c [NETTLE_USE_MINI_GMP]: Skip test, it
223         depends on gmp_randstate_t.
224         * testsuite/ecc-modinv-test.c [NETTLE_USE_MINI_GMP]: Likewise.
225         * testsuite/ecc-mul-a-test.c [NETTLE_USE_MINI_GMP]: Likewise.
226         * testsuite/ecc-mul-g-test.c [NETTLE_USE_MINI_GMP]: Likewise.
227         * testsuite/ecc-redc-test.c [NETTLE_USE_MINI_GMP]: Likewise.
228
229         Various preparations for mini-gmp support.
230         * testsuite/bignum-test.c: Use WITH_HOGWEED instead of HAVE_LIBGMP
231         for preprocessor conditionals.
232         * testsuite/testutils.h: Likewise.
233         * testsuite/sexp-format-test.c: Likewise.
234
235         * testsuite/ecdsa-keygen-test.c (test_main): Use printf,
236         mpz_out_str and write_mpn instead of gmp_fprintf.
237         * testsuite/ecdsa-sign-test.c (test_ecdsa): Likewise.
238         * testsuite/ecdsa-verify-test.c (test_ecdsa): Likewise.
239
240         * dsa.h: Include bignum.h instead of gmp.h.
241         * ecc-internal.h: Likewise.
242         * ecc.h: Likewise.
243         * gmp-glue.h: Likewise.
244         * pkcs1.h: Likewise.
245         * rsa.h: Likewise.
246
247         * testsuite/testutils.c (die): Use plain vfprintf, not
248         gmp_vfprintf.
249         (write_mpn): New function.
250         (test_ecc_point): Use it, replacing gmp_fprintf.
251         * testsuite/testutils.h (write_mpn): Declare it.
252
253         * der-iterator.c: Deleted HAVE_LIBGMP conditionals.
254
255 2014-06-07  Niels Möller  <nisse@lysator.liu.se>
256
257         * Released nettle-3.0
258
259 2014-06-04  Niels Möller  <nisse@lysator.liu.se>
260
261         * NEWS: List des-compat.h as a candidate for removal in the next
262         release.
263
264         * testsuite/des-compat-test.c (test_main): Fixed out of bounds
265         memory read, reported by Nikos Mavrogiannopoulos.
266
267         * nettle-write.h: Include <stddef.h>, fixing compilation on
268         freebsd.
269
270         * aclocal.m4 (ac_stdint): Fixed "unsinged" typo, spotted by Andy
271         Goth.
272
273 2014-06-01  Niels Möller  <nisse@lysator.liu.se>
274
275         * x86_64/gcm-hash8.asm: Pass correct argument count to W64_EXIT.
276         * x86_64/camellia-crypt-internal.asm: Pass correct argument count
277         to W64_ENTRY and W64_EXIT.
278
279         * x86_64/machine.m4 [W64_ABI]: Fix for the case of 6 function
280         arguments. Also push %rdi unconditionally, and use aligned
281         accesses for save and restore %xmm registers (movdqa).
282
283 2014-05-31  Niels Möller  <nisse@lysator.liu.se>
284
285         * configure.ac: Check for COFF type directives.
286         (ASM_COFF_STYLE): New substituted variable.
287         * config.m4.in: Set COFF_STYLE from configure.
288         * asm.m4 (PROLOGUE): Use COFF type directive, if enabled by
289         configure. Fixes problem with windows dll linking.
290
291         * asm.m4: Deleted unused offsets for struct aes_ctx.
292
293 2014-05-28  Niels Möller  <nisse@lysator.liu.se>
294
295         * testsuite/nettle-pbkdf2-test: Delete carriage return characters
296         from output.
297
298         * configure.ac (LIBHOGWEED_LIBS): Be explicit and link
299         libhogweed.so with libnettle.so, not -lnettle.
300         (LIBHOGWEED_LINK): Drop -L. flag, no longer needed, and previously
301         not at the correct position in the link command line.
302
303 2014-05-27  Niels Möller  <nisse@lysator.liu.se>
304
305         * examples/ecc-benchmark.c: If mpn_sec_powm is available,
306         benchmark it, for modinv.
307         (bench_modinv_powm): New function.
308         (bench_curve): Use it.
309
310 2014-05-22  Niels Möller  <nisse@lysator.liu.se>
311
312         From Claudio Bley:
313         * Makefile.in ($(des_headers)): Use the EXEEXT_FOR_BUILD.
314
315 2014-05-15  Niels Möller  <nisse@lysator.liu.se>
316
317         * NEWS: Updated with library version numbers.
318
319         * configure.ac (dummy-dep-files): Use simpler and more portable
320         sed expression. Problem reported by Peter Eriksson.
321         (LIBHOGWEED_MAJOR): Bumped shared library version to 3.0.
322         (LIBHOGWEED_MINOR): Reset to zero. Also increased the package
323         version number to 3.0.
324
325         * getopt.c: Don't use gettext.
326
327 2014-05-14  Niels Möller  <nisse@lysator.liu.se>
328
329         * testsuite/nettle-pbkdf2-test: Avoid the bash construction
330         ${#foo}.
331
332         * getopt.c: Copied from glibc tree, tag glibc-2.19.
333         * getopt.h: Likewise.
334         * getopt1.c: Likewise.
335         * getopt_int.h: New file, also copied from glibc.
336         * Makefile.in (DISTFILES): Added getopt_int.h.
337
338 2014-05-09  Niels Möller  <nisse@lysator.liu.se>
339
340         * mini-gmp.c: Updated, use version from gmp-6.0.0.
341         * mini-gmp.h: Likewise.
342
343         * testsuite/Makefile.in (all): Drop dependency on $(TARGETS), to
344         delay building of test programs until make check.
345
346 2014-05-08  Niels Möller  <nisse@lysator.liu.se>
347
348         * nettle.texinfo (nettle_aead abstraction): Document nettle_aead.
349
350         * Makefile.in (nettle_SOURCES): Added nettle-meta-aeads.c.
351         * nettle-meta.h (nettle_aeads): Declare array.
352         * nettle-meta-aeads.c (nettle_aeads): New file, new array.
353         * testsuite/meta-aead-test.c: New test case.
354         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
355         meta-aead-test.c.
356
357         * aclocal.m4 (GMP_PROG_CC_FOR_BUILD): If CC_FOR_BUILD is gcc, add
358         -O option. This makes eccdata twice as fast.
359
360 2014-05-06  Niels Möller  <nisse@lysator.liu.se>
361
362         * nettle.texinfo: Document SHA3 and ChaCha-Poly1305 as
363         experimental.
364
365 2014-05-05  Niels Möller  <nisse@lysator.liu.se>
366
367         * nettle.texinfo (POLY1305): Document poly1305-aes.
368         (Authenticated encryption): Move AEAD algorithms to their own
369         section.
370         (RSA, DSA, ECDSA): Change some subsections to subsubsections.
371         (ChaCha-Poly1305): Document ChaCha-Poly1305.
372
373 2014-05-04  Niels Möller  <nisse@lysator.liu.se>
374
375         * nettle.texinfo (DSA): Document new DSA interface.
376         (Salsa20): Update salsa20 docs.
377         (ChaCha): Document ChaCha.
378
379 2014-05-03  Niels Möller  <nisse@lysator.liu.se>
380
381         * configure.ac: Check for SIZEOF_SIZE_T.
382         * ccm.c (ccm_set_nonce): Skip code for 64-bit encoding when size_t
383         is only 32 bits.
384
385         * nettle.texinfo (CCM): Document new ccm macros and constants.
386         Describe ccm restrictions.
387
388         * ccm.h (CCM_DIGEST_SIZE): New constant.
389
390 2014-04-30  Niels Möller  <nisse@lysator.liu.se>
391
392         * ccm.c (CCM_IV_MAX_SIZE, CCM_IV_MIN_SIZE): Deleted, replaced by
393         public constants CCM_MIN_NONCE_SIZE and CCM_MAX_NONCE_SIZE.
394         (ccm_build_iv): Updated for above rename.
395         (CCM_L_MAX_SIZE): Deleted, no longer used.
396
397         * ccm.h (CCM_MIN_NONCE_SIZE, CCM_MAX_NONCE_SIZE): New constants.
398         (CCM_MAX_MSG_SIZE): New macro.
399
400 2014-04-27  Niels Möller  <nisse@lysator.liu.se>
401
402         * nettle.texinfo (Cipher modes): Subsection on AEAD constructions.
403         (GCM): Update GCM documentation, including functions for
404         gcm_aes128, gcm_camellia128, ...
405
406 2014-04-26  Niels Möller  <nisse@lysator.liu.se>
407
408         * nettle.texinfo: Update for introduction of nettle_cipher_func.
409         (GCM): Document GCM_DIGEST_SIZE.
410         (UMAC): Document new UMAC constants.
411         (Keyed hash functions): Make HMAC and UMAC their own info nodes.
412         (EAX): Document EAX.
413
414         * umac.h (UMAC_MIN_NONCE_SIZE, UMAC_MAX_NONCE_SIZE): New
415         constants.
416
417 2014-04-25  Niels Möller  <nisse@lysator.liu.se>
418
419         * All hash-related files: Renamed all _DATA_SIZE constants to
420         _BLOCK_SIZE, for consistency. Old names kept for backwards
421         compatibility.
422
423         * nettle.texinfo (CCM): Documentation for CCM mode, contributed by
424         Owen Kirby.
425
426         * testsuite/ccm-test.c (test_cipher_ccm): And tests.
427
428         * ccm.c (ccm_decrypt_message): Change length argument, should now
429         be clear text (dst) length.
430         * ccm-aes128.c (ccm_aes128_decrypt_message): Likewise.
431         * ccm-aes192.c (ccm_aes192_decrypt_message): Likewise.
432         * ccm-aes256.c (ccm_aes256_decrypt_message): Likewise.
433         * ccm.h: Updated prototypes.
434
435 2014-04-22  Niels Möller  <nisse@lysator.liu.se>
436
437         * nettle.texinfo (Recommended hash functions): Document additional
438         sha512 variants.
439
440         * sha2.h (sha512_224_ctx, sha512_256_ctx): New aliases for the
441         sha512_ctx struct tag.
442
443 2014-04-17  Niels Möller  <nisse@lysator.liu.se>
444
445         * examples/Makefile.in (SOURCES): Deleted next-prime.c (forgotten
446         in 2014-04-13 change).
447
448 2014-04-16  Niels Möller  <nisse@lysator.liu.se>
449
450         * testsuite/ccm-test.c (test_cipher_ccm): Deleted check for NULL
451         authdata.
452
453         * sha3-224.c (sha3_224_init): Pass pointer to context struct, not
454         pointer to first element, to memset.
455         * sha3-256.c (sha3_256_init): Likewise.
456         * sha3-384.c (sha3_384_init): Likewise.
457         * sha3-512.c (sha3_512_init): Likewise.
458
459         * examples/eratosthenes.c (vector_alloc): Use sizeof(*vector)
460         instead of explicit type in malloc call.
461         (vector_init): Make constant explicitly unsigned long.
462
463         * tools/input.c (sexp_get_quoted_char): Deleted useless for loop.
464
465 2014-04-13  Niels Möller  <nisse@lysator.liu.se>
466
467         * rsa-compat.c: Deleted file.
468         * rsa-compat.h: Deleted file.
469         * Makefile.in (hogweed_SOURCES): Deleted rsa-compat.c.
470         (HEADERS): Deleted rsa-compat.h.
471
472         * examples/next-prime.c: Deleted file.
473         * bignum-next-prime.c (nettle_next_prime): Deleted file and
474         function.
475         * prime-list.h: Deleted file.
476         * bignum.h (nettle_next_prime): Deleted prototype.
477         * Makefile.in (hogweed_SOURCES): Deleted bignum-next-prime.c.
478         (DISTFILES): Deleted prime-list.h.
479         * examples/Makefile.in (HOGWEED_TARGETS): Deleted next-prime, and
480         corresponding make target.
481
482 2014-04-12  Niels Möller  <nisse@lysator.liu.se>
483
484         * nettle.texinfo (Copyright): Updated licensing info.
485         * README: Likewise.
486
487         * Makefile.in (DISTFILES): Distribute new COPYING* files.
488
489         * COPYING.LESSERv3: New file.
490         * COPYINGv3: New file.
491         * COPYING.LIB: Deleted.
492         * COPYINGv2: New name for GPL version 2 file.
493         * COPYING: Old name, deleted.
494
495         * Update license headers for LGPL3+ and GPL2+ dual licensing.
496
497 2014-04-11  Niels Möller  <nisse@lysator.liu.se>
498
499         * testsuite/testutils.c (test_aead): Use aead->digest_size.
500
501         * configure.ac: Skip GMP tests if public key support is disabled.
502
503         * eax.c (block16_xor): Fixed bug effecting 32-bit platforms.
504
505         * Makefile.in (DISTFILES): Deleted memxor.c, already included via
506         nettle_SOURCES.
507         * tools/Makefile.in (SOURCES): Add nettle-pbkdf2.c.
508
509 2014-04-10  Niels Möller  <nisse@lysator.liu.se>
510
511         From Nikos Mavrogiannopoulos:
512         * examples/hogweed-benchmark.c (bench_openssl_ecdsa_init): Support
513         for secp192r1 and secp256r1.
514         (alg_list): Add them.
515
516 2014-04-09  Niels Möller  <nisse@lysator.liu.se>
517
518         * examples/nettle-benchmark.c (main): Benchmark sha512_224 and
519         sha512_256.
520
521         * testsuite/sha512-224-test.c: New file.
522         * testsuite/sha512-256-test.c: New file.
523         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new files.
524
525         * nettle-meta.h (nettle_sha512_224, nettle_sha512_256): Declare.
526         * sha512-224-meta.c (nettle_sha512_224): New file, new nettle_hash.
527         * sha512-256-meta.c (nettle_sha512_256): New file, new nettle_hash.
528
529         * sha2.h (SHA512_224_DIGEST_SIZE, SHA512_224_DATA_SIZE)
530         (SHA512_256_DIGEST_SIZE, SHA512_256_DATA_SIZE): New constants.
531
532         * sha512.c (sha512_256_digest): Typo fix, call sha512_256_init.
533
534         * testsuite/testutils.c (test_hash): Removed redundant init call.
535         Tests that digest implies init.
536
537 2014-03-28  Niels Möller  <nisse@lysator.liu.se>
538
539         * testsuite/dsa-keygen-test.c (test_main): Explicitly use
540         dsa_compat_generate_keypair.
541         (test_main): Test dsa_generate_params and dsa_generate_keypair
542         with a large q; p_bits = 1024, q_bits = 768.
543
544         * testsuite/testutils.h: Undo dsa-compat.h name mangling.
545
546         * dsa-keygen.c (dsa_generate_keypair): New interface, generating
547         only a keypair, and no new parameters.
548         * dsa-compat-keygen.c (dsa_compat_generate_keypair): New file.
549         Moved old key generation function here. Use dsa_generate_keypair.
550
551 2014-03-27  Niels Möller  <nisse@lysator.liu.se>
552
553         * dsa-compat.c (dsa_public_key_init, dsa_public_key_clear)
554         (dsa_private_key_init, dsa_private_key_clear): : Move deprecated
555         DSA functions to a separate file...
556         * dsa.c: ...from here.
557         * dsa-compat.h: New file, declaring deprecated DSA interface.
558         Include in corresponding C files.
559         * Makefile.in (hogweed_SOURCES): Add dsa-compat.c.
560         (HEADERS): Add dsa-compat.h.
561
562         * dsa-gen-params.c (dsa_generate_params): New file and function,
563         extracted from DSA key generation.
564         * dsa-keygen.c (dsa_generate_keypair): Use dsa_generate_params.
565
566 2014-03-26  Niels Möller  <nisse@lysator.liu.se>
567
568         * der2dsa.c (dsa_params_from_der_iterator): Converted to new DSA
569         interface. Allow q_size == 0, meaning any q < p is allowed.
570         Additional validity checks.
571         (dsa_public_key_from_der_iterator): Converted to new DSA
572         interface. Also check that the public value is in the correct
573         range.
574         (dsa_openssl_private_key_from_der_iterator): Converted
575         to new DSA interface. Additional validity checks.
576         (dsa_openssl_private_key_from_der): Converted to new DSA
577         interface.
578         * tools/pkcs1-conv.c (convert_dsa_private_key): Update to use
579         struct dsa_params, and adapt to the der decoding changes.
580         (convert_public_key): Likewise.
581
582         * examples/hogweed-benchmark.c: Update dsa benchmarking to use new
583         DSA interface.
584
585         * dsa.c (dsa_params_init, dsa_params_clear): New functions.
586         (dsa_public_key_init): Use dsa_params_init.
587         (dsa_public_key_clear): Use dsa_params_clear.
588
589         * sexp2dsa.c (dsa_keypair_from_sexp_alist): Converted to new DSA
590         interface. Allow q_size == 0, meaning any q < p is allowed.
591         Additional validity checks.
592         (dsa_sha1_keypair_from_sexp, dsa_sha256_keypair_from_sexp):
593         Converted to new DSA interface.
594
595         * dsa2sexp.c (dsa_keypair_to_sexp): Converted to new DSA
596         interface.
597         * tools/pkcs1-conv.c: Updated uses of dsa_keypair_to_sexp.
598
599         * dsa.h (struct dsa_params): New struct.
600
601         * dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
602         separate mpz_t.
603         * dsa-verify.c (dsa_verify): Likewise.
604         * dsa-sha1-verify.c (dsa_sha1_verify_digest, dsa_sha1_verify): Use
605         dsa_verify, cast the struct dsa_public_key * input to a struct
606         dsa_params *
607         * dsa-sha256-verify.c (dsa_sha256_verify_digest)
608         (dsa_sha256_verify): Likewise.
609         * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise
610         use dsa_sign, with a cast from struct dsa_public_key * to struct
611         dsa_params *.
612         * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
613         Likewise.
614
615         * testsuite/testutils.c (test_dsa_verify): Use struct dsa_params.
616         (test_dsa_key): Likewise.
617         * testsuite/dsa-test.c (test_main): Adapt to test_dsa_key and
618         test_dsa_verify changes.
619         * testsuite/dsa-keygen-test.c (test_main): Adapt to
620         test_dsa_key change.
621
622         * testsuite/testutils.c (test_dsa_sign): #if out, currently
623         unused.
624
625 2014-03-23  Niels Möller  <nisse@lysator.liu.se>
626
627         From Owen Kirby:
628         * ccm.c: New file.
629         * ccm.h: New file.
630         * ccm-aes128.c: New file.
631         * ccm-aes192.c: New file.
632         * ccm-aes256.c: New file.
633         * Makefile.in (nettle_SOURCES): Added ccm source files.
634         (HEADERS): Added ccm.h.
635         * testsuite/ccm-test.c: New file.
636         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added ccm-test.c.
637
638 2014-03-20  Niels Möller  <nisse@lysator.liu.se>
639
640         From Joachim Strömbergson:
641         * sha512.c (K): Indentation fix.
642         (sha512_224_init, sha512_224_digest, sha512_256_init)
643         (sha512_256_digest): New functions.
644         * sha2.h: Add prototypes.
645         (sha512_224_update, sha512_256_update): New aliases for
646         sha512_update.
647
648 2014-03-18  Niels Möller  <nisse@lysator.liu.se>
649
650         * examples/nettle-benchmark.c (main): Add benchmarking of arcfour,
651         salsa20 and chacha, via time_aead.
652
653         * nettle-internal.c (nettle_arcfour128): Define, as a struct
654         nettle_aead (with NULL set_nonce, update, and digest methods).
655         * examples/nettle-openssl.c (nettle_openssl_arcfour128): Likewise.
656         * nettle-internal.h (nettle_arcfour128)
657         (nettle_openssl_arcfour128): Declare.
658
659         * nettle-types.h (nettle_cipher_func): New typedef, similar to
660         nettle_crypt_func, but with a const context, intended for block
661         ciphers.
662         * nettle-meta.h (struct nettle_cipher): Use the nettle_cipher_func
663         type.
664         * Many other files affected: aes*-meta.c, camellia*-meta.c,
665         cast128-meta.c, serpent-meta.c, twofish-meta.c, cbc.[ch],
666         ctr.[ch], ctr.[ch], des-compat.c, eax.[ch], gcm*.[ch],
667         nettle-internal.*, testsuite/aes-test.c,
668         examples/nettle-benchmark.c, examples/nettle-openssl.c.
669
670 2014-03-16  Niels Möller  <nisse@lysator.liu.se>
671
672         * chacha-set-key.c: Include string.h.
673
674         * arcfour-meta.c: Deleted file.
675         * nettle-meta.h (nettle_arcfour128): Deleted declaration.
676         * nettle-meta-ciphers.c (nettle_ciphers): Deleted
677         nettle_arcfour128 from list.
678         * Makefile.in (nettle_SOURCES): Deleted arcfour-meta.c.
679         * examples/nettle-openssl.c (nettle_openssl_arcfour128): Deleted.
680         * testsuite/meta-cipher-test.c: Adjust test for removal of
681         nettle_arcfour128.
682
683 2014-03-15  Niels Möller  <nisse@lysator.liu.se>
684
685         * examples/nettle-benchmark.c (struct bench_aead_info): New
686         struct.
687         (bench_aead_crypt, bench_aead_update, init_nonce, time_aead): New
688         functions, for benchmarking aead algorithms.
689         (time_gcm, time_eax): Deleted functions.
690         (main): Use time_aead to benchmark gcm, eax and chacha-poly1305.
691
692         * salsa20.h (SALSA20_NONCE_SIZE): Renamed constant, old name
693         SALSA20_IV_SIZE kept as an alias.
694         (salsa20_set_nonce): Update prototype for the 2014-01-20 rename.
695
696         * Makefile.in (.asm.s): Add dependencies.
697         (.s.o, .s.po): Empty any dependency .d file.
698
699 2014-03-04  Niels Möller  <nisse@lysator.liu.se>
700
701         * testsuite/chacha-test.c (test_main): Additional test cases, for
702         256-bit keys.
703
704         * Makefile.in (nettle_SOURCES): Deleted chacha128-set-key.c and
705         chacha256-set-key.c.
706
707         * chacha.h (CHACHA256_KEY_SIZE): Deleted.
708         (chacha_set_key): Updated prototype.
709         * chacha256-set-key.c (chacha256_set_key): Deleted file and
710         function, moved to...
711         * chacha-set-key.c (chacha_set_key): Do 256-bit keys only. Deleted
712         length argument. Updated all callers.
713
714         * chacha128-set-key.c (chacha128_set_key): Deleted file and
715         function. Support for 128-bit chacha keys may be reintroduced
716         later, if really needed.
717         * chacha.h: Deleted chacha128-related declarations.
718         * chacha-set-key.c (chacha_set_key): Drop support for 128-bit
719         keys.
720         * testsuite/chacha-test.c (test_main): #if:ed out all tests with
721         128-bit keys.
722
723 2014-02-16  Niels Möller  <nisse@lysator.liu.se>
724
725         * gcm.h: Declarations for gcm-camellia256.
726         * gcm-camellia256.c: New file.
727         * gcm-camellia256-meta.c: New file.
728         * nettle-meta.h (nettle_gcm_camellia256): Declare.
729         * Makefile.in (nettle_SOURCES): Added gcm-camellia256.c and
730         gcm-camellia256-meta.c.
731         * testsuite/gcm-test.c (test_main): Test cases for
732         nettle_gcm_camellia256.
733
734         * gcm.h: Include camellia.h. Declarations for gcm-camellia128.
735         * gcm-camellia128.c: New file.
736         * gcm-camellia128-meta.c: New file.
737         * nettle-meta.h (nettle_gcm_camellia128): Declare.
738         * Makefile.in (nettle_SOURCES): Added gcm-camellia128.c and
739         gcm-camellia128-meta.c.
740         * testsuite/gcm-test.c (test_main): Test cases for
741         nettle_gcm_camellia128. From Nikos Mavrogiannopoulos.
742
743 2014-02-13  Niels Möller  <nisse@lysator.liu.se>
744
745         * Makefile.in (nettle_SOURCES): Added eax-aes128.c
746         eax-aes128-meta.c.
747         * examples/nettle-benchmark.c: Include eax.h.
748         * nettle-meta.h (nettle_eax_aes128): Declare, moved from
749         nettle-internal.h.
750         * eax.h: Declare eax_aes128_ctx and related functions. Moved from
751         nettle-internal.h
752         (EAX_IV_SIZE): New constant.
753         * eax-aes128-meta.c (nettle_eax_aes128): Moved definition to new
754         file.
755         * eax-aes128.c (eax_aes128_set_key, eax_aes128_set_nonce)
756         (eax_aes128_update, eax_aes128_encrypt, eax_aes128_decrypt)
757         (eax_aes128_digest): Moved functions to a new file.
758         * nettle-internal.c: ... from old location.
759         * nettle-internal.h: Moved eax declarations elsewhere.
760
761         * tools/nettle-pbkdf2.c (main): Added missing deallocation.
762
763 2014-02-12  Niels Möller  <nisse@lysator.liu.se>
764
765         * chacha-poly1305.h: New file.
766         * chacha-poly1305.c: New file.
767         * chacha-poly1305-meta.c (nettle_chacha_poly1305): New file, new
768         aead algorithm.
769         * nettle-meta.h (nettle_chacha_poly1305): Declare.
770
771         * Makefile.in (nettle_SOURCES): Added chacha-poly1305.c and
772         chacha-poly1305-meta.c.
773         (HEADERS): Added chacha-poly1305.h.
774
775         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
776         chacha-poly1305-test.c.
777         * testsuite/chacha-poly1305-test.c: New file.
778
779         * nettle-meta.h (struct nettle_aead): New generalized version
780         if this struct.
781         (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256)
782         (nettle_eax_aes128): Declare, moved from nettle-internal.h.
783         * nettle-internal.h (struct nettle_aead): Deleted struct, moved to
784         nettle-meta.h. Deleted declarations of unused instances.
785         (_NETTLE_AEAD): Deleted macro.
786         * nettle-internal.c (nettle_eax_aes128): Updated for new
787         nettle_aead struct.
788         (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256):
789         Deleted, moved to new files.
790         * gcm-aes128-meta.c (nettle_gcm_aes128): Moved to new file,
791         updated for new nettle_aead struct.
792         * gcm-aes192-meta.c (nettle_gcm_aes192): Likewise.
793         * gcm-aes256-meta.c (nettle_gcm_aes256): Likewise.
794         * testsuite/testutils.c (test_aead): Take alternative set_nonce
795         function as argument, and use it when nonce size differs from
796         aead->nonce_length.
797         * testsuite/testutils.h (test_aead): Updated prototype.
798         * testsuite/gcm-test.c (nettle_gcm_unified_aes128): Updated for
799         new nettle_aead struct.
800         (test_main): Pass additional argument to test_aead.
801         * testsuite/eax-test.c (test_main): Pass additional NULL argument
802         to test_aead.
803
804         * eax.h (EAX_DIGEST_SIZE): New constant.
805         * gcm.h (GCM_DIGEST_SIZE): Likewise.
806
807 2014-02-10  Niels Möller  <nisse@lysator.liu.se>
808
809         * chacha-set-nonce.c (chacha_set_nonce): Renamed file and
810         function, updated callers and Makefile.in.
811         * chacha-set-iv.c (chacha_set_iv): ... from old names.
812
813 2014-02-08  Niels Möller  <nisse@lysator.liu.se>
814
815         * testsuite/chacha-test.c (test_chacha): For 20 rounds, use
816         chacha_crypt, and test varying the message length.
817         (test_main): Add second key stream block, for all testcases with
818         20 rounds.
819
820         * chacha-crypt.c (chacha_crypt): Fixed block counter update.
821
822 2014-02-07  Niels Möller  <nisse@lysator.liu.se>
823
824         * nettle.texinfo (ASCII encoding): Document that
825         base16_encode_update and base64_encode_update now uses dst_length
826         as an output only.
827
828         * testsuite/base64-test.c (test_main): Updated
829         base64_decode_update test case.
830
831         * sexp-transport.c (sexp_transport_iterator_first): For
832         base64_decode_update, omit initialization of coded_length.
833         * examples/base64dec.c (main): Likewise.
834         * examples/base16dec.c (main): Likewise, for base16_decode_update.
835
836         * base64-decode.c (base64_decode_update): Use *dst_length for
837         output only. Don't require callers to pass a sane value.
838         * base16-decode.c (base16_decode_update): Likewise.
839
840 2014-02-06  Niels Möller  <nisse@lysator.liu.se>
841
842         * NEWS: List _set_key incompatibilities.
843
844         * nettle-meta.h (_NETTLE_CIPHER_SEP, _NETTLE_CIPHER_SEP_SET_KEY)
845         (_NETTLE_CIPHER_FIX, _NETTLE_CIPHER): Deleted unused macros.
846
847         * nettle-internal.c (nettle_blowfish128): Deleted only use of
848         _NETTLE_CIPHER.
849
850         * blowfish.c (blowfish128_set_key): New function.
851         * blowfish.h (BLOWFISH128_KEY_SIZE): New constant.
852
853         * cast128-meta.c (nettle_cast128): Deleted only use of
854         _NETTLE_CIPHER_FIX.
855
856         * examples/nettle-benchmark.c (time_cipher): Fixed memset calls.
857
858 2014-01-30  Niels Möller  <nisse@lysator.liu.se>
859
860         * Makefile.in (nettle_SOURCES): Arrange in alphabetic order.
861
862         * nettle.texinfo: Updated, document size_t for length arguments.
863         Document new AES and Camellia interfaces.
864
865         * ecc-size.c (ecc_bit_size): New function.
866         * ecc.h (ecc_bit_size): Declare it.
867
868 2014-01-29  Niels Möller  <nisse@lysator.liu.se>
869
870         * nettle-types.h (typedef nettle_set_key_func): Deleted length
871         argument.
872
873         * arctwo.c (arctwo40_set_key, arctwo64_set_key)
874         (arctwo128_set_key, arctwo128_set_key_gutmann): New functions.
875         * arctwo.h: Declare them.
876         * arctwo-meta.c (ARCTWO): New macro.
877         (nettle_arctwo40, nettle_arctwo64, nettle_arctwo128)
878         (nettle_arctwo_gutmann128): Use new _set_key functions.
879
880         * arcfour.h (ARCFOUR128_KEY_SIZE): New constant.
881         * arcfour.c (arcfour128_set_key): New function.
882         * arcfour-meta.c (nettle_arcfour128): Use arcfour128_set_key and
883         ARCFOUR128_KEY_SIZE.
884
885         * cast128.c (cast5_set_key): Renamed, was cast128_set_key.
886         (cast128_set_key): New definition, with fixed key size.
887         * cast128.h (CAST128_MIN_KEY_SIZE, CAST128_MAX_KEY_SIZE): Renamed
888         constants, to...
889         (CAST5_MIN_KEY_SIZE, CAST5_MAX_KEY_SIZE): ... new names.
890
891         * eax.h (EAX_SET_KEY): Deleted length argument.
892
893         * aes128-meta.c: Deleted _set_key wrappers.
894         * aes192-meta.c: Likewise.
895         * aes256-meta.c: Likewise.
896         * camellia128-meta.c: Likewise.
897         * camellia192-meta.c: Likewise.
898         * camellia256-meta.c: Likewise.
899
900         * gcm-aes128.c (gcm_aes128_set_key): Deleted length argument.
901         * gcm-aes192.c (gcm_aes192_set_key): Likewise.
902         * gcm-aes256.c (gcm_aes256_set_key): Likewise.
903         * gcm.h: Updated prototypes.
904
905         * serpent-set-key.c (serpent128_set_key, serpent192_set_key)
906         (serpent256_set_key): New functions.
907         * serpent.h: Declare new functions.
908         (SERPENT128_KEY_SIZE, SERPENT192_KEY_SIZE)
909         (SERPENT256_KEY_SIZE): New constants.
910         * serpent-meta.c (SERPENT): New macro.
911         (nettle_serpent128, nettle_serpent192, nettle_serpent256): Use new
912         _set_key functions.
913
914         * twofish-set-key.c (twofish128_set_key, twofish192_set_key)
915         (twofish256_set_key): New functions.
916         * twofish.h: Declare new functions.
917         (TWOFISH128_KEY_SIZE, TWOFISH192_KEY_SIZE)
918         (TWOFISH256_KEY_SIZE): New constants.
919         * twofish-meta.c (TWOFISH): New macro.
920         (nettle_twofish128, nettle_twofish192, nettle_twofish256): Use new
921         _set_key functions.
922
923         * nettle-internal.h (struct nettle_aead): Use
924         nettle_hash_update_func for the set_iv function pointer.
925
926         * nettle-internal.c (des_set_key_hack, des3_set_key_hack): Deleted
927         wrapper functions.
928         (chacha_set_key_hack): Deleted length argument. Use
929         chacha256_set_key.
930         (salsa20_set_key_hack): Deleted length argument. Use
931         salsa20_256_set_key.
932         (nettle_unified_aes128, nettle_unified_aes192)
933         (nettle_unified_aes256): Deleted, moved to test program.
934         (eax_aes128_set_key): Deleted length argument. Use EAX_SET_KEY.
935
936         * examples/nettle-benchmark.c: Updated for _set_key changes.
937         * examples/nettle-openssl.c: Likewise.
938         * testsuite/testutils.c: Likewise.
939         * testsuite/gcm-test.c: Likewise.
940
941         * testsuite/aes-test.c (UNIFIED_AES): New macro. Moved glue for
942         testing the old aes interface (struct aes_ctx) here.
943
944         * testsuite/arcfour-test.c (test_arcfour): New function, for key
945         sizes != 128 bits.
946         (test_main): Use it.
947
948         * testsuite/blowfish-test.c (test_blowfish): New function.
949         (test_main): Use it. Also deleted old #if:ed out code.
950
951         * testsuite/cast128-test.c (test_cast5): New function.
952         (test_main): Use it, for 40-bit and 80-bit tests.
953
954         * testsuite/serpent-test.c (test_serpent): New function.
955         (test_main): Use it.
956
957 2014-01-27  Niels Möller  <nisse@lysator.liu.se>
958
959         * eax.h (struct eax_key, struct eax_ctx): Use union
960         nettle_block16, for alignment.
961         * eax.c: Updated everything to use nettle_block16.
962         (block16_xor): New function.
963
964         * examples/nettle-benchmark.c (time_eax): New function.
965         (main): Use it.
966
967         * x86_64/chacha-core-internal.asm: Use pshufhw + pshuflw for the
968         16-bit rotate.
969
970         * configure.ac (asm_replace_list): Added chacha-core-internal.asm.
971         * x86_64/chacha-core-internal.asm: New file.
972
973         * examples/nettle-benchmark.c (main): Add benchmarking of chacha.
974         * nettle-internal.c (nettle_chacha): New const struct, for the
975         benchmark.
976
977         Chacha implementation, based on contribution by Joachim
978         Strömbergson.
979         * chacha.h: New file.
980         * chacha256-set-key.c (chacha256_set_key): New file and function.
981         * chacha128-set-key.c (chacha128_set_key): New file and function.
982         * chacha-set-key.c (chacha_set_key): New file and function.
983         * chacha-set-iv.c (chacha_set_iv): New file and function.
984         * chacha-core-internal.c (_chacha_core): New file and function.
985         * chacha-crypt.c (chacha_crypt): New file and function.
986         * Makefile.in (nettle_SOURCES): Added chacha files.
987         (HEADERS): Added chacha.h.
988         * testsuite/chacha-test.c: New file.
989         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added chacha-test.c.
990
991 2014-01-26  Niels Möller  <nisse@lysator.liu.se>
992
993         * nettle-internal.h (_NETTLE_AEAD_FIX): Renamed to...
994         (_NETTLE_AEAD): ... new name, and deleted old definition. Also use
995         _set_nonce instead of _set_iv.
996         * nettle-internal.c (nettle_gcm_aes128, nettle_gcm_aes192)
997         (nettle_gcm_aes256): Define in terms of new interface.
998         (nettle_eax_aes128): Updated for _NETTLE_AEAD changes.
999
1000         * testsuite/gcm-test.c (test_gcm_hash): Likewise use struct
1001         gcm_aes128_ctx.
1002         (test_main): Added a testcase using the old interface based on
1003         struct gcm_aes_ctx.
1004
1005         * examples/nettle-benchmark.c (time_gcm): Update to use new struct
1006         gcm_aes128_ctx. Also use name "gcm-aes128" in output.
1007
1008         * gcm.h: New interface for gcm_aes128, gcm_aes192, gcm_aes256,
1009         using the new AES interface.
1010         (GCM_CTX): Reorder fields, putting the cipher context
1011         last.
1012
1013         * Makefile.in (nettle_SOURCES): Added gcm-aes128.c, gcm-aes192.c,
1014         and gcm-aes256.c.
1015
1016         * gcm-aes128.c: New file.
1017         * gcm-aes192.c: New file
1018         * gcm-aes256.c: New file.
1019
1020 2014-01-25  Niels Möller  <nisse@lysator.liu.se>
1021
1022         * gcm.h (GCM_SET_KEY): Deleted length argument.
1023         * gcm-aes.c (gcm_aes_set_key): Use aes_set_encrypt_key and
1024         gcm_set_key, can no longer use GCM_SET_KEY macro.
1025
1026 2014-01-23  Niels Möller  <nisse@lysator.liu.se>
1027
1028         * testsuite/gcm-test.c (test_main): Use the correct
1029         nettle_gcm_aes128/192/256 object.
1030
1031 2014-01-21  Niels Möller  <nisse@lysator.liu.se>
1032
1033         Merged camellia-reorg changes (starting at 2013-10-07).
1034
1035 2013-10-10  Niels Möller  <nisse@lysator.liu.se>
1036
1037         * Makefile.in (nettle_SOURCES): Updated list of camellia files.
1038
1039         * testsuite/camellia-test.c (test_invert): Updated for new
1040         camellia interface.
1041
1042         * camellia.h: Reorganized camellia interface, with distinct
1043         context structs and functions for camellia128 and camellia256.
1044
1045         * camellia-meta.c: Deleted file.
1046         * camellia256-meta.c: New file.
1047         * camellia192-meta.c: New file.
1048         * camellia128-meta.c: New file.
1049
1050         * camellia-set-decrypt-key.c: Deleted file, code moved to:
1051         * camellia128-set-decrypt-key.c: New file.
1052         (camellia128_invert_key, camellia128_set_decrypt_key): New
1053         functions.
1054         * camellia256-set-decrypt-key.c: New file.
1055         (camellia256_invert_key, camellia256_set_decrypt_key)
1056         (camellia192_set_decrypt_key): New functions.
1057         * camellia-invert-key.c (_camellia_invert_key): New file and
1058         function.
1059
1060         * camellia-set-encrypt-key.c: Deleted file, code moved to:
1061         * camellia128-set-encrypt-key.c: New file.
1062         (camellia128_set_encrypt_key): New function.
1063         * camellia256-set-encrypt-key.c: New file.
1064         (_camellia256_set_encrypt_key, camellia256_set_encrypt_key)
1065         (camellia192_set_encrypt_key): New functions.
1066         * camellia-absorb.c (_camellia_absorb): New file and function.
1067         * camellia-internal.h: Moved key schedule macros here.
1068
1069         * camellia-crypt.c: Deleted file, code moved to:
1070         * camellia128-crypt.c (camellia128_crypt): New file and function.
1071         * camellia256-crypt.c (camellia256_crypt): New file and function.
1072
1073 2013-10-07  Niels Möller  <nisse@lysator.liu.se>
1074
1075         * configure.ac: Delete check for ALIGNOF_UINT64_T, no longer
1076         needed.
1077         * config.m4.in: Likewise delete ALIGNOF_UINT64_T.
1078
1079         * camellia-crypt.c (camellia_crypt): Updated call to
1080         _camellia_crypt.
1081         * camellia-internal.h (_camellia_crypt): Updated prototype.
1082         * camellia-crypt-internal.c (_camellia_crypt): Take separate
1083         arguments for rounds and subkey array.
1084         * x86_64/camellia-crypt-internal.asm: Likewise. Also corrected
1085         .file pseudo-ops.
1086         * x86/camellia-crypt-internal.asm: Likewise.
1087
1088 2014-01-20  Niels Möller  <nisse@lysator.liu.se>
1089
1090         * poly1305-internal.c (poly1305_digest): Use union nettle_block16
1091         for s argument.
1092         * poly1305-aes.c (poly1305_aes_digest): Update for poly1305_digest
1093         change.
1094
1095         Merged poly1305 changes (starting at 2013-11-08).
1096         * x86_64/poly1305-internal.asm: Update to new interface.
1097         poly1305_digest much simplified.
1098
1099         * poly1305.h (struct poly1305_ctx): Moved block and index
1100         fields...
1101         (struct poly1305_aes_ctx): ... to here.
1102         * asm.m4: Delete also from the assembly definition of struct
1103         poly1305_ctx.
1104
1105         * poly1305-internal.c (poly1305_digest): Don't do final padding
1106         here, leave that to caller. Add digest to the provided nonce s,
1107         and deleted length and dst arguments. Also reset h0-h4 to zero
1108         when done.
1109         (_poly1305_block): Renamed, from...
1110         (poly1305_block): ...old name.
1111
1112         * poly1305-aes.c (poly1305_aes_update): New function.
1113         (poly1305_aes_digest): Update for poly1305_digest changes, do
1114         final padding here.
1115
1116         * poly1305.c (poly1305_update): Deleted file and function. Moved
1117         to poly1305-aes.c.
1118         * Makefile.in (nettle_SOURCES): Deleted poly1305.c.
1119
1120 2014-01-17  Niels Möller  <nisse@lysator.liu.se>
1121
1122         * poly1305-internal.c (poly1305_block): Additional argument with
1123         the high bit.
1124         (poly1305_block_internal): Deleted function, code moved into the
1125         poly1305_block.
1126         (poly1305_digest): Simplified padding code, call poly1305_block
1127         with high bit 0.
1128         * poly1305.h (poly1305_block): Update prototype.
1129         * poly1305.c (poly1305_update): Call poly1305_block with high bit 1.
1130         * x86_64/poly1305-internal.asm (poly1305_block): Handle new
1131         argument.
1132
1133         * poly1305.h (struct poly1305_ctx): Moved nonce field from here...
1134         (struct poly1305_aes_ctx): ... to here.
1135         * poly1305-aes.c (poly1305_aes_set_nonce, poly1305_aes_digest):
1136         Updated for above.
1137         * poly1305.c (poly1305_set_nonce): Deleted function.
1138         * asm.m4: Delete nonce also from the assembly definition of struct
1139         poly1305_ctx.
1140
1141 2014-01-16  Niels Möller  <nisse@lysator.liu.se>
1142
1143         * poly1305-aes.c: Include poly1305.h. Rewrite functions without
1144         using the POLY1305_* macros.
1145
1146         * Makefile.in (HEADERS): Deleted poly1305-aes.h.
1147
1148         * poly1305.h (POLY1305_CTX, POLY1305_SET_KEY, POLY1305_SET_NONCE)
1149         (POLY1305_DIGEST): Deleted macros. Only implemented variant is
1150         poly1305-aes.
1151         (POLY1305_DIGEST_SIZE, POLY1305_BLOCK_SIZE, POLY1305_KEY_SIZE):
1152         New constants.
1153         (POLY1305_AES_KEY_SIZE, POLY1305_AES_DIGEST_SIZE): Moved here,
1154         from poly1305-aes.h.
1155         (struct poly1305_aes_ctx): Likewise.
1156         (poly1305_aes_set_key, poly1305_aes_set_nonce)
1157         (poly1305_aes_update, poly1305_aes_digest): Likewise.
1158         * poly1305-aes.h: Deleted file, declarations moved to poly1305.h.
1159         Update all users.
1160
1161         * poly1305-internal.c (s2, s3, s4): Fixed macros.
1162
1163         * poly1305-aes.h (struct poly1305_aes_ctx): Replace struct aes_ctx
1164         by struct aes128_ctx.
1165         * poly1305-aes.c (poly1305_aes_set_key, poly1305_aes_digest):
1166         Update to use aes128_* functions.
1167         * poly1305.h (POLY1305_SET_KEY): Drop key size argument when
1168         calling set_key.
1169
1170 2013-12-19  Niels Möller  <nisse@lysator.liu.se>
1171
1172         * poly1305-aes.h (poly1305_aes_update): Define as an alias for
1173         poly1305_update, using preprocessor and a type cast.
1174
1175         * poly1305-aes.c (poly1305_aes_update): Deleted function.
1176
1177         * poly1305.h (poly1305_update): Declare.
1178         (_POLY1305_BLOCK, POLY1305_UPDATE): Deleted macros.
1179
1180         * poly1305.c (poly1305_update): New function.
1181
1182 2013-11-21  Niels Möller  <nisse@lysator.liu.se>
1183
1184         * x86_64/poly1305-internal.asm: New file. Almost a factor of two
1185         speedup.
1186
1187         * configure.ac (asm_replace_list): Added poly1305-internal.asm.
1188
1189         * asm.m4: Define struct offsets for 64-bit poly1305_ctx.
1190
1191         * poly1305.h (POLY1305_DIGEST): Pass the encrypted nonce as an
1192         additional argument to poly1305_digest.
1193         (struct poly1305_ctx): Introduce unions, to support either 26-bit
1194         or 64-bit implementation.
1195
1196         * poly1305-internal.c (poly1305_digest): Added s argument.
1197
1198         * poly1305.c (poly1305_set_s): Deleted function.
1199
1200 2013-11-12  Niels Möller  <nisse@lysator.liu.se>
1201
1202         * poly1305-internal.c: New file, for poly1305 functions depending
1203         on the internal mod (2^130 - 5) representation.
1204         (poly1305_block_internal): New helper function.
1205         (poly1305_block, poly1305_digest): Use it.
1206
1207 2013-11-08  Nikos Mavrogiannopoulos  <nmav@gnutls.org>
1208
1209         * poly1305.h: New file.
1210         * poly1305.c: New file.
1211         * poly1305-aes.h: New file.
1212         * poly1305-aes.c: New file.
1213         * Makefile.in (nettle_SOURCES): Added poly1305-aes.c and poly1305.c.
1214         (HEADERS): Added poly1305-aes.h and poly1305.h.
1215
1216         * testsuite/poly1305-test.c: New file.
1217         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added poly1305-test.c.
1218
1219         * examples/nettle-benchmark.c (time_poly1305_aes): New function.
1220         (main): Benchmark poly1305.
1221
1222 2014-01-20  Niels Möller  <nisse@lysator.liu.se>
1223
1224         * Makefile.in (nettle_SOURCES): Added salsa20-set-nonce.c,
1225         salsa20-128-set-key.c, and salsa20-256-set-key.c.
1226
1227         * salsa20.h: Declare new functions.
1228         (SALSA20_128_KEY_SIZE, SALSA20_256_KEY_SIZE): New constants.
1229         (salsa20_set_iv): Define as an alias for salsa20_set_nonce.
1230
1231         * salsa20-set-key.c (salsa20_set_key): Use salsa20_128_set_key and
1232         salsa20_256_set_key.
1233         (salsa20_set_iv): Renamed and moved...
1234         * salsa20-set-nonce.c (salsa20_set_nonce): ... new file, new name.
1235
1236         * salsa20-256-set-key.c (salsa20_256_set_key): New file and
1237         function.
1238         * salsa20-128-set-key.c (salsa20_128_set_key): New file and
1239         function.
1240
1241 2014-01-13  Niels Möller  <nisse@lysator.liu.se>
1242
1243         * nettle-types.h (union nettle_block16): New type, replacing union
1244         gcm_block.
1245         * gcm.h (union gcm_block): Deleted. Replaced by nettle_block16.
1246         * gcm.c: Replaced all use of gcm_block by nettle_block16.
1247
1248 2014-01-04  Niels Möller  <nisse@lysator.liu.se>
1249
1250         * config.guess: Updated to 2014-01-01 version, from
1251         git://git.sv.gnu.org/config.git.
1252         * config.sub: Likewise.
1253
1254         * testsuite/memxor-test.c [HAVE_VALGRIND_MEMCHECK_H] (test_mark):
1255         New function.
1256         (test_memxor, test_memxor3): Use test_mark to tell valgrind the
1257         start and end of src and destination areas.
1258
1259         * configure.ac: Check for valgrind/memcheck.h.
1260
1261         * testsuite/Makefile.in (VALGRIND): Added --partial-loads-ok=yes,
1262         needed for the way unaligned data is handled in, e.g., memxor.
1263
1264 2014-01-03  Niels Möller  <nisse@lysator.liu.se>
1265
1266         * shadata.c (main): Zero-pad output values to 8 hex digits.
1267         * sha256.c (K): Updated table.
1268
1269 2013-12-17  Niels Möller  <nisse@lysator.liu.se>
1270
1271         * configure.ac (ASM_RODATA): New substituted variable. Needed for
1272         portability to darwin.
1273         * config.m4.in: Define RODATA, using configure variable ASM_RODATA
1274         * x86_64/gcm-hash8.asm: Use RODATA macro.
1275
1276         * bignum-random-prime.c (_nettle_generate_pocklington_prime): Use
1277         stronger variants of Pocklington's theorem, to allow p0 of size
1278         down to bits/3.
1279
1280 2013-12-15  Niels Möller  <nisse@lysator.liu.se>
1281
1282         * nettle-internal.h (NETTLE_MAX_BIGNUM_BITS)
1283         (NETTLE_MAX_BIGNUM_SIZE): Deleted arbitrary limits.
1284
1285 2013-12-15  Nikos Mavrogiannopoulos <nmav@redhat.com>
1286
1287         Introduced TMP_GMP_ALLOC macro for temporary allocations of
1288         potentially large data, e.g, sized as an RSA key.
1289         * gmp-glue.h (TMP_GMP_DECL, TMP_GMP_ALLOC, TMP_GMP_FREE): New
1290         macros.
1291         * gmp-glue.c (gmp_alloc, gmp_free): New functions.
1292         * bignum-next-prime.c (nettle_next_prime): Use TMP_GMP_ALLOC.
1293         * bignum-random.c (nettle_mpz_random_size): Likewise.
1294         * pkcs1-decrypt.c (pkcs1_decrypt): Likewise.
1295         * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
1296         * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): Likewise.
1297         * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
1298         (pkcs1_rsa_sha512_encode_digest): Likewise.
1299         * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
1300         (pkcs1_rsa_sha256_encode_digest): Likewise.
1301         * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
1302         (pkcs1_rsa_sha1_encode_digest): Likewise.
1303         * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
1304         (pkcs1_rsa_md5_encode_digest): Likewise.
1305
1306 2013-12-14  Niels Möller  <nisse@lysator.liu.se>
1307
1308         * x86_64/gcm-hash8.asm: Use .short rather than .hword, for
1309         compatibility with apple's assembler.
1310
1311 2013-12-03  Niels Möller  <nisse@lysator.liu.se>
1312
1313         * x86_64/sha1-compress.asm: Reorganized, to get closer to the x86
1314         version. No difference in running time.
1315
1316         * configure.ac (dummy-dep-files): Don't overwrite any existing
1317         dependency files.
1318
1319         * x86_64/md5-compress.asm: New file, similar to the x86 version.
1320         35% speedup on AMD, 15% speedup on Intel.
1321
1322 2013-11-25  Niels Möller  <nisse@lysator.liu.se>
1323
1324         * testsuite/dsa-test.c (test_main): Additional tests from NIST
1325         test vectors.
1326
1327         * testsuite/testutils.c (test_dsa_sign, test_dsa_verify): New
1328         functions, supporting arbitrary digest size.
1329
1330         * testsuite/testutils.h (ASSERT): Improved failure message.
1331
1332         * dsa-verify.c (dsa_verify): Renamed, from _dsa_verify.
1333         * dsa-sign.c (dsa_sign): Renamed, from _dsa_sign.
1334
1335 2013-11-24  Niels Möller  <nisse@lysator.liu.se>
1336
1337         * testsuite/dsa-keygen-test.c (test_main): Test generating a
1338         key with 224-bit q.
1339
1340         * dsa-verify.c (_dsa_verify): Use _dsa_hash.
1341
1342         * dsa-sign.c (_dsa_sign): Use _dsa_hash. Fix memory leak in
1343         error case, spotted by Nikos.
1344
1345         * dsa-keygen.c (dsa_generate_keypair): Allow q_bits == 224.
1346
1347         * dsa-hash.c (_dsa_hash): New file and function. Allows digest
1348         sizes not matching the bitsize of q.
1349         * dsa.h (_dsa_hash): Declare it.
1350         * Makefile.in (hogweed_SOURCES): Added dsa-hash.c.
1351
1352 2013-11-23  Niels Möller  <nisse@lysator.liu.se>
1353
1354         * configure.ac: Check also for openssl/ecdsa.h.
1355
1356 2013-10-05  Niels Möller  <nisse@lysator.liu.se>
1357
1358         * Makefile.in (nettle_SOURCES): Added eax.c.
1359         (HEADERS): Added eax.h.
1360
1361         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added eax-test.c.
1362
1363         * testsuite/eax-test.c: New file.
1364
1365         * nettle-internal.c (nettle_eax_aes128): New aead algorithm.
1366         (eax_aes128_set_key, eax_aes128_set_nonce, eax_aes128_update)
1367         (eax_aes128_encrypt, eax_aes128_decrypt, eax_aes128_digest): New
1368         functions.
1369
1370         * eax.c: New file.
1371         * eax.h: New file.
1372
1373         * aes.h: Fixed typo in name mangling for new aes functions.
1374
1375 2013-09-28  Niels Möller  <nisse@lysator.liu.se>
1376
1377         * Merge aes-reorg branch. Changes below,
1378         dated 2013-05-17 - 2013-08-13.
1379
1380 2013-08-13  Niels Möller  <nisse@lysator.liu.se>
1381
1382         * yarrow.h (struct yarrow256_ctx): Use aes256_ctx, not aes_ctx.
1383         * yarrow256.c: Adapted to use new aes256 interface.
1384
1385 2013-08-07  Niels Möller  <nisse@lysator.liu.se>
1386
1387         * umac.h (_UMAC_STATE): Use struct aes128_ctx, not aes_ctx.
1388         * umac-set-key.c (umac_kdf, _umac_set_key): Use aes128 interface.
1389         * umac32.c (umac32_digest): Likewise.
1390         * umac64.c (umac64_digest): Likewise.
1391         * umac96.c (umac96_digest): Likewise.
1392         * umac128.c (umac128_digest): Likewise.
1393
1394 2013-06-25  Niels Möller  <nisse@lysator.liu.se>
1395
1396         * aes-meta.c: Deleted file.
1397
1398         Analogous changes for new aes192 and aes256 interface.
1399
1400         * aes.h (struct aes128_ctx): New aes128 declarations.
1401         * aes-decrypt.c (aes128_decrypt): New function.
1402         * aes-encrypt.c (aes128_encrypt): New function.
1403         * aes128-meta.c: New file.
1404         * aes128-set-encrypt-key.c (aes128_set_encrypt_key): New file and
1405         function.
1406         * aes128-set-decrypt-key.c (aes128_set_decrypt_key)
1407         (aes128_invert_key): New file and functions.
1408         * Makefile.in (nettle_SOURCES): Added aes128-set-encrypt-key.c,
1409         aes128-set-decrypt-key.c and aes128-meta.c.
1410
1411         * nettle-internal.c (nettle_unified_aes128): For testing the old
1412         AES interface.
1413         * testsuite/aes-test.c (test_cipher2): New function.
1414         (test_main): Test both nettle_aes128 and nettle_unified_aes128.
1415
1416 2013-05-22  Niels Möller  <nisse@lysator.liu.se>
1417
1418         * Makefile.in (nettle_SOURCES): Added aes-invert-internal.c and
1419         aes-set-key-internal.c.
1420
1421         * aes.h (AES128_KEY_SIZE, _AES128_ROUNDS): New constants.
1422         Similarly also for aes192 and aes256.
1423
1424         * aes-internal.h: Declare new functions.
1425
1426         * aes-set-key-internal.c (_aes_set_key): New file and funxtion
1427         extracted from aes_set_encrypt_key.
1428         * aes-set-encrypt-key.c (aes_set_encrypt_key): Use _aes_set_key.
1429
1430         * aes-invert-internal.c (_aes_invert): New file and function,
1431         extracted from aes_invert_key.
1432         * aes-set-decrypt-key.c (aes_invert_key): Use _aes_invert.
1433
1434         * arm/v6/aes-encrypt-internal.asm: Adapted to new interface.
1435         Unfortunately, 4% slowdown on Cortex-A9, for unknown reason.
1436         * arm/v6/aes-decrypt-internal.asm: Likewise.
1437         * arm/aes-encrypt-internal.asm: Adapted to new interface.
1438         * arm/aes-decrypt-internal.asm: Likewise.
1439
1440 2013-05-21  Niels Möller  <nisse@lysator.liu.se>
1441
1442         * sparc32/aes-encrypt-internal.asm: Adapted to new interface.
1443         * sparc32/aes-decrypt-internal.asm: Likewise.
1444         * sparc64/aes-encrypt-internal.asm: Likewise.
1445         * sparc64/aes-decrypt-internal.asm: Likewise.
1446
1447         * x86/aes-encrypt-internal.asm: Adapted to new interface.
1448         * x86/aes-decrypt-internal.asm: Likewise.
1449
1450 2013-05-20  Niels Möller  <nisse@lysator.liu.se>
1451
1452         * x86_64/aes-encrypt-internal.asm: Adapted to new interface.
1453         * x86_64/aes-decrypt-internal.asm: Likewise.
1454
1455 2013-05-17  Niels Möller  <nisse@lysator.liu.se>
1456
1457         * aes.h (struct aes_ctx): Renamed nrounds to rounds, and moved
1458         first in the structure.
1459         * aes-set-encrypt-key.c (aes_set_encrypt_key): Updated for renaming.
1460         * aes-set-decrypt-key.c (aes_invert_key): Likewise.
1461
1462         * aes-encrypt-internal.c (_nettle_aes_encrypt): Take rounds and
1463         subkeys as separate arguments, not a struct aes_ctx *. Updated
1464         callers.
1465         * aes-decrypt-internal.c (_nettle_aes_decrypt): Likewise.
1466         * aes-internal.h: Updated prototypes.
1467
1468         * Start of aes-reorg changes.
1469
1470 2013-09-28  Niels Möller  <nisse@lysator.liu.se>
1471
1472         * md4.h (struct md4_ctx): Use single uint64_t variable for block
1473         count.
1474         * md4.c: Use new block count variable.
1475         * md5.c, md5.h (struct md5_ctx): Likewise.
1476         * ripemd160.c, ripemd160.h (struct ripemd160_ctx): Likewise.
1477         * sha1.c, sha1.h (struct sha1_ctx): Likewise.
1478         * sha256.c, sha2.h (struct sha256_ctx): Likewise.
1479
1480         * testsuite/testutils.c (test_hash_large): Added simple progress
1481         indicator.
1482
1483         * macros.h (MD_PAD): Use size argument, don't depend on
1484         sizeof of the count field(s).
1485
1486 2013-09-22  Niels Möller  <nisse@lysator.liu.se>
1487
1488         * x86_64/gcm-hash8.asm: New file.
1489         * x86_64/gcm-gf-mul-8.asm: Deleted.
1490
1491         * configure.ac (asm_nettle_optional_list): Look for gcm-hash8.asm,
1492         not gcm-gf-mul-8.asm.
1493         * gcm.c [HAVE_NATIVE_gcm_hash8]: Make use of (optional) assembly
1494         implementation.
1495
1496 2013-09-21  Niels Möller  <nisse@lysator.liu.se>
1497
1498         * Makefile.in (des.po): Add same dependencies as for des.o.
1499         Reported by Vincent Torri.
1500
1501 2013-09-20  Niels Möller  <nisse@lysator.liu.se>
1502
1503         * testsuite/gcm-test.c: Added tests with associated data of
1504         varying size.
1505
1506         * testsuite/testutils.c (tstring_alloc): Add NUL-termination.
1507
1508 2013-09-18  Niels Möller  <nisse@lysator.liu.se>
1509
1510         * Makefile.in: New stampfiles, libnettle.stamp and
1511         libhogweed.stamp, updated when both static and shared libraries
1512         are rebuilt. Used as link dependencies in subdirectories.
1513         * examples/Makefile.in: Make executable targets depend on
1514         ../libnettle.stamp and libhogweed.stamp, not directly on the
1515         static library files.
1516         * testsuite/Makefile.in: Likewise.
1517         * tools/Makefile.in: Likewise.
1518
1519 2013-09-09  Niels Möller  <nisse@lysator.liu.se>
1520
1521         * gcm.c [HAVE_NATIVE_gcm_gf_mul_8]: Make use of (optional)
1522         assembly implementation.
1523
1524         * configure.ac: Support optional assembly files for both nettle
1525         and hogweed. Replaced OPT_ASM_SOURCES with OPT_ASM_NETTLE_SOURCES,
1526         OPT_ASM_HOGWEED_SOURCES, and asm_optional_list with
1527         asm_nettle_optional_list and asm_hogweed_optional_list.
1528         (asm_nettle_optional_list): Added gcm-gf-mul-8.asm.
1529
1530 2013-06-25  Niels Möller  <nisse@lysator.liu.se>
1531
1532         * testsuite/gcm-test.c: Deleted redundant include of aes.h.
1533
1534         * testsuite/testutils.c (test_aead): Allow digest size smaller
1535         than the block size.
1536
1537         * tools/nettle-pbkdf2.c: New command line tool.
1538         * tools/Makefile.in (TARGETS): Added nettle-pbkdf2.
1539         (nettle-pbkdf2$(EXEEXT)): New target.
1540         * testsuite/nettle-pbkdf2-test: New test case.
1541         * testsuite/Makefile.in (TS_SH): Added nettle-pbkdf2-test.
1542
1543         * tools/nettle-hash.c (digest_file): Use stack allocation for the
1544         small hex output buffer.
1545
1546         * examples/io.c (MIN): Deleted unused macro.
1547
1548 2013-05-21  Niels Möller  <nisse@lysator.liu.se>
1549
1550         From nettle-2.7-fixes branch:
1551         * Makefile.in (distdir): Distribute files in arm/v6 subdirectory.
1552
1553 2013-05-20  Niels Möller  <nisse@lysator.liu.se>
1554
1555         * arm/v6/sha1-compress.asm: Moved into v6 directory, since it uses
1556         the v6 instruction uadd8, sel and rev.
1557         * arm/v6/sha256-compress.asm: Likewise.
1558
1559         * nettle-types.h: Include <stddef.h>, for size_t.
1560
1561 2013-05-17  Niels Möller  <nisse@lysator.liu.se>
1562
1563         * macros.h (ROTL32, ROTL64): Avoid undefined behaviour for zero
1564         rotation count. Unfortunately makes CAST128 a bit slower with
1565         gcc-4.6.3.
1566
1567         * ecc-j-to-a.c (ecc_j_to_a): Fixed ecc_modp_mul call, to avoid
1568         invalid overlap of arguments to mpn_mul_n. Problem tracked down by
1569         Magnus Holmgren.
1570
1571 2013-05-16  Niels Möller  <nisse@lysator.liu.se>
1572
1573         * arm/aes-encrypt-internal.asm: New file, for pre-v6 processors.
1574         * arm/aes-decrypt-internal.asm: New file, likewise.
1575
1576         * arm/aes.m4 (AES_FINAL_ROUND_V5): Variant without using uxtb.
1577         (AES_FINAL_ROUND_V6): New name, updated callers.
1578         (AES_FINAL_ROUND): ... old name. Also eliminated one uxtb
1579         instruction.
1580         (AES_ENCRYPT_ROUND, AES_DECRYPT): Moved macros to the
1581         files using them.
1582
1583         * arm/v6/aes-encrypt-internal.asm: Use ALIGN macro. Use 16-byte
1584         alignment for loops.
1585         * arm/v6/aes-decrypt-internal.asm: Likewise. Also added a nop
1586         which mysteriously improves benchmark performance on Cortex-A9.
1587
1588 2013-05-15  Niels Möller  <nisse@lysator.liu.se>
1589
1590         * configure.ac (asm_path): Handle armv6 and armv7 differently from
1591         older ARMs. Add the arm/v6 directory to asm_path when appropriate.
1592
1593         * arm/v6/aes-encrypt-internal.asm: Moved into v6 directory. Uses
1594         the uxtb instruction which is not available for older ARMs.
1595         * arm/v6/aes-decrypt-internal.asm: Likewise.
1596
1597 2013-05-03  Niels Möller  <nisse@lysator.liu.se>
1598
1599         * cast128.c: Adapt to new struct cast128_ctx.
1600         (cast128_set_key): Rewrite, eliminating lots of conditions and
1601         some false warnings.
1602
1603         * cast128.h (struct cast128_ctx): Separate the small 5-bit
1604         rotation subkeys and the larger 32-bit masking subkeys.
1605
1606 2013-05-02  Niels Möller  <nisse@lysator.liu.se>
1607
1608         * testsuite/testutils.c (mpz_combit): Renamed. Define only if not
1609         provided GMP. Updated all uses.
1610         (mpz_togglebit): ... old name.
1611
1612         * sexp-format.c (sexp_vformat): Use type mpz_srcptr rather
1613         than the old MP_INT *.
1614
1615 2013-04-26  Niels Möller  <nisse@lysator.liu.se>
1616
1617         * Many files: Use size_t rather than unsigned for data sizes.
1618         * x86_64/aes-encrypt-internal.asm: Accept 64-bit length.
1619         * x86_64/aes-decrypt-internal.asm: Likewise.
1620
1621 2013-04-25  Niels Möller  <nisse@lysator.liu.se>
1622
1623         * configure.ac: Changed version number, to 2.8.
1624         (LIBNETTLE_MAJOR): Bumped major number, following
1625         nettle_memxor ABI break.
1626         (LIBNETTLE_MINOR): Reset to zero.
1627
1628         * examples/hogweed-benchmark.c: Add benchmarking of OpenSSL's RSA
1629         functions.
1630         (all functions): Deleted unneeded casts.
1631
1632 2013-04-24  Niels Möller  <nisse@lysator.liu.se>
1633
1634         * nettle.texinfo (Miscellaneous functions): Updated memxor
1635         prototype. Document memxor3.
1636
1637         * salsa20-crypt.c (salsa20_crypt): Deleted cast of memxor
1638         argument, no longer needed.
1639         * salsa20r12-crypt.c (salsa20r12_crypt): Likewise.
1640         * sha3.c (sha3_absorb): Likewise.
1641
1642         * memxor.h: Updated prototypes. Drop include of nettle-types.h.
1643
1644         * memxor.c: Include nettle-types.h, for uintptr_t. Replace all
1645         internal uses of uint8_t by plain char.
1646         (memxor): Use void * rather than uint8_t * for
1647         arguments.
1648         (memxor3): Likewise.
1649
1650         * x86_64/memxor.asm: Added nettle_ prefix to symbols.
1651         * arm/memxor.asm: Likewise.
1652
1653         * testsuite/symbols-test: Don't allow memxor functions without
1654         nettle prefix,
1655
1656         * memxor.h (memxor3): Added name mangling to add "nettle_" prefix
1657         to memxor and memxor3 symbols.
1658
1659         * Makefile.in (nettle_OBJS): Deleted $(LIBOBJS), and also deleted
1660         LIBOBJS substitution.
1661         (nettle_SOURCES): Added memxor.c, to include it in the library
1662         unconditionally.
1663
1664         * configure.ac: Deleted AC_REPLACE_FUNCS for memxor.
1665
1666         * Released nettle-2.7.
1667
1668 2013-04-23  Niels Möller  <nisse@lysator.liu.se>
1669
1670         From Martin Storsjö:
1671         * x86_64/sha256-compress.asm: Add forgotten W64_EXIT.
1672         * x86_64/sha512-compress.asm: Likewise.
1673         * x86_64/salsa20-crypt.asm (Lpartial): Don't return via W64_EXIT
1674         within this subfunction.
1675         * x86_64/machine.m4 (W64_ENTRY): Use movdqu instead of movdqa for
1676         saving xmm registers, since the stack is not guaranteed to be
1677         16-byte aligned on win64. Take pushed xmm registers into account
1678         when reading the fifth parameter from the stack.
1679
1680         * Makefile.in: Consistently use EXEEXT_FOR_BUILD.
1681
1682 2013-04-21  Niels Möller  <nisse@lysator.liu.se>
1683
1684         * Makefile.in (DISTFILES): Added mini-gmp.c and mini-gmp.h.
1685         (distdir): Use find, for identifying assembly files to copy.
1686
1687 2013-04-18  Niels Möller  <nisse@lysator.liu.se>
1688
1689         * configure.ac: Recognize cpu type "arm*", not just "armv7*'.
1690
1691         * arm/aes-encrypt-internal.asm: Updated include of aes.m4.
1692         * arm/aes-decrypt-internal.asm: Likewise.
1693
1694         * Makefile.in (distdir): Updated for ARM reorganization.
1695
1696         * configure.ac (asm_path): Generalized, can now be a list of
1697         directories. On ARM, check for neon instructions, and add arm/neon
1698         if appropriate. New command line options
1699         --enable-arm-neon/--disable-arm-neon, for overriding the default.
1700
1701         arm/neon: New subdirectory, for assembly files making use of neon
1702         instructions.
1703
1704         arm: Renamed directory, from...
1705         armv7: ...old name.
1706
1707         * aclocal.m4 (NETTLE_CHECK_ARM_NEON): New macro.
1708
1709         * nettle.texinfo (Keyed hash functions): Document UMAC.
1710
1711         * umac.h (UMAC32_DIGEST_SIZE, UMAC64_DIGEST_SIZE)
1712         (UMAC96_DIGEST_SIZE, UMAC128_DIGEST_SIZE): New constants.
1713         (UMAC_DATA_SIZE): New name, for consistency with hash functions.
1714         Updated all uses.
1715         (UMAC_BLOCK_SIZE): ... old name.
1716
1717 2013-04-17  Niels Möller  <nisse@lysator.liu.se>
1718
1719         * examples/nettle-benchmark.c (main): Benchmark salsa20r12.
1720
1721         * nettle-internal.c (nettle_salsa20r12): Cipher struct for
1722         benchmarking only.
1723         * nettle-internal.h (nettle_salsa20): Declare it.
1724
1725         * Makefile.in (eccdata): Depend on mini-gmp files. Drop -lgmp.
1726
1727         * eccdata.c: Use mini-gmp, to avoid gmp dependency and associated
1728         configure tests for the *build* system. Replaced mpz_submul_ui by
1729         mpz_mul_ui + mpz_sub, and gmp_printf and gmp_fprintf by calls to
1730         mpz_out_str.
1731
1732         * mini-gmp.h, mini-gmp.c: New files, copied from gmp-5.1.1.
1733
1734 2013-04-16  Niels Möller  <nisse@lysator.liu.se>
1735
1736         * umac-set-key.c (BE_SWAP32_N): Fixed dummy definition used for
1737         big-endian systems.
1738
1739         * Makefile.in (TARGETS): Deleted eccdata, it should be build only
1740         when public key support is enabled.
1741         (clean-here): Exlicitly list it here.
1742
1743         * asm.m4 (m4_log2): New macro, similar to the one in gmp.
1744         (ALIGN): Changed to take alignment in bytes. Updated all callers,
1745         currently used only in x86 and x86_64 files.
1746
1747         * umac.h (umac32_ctx, umac64_ctx, umac96_ctx, umac128_ctx): Make
1748         block count an uint64_t. Reorder some elements to put short values
1749         together.
1750         * umac-l2.c (_umac_l2, _umac_l2_final): Make count argument an uint64_t.
1751         (_umac_l2): Deleted redundant memcpy.
1752         (_umac_l2, _umac_l2_final): Store input buffer at end of the
1753         poly64/poly128 state. Deleted l1_out from corresponding context
1754         structs, and updated all callers.
1755
1756         * configure.ac: Changed version number to 2.7.
1757         (LIBNETTLE_MINOR): Bumped library version, to 4.6.
1758         (LIBHOGWEED_MINOR): And to 2.4.
1759
1760         * Makefile.in (distdir): Include files from armv7 subdirectory.
1761
1762         * x86_64/umac-nh-n.asm: New file, 3.5 time speedup.
1763
1764         * umac32.c (umac32_digest): Fix nonce caching.
1765         * umac64.c (umac64_digest): Likewise.
1766
1767         * testsuite/umac-test.c (test_incr): New function.
1768         (test_main): Test nonce increment.
1769
1770         * misc/umac/umac.py: UMAC reference implementation.
1771         * misc/umac/rijndael.py: AES implementation used by umac.py.
1772         * misc/umac/mkvectors: Script to generate UMAC test vectors.
1773         * misc/umac/vectors.out: Generated test vectors.
1774
1775         * umac32.c (umac32_digest): Fix nonce increment, use INCREMENT
1776         macro.
1777         * umac64.c (umac64_digest): Likewise.
1778         * umac96.c (umac96_digest): Likewise.
1779         * umac128.c (umac128_digest): Likewise.
1780
1781         * macros.h (INCREMENT): Allow size == 1.
1782
1783 2013-04-15  Niels Möller  <nisse@lysator.liu.se>
1784
1785         * x86_64/umac-nh.asm: New file. 4.4 time speedup.
1786
1787         * armv7/umac-nh-n.asm: New file. 2.0-2.3 time speedup.
1788
1789         * testsuite/umac-test.c (test_align): Fixed memory leak.
1790
1791 2013-04-12  Niels Möller  <nisse@lysator.liu.se>
1792
1793         * armv7/umac-nh.asm: New file. 2.4 time speedup.
1794
1795         * armv7/machine.m4 (D0REG, D1REG): New macros.
1796
1797         * configure.ac (asm_replace_list): Added umac-nh.asm and
1798         umac-nh-n.asm.
1799
1800         * testsuite/umac-test.c: Test different alignments for the
1801         message.
1802
1803 2013-04-11  Niels Möller  <nisse@lysator.liu.se>
1804
1805         * umac-nh-n.c (_umac_nh_n): Rewrote as a single pass over the
1806         message data.
1807
1808         * examples/nettle-benchmark.c (time_umac): New function.
1809         (main): Call it.
1810
1811         * umac-set-key.c (_umac_set_key): Drop byteswapping of l3_key2, it
1812         can be xored directly to the pad in native byteorder.
1813         * umac-l3.c (_umac_l3): Drop key_2 argument, let caller do that
1814         xor. Updated all callers.
1815         * umac32.c (umac32_digest): Adapt to l3 changes.
1816         * umac64.c (umac64_digest): Likewise.
1817         * umac96.c (umac96_digest): Likewise.
1818         * umac128.c (umac128_digest): Likewise.
1819
1820         Initial implementation of umac.
1821         * umac.h: New file.
1822         * umac-nh.c: New file.
1823         * umac-nh-n.c: New file.
1824         * umac-poly64.c: New file.
1825         * umac-poly128.c: New file.
1826         * umac-l2.c: New file.
1827         * umac-l3.c: New file.
1828         * Makefile.in (nettle_SOURCES): Added umac source files.
1829         (HEADERS): Added umac.h.
1830         * testsuite/umac-test.c: New file.
1831         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added umac-test.c.
1832
1833         * ecc-mul-a.c (ecc_mul_a): Avoid using mp_bitcnt_t, for
1834         compatibility with older GMP versions.
1835         * ecc-mul-g.c (ecc_mul_g): Likewise.
1836         * eccdata.c (ecc_mul_binary): Likewise.
1837         * sec-modinv.c (sec_modinv): Likewise.
1838
1839         * x86_64/sha3-permute.asm: Go via memory for moves between general
1840         registers and xmm registers.
1841
1842 2013-04-06  Niels Möller  <nisse@lysator.liu.se>
1843
1844         From Edgar E. Iglesias:
1845         * sha3.c (_sha3_update): Fix condition for when the block buffer
1846         is full.
1847
1848 2013-04-04  Niels Möller  <nisse@lysator.liu.se>
1849
1850         * ecc-point.c (ecc_point_get): Allow NULL x or y, ignore
1851         corresponding coordinate.
1852
1853         * nettle.texinfo (Elliptic curves): Document high-level ECDSA
1854         support.
1855
1856         From Martin Storsjö. Fallback functions for older GMP releases.
1857         * gmp-glue.c (mpn_copyd, mpn_copyi, mpn_zero): New functions.
1858         * gmp-glue.h: Declare them.
1859         (mpn_sqr): Fallback macro.
1860
1861         * gmp-glue.h (cnd_add_n, cnd_sub_n): Moved here, define in terms
1862         of mpn_cnd_add_n and mpn_sub_n if available, otherwise in terms of
1863         mpn_addmul_1 and mpn_submul_1. This seems to be an improvement for
1864         subtraction, but more questionable for addition.
1865
1866         * ecc-internal.h: Include gmp-glue.h. Deleted corresponding
1867         include in all files using ecc-internal.h.
1868         (cnd_add_n, cnd_sub_n): Moved from here.
1869
1870 2013-04-03  Niels Möller  <nisse@lysator.liu.se>
1871
1872         * ecc-point-mul-g.c (ecc_point_mul_g): New file and function.
1873         * ecc-point-mul.c (ecc_point_mul): New file and function.
1874         * ecc.h: Updated declarations and name mangling.
1875         * Makefile.in (hogweed_SOURCES): Added ecc-point-mul.c and
1876         ecc-point-mul-g.c.
1877
1878         * testsuite/salsa20-test.c (test_main): Tests for salsa20r12,
1879         contributed by Nikos Mavrogiannopoulos.
1880
1881 2013-03-26  Niels Möller  <nisse@lysator.liu.se>
1882
1883         * armv7/salsa20-core-internal.asm: New file. 45% speedup.
1884
1885 2013-03-25  Niels Möller  <nisse@lysator.liu.se>
1886
1887         From Martin Storsjö:
1888         * examples/timing.c: New file, extracted from nettle-benchmark.c.
1889         * examples/timing.h: New file.
1890         * examples/Makefile.in (SOURCES): Added timing.c.
1891         (DISTFILES): Added timing.h.
1892         (BENCH_OBJS, ECC_BENCH_OBJS, HOGWEED_BENCH_OBJS): Added timing.o.
1893         * examples/nettle-benchmark.c: Use timing.h.
1894         * examples/hogweed-benchmark.c: Likewise.
1895         * examples/ecc-benchmark.c: Likewise.
1896
1897         From Nikos Mavrogiannopoulos:
1898         * salsa20r12-crypt.c (salsa20r12_crypt): New file and function.
1899         * salsa20.h (salsa20r12_crypt): Declare.
1900         * Makefile.in (nettle_SOURCES): Added salsa20r12-crypt.c.
1901
1902         From Martin Storsjö:
1903         * examples/hogweed-benchmark.c: Include local headers.
1904         * testsuite/ecdsa-keygen-test.c: Likewise.
1905         * x86_64/sha3-permute.asm: Workaround for Apple's assembler; write
1906         movq instructions as movd.
1907
1908         * Makefile.in (hogweed_PURE_OBJS): Don't include OPT_ASM_SOURCES
1909         twice.
1910
1911 2013-03-15  Niels Möller  <nisse@lysator.liu.se>
1912
1913         * armv7/sha3-permute.asm: New file. 4.5 time speedup.
1914
1915         * armv7/machine.m4 (QREG): New macro.
1916
1917 2013-03-14  Niels Möller  <nisse@lysator.liu.se>
1918
1919         * configure.ac (asm_replace_list): Added sha3-permute.asm,
1920         revering 2012-12-30 change. 34% speedup on intel i5, from 2190
1921         cycles for the C implementation down to 1630.
1922
1923         * armv7/sha512-compress.asm: Optimized. Keep expanded data in
1924         registers, exploit parallelism. Another 70% speedup.
1925
1926         * testsuite/sha512-test.c (test_main): Additional test vectors,
1927         including some longer than 128 bytes.
1928
1929 2013-03-13  Niels Möller  <nisse@lysator.liu.se>
1930
1931         * armv7/sha512-compress.asm: New file, using neon instructions.
1932         2.3 time speedup.
1933
1934         * configure.ac (asm_replace_list): Added sha512-compress.asm.
1935         * x86_64/machine.m4 (OFFSET64): New macro.
1936         * x86_64/sha512-compress.asm: New file, 20% speedup.
1937
1938         * sha512-compress.c (ROUND): Eliminated a temporary, analogous to
1939         sha256 change below.
1940
1941         * x86_64/sha256-compress.asm: New file, 16% speedup (benchmarked
1942         on intel i5).
1943
1944 2013-03-11  Niels Möller  <nisse@lysator.liu.se>
1945
1946         * armv7/sha256-compress.asm: New file, 25% speedup.
1947
1948         * configure.ac (asm_replace_list): Added sha256-compress.asm.
1949
1950         * sha256-compress.c (ROUND): Eliminated a temporary.
1951
1952         * armv7/sha1-compress.asm: New file, 9% speedup.
1953
1954         * testsuite/testutils.c (test_hash): Test different alignments for
1955         the hash input.
1956
1957 2013-03-08  Niels Möller  <nisse@lysator.liu.se>
1958
1959         * armv7/aes-decrypt-internal.asm: New file, 15% speedup.
1960         * armv7/aes-encrypt-internal.asm: New file, 25% speedup.
1961         * armv7/aes.m4: New file.
1962
1963 2013-03-07  Niels Möller  <nisse@lysator.liu.se>
1964
1965         * gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros.
1966
1967         * Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata)
1968         (eccdata): Arrange for compiling these programs for running on the
1969         build system, also when cross compiling everything else.
1970
1971         * config.make.in (CC_FOR_BUILD, EXEEXT_FOR_BUILD): New variables.
1972
1973         * configure.ac: Use GMP_PROG_CC_FOR_BUILD and
1974         GMP_PROG_EXEEXT_FOR_BUILD.
1975
1976         * aclocal.m4 (GMP_PROG_CC_FOR_BUILD, GMP_PROG_CC_FOR_BUILD_WORKS)
1977         (GMP_PROG_EXEEXT_FOR_BUILD): New macros, based on GMP's.
1978
1979         * aesdata.c: Deleted includes of config.h and nettle-types.h. Use
1980         unsigned char and unsigned long instead of stdint.h types.
1981
1982         * desdata.c: Deleted includes of config.h and desCode.h.
1983         (main): Return 1 on invalid argument. Don't use ROR macro. Use
1984         unsigned long instead of uint32_t, and make it work if unsigned
1985         long is larger than 32 bits.
1986
1987         * gcmdata.c: Deleted include of config.h and use UNUSED macro.
1988         * shadata.c: Likewise.
1989
1990         * twofishdata.c: Deleted include of nettle-types.h. Use unsigned
1991         char instead of stdint.h types.
1992
1993         * x86_64/ecc-521-modp.asm: New file. 2.4 time speedup.
1994
1995 2013-03-06  Niels Möller  <nisse@lysator.liu.se>
1996
1997         * x86_64/ecc-384-modp.asm: New file, 3 time speedup.
1998         * x86_64/ecc-256-redc.asm: New file, 2.5 time speedup.
1999         * x86_64/ecc-224-modp.asm: New file, 5 time speedup over C
2000         version.
2001
2002 2013-03-05  Niels Möller  <nisse@lysator.liu.se>
2003
2004         * configure.ac (asm_optional_list): Added ecc-521-modp.asm.
2005         * ecc-521.c: Check HAVE_NATIVE_ecc_521_modp, and use native
2006         version if available.
2007         * armv7/ecc-521-modp.asm: New file, 2 time speedup over C version.
2008
2009 2013-03-04  Niels Möller  <nisse@lysator.liu.se>
2010
2011         * configure.ac (asm_optional_list): Added ecc-384-modp.asm. Deleted
2012         bogus reference to $asm_search_list.
2013         * ecc-384.c: Check HAVE_NATIVE_ecc_384_modp, and use native
2014         version if available.
2015         * armv7/ecc-384-modp.asm: New file, 3 time speedup over C version.
2016
2017 2013-03-03  Niels Möller  <nisse@lysator.liu.se>
2018
2019         * ecc-256.c: Fixed definition of USE_REDC.
2020
2021 2013-03-01  Niels Möller  <nisse@lysator.liu.se>
2022
2023         * ecc-256.c: Check HAVE_NATIVE_ecc_256_redc, and use native
2024         version if available.
2025         * armv7/ecc-256-redc.asm: New file, 4 time speedup over C version.
2026
2027         * testsuite/ecc-redc-test.c: Increased test count.
2028
2029         * ecc-224.c: Check HAVE_NATIVE_ecc_224_modp, and use native
2030         version if available.
2031         * armv7/ecc-224-modp.asm: New file, 4.5 time speedup over C
2032         version.
2033
2034         * configure.ac (asm_optional_list): Added ecc-224-modp.asm.
2035         (OPT_ASM_SOURCES): Fixed assignment.
2036
2037 2013-02-28  Niels Möller  <nisse@lysator.liu.se>
2038
2039         * x86_64/ecc-192-modp.asm: Reorganized to reduce number of
2040         additions. Use setc instruction.
2041
2042         * examples/Makefile.in: Let $(HOGWEED_TARGETS) depend on
2043         ../libhogweed.a.
2044
2045         * armv7/ecc-192-modp.asm: New file. 2.5 time speedup over C
2046         version.
2047
2048 2013-02-27  Niels Möller  <nisse@lysator.liu.se>
2049
2050         * ecc-192.c: Check HAVE_NATIVE_ecc_192_modp, and use native
2051         version if available.
2052         (ecc_192_modp): Fixed carry handling bug in 32-bit version.
2053
2054         * x86_64/ecc-192-modp.asm: New file. 3.8 times speedup over C
2055         version.
2056
2057         * configure.ac (OPT_ASM_SOURCES): New substituted variable.
2058         (asm_replace_list, asm_optional_list): New variables. For files in
2059         asm_optional_list, also add them to OPT_ASM_SOURCES and define
2060         appropriate HAVE_NATIVE_* symbols found.
2061
2062         * Makefile.in (OPT_ASM_SOURCES): New variable. Used for setting
2063         hogweed_OBJS and hogweed_PURE_OBJS.
2064
2065         * testsuite/ecc-mod-test.c: Increased test count.
2066
2067         * ecc-384.c (ecc_384_modp): Fixed typo which broke carry handling
2068         in the 64-bit version.
2069
2070         * examples/ecc-benchmark.c (bench_add_jjj): Typo fix, benchmark
2071         the right function.
2072
2073         * gmp-glue.h: Check if GMP provides mpz_limbs_read (expected in
2074         next release).
2075         * gmp-glue.c: Use GMP's mpz_limbs_read and friends if available.
2076         Renamed all functions for consistency with GMP. Updated all
2077         callers.
2078
2079 2013-02-20  Niels Möller  <nisse@lysator.liu.se>
2080
2081         * examples/Makefile.in (HOGWEED_TARGETS): Added
2082         hogweed-benchmark$(EXEEXT).
2083         (SOURCES): Added hogweed-benchmark.c.
2084         (hogweed-benchmark$(EXEEXT)): New target.
2085
2086         * examples/hogweed-benchmark.c: New file.
2087
2088         * ecdsa-keygen.c (ecdsa_generate_keypair): New file and function.
2089         * Makefile.in (hogweed_SOURCES): Added ecdsa-keygen.c.
2090         * testsuite/ecdsa-keygen-test.c: New testcase.
2091         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2092         ecdsa-keygen-test.c.
2093
2094         * nettle-internal.h (TMP_ALLOC): Added missing parentheses.
2095
2096 2013-02-18  Niels Möller  <nisse@lysator.liu.se>
2097
2098         * testsuite/ecdsa-verify-test.c: New testcase.
2099         * testsuite/ecdsa-sign-test.c: New testcase.
2100         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2101         ecdsa-sign-test.c and ecdsa-verify-test.c.
2102         * testsuite/testutils.h: Include ecdsa.h.
2103         (SHEX): Deleted const cast.
2104
2105         * ecc-point.c: New file, struct ecc_point abstraction.
2106         * ecc-scalar.c: New file, struct ecc_scalar abstraction.
2107         * ecc-random.c (ecc_modq_random, ecc_scalar_random): New file, new
2108         functions.
2109         * ecc-hash.c (ecc_hash): New file and function.
2110         * ecc-ecdsa-sign.c: New file, low-level signing interface.
2111         * ecc-ecdsa-verify.c: New file, low-level ecdsa verify.
2112         * ecdsa-sign.c: (ecdsa_sign): New file and function.
2113         * ecdsa-verify.c (ecdsa_verify): New file and function.
2114         * ecdsa.h: New header file.
2115         * ecc.h: Declare ecc_point and ecc_scalar functions.
2116         * ecc-internal.h: Added declarations.
2117         * Makefile.in (hogweed_SOURCES): Added new source files.
2118         (HEADERS): Added ecdsa.h.
2119
2120         * gmp-glue.c (_mpz_set_mpn): New convenience function.
2121         (_mpn_set_base256): New function.
2122         (_gmp_alloc_limbs): New function.
2123         (_gmp_free_limbs): New function.
2124         * gmp-glue.h: Corresponding declarations. Include nettle-stdinh.h.
2125
2126         * examples/Makefile.in (HOGWEED_TARGETS): Renamed, was
2127         RSA_TARGETS. Added ecc-benchmark$(EXEEXT).
2128         (SOURCES): Added ecc-benchmark.c.
2129         (ecc-benchmark$(EXEEXT)): New target.
2130
2131         * examples/ecc-benchmark.c: New file, benchmarking ecc primitives.
2132
2133 2013-02-15  Niels Möller  <nisse@lysator.liu.se>
2134
2135         Integrate ecc_mul_a.
2136         * ecc-a-to-j.c: New file.
2137         * ecc-add-jjj.c: New file.
2138         * ecc-mul-a.c: New file.
2139         * Makefile.in (hogweed_SOURCES): Added new files.
2140         * testsuite/ecc-mul-a-test.c: New file.
2141         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2142         ecc-mul-a-test.c.
2143
2144         * testsuite/testutils.c: Removed redundant includes.
2145         (die): New function.
2146
2147         Integrate ecc_mul_g.
2148         * ecc.h: New file.
2149         * ecc-j-to-a.c: New file.
2150         * ecc-size.c: New file.
2151         * ecc-add-jja.c: New file.
2152         * ecc-dup-jj.c: New file.
2153         * ecc-mul-g.c: New file.
2154         * sec-tabselect.c: New file.
2155         * Makefile.in (hogweed_SOURCES): Added new files.
2156         (HEADERS): Added ecc.h
2157         * testsuite/ecc-mul-g-test.c: New file.
2158         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2159         ecc-mul-g-test.c.
2160         * testsuite/testutils.c (xalloc_limbs): New function.
2161         (test_mpn): New function.
2162         (test_ecc_point): New function.
2163         (test_ecc_mul_a): New function.
2164         (test_ecc_mul_j): New function.
2165         * testsuite/testutils.h: Corresponding declarations.
2166
2167         Integrate ECC internals.
2168         * ecc-curve.h: New file.
2169         * ecc-internal.h: New file.
2170         * cnd-copy.c: New file.
2171         * ecc-192.c: New file.
2172         * ecc-224.c: New file.
2173         * ecc-256.c: New file.
2174         * ecc-384.c: New file.
2175         * ecc-521.c: New file.
2176         * ecc-generic-modp.c: New file.
2177         * ecc-generic-modq.c: New file.
2178         * ecc-generic-redc.c: New file.
2179         * ecc-mod.c: New file.
2180         * ecc-modp.c: New file.
2181         * ecc-modq.c: New file.
2182         * sec-add-1.c: New file.
2183         * sec-modinv.c: New file.
2184         * sec-sub-1.c: New file.
2185         * Makefile.in (hogweed_SOURCES): Added new files.
2186         (HEADERS): Added ecc-curve.h.
2187         (DISTFILES): Added ecc-internal.h.
2188         * testsuite/ecc-mod-test.c: New file.
2189         * testsuite/ecc-modinv-test.c: New file.
2190         * testsuite/ecc-redc-test.c: New file.
2191         * testsuite/testutils.c (ecc_curves): New constant array.
2192         * testsuite/testutils.h: Include ecc-related headers. Declare
2193         ecc_curves array.
2194         * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added ecc-mod-test.c
2195         ecc-modinv-test.c ecc-redc-test.c.
2196
2197         * gmp-glue.c: New file, mpn <-> mpz conversions.
2198         * gmp-glue.h: New file.
2199         * Makefile.in: Added to hogweed_SOURCES and DISTFILES, respectively.
2200
2201         * eccdata.c: New program, for generating ECC-related tables.
2202         * Makefile.in (ecc-192.h, ecc-224.h, ecc-256.h, ecc-384.h)
2203         (ecc-512.h): New generated files.
2204
2205 2013-02-19  Niels Möller  <nisse@lysator.liu.se>
2206
2207         * armv7/memxor.asm (memxor): Software pipelining for the aligned
2208         case. Runs at 6 cycles (0.5 cycles per byte). Delayed push of
2209         registers until we know how many registers we need.
2210         (memxor3): Use 3-way unrolling also for aligned memxor3.
2211         Runs at 8 cycles (0.67 cycles per byte)
2212
2213 2013-02-14  Niels Möller  <nisse@lysator.liu.se>
2214
2215         * configure.ac: Find GMP's GMP_NUMB_BITS. Substitute in Makefile.
2216         * config.make.in (GMP_NUMB_BITS): New variable.
2217
2218         * examples/rsa-keygen.c (uint_arg): New function.
2219         (main): New options -s and -e, to specify key size and public
2220         exponent. Increased default key size to 2048.
2221
2222 2013-02-12  Niels Möller  <nisse@lysator.liu.se>
2223
2224         * armv7/memxor.asm (memxor): Optimized aligned case, using 3-way
2225         unrolling.
2226
2227 2013-02-06  Niels Möller  <nisse@lysator.liu.se>
2228
2229         * armv7/memxor.asm (memxor, memxor3): Optimized aligned case, now
2230         runs at 0.75 cycles/byte.
2231
2232         * armv7/README: New file.
2233         * armv7/machine.m4: New (empty) file.
2234         * armv7/memxor.asm: Initial assembly implementation.
2235
2236         * config.m4.in: Substitute ASM_TYPE_PROGBITS as TYPE_PROGBITS.
2237
2238         * config.make.in: Added .s to the suffix list.
2239
2240         * Makefile.in (.asm.s): Use a separate make target for .asm
2241         preprocessing. Include asm.d, which the corresponding
2242         dependencies.
2243
2244         * configure.ac (asm_file_list): Collect assembly files into this
2245         variable.
2246         (asm.d): Make config.status write dependencies for .s files into
2247         asm.d.
2248         (ASM_ALIGN_LOG): Set to "no" when appropriate.
2249         (ASM_TYPE_FUNCTION): Default to "@function".
2250         (ASM_TYPE_PROGBITS): New substituted variable, set in the same way
2251         as ASM_TYPE_FUNCTION.
2252         (ASM_MARK_NOEXEC_STACK): Use TYPE_PROGBITS.
2253         (asm_path): Set up asm_path for armv7.
2254
2255         * asm.m4: Use changecom to disable m4 quoting. Use divert to
2256         suppress output.
2257
2258 2013-02-05  Niels Möller  <nisse@lysator.liu.se>
2259
2260         * testsuite/rsa-keygen-test.c (test_main): Updated expected
2261         signatures, after the nettle_mpz_random change below.
2262         * testsuite/dsa-test.c (test_main): Likewise. Also fixed the
2263         dsa256 test to actually use the expected signature.
2264
2265 2013-01-31  Niels Möller  <nisse@lysator.liu.se>
2266
2267         * bignum-random.c (nettle_mpz_random): Increased number of extra
2268         bits to 64, following FIPS 186-3.
2269
2270 2013-01-16  Niels Möller  <nisse@lysator.liu.se>
2271
2272         * Released nettle-2.6.
2273
2274 2013-01-12  Niels Möller  <nisse@lysator.liu.se>
2275
2276         * configure.ac: Use AC_LANG_SOURCE.
2277
2278 2013-01-02  Niels Möller  <nisse@lysator.liu.se>
2279
2280         * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.5.
2281         (LIBHOGWEED_MINOR): And to 2.3.
2282
2283         * examples/Makefile.in: Explicit rules for building objects in
2284         parent directory.
2285         * tools/Makefile.in: Likewise.
2286         * testsuite/Makefile.in: Likewise.
2287
2288 2013-01-01  Niels Möller  <nisse@lysator.liu.se>
2289
2290         * nettle.texinfo (Recommended hash functions): Document additional
2291         sha3 functions.
2292
2293         * examples/nettle-benchmark.c (main): Benchmark additional sha3
2294         functions.
2295
2296 2012-12-30  Niels Möller  <nisse@lysator.liu.se>
2297
2298         * sha3-224.c, sha3-224-meta.c: New files.
2299         * sha3-384.c, sha3-384-meta.c: New files.
2300         * sha3-512.c, sha3-512-meta.c: New files.
2301         * sha3.h: Prototypes for sha3 with sizes 224, 384 and 512.
2302         * nettle-meta.h: Declare nettle_sha3_224, nettle_sha3_384 and
2303         nettle_sha3_512.
2304         * Makefile.in (nettle_SOURCES): Added new sha3 files.
2305
2306         * testsuite/sha3-224-test.c: New file.
2307         * testsuite/sha3-384-test.c: New file.
2308         * testsuite/sha3-512-test.c: New file.
2309         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new sha3 test files.
2310
2311         * configure.ac: Disabled use of sha3-permute.asm.
2312
2313 2012-12-20  Niels Möller  <nisse@lysator.liu.se>
2314
2315         From Tim Rühsen:
2316         * testsuite/des-compat-test.c (pt): Use proper prototype, use
2317         const.
2318         * testsuite/testutils.c (test_dsa_key): Deleted spurious
2319         semicolon.
2320
2321 2012-12-15  Niels Möller  <nisse@lysator.liu.se>
2322
2323         Based on a patch from Alon Bar-Lev:
2324         * Makefile.in (LIBTARGETS, SHLIBTARGET): Define as empty if static
2325         or shared libraries, respectively, are disabled.
2326         (TARGETS): Deleted @IF_SHARED@ conditional, now in the definition
2327         of SHLIBTARGET.
2328
2329         From Alon Bar-Lev:
2330         * configure.ac: Check for ar program. New option --disable-static.
2331         * config.make.in (AR): Use configured value.
2332
2333 2012-12-13  Niels Möller  <nisse@lysator.liu.se>
2334
2335         * x86_64/sha3-permute.asm: Rewrote, to keep all state in
2336         registers. 2400 cycles on x86_64, only slightly faster than the
2337         current C code.
2338
2339 2012-12-09  Niels Möller  <nisse@lysator.liu.se>
2340
2341         * sha3-permute.c (sha3_permute): Rewrote to do permutation in
2342         place. 80% speedup on x86_64, 2500 cycles.
2343
2344 2012-12-04  Niels Möller  <nisse@lysator.liu.se>
2345
2346         * ctr.c (ctr_crypt): Fix bug reported by Tim Kosse. Don't
2347         increment the counter when length is zero (was broken for the
2348         in-place case).
2349
2350         * testsuite/ctr-test.c (test_main): Added test with zero-length
2351         data.
2352         * testsuite/testutils.c (test_cipher_ctr): Check the ctr value
2353         after encrypt and decrypt.
2354
2355 2012-12-03  Niels Möller  <nisse@lysator.liu.se>
2356
2357         * sha3-permute.c (sha3_permute): Optimized, to reduce number of
2358         passes over the data. 20% speedup on x86_64, 4700 cycles.
2359
2360         * configure.ac: Added sha3-permute.asm.
2361
2362         * x86_64/sha3-permute.asm: New file. 30% speedup over current C
2363         code, 4300 cycles.
2364
2365         * nettle.texinfo (Hash functions): Split into several sections,
2366         separating recommended hash functions and legacy hash functions.
2367         Document sha3-256.
2368
2369 2012-12-02  Niels Möller  <nisse@lysator.liu.se>
2370
2371         Split sha.h into new files sha1.h and sha2.h. Replaced all
2372         internal usage of sha.h in all files.
2373         * sha.h: Kept for compatibility, just includes both new files.
2374         * sha1.h: New file.
2375         * sha2.h: New file.
2376         * Makefile.in (HEADERS): Added sha1.h and sha2.h.
2377
2378 2012-11-28  Niels Möller  <nisse@lysator.liu.se>
2379
2380         From Fredrik Thulin:
2381         * testsuite/pbkdf2-test.c (test_main): Add PBKDF2-HMAC-SHA512 test
2382         cases.
2383
2384 2012-11-15  Niels Möller  <nisse@lysator.liu.se>
2385
2386         * sha3-permute.c (sha3_permute): Use ULL suffix on round
2387         constants. Avoid passing shift count 0 to ROTL64.
2388
2389         * sha3.c (sha3_absorb): Fixed big-endian code. Need macros.h.
2390
2391         * macros.h (LE_READ_UINT64): New macro.
2392
2393 2012-11-13  Niels Möller  <nisse@lysator.liu.se>
2394
2395         * sha3-permute.c (sha3_permute): Micro optimizations. Partial
2396         unrolling. Use lookup table for the permutation. On an x86_64,
2397         execution time reduced from appr. 13000 cycles to appr. 6000.
2398
2399         * examples/nettle-benchmark.c (TIME_CYCLES): New macro.
2400         (bench_sha1_compress, bench_salsa20_core): Use it.
2401         (bench_sha3_permute): New function.
2402         (main): Call bench_sha3_permute.
2403
2404 2012-11-12  Niels Möller  <nisse@lysator.liu.se>
2405
2406         * examples/nettle-benchmark.c (main): Benchmark sha3_256.
2407
2408         * sha3-permute.c: New file. Permutation function for sha3, aka
2409         Keccak.
2410         * sha3.h: New header file.
2411         * sha3.c: New file, absorption and padding for sha3.
2412         * sha3-256.c: New file.
2413         * sha3-256-meta.c: New file.
2414         * nettle-meta.h (nettle_sha3_256): Declare.
2415         * Makefile.in (nettle_SOURCES): Added sha3 files.
2416         (HEADERS): Added sha3.h.
2417         * testsuite/sha3.awk: New file. Script to extract test vectors.
2418         * testsuite/sha3-256-test.c: New file.
2419         * testsuite/sha3-permute-test.c: New file.
2420         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2421         sha3-permute-test.c and sha3-256-test.c.
2422         (DISTFILES): Added sha3.awk.
2423         * testsuite/.test-rules.make: Added sha3 targets.
2424
2425         * macros.h (LE_WRITE_UINT64): New macro.
2426         * write-le64.c (_nettle_write_le64): New file and function.
2427         * nettle-write.h (_nettle_write_le64): Declare. Also deleted
2428         declaration of non-existent _nettle_write_be64.
2429         * Makefile.in (nettle_SOURCES): Added write-le64.c.
2430
2431         * macros.h (ROTL64): New macro, moved from...
2432         * sha512-compress.c (ROTL64): ... old location, deleted.
2433
2434         * serpent-internal.h [HAVE_NATIVE_64_BIT] (DROTL32): Renamed from...
2435         (ROTL64): ... old name.
2436         (DRSHIFT32): Renamed from ...
2437         (RSHIFT64): ... old name.
2438         * serpent-encrypt.c (LINEAR_TRANSFORMATION64): Updated for above
2439         renames.
2440         * serpent-decrypt.c (LINEAR_TRANSFORMATION64_INVERSE): Likewise.
2441
2442 2012-11-11  Niels Möller  <nisse@lysator.liu.se>
2443
2444         From Nikos Mavrogiannopoulos:
2445         * nettle.texinfo (Hash functions): Added documentation for
2446         gosthash94.
2447         * examples/nettle-benchmark.c (main): Benchmark gosthash94.
2448
2449 2012-11-10  Niels Möller  <nisse@lysator.liu.se>
2450
2451         * nettle.texinfo (nettle_hashes, nettle_ciphers): Use deftypevr,
2452         not deftypevrx. Spotted by Nikos Mavrogiannopoulos.
2453
2454 2012-11-08  Niels Möller  <nisse@lysator.liu.se>
2455
2456         Gost hash function, ported from Aleksey Kravchenko's rhash library
2457         by Nikos Mavrogiannopoulos.
2458         * gosthash94.c: New file.
2459         * gosthash94.h: New file.
2460         * gosthash94-meta.c: New file.
2461         * nettle-meta.h (nettle_gosthash94): Declare.
2462         * Makefile.in (nettle_SOURCES): Added gosthash94.c and
2463         gosthash94-meta.c.
2464         (HEADERS): Added gosthash94.h.
2465         * testsuite/gosthash94-test.c: New file.
2466         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2467         gosthash94-test.c.
2468
2469 2012-10-29  Niels Möller  <nisse@lysator.liu.se>
2470
2471         From Martin Storsjö:
2472         * configure.ac (dummy-dep-files): Avoid non-posix \|-operator in
2473         sed regexp.
2474
2475 2012-10-29  Niels Möller  <nisse@lysator.liu.se>
2476
2477         * x86_64/salsa20-core-internal.asm: New file.
2478         * configure.ac: Added salsa20-core-internal.asm.
2479         * examples/nettle-benchmark.c (bench_salsa20_core): New function.
2480
2481 2012-10-27  Niels Möller  <nisse@lysator.liu.se>
2482
2483         * testsuite/Makefile.in (TS_SOURCES, CXX_SOURCES): Include sources
2484         unconditionally.
2485         (TS_CXX): Moved @IF_CXX@ conditional here.
2486         (DISTFILES): Use $(SOURCES), which now includes all C source
2487         files. testutils.c was lost in a the 2012-09-20 change.
2488
2489         * x86_64/salsa20-crypt.asm: Include x86_64/salsa20.m4.
2490         Make all exits go via .Lend and W64_EXIT.
2491
2492         * x86_64/salsa20.m4: New file, extracted from
2493         x86_64/salsa20-crypt.asm.
2494
2495 2012-10-26  Niels Möller  <nisse@lysator.liu.se>
2496
2497         * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LIBS): Add $(CFLAGS) on
2498         the link command line. Reported by Dennis Clarke.
2499
2500 2012-10-03  Niels Möller  <nisse@lysator.liu.se>
2501
2502         From: Nikos Mavrogiannopoulos:
2503         * testsuite/testutils.c (test_hash): On failure, print the
2504         expected and returned hash values.
2505
2506 2012-09-23  Niels Möller  <nisse@lysator.liu.se>
2507
2508         * Makefile.in (nettle_SOURCES): Added salsa20-core-internal.c.
2509
2510         * salsa20-core-internal.c (_salsa20_core): New file and function,
2511         extracted from salsa20_crypt.
2512         * salsa20.h (_salsa20_core): Declare it.
2513         * salsa20-crypt.c (salsa20_crypt): Use _salsa20_core.
2514
2515 2012-09-21  Niels Möller  <nisse@lysator.liu.se>
2516
2517         * pbkdf2.c (pbkdf2): assert that iterations > 0. Reorganized
2518         loops.
2519
2520         * nettle.texinfo (Cipher functions): Stress that the salsa20 hash
2521         function is not suitable as a general hash function.
2522
2523 2012-09-20  Simon Josefsson  <simon@josefsson.org>
2524
2525         * pbkdf2-hmac-sha1.c, pbkdf2-hmac-sha256.c: New files.
2526         * pbkdf2.h (pbkdf2_hmac_sha1, pbkdf2_hmac_sha256): New prototypes.
2527         * Makefile.in (nettle_SOURCES): Add pbkdf2-hmac-sha1.c and
2528         pbkdf2-hmac-sha256.c.
2529         * nettle.texinfo (Key derivation functions): Improve.
2530         * testsuite/pbkdf2-test.c (test_main): Test new functions.
2531
2532 2012-09-20  Niels Möller  <nisse@lysator.liu.se>
2533
2534         * pbkdf2.c (pbkdf2): Reordered arguments, for consistency.
2535         * pbkdf2.h (PBKDF2): Analogous reordering.
2536         * testsuite/pbkdf2-test.c: Adapted to new argument order. Also use
2537         LDATA for the salt.
2538         * nettle.texinfo (Key derivation functions): Updated documented
2539         pbkdf2 prototype.
2540
2541         * testsuite/Makefile.in (VALGRIND): New variable, to make valgrind
2542         checking easier.
2543
2544         * configure.ac: New substitution IF_CXX, replacing CXX_TESTS.
2545         (dummy-dep-files): Handle .cxx files.
2546
2547         * testsuite/Makefile.in: Use IF_CXX. Include dependency file for
2548         cxx-test.o.
2549
2550 2012-09-19  Niels Möller  <nisse@lysator.liu.se>
2551
2552         From Tim Rühsen:
2553         * examples/rsa-encrypt.c (main): Added missing mpz_clear.
2554         * examples/rsa-keygen.c (main): Added missing deallocation.
2555
2556         * testsuite/meta-hash-test.c (test_main): Validate
2557         NETTLE_MAX_HASH_DIGEST_SIZE.
2558
2559         * pbkdf2.h (PBKDF2): New macro.
2560         * testsuite/pbkdf2-test.c: Use it.
2561
2562 2012-09-12  Simon Josefsson  <simon@josefsson.org>
2563
2564         * NEWS: Mention addition of PBKDF2.
2565         * pbkdf2.c (pbkdf2): New file and function.
2566         * pbkdf2.h: Declare it.
2567         * Makefile.in (nettle_SOURCES): Add pbkdf2.c.
2568         (HEADERS): Add pbkdf2.h.
2569         * nettle.texinfo (Key derivation functions): New section.
2570         * testsuite/pbkdf2-test.c: New test case.
2571         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Add pbkdf2-test.c.
2572         * testsuite/.test-rules.make (pbkdf2-test): New target.
2573
2574 2012-09-16  Niels Möller  <nisse@lysator.liu.se>
2575
2576         * testsuite/: Overhaul of testsuite, affecting almost all files.
2577         + Use struct tstring for allocated strings, and deallocate before
2578         exit.
2579         + Changed most test functions to take struct tstring as arguments.
2580         + Made all test_main return on success.
2581
2582         * testsuite/testutils.h (struct tstring): New struct type.
2583         (H2, HL, MEMEQH, SUCCESS): Deleted macros.
2584         (SHEX, SDATA): New macros.
2585         (H): Redefined to track storage.
2586
2587         * testsuite/testutils.c (tstring_alloc): New function.
2588         (tstring_clear): New function.
2589         (tstring_data): New function.
2590         (tstring_hex): New function.
2591         (tstring_print_hex): New function.
2592         (decode_hex_length): Made static.
2593         (decode_hex): Made static. No return value, abort on error.
2594         (main): Expect test_main to return, and call tstring_clear before
2595         exit.
2596         (test_dsa_key): Added missing mpz_clear.
2597         (test_mac): Deleted unused function.
2598
2599         * testsuite/rsa2sexp-test.c (test_main): Added missing
2600         nettle_buffer_clear.
2601
2602         * testsuite/yarrow-test.c (open_file): Don't leak filename.
2603         (test_main): fclose input file properly.
2604
2605         * testsuite/sexp-format-test.c (test_main): Added missing calls to
2606         nettle_buffer_clear and mpz_clear.
2607
2608         * testsuite/serpent-test.c (tstring_hex_reverse): New function,
2609         replacing...
2610         (decode_hex_reverse): ... deleted function.
2611         (RHEX): New macro, replacing...
2612         (RH, RHL): ... deleted macros.
2613
2614         * testsuite/rsa2sexp-test.c (test_main): Added missing
2615         nettle_buffer_clear.
2616
2617         * testsuite/random-prime-test.c (test_main): Added missing
2618         mpz_clear.
2619
2620         * realloc.c (nettle_realloc): Only call libc realloc if length >
2621         0, otherwise call free. Fixes a small memory leak.
2622         (nettle_xrealloc): Likewise.
2623
2624         * run-tests (test_program): Don't quote $EMULATOR; allow it to
2625         expand to program and arguments (e.g., valgrind).
2626
2627         * tools/pkcs1-conv.c (convert_public_key): Added missing calls to
2628         dsa_public_key_clear and rsa_public_key_clear.
2629         (main): Added missing nettle_buffer_clear.
2630
2631 2012-09-10  Niels Möller  <nisse@lysator.liu.se>
2632
2633         * examples/eratosthenes.c (main): Explicitly deallocate storage
2634         before exit.
2635
2636         * examples/io.c (read_file): Explicitly treat an empty file as an
2637         error. Rearrange loop, check for short fread return value.
2638
2639         * desdata.c: Don't declare printf, include <stdio.h> instead. Also
2640         deleted casts of printf return value.
2641
2642         From Tim Rühsen:
2643         * examples/nettle-benchmark.c (die): Use PRINTF_STYLE attribute.
2644         * pgp-encode.c (pgp_put_rsa_sha1_signature): Deleted unused variable.
2645         * rsa2openpgp.c (rsa_keypair_to_openpgp): Likewise.
2646         * examples/base16enc.c (main): Deleted useless allocations.
2647
2648 2012-09-07  Niels Möller  <nisse@lysator.liu.se>
2649
2650         * examples/nettle-benchmark.c (die): Add NORETURN attribute. Patch
2651         from Tim Rühsen.
2652         * tools/misc.h (die, werror): Use PRINTF_STYLE and NORETURN macros
2653         for attributes. Patch from Tim Rühsen.
2654
2655         * examples/io.h (werror): Use PRINTF_STYLE macro.
2656
2657 2012-08-22  Niels Möller  <nisse@lysator.liu.se>
2658
2659         From Sam Thursfield <sam.thursfield@codethink.co.uk>:
2660         * configure.ac: Make documentation optional, to avoid requiring
2661         TeX. New option --disable-documentation, and Makefile substitution
2662         IF_DOCUMENTATION.
2663         * Makefile.in: Use IF_DOCUMENTATION.
2664
2665 2012-07-12  Niels Möller  <nisse@lysator.liu.se>
2666
2667         * asm.m4 (ALIGN): Use << operator rather than **, with m4 eval.
2668         The latter is not supported by BSD m4.
2669
2670 2012-07-07  Niels Möller  <nisse@lysator.liu.se>
2671
2672         Copyright headers: Updated FSF address. Patch from David Woodhouse.
2673
2674         * examples/Makefile.in (BENCH_LIBS): Added -lm, needed for the
2675         ldexp function. Reported by Anthony G. Basile.
2676
2677         * configure.ac: Changed version number to 2.6.
2678
2679         * Released nettle-2.5.
2680
2681 2012-07-05  Niels Möller  <nisse@lysator.liu.se>
2682
2683         * x86_64/salsa20-crypt.asm (salsa20_crypt): Write the 64-bit movq
2684         instructions as "movd", since that makes the osx assembler
2685         happier. Assembles to the same machine code on gnu/linux.
2686
2687 2012-07-03  Niels Möller  <nisse@lysator.liu.se>
2688
2689         * aclocal.m4 (LSH_FUNC_ALLOCA): In the config.h boilerplate,
2690         include malloc.h if it exists, also when compiling with gcc.
2691         Needed for cross-compiling with --host=i586-mingw32msvc.
2692
2693         * examples/base16dec.c: Don't #include files using <nettle/...>,
2694         we don't want to pick up installed versions. On windows, include
2695         <fcntl.h>, needed for _setmode.
2696         * examples/base16enc.c: Likewise.
2697         * examples/base64dec.c: Likewise.
2698         * examples/base64enc.c: Likewise
2699
2700         * nettle.texinfo (Cipher functions): Document Salsa20.
2701
2702 2012-06-25  Niels Möller  <nisse@lysator.liu.se>
2703
2704         * pkcs1.c (_pkcs1_signature_prefix): Renamed function, adding a
2705         leading underscore. Updated all callers.
2706
2707         * bignum-next-prime.c (nettle_next_prime): Consistently use the
2708         type nettle_random_func * (rather then just nettle_random_func)
2709         when passing the function pointer as argument. Similar change for
2710         nettle_progress_func. Should have been done for the 2.0 release,
2711         but a few arguments were overlooked.
2712         * bignum-random-prime.c (_nettle_generate_pocklington_prime)
2713         (nettle_random_prime): Likewise.
2714         * bignum-random.c (nettle_mpz_random_size, nettle_mpz_random):
2715         Likewise.
2716         * dsa-keygen.c (dsa_generate_keypair): Likewise.
2717         * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise.
2718         * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
2719         Likewise.
2720         * dsa-sign.c (_dsa_sign): Likewise.
2721         * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
2722         * rsa-blind.c (_rsa_blind): Likewise.
2723         * rsa-decrypt-tr.c (rsa_decrypt_tr): Likewise.
2724         * rsa-encrypt.c (rsa_encrypt): Likewise.
2725         * rsa-keygen.c (rsa_generate_keypair): Likewise.
2726         * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): Likewise.
2727
2728         * cbc.c (cbc_encrypt, cbc_decrypt): Similarly, use the type
2729         nettle_crypt_func * rather than just nettle_crypt_func.
2730         * ctr.c (ctr_crypt): Likewise.
2731         * gcm.c (gcm_set_key): Likewise.
2732
2733         * testsuite/des-compat-test.c (test_main): Disable declarations of
2734         disabled functions and variables, to avoid warnings. No verbose
2735         output unless verbose flag is set.
2736
2737 2012-06-09  Niels Möller  <nisse@lysator.liu.se>
2738
2739         * examples/Makefile.in (SOURCES): Added base16dec.c, forgotten
2740         earlier.
2741
2742         General pkcs1 signatures, with a "DigestInfo" input. Suggested by
2743         Nikos Mavrogiannopoulos.
2744         * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-digest.c,
2745         rsa-pkcs1-sign.c, rsa-pkcs1-sign-tr.c, and rsa-pkcs1-verify.c.
2746
2747         * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): New file and
2748         function.
2749         * pkcs1.h: Declare it.
2750
2751         * rsa-pkcs1-verify.c (rsa_pkcs1_verify): New file and function.
2752         * rsa-pkcs1-sign.c (rsa_pkcs1_sign): New file and function.
2753         * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): New file and function,
2754         contributed by Nikos Mavrogiannopoulos.
2755         * rsa.h: Declare new functions.
2756
2757         * rsa.h (_rsa_blind, _rsa_unblind): Declare functions.
2758         * rsa-blind.c (_rsa_blind, _rsa_unblind): Functions moved to a
2759         separate file, renamed and made non-static. Moved from...
2760         * rsa-decrypt-tr.c: ... here.
2761
2762 2012-06-03  Niels Möller  <nisse@lysator.liu.se>
2763
2764         * testsuite/pkcs1-test.c (test_main): Include leading zero in
2765         expected result.
2766
2767         * pkcs1.c (pkcs1_signature_prefix): Return pointer to where the
2768         digest should be written. Let the size input be the key size in
2769         octets, rather then key size - 1.
2770         * pkcs1-rsa-*.c: Updated for above.
2771         * rsa-*-sign.c, rsa-*-verify.c: Pass key->size, not key->size - 1.
2772
2773 2012-05-18  Niels Möller  <nisse@lysator.liu.se>
2774
2775         * pkcs1-encrypt.c (pkcs1_encrypt): New file and function.
2776         * rsa-encrypt.c (rsa_encrypt): Use pkcs1_encrypt.
2777
2778 2012-05-09  Niels Möller  <nisse@lysator.liu.se>
2779
2780         * rsa-decrypt-tr.c (rsa_decrypt_tr): Added missing mpz_clear,
2781         spotted by Nikos Mavrogiannopoulos.
2782
2783 2012-05-07  Niels Möller  <nisse@lysator.liu.se>
2784
2785         * nettle-types.h (_STDINT_HAVE_INT_FAST32_T): Define here, to
2786         force nettle-stdint.h to not try to define the int_fast*_t types.
2787         Avoids compilation problems with gnutls on SunOS-5.8, where the
2788         definitions here collide with gnulib's.
2789
2790 2012-04-23  Niels Möller  <nisse@lysator.liu.se>
2791
2792         * nettle-internal.h (NETTLE_MAX_BIGNUM_SIZE): New constant. Based
2793         on NETTLE_MAX_BIGNUM_BITS, rounded upwards. Replaced all uses of
2794         NETTLE_MAX_BIGNUM_BITS.
2795
2796 2012-04-19  Niels Möller  <nisse@lysator.liu.se>
2797
2798         * list-obj-sizes.awk: Use decimal rather than hexadecimal output.
2799         (hex2int): Use local variables.
2800
2801 2012-04-18  Niels Möller  <nisse@lysator.liu.se>
2802
2803         * x86_64/salsa20-crypt.asm: New file.
2804
2805 2012-04-17  Niels Möller  <nisse@lysator.liu.se>
2806
2807         * testsuite/salsa20-test.c (test_salsa20_stream): Check that
2808         salsa20_crypt doesn't write beyond the given destination area.
2809         (test_salsa20): Likewise.
2810
2811         * salsa20-crypt.c: Renamed file, from...
2812         * salsa20.c: ... old name.
2813
2814         * x86_64/machine.m4 (WREG): New macro.
2815
2816         * salsa20.c (salsa20_hash): Deleted function, inlined into
2817         salsa20_crypt.
2818         (salsa20_set_key, salsa20_set_iv): Moved, to...
2819         * salsa20-set-key.c: ...new file.
2820
2821 2012-04-15  Niels Möller  <nisse@lysator.liu.se>
2822
2823         * testsuite/salsa20-test.c (test_salsa20_stream): New function.
2824         (test_main): Tests for encrypting more than one block at a time.
2825
2826 2012-04-14  Niels Möller  <nisse@lysator.liu.se>
2827
2828         * examples/io.c (write_file): Use write_string.
2829
2830         * examples/Makefile.in (base64enc): New targets. Also
2831         added missing io.o dependency to several other targets.
2832         (base64dec, base16enc, base16dec): Likewise.
2833
2834         * examples/base64enc.c: New file, based on example code
2835         contributed by Jeronimo Pellegrini.
2836         * examples/base64dec.c: Likewise.
2837         * examples/base16enc.c: Likewise.
2838         * examples/base16dec.c: Likewise.
2839
2840         * examples/rsa-encrypt.c (process_file): Reorganized fread loop.
2841         (usage): New function.
2842         (main): Implemented --help option.
2843
2844         * examples/rsa-decrypt.c (process_file): Improved error message
2845         for too short input file.
2846
2847         * aes-set-decrypt-key.c (gf2_log, gf2_exp): Deleted tables.
2848         (mult, inv_mix_column): Deleted functions.
2849         (mtable): New table.
2850         (MIX_COLUMN): New macro.
2851         (aes_invert_key): Use MIX_COLUMN and mtable.
2852
2853         * aesdata.c (compute_mtable): New table, for the inv mix column
2854         operation in aes_invert_key.
2855
2856 2012-04-13  Niels Möller  <nisse@lysator.liu.se>
2857
2858         * aes-set-encrypt-key.c (aes_set_encrypt_key): Use LE_READ_UINT32.
2859         Tabulate the needed "round constants".
2860         (xtime): Deleted function.
2861
2862         * aes-internal.h (SUBBYTE): Cast to uint32_t. Use B0, ..., B3
2863         macros.
2864
2865 2012-04-09  Niels Möller  <nisse@lysator.liu.se>
2866
2867         Timing resistant RSA decryption, based on RSA blinding code
2868         contributed by Nikos Mavrogiannopoulos.
2869         * rsa-decrypt-tr.c (rsa_decrypt_tr): New function.
2870         (rsa_blind): Helper function.
2871         (rsa_unblind): Helper function.
2872         * rsa.h: Declare rsa_decrypt_tr. Some cleanups, no longer include
2873         nettle-meta.h, more consistent declarations of function pointer
2874         arguments.
2875         * testsuite/rsa-encrypt-test.c (test_main): Test rsa_decrypt_tr.
2876         Check for writes past the end of the message area.
2877
2878         * Makefile.in (hogweed_SOURCES): Added pkcs1-decrypt.c.
2879         * rsa-decrypt.c (rsa_decrypt): Use pkcs1_decrypt.
2880         * pkcs1-decrypt.c (pkcs1_decrypt): New file and function,
2881         extracted from rsa_decrypt.
2882
2883 2012-04-01  Niels Möller  <nisse@lysator.liu.se>
2884
2885         * salsa20.c (LE_SWAP32): Typo fix for big-endian case.
2886         (QROUND): New macro.
2887         (salsa20_hash): Use it.
2888
2889 2012-03-31  Niels Möller  <nisse@lysator.liu.se>
2890
2891         * salsa20.c: (salsa20_set_iv): Deleted size argument, only one
2892         size allowed.
2893         (U8TO32_LITTLE): Deleted macro. Use LE_READ_UINT32 instead, which
2894         avoids unaligned reads.
2895         (salsa20_set_key): Rearranged slightly, to avoid unnecessary
2896         byte-to-word conversions.
2897
2898         (LE_SWAP32): Renamed macro from...
2899         (U32TO32_LITTLE): ... old name.
2900         (U32TO8_LITTLE): Deleted macro.
2901         (salsa20_wordtobyte): Renamed function to...
2902         (salsa20_hash): ... new name. Changed output argument from byte
2903         array to word array. Use memxor3, which brings a considerable
2904         performance gain.
2905
2906         * nettle-internal.c (salsa20_set_key_hack): Updated salsa20_set_iv
2907         call.
2908         * testsuite/salsa20-test.c (test_salsa20): Deleted iv_length
2909         argument, updated all calls.
2910
2911         * salsa20.h (SALSA20_BLOCK_SIZE): New constant.
2912         (_SALSA20_INPUT_LENGTH): New constant.
2913         * salsa20.c: Use these constants.
2914
2915         * salsa20.c (ROTL32): Deleted macro, use the one from macros.h
2916         instead, with reversed order of arguments.
2917         (ROTATE, XOR, PLUS, PLUSONE): Deleted macros, use ROTL32 and
2918         builtin operators directly.
2919
2920         Unification of rotation macros.
2921         * macros.h (ROTL32): New macro, to replace (almost) all other
2922         rotation macros.
2923
2924         * aes-set-encrypt-key.c: Include macros.h.
2925         (aes_set_encrypt_key): Use ROTL32.
2926         * aes-internal.h (ROTBYTE, ROTRBYTE): Deleted macros.
2927
2928         * camellia-internal.h (ROL32): Deleted macro.
2929         (ROTL128): Renamed for consistency, from...
2930         (ROL128): ... old name.
2931         * camellia-crypt-internal.c: Updated for renamed rotation macros.
2932         * camellia-set-encrypt-key.c: Likewise.
2933         * cast128.c (ROL): Deleted macro.
2934         (F1, F2, F3): Updated to use ROTL32 (reversed order of arguments).
2935         Also added proper do { ... } while (0) wrappers.
2936
2937         * ripemd160-compress.c (ROL32): Deleted macro.
2938         (R): Updated to use ROTL32 (reversed order of arguments).
2939
2940         * serpent-internal.h (ROL32): Deleted macro.
2941         (ROTL64): Renamed (from ROL64) and reorderd arguments, for
2942         consistency.
2943         (RSHIFT64): Reordered arguments, for consistency.
2944         * serpent-decrypt.c: Updated for renamed rotation macros, with
2945         reversed argument order.
2946         * serpent-encrypt.c: Likewise.
2947         * serpent-set-key.c: Likewise.
2948
2949         * sha1-compress.c (ROTL): Deleted macro, use ROTL32 instead.
2950
2951         * sha256-compress.c (ROTR): Deleted macro. Replaced by ROTL32,
2952         with complemented shift count.
2953         (SHR): Deleted macro, use plain shift operator instead.
2954
2955         * sha512-compress.c (ROTR): Deleted macro, replaced by...
2956         (ROTL64): ...new macro, with complemented shift count
2957         (SHR): Deleted macro, use plain shift operator instead.
2958         (S0, S1, s0, s1): Updated accordingly.
2959
2960 2012-03-30  Niels Möller  <nisse@lysator.liu.se>
2961
2962         * nettle-internal.c (nettle_salsa20): Cipher struct for
2963         benchmarking only. Sets a fix zero IV, and ignores block size.
2964         * nettle-internal.h (nettle_salsa20): Declare it.
2965
2966         * examples/nettle-benchmark.c (block_cipher_p): New function.
2967         (time_cipher): Use block_cipher_p.
2968         (main): Include salsa20 in benchmark.
2969
2970         * Makefile.in (soname link): Fixed logic.
2971         (nettle_SOURCES): Removed nettle-internal.c, so that it's not
2972         part of the library...
2973         (internal_SOURCES): ...and put it here.
2974         * testsuite/Makefile.in (TEST_OBJS): Added ../nettle-internal.o.
2975         * examples/Makefile.in (BENCH_OBJS): New variable, to simplify the
2976         nettle-benchmark rule. Also link with ../nettle-internal.o.
2977
2978 2012-03-29  Niels Möller  <nisse@lysator.liu.se>
2979
2980         Implementation of Salsa20, contributed by Simon Josefsson.
2981         * salsa20.h: New file.
2982         * salsa20.c: New file.
2983         * Makefile.in (nettle_SOURCES): Added salsa20.c
2984         (HEADERS): Added salsa20.h.
2985         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added salsa20-test.c.
2986         * testsuite/salsa20-test.c: New test case.
2987
2988         * Makefile.in (soname links): Adding missing space before ].
2989
2990 2012-03-23  Niels Möller  <nisse@lysator.liu.se>
2991
2992         * arcfour.h (arcfour_stream): Deleted obsolete prototype.
2993
2994 2012-03-05  Niels Möller  <nisse@lysator.liu.se>
2995
2996         * configure.ac (enable_shared): Build shared libraries by default.
2997
2998 2012-03-04  Niels Möller  <nisse@lysator.liu.se>
2999
3000         * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.4.
3001         (LIBHOGWEED_MINOR): And to 2.2.
3002
3003 2012-02-27  Niels Möller  <nisse@lysator.liu.se>
3004
3005         * list-obj-sizes.awk: Recognize elf64 objects.
3006
3007         * Makefile.in (.texinfo.dvi): Pass -b option to texi2dvi.
3008
3009         * Makefile.in (TARGETS): Added twofishdata.
3010         (SOURCES): Added twofishdata.c.
3011         (twofishdata): New rule.
3012
3013         * twofish.c (q0, q1): Made const, and reformatted to match the
3014         twofishdata program.
3015
3016         * twofishdata.c: Resurrected old file. Used to be called
3017         generate_q.c, when the twofish code was contributed back in 1999.
3018
3019         * nettle.texinfo: Documentation for base16 and base64 encoding.
3020         Text contributed by Jeronimo Pellegrini
3021         <pellegrini@mpcnet.com.br>, back in April 2006.
3022
3023 2012-02-18  Niels Möller  <nisse@lysator.liu.se>
3024
3025         * run-tests, getopt.c, getopt1.c, getopt.h: These files were moved
3026         to the top-level in the conversion to an independent git
3027         repository. They used to be symlinks to lsh files, from the
3028         subdirectories which use them.
3029
3030         * Makefile.in: Build and distribute getopt files. Distribute
3031         run-tests script.
3032         * examples/Makefile.in: Adapt to getopt files and the run-tests
3033         script now located in the parent directory.
3034         * testsuite/Makefile.in: Likewise.
3035         * tools/Makefile.in: Likewise.
3036
3037         * index.html: Converted to xhtml (from lsh repository, change
3038         dated 2012-02-03). Updated git instructions.
3039
3040         * nettle.texinfo: Updated charset declaration.
3041         * misc/plan.html: Likewise.
3042
3043 2012-01-17  Niels Möller  <nisse@lysator.liu.se>
3044
3045         * testsuite/Makefile.in (DISTFILES): Added setup-env.
3046
3047         * examples/rsa-decrypt.c (main): Use _setmode rather than setmode,
3048         suggested by Eli Zaretskii. Affects windows builds only.
3049         * examples/rsa-encrypt.c: Likewise.
3050
3051         * Makefile.in ($(LIBNETTLE_FORLINK)): Always create a .lib symlink
3052         to the library file. Use LN_S.
3053         ($(LIBHOGWEED_FORLINK)): Likewise.
3054
3055         (install-shared-nettle): Use LN_S.
3056         (install-shared-hogweed): Likewise.
3057
3058         * configure.ac: Use AC_PROG_LN_S.
3059         * config.make.in (LN_S): New substitution.
3060
3061         * testsuite/setup-env: New file. Wine workaround. Can't get
3062         ../.lib into wine's dll search path, so create additional
3063         symlinks.
3064         * testsuite/teardown-env: ...and delete them here. Also delete
3065         file testtmp.
3066         * examples/setup-env: Similar links setup here.
3067         * examples/teardown-env: ... and deleted.
3068
3069 2012-01-07  Niels Möller  <nisse@lysator.liu.se>
3070
3071         * examples/Makefile.in (check): Add ../.lib to PATH, like in
3072         testsuite/Makefile. Needed for w*ndows. Reported by Eli Zaretskii.
3073
3074 2011-11-25  Niels Möller  <nisse@lysator.liu.se>
3075
3076         From Martin Storsjö:
3077         * x86_64/machine.m4 (W64_ENTRY, W64_EXIT): New macros for
3078         supporting W64 ABI.
3079         * x86_64: Updated all assembly files to use them.
3080
3081         * configure.ac (W64_ABI): New variable, set when compiling for
3082         W64 ABI (64-bit M$ windows).
3083         * config.m4.in (W64_ABI): Define, from configure substitution.
3084
3085 2011-11-24  Niels Möller  <nisse@lysator.liu.se>
3086
3087         From Martin Storsjö:
3088         * examples/Makefile.in (check): Pass $(EMULATOR) and $(EXEEXT) in
3089         the environment of run-tests.
3090         * examples/rsa-encrypt-test: Use $EXEEXT and $EMULATOR.
3091         * examples/rsa-sign-test: Likewise.
3092         * examples/rsa-verify-test: Likewise.
3093         * examples/setup-env: Likewise.
3094
3095         * testsuite/Makefile.in (check): Pass $(EXEEXT) in the environment of
3096         run-tests.
3097         * testsuite/pkcs1-conv-test: Use $EXEEXT and $EMULATOR. Ignore \r
3098         in rsa-sign output.
3099
3100         * examples/rsa-decrypt.c (main) [WIN32]: Set stdout/stdin to
3101         binary mode.
3102         * examples/rsa-encrypt.c (main): Likewise.
3103
3104 2011-11-24  Niels Möller  <nisse@lysator.liu.se>
3105
3106         * configure.ac (HAVE_NATIVE_64_BIT): Workaround to get it set to 1
3107         on w64.
3108
3109         * serpent-internal.h (ROL64): Use (uint64_t) 1 rather than 1L, for
3110         M$ w64.
3111         (RSHIFT64): Likewise. Also added a missing parenthesis.
3112
3113 2011-11-24  Niels Möller  <nisse@lysator.liu.se>
3114
3115         From Martin Storsjö:
3116         * testsuite/symbols-test: Use $NM, falling back to nm if undefined.
3117         * testsuite/Makefile.in (check): Pass $(NM) in the environment of
3118         run-tests.
3119         * config.make.in (NM): Set NM.
3120
3121         * testsuite/sexp-conv-test: Use $EMULATOR when running test
3122         programs. Also ignore \r for output in the non-canonical output
3123         formats.
3124         * testsuite/Makefile.in (check): Pass $(EMULATOR) in the
3125         environment of run-tests.
3126         * configure.ac (EMULATOR): New substituted variable. Set to wine
3127         or wine64 when cross compiling for windows, otherwise empty.
3128         * config.make.in (EMULATOR): Set from autoconf value.
3129
3130 2011-11-20  Niels Möller  <nisse@lysator.liu.se>
3131
3132         * x86/camellia-crypt-internal.asm: Take ALIGNOF_UINT64_T into
3133         account when getting the offset for the subkeys. Differs between
3134         w32 and other systems. w32 problem identified by Martin Storsjö.
3135
3136         * config.m4.in: Define ALIGNOF_UINT64_T (from configure).
3137
3138         * configure.ac: Check alignment of uint64_t, and also use AC_SUBST
3139         for use in config.m4.in.
3140
3141 2011-11-19  Niels Möller  <nisse@lysator.liu.se>
3142
3143         Cygwin/mingw32 improvements contributed by Martin Storsjö:
3144         * Makefile.in (IMPLICIT_TARGETS): New variable for DLL link
3145         libraries.
3146         (clean-here): Delete the DLL import libraries.
3147
3148         * configure.ac: Setup installation of DLL files in $bindir.
3149         (IF_DLL, LIBNETTLE_FILE_SRC, LIBHOGWEED_FILE_SRC): New
3150         substitutions.
3151
3152         * config.make.in (LIBNETTLE_FILE_SRC): Substitute new autoconf
3153         variable.
3154         (LIBHOGWEED_FILE_SRC): Likewise.
3155
3156         * Makefile.in (install-dll-nettle, uninstall-dll-nettle): New
3157         target for installing the DLL file in $bindir.
3158         (install-shared-nettle): Conditionally
3159         depend on install-dll-nettle. Use LIBNETTLE_FILE_SRC.
3160         (uninstall-shared-nettle): Conditionally depend on
3161         install-dll-nettle.
3162         (various hogweed targets): Analogous changes.
3163
3164         * configure.ac: Unify shared lib setup for cygwin and mingw.
3165
3166 2011-10-31  Niels Möller  <nisse@lysator.liu.se>
3167
3168         * configure.ac (LIBHOGWEED_LIBS): Typo fix for the darwin case.
3169         Spotted by Martin Storsjö.
3170
3171 2011-10-25  Niels Möller  <nisse@lysator.liu.se>
3172
3173         * configure.ac (LIBHOGWEED_LIBS): cygwin fix, added
3174         libnettle.dll.a. Reported by Volker Zell.
3175
3176 2011-10-18  Niels Möller  <nisse@lysator.liu.se>
3177
3178         * configure.ac: Improved setup för darwin shared libraries.
3179         Patch contributed by Ryan Schmidt.
3180
3181 2011-10-03  Niels Möller  <nisse@lysator.liu.se>
3182
3183         * x86_64/memxor.asm: Implemented sse2-loop. Configured at compile
3184         time, and currently disabled.
3185
3186         * testsuite/testutils.h (ASSERT): Write message to stderr.
3187
3188         * testsuite/memxor-test.c: Use 16-byte alignment for "fully
3189         aligned" operands.
3190
3191 2011-09-03  Niels Möller  <nisse@lysator.liu.se>
3192
3193         * x86/camellia-crypt-internal.asm: Use "l"-suffix on instructions
3194         more consistently. Reportedly, freebsd and netbsd systems with
3195         clang are more picky about this.
3196
3197         * configure.ac: Changed version number to 2.5.
3198
3199         * Released nettle-2.4.
3200
3201         * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.3.
3202
3203         * gcm-aes.c: Include config.h.
3204         * tools/nettle-lfib-stream.c: Likewise.
3205
3206         * ripemd160-compress.c: Added missing include of config.h. Needed
3207         for correct operation on big-endian systems.
3208
3209 2011-09-02  Niels Möller  <nisse@amfibolit.hack.org>
3210
3211         * configure.ac: Changed version number to 2.4.
3212
3213         * Released nettle-2.3.
3214
3215 2011-08-30  Niels Möller  <nisse@lysator.liu.se>
3216
3217         * testsuite/hmac-test.c: Added tests for hmac-ripemd160.
3218
3219         * hmac.h: Declare hmac-ripemd160 related functions.
3220
3221         * Makefile.in (nettle_SOURCES): Added hmac-ripemd160.c.
3222
3223 2011-08-30  Niels Möller  <nisse@amfibolit.hack.org>
3224
3225         * nettle.texinfo (Hash functions): Document ripemd-160.
3226
3227         * hmac-ripemd160.c: New file.
3228
3229         * hmac.h: Declare hmac-ripemd160 functions.
3230
3231 2011-08-29  Niels Möller  <nisse@lysator.liu.se>
3232
3233         * sha256.c (sha256_update): Updated MD_UPDATE call for new
3234         conventions.
3235         (sha256_write_digest): Use MD_PAD rather than MD_FINAL, and insert
3236         the length manually.
3237         * sha512.c: Analogous changes.
3238
3239         * sha1.c (COMPRESS): New macro.
3240         (sha1_update): Updated MD_UPDATE call for new conventions.
3241         (sha1_digest): Use MD_PAD rather than MD_FINAL, and insert the
3242         length manually.
3243
3244         * ripemd160.c (ripemd160_init): Use memcpy for initializing the
3245         state vector.
3246         (COMPRESS): New macro.
3247         (ripemd160_update): Use MD_UPDATE.
3248         (ripemd160_digest): Inline ripemd160_final processing. Use MD_PAD
3249         and _nettle_write_le32.
3250         (ripemd160_final): Deleted function.
3251
3252         * ripemd160.h (struct ripemd160_ctx): Use a 64-bit block count.
3253         Renamed digest to state.
3254
3255         * md5.c (md5_init): Use memcpy for initializing the state vector.
3256         (COMPRESS): New macro, wrapping _nettle_md5_compress.
3257         (md5_update): Use MD_UPDATE.
3258         (md5_digest): Inline md5_final processing. Use MD_PAD and
3259         _nettle_write_le32.
3260         (md5_final): Deleted.
3261
3262         * md5.h (struct md5_ctx): Renamed some fields, for consistency.
3263
3264         * md4.h (struct md4_ctx): Renamed some fields, for consistency.
3265
3266         * md4.c (md4_init): Use memcpy for initializing the state vector.
3267         (md4_update): Use MD_UPDATE.
3268         (md4_digest): Inline md4_final processing, using MD_PAD. Use
3269         _nettle_write_le32.
3270         (md4_block): Renamed, to...
3271         (md4_compress): ... new name. Take ctx pinter as argument.
3272         (md4_final): Deleted function.
3273
3274         * md2.c (md2_update): Use MD_UPDATE.
3275
3276         * macros.h (MD_UPDATE): Added incr argument. Invoke compression
3277         function with ctx pointer as argument, rather than ctx->state.
3278         (MD_FINAL): Just pad, don't store length field. Renamed to MD_PAD.
3279         (MD_PAD): Analogous change of compression invocations.
3280
3281         * sha512.c: (COMPRESS): New macro wrapping _nettle_sha512_compress.
3282         (sha512_update): Use MD_UPDATE.
3283         (sha512_final): Deleted function.
3284         (sha512_write_digest): Use MD_FINAL.
3285
3286         * sha256.c (COMPRESS): New macro wrapping _nettle_sha256_compress.
3287         (SHA256_INCR): Deleted macro.
3288         (sha256_update): Use MD_UPDATE.
3289         (sha256_final): Deleted function.
3290         (sha256_write_digest): New function, replacing sha256_final, and
3291         using MD_FINAL.
3292         (sha256_digest): Use sha256_write_digest.
3293         (sha224_digest): Likewise.
3294
3295         * tools/nettle-hash.c (list_algorithms): Fixed typo in header.
3296
3297         * sha1.c (SHA1_DATA_LENGTH): Deleted unused macro.
3298         (sha1_init): Use memcpy to initialize the state vector.
3299         (SHA1_INCR): Deleted macro.
3300         (sha1_update): Use MD_UPDATE macro, to reduce code duplication.
3301         (sha1_digest): Use MD_FINAL macro.
3302         (sha1_final): Deleted function.
3303
3304         * sha.h (struct sha1_ctx): Renamed attribute digest to state.
3305
3306         * macros.h (MD_UPDATE): New macro.
3307         (MD_FINAL): New macro.
3308
3309 2011-08-28  Niels Möller  <nisse@lysator.liu.se>
3310
3311         * ripemd160.c (ripemd160_final): Use LE_WRITE_UINT32. Deleted byte
3312         swapping at the end, leaving it to ripemd160_digest.
3313         (ripemd160_digest): Use _nettle_write_le32.
3314
3315         * Makefile.in (nettle_SOURCES): Added write-le32.c.
3316
3317         * md5.c (md5_digest): Use _nettle_write_le32.
3318
3319         * write-le32.c (_nettle_write_le32): New file and function.
3320
3321         * ripemd160-compress.c (ROL32): Renamed macro (was "rol"). Deleted
3322         x86 version using inline assembly; at least gcc-4.4.5 recognizes
3323         shift-and-or expressions which are in fact rotations.
3324         (_nettle_ripemd160_compress): Use LE_READ_UINT32.
3325
3326         * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.2.
3327
3328         * testsuite/meta-hash-test.c: Updated for the addition of
3329         ripemd-160.
3330
3331         * testsuite/.test-rules.make: Added rule for ripemd160-test.
3332
3333         * examples/nettle-benchmark.c (main): Benchmark ripemd-160.
3334
3335 2011-08-28  Niels Möller  <nisse@lysator.liu.se>
3336
3337         RIPEMD-160 hash function. Ported from libgcrypt by Andres Mejia.
3338         * testsuite/ripemd160-test.c: New file.
3339         * ripemd160.h: New file.
3340         * nettle-meta.h: Declare nettle_ripemd160.
3341         * ripemd160.c: New file, ported from libgcrypt.
3342         * ripemd160-compress.c: Likewise.
3343         * ripemd160-meta.c: New file.
3344         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3345         ripemd160-test.c.
3346         * nettle-meta-hashes.c (nettle_hashes): Added nettle_ripemd160.
3347         * Makefile.in (nettle_SOURCES): Added ripemd160.c,
3348         ripemd160-compress.c, and ripemd160-meta.c.
3349         (HEADERS): Added ripemd160.h.
3350
3351 2011-08-10  Niels Möller  <nisse@amfibolit.hack.org>
3352
3353         * nettle.texinfo: Fixed mis-placed const in various prototypes.
3354         Spotted by Tatsuhiro Tsujikawa.
3355
3356 2011-07-24  Niels Möller  <nisse@lysator.liu.se>
3357
3358         * Makefile.in (PKGCONFIG_FILES, pkgconfigdir): New variables.
3359         (DISTFILES): Added nettle.pc.in and hogweed.pc.in.
3360         (nettle.pc, hogweed.pc): New targets (invoking config.status).
3361         (install-pkgconfig, uninstall-pkgconfig): New targets.
3362         (install-here): Depend on install-pkgconfig.
3363         (uninstall-here): Depend on uninstall-pkgconfig.
3364         (distclean-here): Delete nettle.pc and hogweed.pc.
3365
3366 2011-07-20  Niels Möller  <nisse@lysator.liu.se>
3367
3368         * configure.ac: Generate nettle.pc and hogweed.pc.
3369
3370         * nettle.pc.in, hogweed.pc.in: New files.
3371
3372 2011-07-17  Niels Möller  <nisse@lysator.liu.se>
3373
3374         * nettle-internal.h: Added missing extern declarations.
3375
3376 2011-07-11  Niels Möller  <nisse@lysator.liu.se>
3377
3378         * configure.ac: Changed version number to 2.3.
3379
3380         * Released nettle-2.2.
3381
3382         * Makefile.in (DISTFILES): Distribute COPYING.LIB, not COPYING,
3383
3384 2011-07-07  Niels Möller  <nisse@lysator.liu.se>
3385
3386         * tools/misc.h (werror): Removed incorrect noreturn attribute from
3387         declaration.
3388
3389         * examples/io.c (read_file): Bug fix, in dependence of initial
3390         size on max_size.
3391
3392 2011-07-01  Niels Möller  <nisse@lysator.liu.se>
3393
3394         * cbc.c (CBC_BUFFER_LIMIT): Reduced to 512 bytes.
3395         (cbc_decrypt): For in-place operation, use overlapping memxor3 and
3396         eliminate a memcpy.
3397
3398         * ctr.c (ctr_crypt): Reorganized to call the encryption function
3399         with several blocks at a time. Handle the case of a single block
3400         specially.
3401
3402         * x86_64/memxor.asm: Added ALIGN for shifting loop. Deleted
3403         obsolete ifelse.
3404
3405 2011-06-30  Niels Möller  <nisse@lysator.liu.se>
3406
3407         * configure.ac: Link in serpent-decrypt.asm, if found.
3408
3409         * x86_64/serpent-decrypt.asm: Added an SSE2 loop, doing four
3410         blocks at a time in parallel.
3411
3412         * x86_64/serpent-encrypt.asm: Include serpent.m4. Deleted a
3413         redundant label.
3414
3415         * x86_64/serpent.m4: New file, with serpent-related macros.
3416
3417 2011-06-29  Niels Möller  <nisse@lysator.liu.se>
3418
3419         * x86_64/serpent-decrypt.asm: Wrote main (32-bit) loop.
3420         (SBOX0I, SBOX1I, SBOX7I): Fixed bugs.
3421
3422         * nettle.texinfo (Copyright): Updated for license change to
3423         LGPLv2+. Updated copyright info on serpent.
3424
3425         * NEWS: Updated information for nettle-2.2.
3426
3427         * x86_64/serpent-decrypt.asm: New file.
3428
3429         * x86_64/serpent-encrypt.asm: Fixed .file pseudo op.
3430
3431         * testsuite/testutils.c (test_cipher_ctr): Display more info on
3432         failure.
3433
3434         * examples/nettle-benchmark.c (bench_ctr): New function.
3435         (time_cipher): Also benchmark CTR mode.
3436
3437         * configure.ac (LIBNETTLE_MINOR): Updated library version number
3438         to 4.1.
3439         (LIBHOGWEED_MINOR): And to 2.1.
3440
3441 2011-06-22  Niels Möller  <nisse@lysator.liu.se>
3442
3443         * configure.ac: Use pwd -P when examining lib directories.
3444         Link in serpent-encrypt.asm, if found.
3445
3446 2011-06-21  Niels Möller  <nisse@lysator.liu.se>
3447
3448         * serpent-decrypt.c (SBOX3_INVERSE): Eliminated temporaries.
3449         (SBOX4_INVERSE): Likewise.
3450         (SBOX5_INVERSE): Likewise.
3451         (SBOX6_INVERSE): Likewise.
3452         (SBOX7_INVERSE): Likewise.
3453         (All SBOX_INVERSE-macros): Deleted type argument, and updated users.
3454
3455 2011-06-20  Niels Möller  <nisse@lysator.liu.se>
3456
3457         * serpent-decrypt.c: Renamed arguments in sbox macros.
3458         (SBOX0_INVERSE): Eliminated temporaries.
3459         (SBOX1_INVERSE): Likewise.
3460         (SBOX2_INVERSE): Likewise.
3461
3462         * x86_64/serpent-encrypt.asm: Added an SSE2 loop, doing four
3463         blocks at a time in parallel.
3464
3465         * testsuite/serpent-test.c (test_main): Added some more multiple
3466         block tests.
3467
3468 2011-06-15  Niels Möller  <nisse@lysator.liu.se>
3469
3470         * configure.ac (libdir): On 64-bit Linux, we used to assume that
3471         libraries are installed according to the FHS. Since at least
3472         Fedora and Gentoo follow the FHS convention, while at least Debian
3473         doesn't, we have to try to figure out which convention is used.
3474
3475 2011-06-14  Niels Möller  <nisse@lysator.liu.se>
3476
3477         * x86_64/serpent-encrypt.asm: Slight simplification of loop logic.
3478
3479         * x86_64/serpent-encrypt.asm: New file.
3480
3481 2011-06-12  Niels Möller  <nisse@lysator.liu.se>
3482
3483         * testsuite/serpent-test.c (test_main): Added tests with multiple
3484         blocks at a time.
3485
3486         * serpent-encrypt.c (SBOX6): Renamed arguments. Eliminated
3487         temporaries.
3488         (SBOX7): Likewise.
3489         (All SBOX-macros): Deleted type argument, and updated users.
3490
3491         * configure.ac: Display summary at the end of configure..
3492         (asm_path): Set only if enable_assember is yes.
3493
3494 2011-06-10  Niels Möller  <nisse@lysator.liu.se>
3495
3496         * serpent-encrypt.c (SBOX5): Renamed arguments. Eliminated
3497         temporaries.
3498
3499 2011-06-09  Niels Möller  <nisse@lysator.liu.se>
3500
3501         * serpent-encrypt.c (SBOX4): Renamed arguments. Eliminated
3502         temporaries.
3503
3504         * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LINK): Cygwin fix, from
3505         Vincent Torri.
3506
3507 2011-06-08  Niels Möller  <nisse@lysator.liu.se>
3508
3509         * examples/eratosthenes.c (find_first_one): Fixed c99-style
3510         declaration. Reported by Sebastian Reitenbach.
3511         (find_first_one): Declare the lookup table as static const, and
3512         use unsigned char rather than unsigned..
3513
3514 2011-06-07  Niels Möller  <nisse@lysator.liu.se>
3515
3516         * serpent-encrypt.c (SBOX0): Renamed arguments. Eliminated
3517         temporaries.
3518         (SBOX1): Likewise.
3519         (SBOX2): Likewise.
3520         (SBOX3): Likewise.
3521
3522 2011-06-06  Niels Möller  <nisse@lysator.liu.se>
3523
3524         * Makefile.in (DISTFILES): Added serpent-internal.h.
3525         (nettle_SOURCES): Replaced serpent.c by serpent-set-key.c,
3526         serpent-encrypt.c, and serpent-decrypt.c.
3527
3528         * serpent.c: Replaced by several new files.
3529         * serpent-set-key.c: New file.
3530         * serpent-encrypt.c: New file.
3531         * serpent-decrypt.c: New file.
3532         * serpent-internal.h: New file.
3533
3534         * serpent.c [HAVE_NATIVE_64_BIT]: Process two blocks at a time in
3535         parallel. Measured speedup of 10%--25% (higher for encryption) on
3536         x86_64.
3537
3538 2011-06-01  Niels Möller  <nisse@lysator.liu.se>
3539
3540         * serpent.c (ROUNDS): Deleted macro.
3541         (serpent_block_t): Deleted array typedef.
3542         (KEYXOR): New macro, replacing BLOCK_XOR.
3543         (BLOCK_COPY, SBOX, SBOX_INVERSE): Deleted macros.
3544         (LINEAR_TRANSFORMATION): Use four separate arguments.
3545         (LINEAR_TRANSFORMATION_INVERSE): Likewise.
3546         (ROUND): Take separate arguments for all input and output words.
3547         (ROUND_INVERSE): Likewise.
3548         (ROUND_LAST, ROUND_FIRST_INVERSE): Deleted macros.
3549         (serpent_set_key): Moved loop termination test.
3550         (serpent_encrypt): Rewrote with unrolling of just eight rounds,
3551         and without serpent_block_t.
3552         (serpent_decrypt): Likewise.
3553
3554         * serpent.c: Added do { ... } while (0) around block macros.
3555         (serpent_key_t): Deleted array typedef.
3556         (ROL32, ROR32): Renamed macros, were rol and ror.
3557         (KS_RECURRENCE, KS): New macros.
3558         (serpent_key_pad): Renamed, from...
3559         (serpent_key_prepare): ...old name.
3560         (serpent_subkeys_generate): Deleted function.
3561         (serpent_set_key): Rewrote the generation of subkeys. Reduced both
3562         temporary storage and code size (less unrolling)
3563
3564 2011-05-31  Niels Möller  <nisse@lysator.liu.se>
3565
3566         * testsuite/serpent-test.c (test_main): Enabled test with short,
3567         40-bit, key.
3568
3569         * serpent.c (byte_swap_32): Deleted macro.
3570         (serpent_key_prepare): Use LE_READ_UINT32. Don't require aligned
3571         input, and support arbitrary key sizes.
3572
3573 2011-05-30  Simon Josefsson  <simon@josefsson.org>
3574
3575         * serpent.c: Rewrite, based on libgcrypt code.  License changed
3576         from GPL to LGPL.
3577         * serpent_sboxes.h: Removed.
3578         * Makefile.in: Drop serpent_sboxes.h.
3579
3580 2011-05-31  Niels Möller  <nisse@lysator.liu.se>
3581
3582         * testsuite/serpent-test.c (test_main): Added some tests for
3583         padding of keys of length which is not a multiple of four bytes.
3584
3585 2011-05-30  Simon Josefsson  <simon@josefsson.org>
3586
3587         * testsuite/serpent-test.c (test_main): Add test vectors from
3588         libgcrypt.
3589
3590 2011-05-21  Niels Möller  <nisse@lysator.liu.se>
3591
3592         * dsa-keygen.c (dsa_generate_keypair): Avoid double init of mpz
3593         variable. Spotted by Nikos Mavrogiannopoulos.
3594
3595 2011-05-06  Niels Möller  <nisse@lysator.liu.se>
3596
3597         * configure.ac: Fix link flags for shared libraries on Solaris,
3598         which needs -h to set the soname. Patch contributed by Dagobert
3599         Michelsen.
3600
3601 2011-05-06  Niels Möller  <nisse@lysator.liu.se>
3602
3603         * configure.ac: New configure option --enable-gcov.
3604
3605         * arcfour.h (arcfour_stream): Deleted obsolete define.
3606
3607 2011-04-27  Niels Möller  <nisse@lysator.liu.se>
3608
3609         * tools/nettle-hash.c (find_algorithm): Require exact match.
3610
3611 2011-04-15  Niels Möller  <nisse@lysator.liu.se>
3612
3613         Reverted broken byte-order change from 2001-06-17:
3614         * serpent.c (serpent_set_key): Use correct byteorder.
3615         (serpent_encrypt): Likewise.
3616         (serpent_decrypt): Likewise.
3617
3618         * testsuite/serpent-test.c (decode_hex_reverse): New function.
3619         (RH, RHL): New macros.
3620         (test_main): Byte reverse inputs and outputs for the testvectors
3621         taken from the serpent submission package. Enable test vectors
3622         from http://www.cs.technion.ac.il/~biham/Reports/Serpent/.
3623
3624 2011-03-23  Niels Möller  <nisse@lysator.liu.se>
3625
3626         * tools/sexp-conv.c (xalloc): Deleted function, now it's in misc.c
3627         instead.
3628
3629         * configure.ac: Use LSH_FUNC_STRERROR.
3630
3631         * tools/Makefile.in (TARGETS): Added nettle-hash, and related
3632         build rules.
3633         (SOURCES): Added nettle-hash.c.
3634
3635         * tools/misc.c (xalloc): New function.
3636
3637         * tools/pkcs1-conv.c (main): Made the OPT_* constants local, and
3638         fixed numerical values to start with non-ASCII 0x300.
3639
3640         * tools/nettle-hash.c: New file.
3641
3642 2011-03-23  Niels Möller  <nisse@lysator.liu.se>
3643
3644         Contributed by Daniel Kahn Gillmor:
3645         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3646         meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.
3647
3648         * testsuite/meta-hash-test.c: New file.
3649         * testsuite/meta-cipher-test.c: New file.
3650         * testsuite/meta-armor-test.c: New file.
3651
3652         * nettle.texinfo: Document nettle_hashes and nettle_ciphers.
3653
3654         * nettle-meta.h: Declare algorithm lists nettle_ciphers,
3655         nettle_hashes, nettle_armors.
3656
3657         * Makefile.in (nettle_SOURCES): Added nettle-meta-hashes.c,
3658         nettle-meta-ciphers.c, and nettle-meta-armors.c.
3659
3660         * nettle-meta-armors.c: New file.
3661         * nettle-meta-ciphers.c: New file.
3662         * nettle-meta-hashes.c: New file.
3663
3664 2011-02-18  Niels Möller  <nisse@lysator.liu.se>
3665
3666         * arcfour.c (arcfour_stream): Deleted function. It's not very
3667         useful, and neither documented nor tested.
3668
3669 2011-02-16  Niels Möller  <nisse@lysator.liu.se>
3670
3671         * cbc.h (CBC_ENCRYPT): Avoid using NULL; we don't ensure that it
3672         is defined.
3673         (CBC_DECRYPT): Likewise.
3674
3675         * gcm-aes.c (gcm_aes_set_iv): Use GCM_SET_IV.
3676         (gcm_aes_set_key): Deleted cast.
3677         (gcm_aes_encrypt): Likewise.
3678         (gcm_aes_decrypt): Likewise.
3679         (gcm_aes_digest): Likewise.
3680         (gcm_aes_update): One less argument to GCM_UPDATE.
3681
3682         * gcm.h (GCM_SET_KEY): Added cast to nettle_crypt_func *. Help
3683         compiler type checking despite this cast.
3684         (GCM_ENCRYPT): Likewise.
3685         (GCM_DECRYPT): Likewise.
3686         (GCM_DIGEST): Likewise.
3687         (GCM_SET_IV): New macro, for completeness.
3688         (GCM_UPDATE): Deleted unused argument encrypt.
3689
3690 2011-02-14  Niels Möller  <nisse@lysator.liu.se>
3691
3692         * nettle.texinfo: Split node on cipher modes, and started on
3693         the GCM documentation.
3694
3695         * testsuite/gcm-test.c (test_gcm_aes): Deleted function, replaced
3696         by test_aead.
3697         (test_main): Use test_aead.
3698
3699         * testsuite/testutils.c (test_aead): New function, replacing
3700         test_gcm_aes and before that test_cipher_gcm.
3701
3702         * nettle-internal.c (nettle_gcm_aes128): New const struct.
3703         (nettle_gcm_aes192): Likewise.
3704         (nettle_gcm_aes256): Likewise.
3705
3706         * nettle-internal.h (struct nettle_aead): Tentative interface for
3707         authenticated encryption with associated data.
3708
3709         * examples/nettle-benchmark.c (time_gcm): Renamed. Updated for
3710         gcm_aes_auth to gcm_aes_update renaming. Benchmark both encryption
3711         and hashing.
3712         (time_gmac): ...old name.
3713
3714         * nettle-internal.c (des_set_key_hack): Don't touch the bits
3715         parity, since thay are now ignored.
3716         (des3_set_key_hack): Likewise.
3717
3718         * cast128-meta.c (nettle_cast128): Don't pass keysize.
3719         * nettle-meta.h (_NETTLE_CIPHER_FIX): Deleted keysize parameter
3720         derived from the appropriate constant instead.
3721
3722         * testsuite/gcm-test.c (test_gcm_aes): Updated for gcm_aes_auth to
3723         gcm_aes_update renaming.
3724
3725 2011-02-13  Niels Möller  <nisse@lysator.liu.se>
3726
3727         * gcm.h (GCM_UPDATE): Renamed, from...
3728         (GCM_AUTH): ...old name.
3729
3730         * gcm-aes.c (gcm_aes_update): Renamed, from...
3731         (gcm_aes_auth): ...old name.
3732
3733         * gcm.c (gcm_update): Renamed, and fixed an assert. From...
3734         (gcm_auth): ...old name.
3735
3736         * gcm.h (GCM_TABLE_BITS): Increase table size to 8 bits,
3737         corresponding to 4 KByte of key-dependent tables.
3738
3739 2011-02-10  Niels Möller  <nisse@lysator.liu.se>
3740
3741         * x86_64/memxor.asm: New file. Improves performance by 22% for the
3742         unaligned01 case and 35% for the unaligned12 case, benchmarked on
3743         Intel SU1400.
3744
3745         * examples/nettle-benchmark.c (cgt_works_p): New function.
3746         (cgt_time_start): Likewise.
3747         (cgt_time_end): Likewise.
3748         (clock_time_start): Likewise.
3749         (clock_time_end): Likewise.
3750         (time_function): Read clock via function pointers time_start and
3751         time_end, so we can select method at runtime.
3752         (xalloc): Use die function.
3753         (main): Choose timing function. If available, try clock_gettime,
3754         and fall back to clock if it doesn't exist.
3755
3756         * examples/nettle-benchmark.c (die): New function.
3757         (TIME_END, TIME_START): Check return value from clock_gettime.
3758
3759         * gcm.h (union gcm_block): Use correct length for w array.
3760
3761         * testsuite/gcm-test.c (test_main): Added the rest of the
3762         testcases from the spec.
3763
3764 2011-02-09  Niels Möller  <nisse@lysator.liu.se>
3765
3766         * testsuite/gcm-test.c (test_main): Enabled testcases 5 and 6,
3767         with different IV lengths.
3768
3769         * gcm-aes.c (gcm_aes_set_iv): Updated for gcm_set_iv change.
3770
3771         * gcm.c (gcm_hash_sizes): New function.
3772         (gcm_set_iv): Added support for IVs of arbitrary size. Needed
3773         another argument, for the hash subkey.
3774         (gcm_digest): Use gcm_hash_sizes.
3775
3776         * examples/nettle-benchmark.c (time_gmac): Use gcm_aes interface.
3777
3778         * testsuite/gcm-test.c (test_gcm_aes): New function, replacing
3779         test_cipher_gcm and using the new gcm_aes interface.
3780         (test_main): Updated to use test_gcm_aes.
3781         * testsuite/testutils.c (test_cipher_gcm): Deleted function.
3782
3783         * Makefile.in (nettle_SOURCES): Added gcm-aes.c.
3784
3785         * gcm.c (gcm_set_key): Replaced context argument by a struct
3786         gcm_key *.
3787         (gcm_hash): Replaced context argument by a struct gcm_key * and a
3788         pointer to the hashing state block.
3789         (gcm_auth): Added struct gcm_key * argument.
3790         (gcm_encrypt): Likewise.
3791         (gcm_decrypt): Likewise.
3792         (gcm_digest): Likewise.
3793
3794         * gcm-aes.c: New file.
3795         (gcm_aes_set_key): New function.
3796         (gcm_aes_set_iv): Likewise.
3797         (gcm_aes_auth): Likewise.
3798         (gcm_aes_encrypt): Likewise.
3799         (gcm_aes_decrypt): Likewise.
3800         (gcm_aes_digest): Likewise.
3801
3802         * gcm.h (struct gcm_key): Moved the key-dependent and
3803         message-independent state to its own struct.
3804         (struct gcm_ctx): ... and removed it here.
3805         (GCM_CTX): New macro.
3806         (GCM_SET_KEY): Likewise.
3807         (GCM_AUTH): Likewise.
3808         (GCM_ENCRYPT): Likewise.
3809         (GCM_DECRYPT): Likewise.
3810         (GCM_DIGEST): Likewise.
3811         (struct gcm_aes_ctx): New struct.
3812
3813 2011-02-08  Niels Möller  <nisse@lysator.liu.se>
3814
3815         * gcm.h (struct gcm_ctx): The hash key is now always an array,
3816         named h, with array size depending on GCM_TABLE_BITS.
3817         * gcm.c (gcm_gf_shift): Added a separate result argument.
3818         (gcm_gf_mul): Compile bitwise version only when GCM_TABLE_BITS ==
3819         0. Simplified interface with just two arguments pointing to
3820         complete blocks.
3821         (gcm_gf_shift_4, gcm_gf_shift_8): Renamed table-based functions, from...
3822         (gcm_gf_shift_chunk): ... old name.
3823         (gcm_gf_mul): Renamed both table-based versions and made the
3824         argument types compatible with the bitwise gcm_gf_mul.
3825         (gcm_gf_mul_chunk): ... the old name.
3826         (gcm_set_key): Initialize the table using adds and shifts only.
3827         When GCM_TABLE_BITS > 0, this eliminates the only use of the
3828         bitwise multiplication.
3829         (gcm_hash): Simplified, now that we have the same interface for
3830         gcm_gf_mul, regardless of table size.
3831
3832         * gcm.c (GHASH_POLYNOMIAL): Use unsigned long for this constant.
3833         (gcm_gf_shift_chunk): Fixed bugs for the big endian 64-bit case,
3834         e.g., sparc64. For both 4-bit and 8-bit tables.
3835
3836         * gcm.c: Use the new union gcm_block for all gf operations.
3837
3838         * gcm.h (union gcm_block): New union, used to enforce alignment.
3839
3840 2011-02-07  Niels Möller  <nisse@lysator.liu.se>
3841
3842         * gcm.c (gcm_gf_shift_chunk) : Bug fix for little-endian 8-bit
3843         tables.
3844
3845         * gcm.c (gcm_gf_mul_chunk): Special case first and last iteration.
3846         (gcm_gf_add): New function, a special case of memxor. Use it for
3847         all memxor calls with word-aligned 16 byte blocks. Improves
3848         performance to 152 cycles/byte with no tables, 28 cycles per byte
3849         with 4-bit tables and 10.5 cycles per byte with 8-bit tables.
3850
3851         Introduced 8-bit tables. If enabled, gives gmac performance of 19
3852         cycles per byte (still on intel x86_64).
3853         * gcm.c (gcm_gf_shift_chunk): New implementation for 8-bit tables.
3854         (gcm_gf_mul_chunk): Likewise.
3855         (gcm_set_key): Generate 8-bit tables.
3856
3857         * Makefile.in (SOURCES): Added gcmdata.c.
3858
3859         * gcm.h (GCM_TABLE_BITS): Set to 4.
3860
3861 2011-02-06  Niels Möller  <nisse@lysator.liu.se>
3862
3863         * Makefile.in (TARGETS): Added gcmdata.
3864         (gcmdata): New rule.
3865
3866         Introduced 4-bit tables. Gives gmac performance of 45 cycles per
3867         byte (still on intel x86_64).
3868         * gcm.c (gcm_gf_shift): Renamed. Tweaked little-endian masks.
3869         (gcm_rightshift): ... old name.
3870         (gcm_gf_mul): New argument for the output. Added length argument
3871         for one of the inputs (implicitly padding with zeros).
3872         (shift_table): New table (in 4-bit and 8-bit versions), generated
3873         by gcmdata.
3874         (gcm_gf_shift_chunk): New function shifting 4 bits at
3875         a time.
3876         (gcm_gf_mul_chunk): New function processing 4 bits at a time.
3877         (gcm_set_key): Generation of 4-bit key table.
3878         (gcm_hash): Use tables, when available.
3879
3880         * gcmdata.c (main): New file.
3881
3882         * gcm.c (gcm_rightshift): Moved the reduction of the shifted out
3883         bit here.
3884         (gcm_gf_mul): Updated for gcm_rightshift change. Improves gmac
3885         performance to 181 cycles/byte.
3886
3887         * gcm.c (gcm_gf_mul): Rewrote. Still uses the bitwise algorithm from the
3888         specification, but with separate byte and bit loops. Improves gmac
3889         performance a bit further, to 227 cycles/byte.
3890
3891         * gcm.c (gcm_rightshift): Complete rewrite, to use word rather
3892         than byte operations. Improves gmac performance from 830 cycles /
3893         byte to (still poor) 268 cycles per byte on intel x86_64.
3894
3895 2011-02-05  Niels Möller  <nisse@lysator.liu.se>
3896
3897         * examples/nettle-benchmark.c (time_gmac): New function.
3898         (main): Call time_gmac.
3899
3900         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added gcm-test.c.
3901
3902         * testsuite/testutils.c (test_cipher_gcm): New function,
3903         contributed by Nikos Mavrogiannopoulos.
3904
3905         * testsuite/gcm-test.c: New file, contributed by Nikos
3906         Mavrogiannopoulos.
3907
3908         * Makefile.in (nettle_SOURCES): Added gcm.c.
3909         (HEADERS): Added gcm.h.
3910
3911         * gcm.c: New file, contributed by Nikos Mavrogiannopoulos.
3912         * gcm.h: New file, contributed by Nikos Mavrogiannopoulos.
3913
3914         * macros.h (INCREMENT): New macro, moved from ctr.c. Deleted third
3915         argument.
3916         * ctr.c: Use INCREMENT macro from macros.h, deleted local version.
3917
3918 2011-01-07  Niels Möller  <nisse@lysator.liu.se>
3919
3920         * testsuite/Makefile.in (check): Add ../.lib to PATH, since that's
3921         where w*ndows looks for dlls.
3922
3923         * testsuite/testutils.c (test_cipher_stream): More debug output on
3924         failure.
3925
3926 2010-12-14  Niels Möller  <nisse@lysator.liu.se>
3927
3928         * nettle-types.h: Deleted some unnecessary parenthesis from
3929         function typedefs.
3930         (nettle_realloc_func): Moved typedef here...
3931         * realloc.h: ...from here.
3932
3933         * buffer.c (nettle_buffer_init_realloc): Use an explicit pointer
3934         for realloc argument.
3935
3936 2010-12-07  Niels Möller  <nisse@lysator.liu.se>
3937
3938         * nettle.texinfo (Copyright): Updated info on blowfish.
3939
3940 2010-11-26  Niels Möller  <nisse@lysator.liu.se>
3941
3942         Reapplied optimizations (150% speedup on x86_32) and other fixes,
3943         relicensing them as LGPL.
3944         * blowfish.c (do_encrypt): Renamed, to...
3945         (encrypt): ...new name.
3946         (F): Added context argument. Shift input explicitly, instead of
3947         reading individual bytes via memory.
3948         (R): Added context argument.
3949         (encrypt): Deleted a bunch of local variables. Using the context
3950         pointer for everything should consume less registers.
3951         (decrypt): Likewise.
3952         (initial_ctx): Arrange constants into a struct, to simplify key
3953         setup.
3954         (blowfish_set_key): Some simplification.
3955
3956 2010-11-26  Simon Josefsson  <simon@josefsson.org>
3957
3958         * blowfish.c: New version ported from libgcrypt. License changed
3959         from GPL to LGPL.
3960
3961 2010-11-25  Niels Möller  <nisse@lysator.liu.se>
3962
3963         * Makefile.in (install-shared-nettle): Use INSTALL_DATA, which
3964         clears the execute permission bits.
3965         (install-shared-hogweed): Likewise.
3966
3967 2010-11-16  Niels Möller  <nisse@lysator.liu.se>
3968
3969         * configure.ac: Updated gmp url.
3970
3971 2010-11-01  Niels Möller  <nisse@lysator.liu.se>
3972
3973         * tools/misc.c (werror): Don't call exit (copy&paste-error).
3974
3975 2010-10-26  Niels Möller  <nisse@lysator.liu.se>
3976
3977         * examples/rsa-encrypt.c (main): No extra message for bad options.
3978
3979         * examples/rsa-keygen.c (main): Added long options. Deleted -?,
3980         and fixed handling of bad options.
3981
3982         * examples/next-prime.c (main): Deleted -?, and fixed handling of
3983         bad options.
3984         * examples/random-prime.c (main): Likewise.
3985
3986 2010-10-22  Niels Möller  <nisse@lysator.liu.se>
3987
3988         * examples/nettle-benchmark.c (main): Added long options. Deleted -?,
3989         and fixed handling of bad options.
3990
3991         * examples/eratosthenes.c (main): Added long options. Deleted -?,
3992         and fixed handling of bad options. Renamed -s to -q (long option
3993         --quiet).
3994
3995         * tools/pkcs1-conv.c (main): Deleted short alias -? for --help,
3996         and fixed handling of bad options.
3997         * tools/sexp-conv.c (parse_options): Likewise.
3998
3999 2010-10-06  Niels Möller  <nisse@lysator.liu.se>
4000
4001         * memxor.c (memxor3): Optimized.
4002         (memxor3_common_alignment): New function.
4003         (memxor3_different_alignment_b): New function.
4004         (memxor3_different_alignment_ab): New function.
4005         (memxor3_different_alignment_all): New function.
4006
4007         * examples/nettle-benchmark.c (time_function): Reorganized, to
4008         reduce overhead.
4009         (time_memxor): Also benchmark memxor3.
4010
4011         * x86_64/memxor.asm: New file.
4012
4013         * examples/nettle-benchmark.c (overhead): New global variable.
4014         (time_function): Compensate for call overhead.
4015         (bench_nothing, time_overhead): New functions.
4016         (time_memxor): Tweaked src size, making it an integral number of
4017         words.
4018         (main): Call time_overhead.
4019
4020 2010-10-01  Niels Möller  <nisse@lysator.liu.se>
4021
4022         * x86_64/camellia-crypt-internal.asm (ROUND): Reordered sbox
4023         lookups.
4024
4025         * testsuite/memxor-test.c: Also test memxor3.
4026
4027 2010-09-30  Niels Möller  <nisse@lysator.liu.se>
4028
4029         * configure.ac: Link in memxor.asm, if found.
4030
4031         * testsuite/testutils.c (test_cipher_cbc): Print more info when
4032         failing.
4033
4034         * testsuite/memxor-test.c (test_xor): Added verbose printout.
4035
4036         * examples/nettle-benchmark.c (time_memxor): Count size of
4037         unsigned long as "block size" for memxor.
4038
4039 2010-09-24  Niels Möller  <nisse@lysator.liu.se>
4040
4041         * testsuite/.test-rules.make: Added rule for memxor-test.
4042         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added memxor-test.c
4043         * testsuite/memxor-test.c: New file.
4044
4045         * memxor.c (memxor_common_alignment): New function.
4046         (memxor_different_alignment): New function.
4047         (memxor): Optimized to do word-operations rather than byte
4048         operations.
4049
4050         * configure.ac (HAVE_NATIVE_64_BIT): New config.h define.
4051
4052         Partial revert of 2010-09-20 changes.
4053         * camellia-set-encrypt-key.c (camellia_set_encrypt_key):
4054         Reintroduce CAMELLIA_F_HALF_INV, for 32-bit machines.
4055         * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Two variants,
4056         differing in where addition of the key is done.
4057         * x86/camellia-crypt-internal.asm: Moved addition of key.
4058
4059 2010-09-22  Niels Möller  <nisse@lysator.liu.se>
4060
4061         * examples/nettle-benchmark.c (BENCH_INTERVAL): Changed unit to
4062         seconds.
4063         (time_function): Use clock_gettime with CLOCK_PROCESS_CPUTIME_ID,
4064         if available. This gives better accuracy, at least on recent
4065         linux.
4066         (BENCH_INTERVAL): Reduced to 0.1 s.
4067         (struct bench_memxor_info): New struct.
4068         (bench_memxor): New function.
4069         (time_memxor): New function.
4070         (main): Use time_memxor. Added optional argument used to limit the
4071         algorithms being benchmarked.
4072         (GET_CYCLE_COUNTER): Define also for x86_64.
4073         (time_memxor): Improved display.
4074
4075         * examples/Makefile.in (nettle-benchmark): Link using
4076         $(BENCH_LIBS) rather than $(LIBS).
4077
4078         * configure.ac: Check for clock_gettime, and add -lrt to
4079         BENCH_LIBS if needed.
4080
4081 2010-09-20  Niels Möller  <nisse@lysator.liu.se>
4082
4083         * configure.ac: Less quoting when invoking $CC, to allow CC="gcc
4084         -m32".
4085
4086         * x86/camellia-crypt-internal.asm (ROUND): Adapted to new key
4087         convention, moving key xor to the end.
4088
4089         * camellia-set-encrypt-key.c (CAMELLIA_F_HALF_INV): Deleted macro.
4090         (camellia_set_encrypt_key): Deleted the CAMELLIA_F_HALF_INV
4091         operations intended for moving the key xor into the middle of the
4092         round.
4093
4094         * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Moved addition of
4095         key to the end, to use a 64-bit xor operation.
4096
4097         * x86_64/camellia-crypt-internal.asm: New file.
4098
4099         * x86_64/machine.m4 (LREG, HREG, XREG): New macros.
4100
4101 2010-09-17  Niels Möller  <nisse@lysator.liu.se>
4102
4103         * configure.ac: Support shared libraries (dlls) with mingw32.
4104         Contributed by David Hoyt.
4105
4106 2010-07-25  Niels Möller  <nisse@lysator.liu.se>
4107
4108         * configure.ac: Changed version number to nettle-2.2.
4109
4110         * Released nettle-2.1.
4111
4112         * configure.ac: Use camellia-crypt-internal.asm, if available.
4113         Bumped soname to libnettle.so.4, and reset LIBNETTLE_MINOR to
4114         zero.
4115
4116         * x86/machine.m4 (LREG, HREG): Moved macros here, from...
4117         * x86/aes.m4: ...here.
4118
4119         * x86/camellia-crypt-internal.asm: New file.
4120
4121         * nettle.texinfo: Updated and expanded section on DSA.
4122         Document aes_invert_key, and camellia. Added missing functions
4123         rsa_sha512_verify and rsa_sha512_verify_digest.
4124
4125         * camellia.h (struct camellia_ctx): Eliminate the two unused
4126         subkeys, and renumber the remaining ones.
4127         * camellia-crypt-internal.c (_camellia_crypt): Updated for
4128         renumbered subkeys.
4129         * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Likewise.
4130         * camellia-set-decrypt-key.c (camellia_invert_key): Likewise.
4131
4132         * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Inline
4133         the expansion of camellia_setup128 and camellia_setup256, keeping
4134         the unexpanded key in scalar variables.
4135         (camellia_setup128): Deleted.
4136         (camellia_setup256): Deleted.
4137
4138 2010-07-24  Niels Möller  <nisse@lysator.liu.se>
4139
4140         * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Reduced
4141         code size, no complete loop unroll. Use one loop for each phase of
4142         the post-processing.
4143
4144         * testsuite/camellia-test.c: New tests for camellia_invert_key.
4145         * testsuite/aes-test.c: New tests for aes_invert_key.
4146
4147         * aes.h (aes_invert_key): Declare it.
4148
4149         * aes-set-decrypt-key.c (aes_invert_key): New function, key
4150         inversion code extracted from aes_set_decrypt_key.
4151         (aes_set_decrypt_key): Use aes_invert_key.
4152
4153         * camellia-set-encrypt-key.c (camellia_setup128): Generate
4154         unmodified subkeys according to the spec. Moved clever combination
4155         of subkeys to camellia_set_encrypt_key.
4156         (camellia_setup256): Likewise.
4157         (camellia_set_encrypt_key): Moved subkey post-processing code
4158         here, and reduce code duplication between 128-bit keys and larger
4159         keys.
4160
4161         * camellia.c: Deleted file, split into several new files...
4162         * camellia-table.c (_camellia_table): New file with the constant
4163         sbox tables.
4164         * camellia-set-encrypt-key.c: New file.
4165         (camellia_setup128): Generate unmodified subkeys according to the
4166         spec. Moved clever combination of subkeys to camellia_set_encrypt_key.
4167         (camellia_setup256): Likewise.
4168
4169         * camellia-set-decrypt-key.c: New file.
4170         (camellia_invert_key): Key inversion function.
4171         (camellia_set_decrypt_key): New key setup function.
4172         * camellia-internal.h: New file.
4173         * camellia-crypt.c (camellia_crypt): New file, new wrapper
4174         function passing the sbox table to _camellia_crypt.
4175         * camellia-crypt-internal.c (_camellia_crypt): New file, with main
4176         encrypt/decrypt function.
4177         * Makefile.in (nettle_SOURCES): Updated list of camellia source files.
4178         (DISTFILES): Added camellia-internal.h.
4179
4180 2010-07-20  Niels Möller  <nisse@lysator.liu.se>
4181
4182         * camellia-meta.c: Use _NETTLE_CIPHER_SEP_SET_KEY.
4183
4184         * camellia.h (struct camellia_ctx): Replaced flag camellia128 by
4185         expanded key length nkeys.
4186
4187         * camellia.c (camellia_set_encrypt_key): Renamed, from...
4188         (camellia_set_key): ... old name.
4189         (camellia_invert_key): New function.
4190         (camellia_set_decrypt_key): New function, using
4191         camellia_invert_key.
4192         (camellia_crypt): Renamed, from...
4193         (camellia_encrypt): ... old name.
4194         (camellia_decrypt): Deleted, no longer needed. camellia_crypt used
4195         for both encryption and decryption.
4196
4197         * nettle-meta.h (_NETTLE_CIPHER_SEP_SET_KEY): New macro.
4198
4199         * dsa-keygen.c: Removed unnecessary include of memxor.h.
4200
4201         * camellia.c: Rewrote to use 64-bit type for subkeys and use
4202         64-bit operations throughout. Performance on x86_32, when compiled
4203         with gcc-4.4.4, is reduced by roughly 15%, this should be fixed
4204         later.
4205
4206         * camellia.h (struct camellia_ctx): Use type uint64_t for subkeys.
4207
4208 2010-07-07  Niels Möller  <nisse@lysator.liu.se>
4209
4210         * aes.h (aes_encrypt, aes_decrypt): Declare ctx argument as const.
4211         Also updated implementation.
4212         * blowfish.h (blowfish_encrypt, blowfish_decrypt): Likewise.
4213         * cast128.h (cast128_encrypt, cast128_decrypt): Likewise.
4214         * serpent.h (serpent_encrypt, serpent_decrypt): Likewise.
4215         * twofish.h (twofish_encrypt, twofish_decrypt): Likewise.
4216
4217         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
4218         camellia-test.c.
4219
4220         * examples/nettle-benchmark.c: Added camellia ciphers.
4221
4222         * Makefile.in (nettle_SOURCES): Added camellia.c and
4223         camellia-meta.c.
4224         (HEADERS): Added camellia.h.
4225
4226         * nettle-meta.h (nettle_camellia128): Declare.
4227         (nettle_camellia192): Likewise.
4228         (nettle_camellia256): Likewise.
4229
4230         * camellia-meta.c: New file.
4231
4232         * camellia.h: Rewrote interface to match nettle conventions.
4233
4234         * camellia.c: Converted to nettle conventions.
4235         (camellia_encrypt128, camellia_encrypt256): Unified to new
4236         function...
4237         (camellia_encrypt): ...New function, with a loop doing 6
4238         regular rounds, one FL round and one FLINV round per iteration,
4239         with iteration count depending on the key size.
4240
4241         (camellia_decrypt128, camellia_decrypt256): Similarly unified
4242         as...
4243         (camellia_decrypt): ...New function, analogous to
4244         camellia_encrypt.
4245
4246 2010-07-06  Niels Möller  <nisse@lysator.liu.se>
4247
4248         * camellia.c, camellia.h: New files, copied from
4249         http://info.isl.ntt.co.jp/crypt/eng/camellia/dl/camellia-LGPL-1.2.0.tar.gz.
4250
4251         * testsuite/camellia-test.c: New file.
4252
4253 2010-07-05  Niels Möller  <nisse@lysator.liu.se>
4254
4255         * nettle.texinfo: Document new conventions for weak key and des
4256         parity checks. Document des_check_parity.
4257
4258         * testsuite/des-test.c (test_weak): Don't check the deleted status
4259         attribute.
4260
4261         * des-compat.c (des_key_sched): Rewrote error checking logic for
4262         the case of non-zero des_check_key.
4263
4264         * des3.c (des3_set_key): Changed weak key detection logic.
4265         Complete key setup also for weak keys, and don't set the status
4266         attribute.
4267
4268         * des.c (des_set_key): New iteration logic, to keep key pointer
4269         unchanged. Moved weak key check to the end, and don't set the
4270         status attribute.
4271         (des_encrypt): Ignore status attribute.
4272         (des_decrypt): Likewise.
4273
4274         * des.h (enum des_error): Deleted.
4275         (struct des_ctx): Deleted status attribute.
4276         (struct des3_ctx): Likewise.
4277
4278         * blowfish.c (initial_ctx): Deleted status value.
4279         (blowfish_encrypt): Ignore status attribute.
4280         (blowfish_decrypt): Likewise.
4281         (blowfish_set_key): Return result from weak key check, without
4282         setting the status attribute.
4283
4284         * blowfish.h (enum blowfish_error): Deleted.
4285         (struct blowfish_ctx): Deleted status attribute.
4286
4287         * Makefile.in (des_headers): Deleted parity.h.
4288
4289 2010-06-30  Niels Möller  <nisse@lysator.liu.se>
4290
4291         * testsuite/des-test.c (test_des): New function.
4292         (test_weak): New function.
4293         (test_main): Use test_des and test_weak. Added tests for all the
4294         weak keys. Added some tests with invalid (to be ignored) parity
4295         bits.
4296
4297         * des.c (parity_16): New smaller parity table.
4298         (des_check_parity): New function.
4299         (des_fix_parity): Use parity_16.
4300         (des_weak_p): New weak-key detection. Ignores parity bits, and
4301         uses a hash table.
4302         (des_set_key): Deleted parity checking code. Replaced old weak-key
4303         detection code by a call to des_weak_p.
4304
4305 2010-06-04  Niels Möller  <nisse@lysator.liu.se>
4306
4307         * testsuite/testutils.c (test_dsa_key): Updated for new name
4308         DSA_SHA1_MIN_P_BITS.
4309
4310         * dsa-keygen.c (dsa_generate_keypair): Use DSA_SHA1_MIN_P_BITS and
4311         DSA_SHA256_MIN_P_BITS.
4312
4313         * dsa.h (DSA_MIN_P_BITS, DSA_Q_OCTETS, DSA_Q_BITS): Renamed to...
4314         (DSA_SHA1_MIN_P_BITS, DSA_SHA1_Q_OCTETS, DSA_SHA1_Q_BITS): New
4315         names.
4316
4317         * sexp2dsa.c (dsa_keypair_from_sexp_alist): New argument q_bits.
4318         Renamed parameter limit to p_max_bits.
4319         (dsa_sha1_keypair_from_sexp): Renamed, was dsa_keypair_from_sexp.
4320         Updated to call dsa_keypair_from_sexp_alist with the new argument.
4321         (dsa_sha256_keypair_from_sexp): New function.
4322         (dsa_signature_from_sexp): New argument q_bits.
4323
4324         * der2dsa.c (dsa_params_from_der_iterator): Enforce 160-bit limit
4325         on q. Renamed parameter limit to p_max_bits.
4326         (dsa_openssl_private_key_from_der_iterator): Enforce 160-bit limit
4327         on q and x. Renamed parameter limit to p_max_bits.
4328
4329 2010-06-03  Niels Möller  <nisse@lysator.liu.se>
4330
4331         * testsuite/dsa-test.c (test_main): Added test for dsa-sha256.
4332
4333 2010-06-02  Niels Möller  <nisse@lysator.liu.se>
4334
4335         * testsuite/dsa-test.c (test_main): Provide expected value of the
4336         signature.
4337
4338         * testsuite/testutils.c (test_dsa160): Added argument for expected
4339         signature.
4340         (test_dsa256): Likewise.
4341
4342 2010-06-01  Niels Möller  <nisse@lysator.liu.se>
4343
4344         * testsuite/rsa-keygen-test.c (test_main): Updated expected
4345         signatures.
4346
4347         * examples/random-prime.c (main): Updated for nettle_random_prime
4348         change.
4349         * testsuite/random-prime-test.c (test_main): Likewise.
4350
4351         * rsa-keygen.c (bignum_random_prime): Deleted function.
4352         (rsa_generate_keypair): Use new nettle_random_prime. Generate
4353         secret factors p and q with the two most significant bits set.
4354
4355         * dsa-keygen.c (dsa_generate_keypair): Updated for changes in
4356         nettle_random_prime and _nettle_generate_pocklington_prime. Invoke
4357         progress callback.
4358
4359         * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4360         argument top_bits_set, to optionally generate primes with the two
4361         most significant bits set. Reordered argument list.
4362         (nettle_random_prime): Likewise, added top_bits_set argument.
4363         Invoke progress callback when a prime is generated.
4364
4365 2010-05-26  Niels Möller  <nisse@lysator.liu.se>
4366
4367         * dsa-keygen.c (dsa_generate_keypair): Use
4368         _nettle_generate_pocklington_prime. Deleted old key generation
4369         code.
4370
4371         * bignum-random-prime.c (_nettle_generate_pocklington_prime): Also
4372         return the used r. Updated caller.
4373
4374         * examples/random-prime.c (main): Allow sizes down to 3 bits.
4375
4376         * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4377         function. Rely on mpz_probab_prime_p (for lack of a trial division
4378         function) for trial division.
4379         (nettle_random_prime): Rewritten. Uses the prime table for the
4380         smallest sizes, then trial division using a new set of tables, and
4381         then Maurer's algorithm, calling the new
4382         _nettle_generate_pocklington_prime for the final search.
4383
4384 2010-05-25  Niels Möller  <nisse@lysator.liu.se>
4385
4386         * testsuite/dsa-test.c (test_main): Updated for dsa testing
4387         changes.
4388
4389         * testsuite/dsa-keygen-test.c (test_main): Test dsa256.
4390
4391         * testsuite/testutils.h (struct nettle_mac): New struct, currently
4392         unused.
4393
4394         * testsuite/testutils.c (test_mac): New function (currently not
4395         used).
4396         (test_dsa): Replaced by two new functions...
4397         (test_dsa160): New function.
4398         (test_dsa256): New function.
4399         (test_dsa_key): New argument q_size.
4400         (DSA_VERIFY): Generalized.
4401
4402         * dsa-keygen.c (dsa_generate_keypair): Rewritten, now generating
4403         primes using Pocklington's theorem. Takes both p_size and q_size
4404         as arguments.
4405
4406 2010-05-20  Niels Möller  <nisse@lysator.liu.se>
4407
4408         * bignum-random-prime.c (miller_rabin_pocklington): Fixed broken
4409         logic when Miller-rabin succeeds early.
4410
4411 2010-04-09  Niels Möller  <nisse@lysator.liu.se>
4412
4413         * bignum-next-prime.c: Include stdlib.h, needed for alloca on
4414         freebsd.
4415         * hmac.c: Likewise.
4416
4417         * examples/Makefile.in (SOURCES): Added random-prime.c.
4418
4419         * examples/random-prime.c: New program.
4420
4421         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Moved
4422         knuth-lfib-test.c, cbc-test.c, ctr-test.c, hmac-test.c here, from
4423         TS_HOGWEED_SOURCES.
4424         (TS_HOGWEED_SOURCES): Added random-prime-test.c.
4425
4426         * testsuite/random-prime-test.c: New test case.
4427
4428         * examples/next-prime.c (main): With no command line arguments.
4429         exit after dislaying usage message.
4430
4431         * examples/io.c (simple_random): Free buffer when done.
4432
4433         * configure.ac: Changed message, say CC is the recommended
4434         way to configure the ABI.
4435
4436         * bignum-random.c: Deleted test of HAVE_LIBGMP.
4437         * bignum.c: Likewise.
4438         * sexp2bignum.c: Likewise.
4439
4440         * Makefile.in (hogweed_SOURCES): Added bignum-random-prime.c.
4441
4442         * bignum-random-prime.c (nettle_random_prime): New file, new
4443         function.
4444
4445 2010-03-31  Niels Möller  <nisse@lysator.liu.se>
4446
4447         * examples/nettle-benchmark.c (main): Benchmark sha224.
4448
4449 2010-03-30  Niels Möller  <nisse@lysator.liu.se>
4450
4451         * testsuite/testutils.c (DSA_VERIFY): Updated for dsa_sha1_verify
4452         rename.
4453         (test_dsa): Check return value from dsa_sha1_sign.
4454
4455         * Makefile.in (hogweed_SOURCES): Added dsa-sha1-sign.c,
4456         dsa-sha1-verify.c, dsa-sha256-sign.c, and dsa-sha256-verify.c.
4457
4458         * dsa.h: Updated and added dsa declarations.
4459
4460         * dsa-sha256-verify.c (dsa_sha256_verify_digest): New file, new
4461         function.
4462         (dsa_sha256_verify): New function.
4463         * dsa-sha256-sign.c (dsa_sha256_sign_digest): New file, new
4464         function.
4465         (dsa_sha256_sign): New function.
4466
4467         * dsa-sha1-verify.c (dsa_sha1_verify_digest): New file. Moved and
4468         renamed function, from dsa_verify_digest, rewrote to use
4469         _dsa_verify.
4470         (dsa_sha1_verify): Analogous change, renamed from dsa_verify.
4471         * dsa-sha1-sign.c (dsa_sha1_sign_digest): New file. Moved and
4472         renamed function, from dsa_sign_digest, rewrote to use _dsa_sign,
4473         and added return value.
4474         (dsa_sha1_sign): Analogous change, renamed from dsa_sign.
4475
4476         * dsa-verify.c (_dsa_verify): New general verification function,
4477         for any hash.
4478         * dsa-sign.c (_dsa_sign): New general signing function, for any
4479         hash. Returns success code, like the rsa signture functions.
4480
4481 2010-03-29  Niels Möller  <nisse@lysator.liu.se>
4482
4483         * configure.ac (ABI): Attempt to use a better, ABI-dependant,
4484         default value for libdir.
4485
4486         * x86/md5-compress.asm: Fixed function name in epilogue.
4487
4488         * asm.m4 (EPILOGUE): Use . to refer to current address.
4489
4490         * configure.ac (ABI): Detect which ABI the compiler is using.
4491         On x86_64, also check for __arch64__.
4492
4493 2010-03-28  Niels Möller  <nisse@lysator.liu.se>
4494
4495         * configure.ac (asm_path): For x86_64, check if compiler is
4496         generating 32-bit code.
4497
4498 2010-03-27  Niels Möller  <nisse@lysator.liu.se>
4499
4500         * testsuite/hmac-test.c (test_main): Rewrote rest of tests to use
4501         HMAC_TEST, and added more tests from Daniel Kahn Gillmor and from
4502         RFC 4231.
4503
4504         * Makefile.in (nettle_SOURCES): Added hmac-sha224.c and
4505         hmac-sha384.c.
4506
4507         * hmac.h: Added declarations of hmac-sha224 and hmac-sha384.
4508
4509         * hmac-sha224.c: New file.
4510
4511 2010-03-26  Niels Möller  <nisse@lysator.liu.se>
4512
4513         * testsuite/hmac-test.c (HMAC_TEST): New macro.
4514         (test_main): Use HMAC_TEST for the md5 and sha1 tests, and add
4515         test vectors from Daniel Kahn Gillmor.
4516
4517         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha224-test.c.
4518
4519         * Makefile.in (nettle_SOURCES): Added sha224-meta.c and
4520         write-be32.c.
4521         (DISTFILES): Added nettle-write.h.
4522
4523         * sha.h: Added declarations for sha224. Some are aliases for the
4524         corresponding sha256 definition.
4525
4526         * sha256.c (sha256_digest): Use _nettle_write_be32.
4527         (sha224_init): New function.
4528         (sha224_digest): New function.
4529
4530         * sha1.c (sha1_digest): Use _nettle_write_be32.
4531
4532         * nettle-internal.h (NETTLE_MAX_HASH_BLOCK_SIZE)
4533         (NETTLE_MAX_HASH_DIGEST_SIZE): Increased, to take sha512 into
4534         account.
4535
4536         * nettle-write.h: New file.
4537
4538         * write-be32.c (_nettle_write_be32): New file, new function.
4539
4540         * sha224-meta.c: New file.
4541
4542 2010-03-25  Niels Möller  <nisse@lysator.liu.se>
4543
4544         * hmac-sha384.c: New file.
4545
4546         * testsuite/sha224-test.c: New file.
4547
4548         * testsuite/md4-test.c (test_main): More test vectors, provided by
4549         Daniel Kahn Gillmor.
4550         * testsuite/md5-test.c (test_main): Likewise.
4551         * testsuite/sha1-test.c (test_main): Likewise.
4552         * testsuite/sha256-test.c (test_main): Likewise.
4553         * testsuite/sha384-test.c (test_main): Likewise.
4554         * testsuite/sha512-test.c (test_main): Likewise.
4555
4556         * configure.ac: Bumped version numbers. Package version
4557         nettle-2.1, library versions libnettle.so.3.1, libhogweed.so.2.0.
4558
4559         * examples/nettle-benchmark.c (main): Benchmark sha384.
4560
4561         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha384-test.c.
4562
4563         * testsuite/sha384-test.c: New file.
4564
4565         * Makefile.in (nettle_SOURCES): Added sha384-meta.c.
4566
4567         * sha384-meta.c: New file.
4568
4569         * sha.h: Added declarations for sha384. Some are aliases for the
4570         corresponding sha512 definition.
4571
4572         * sha512.c (sha512_write_digest): New function.
4573         (sha512_digest): Use it.
4574         (sha384_init): New function.
4575         (sha384_digest): New function.
4576
4577 2010-03-24  Niels Möller  <nisse@lysator.liu.se>
4578
4579         * sha512.c: (sha512_digest): Simplified handling of any final
4580         partial word of the digest.
4581
4582         * sha512.c: Reorganized to use _nettle_sha512_compress.
4583
4584         * sha512-compress.c (_nettle_sha512_compress): Compression
4585         function extracted from sha512.c to a new file.
4586
4587         * Makefile.in (nettle_SOURCES): Added sha256-compress.c and
4588         sha512-compress.c.
4589
4590         * sha256.c: Reorganized to use _nettle_sha256_compress.
4591
4592         * sha256-compress.c (_nettle_sha256_compress): Compression
4593         function extracted from sha256.c to a new file.
4594
4595         * examples/nettle-benchmark.c (main): Benchmark sha512.
4596
4597         * rsa-keygen.c (rsa_generate_keypair): Ensure that bit size of e
4598         is less than bit size of n, and check for the unlikely case p = q.
4599
4600         * rsa.h (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Reduced, to
4601         correspond to pkcs#1 encryption of single byte messagees.
4602
4603         * pgp-encode.c (pgp_put_rsa_sha1_signature): Check return value
4604         from rsa_sha1_sign.
4605         * rsa-compat.c (R_SignFinal): Likewise.
4606
4607         * rsa-md5-sign.c (rsa_md5_sign): Check and propagate return value
4608         from pkcs1_rsa_md5_encode.
4609         (rsa_md5_sign_digest): Check and propagate return value from
4610         pkcs1_rsa_md5_encode_digest.
4611         * rsa-md5-verify.c (rsa_md5_verify): Check return value from
4612         pkcs1_rsa_md5_encode.
4613         (rsa_md5_verify_digest): Check return value from
4614         pkcs1_rsa_md5_encode_digest.
4615         * rsa-sha1-sign.c: Analogous changes.
4616         * rsa-sha1-verify.c: Analogous changes.
4617         * rsa-sha256-sign.c: Analogous changes.
4618         * rsa-sha256-verify.c: Analogous changes.
4619         * rsa-sha512-sign.c: Analogous changes.
4620         * rsa-sha512-verify.c: Analogous changes.
4621
4622         * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
4623         (pkcs1_rsa_md5_encode_digest): Added return value. Check and
4624         propagate return value from pkcs1_signature_prefix.
4625         * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
4626         (pkcs1_rsa_sha256_encode_digest): Likewise.
4627         * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
4628         (pkcs1_rsa_sha1_encode_digest): Likewise.
4629         * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
4630         (pkcs1_rsa_sha512_encode_digest): Likewise.
4631
4632         * pkcs1.c (pkcs1_signature_prefix): Interface change, take both
4633         the total size and digest size as arguments, and return a status
4634         code to say if the size was large enough.
4635
4636         * testsuite/Makefile.in: Added hogweed dependency for the test
4637         programs.
4638
4639 2010-03-23  Niels Möller  <nisse@lysator.liu.se>
4640
4641         * testsuite/rsa-test.c (test_main): Test signing with sha512.
4642
4643         * testsuite/testutils.c (test_rsa_sha512): New function.
4644
4645         * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-sha512.c,
4646         rsa-sha512-sign.c and rsa-sha512-verify.c.
4647
4648         * rsa.h: Added prototypes for sha512-related functions.
4649         (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased.
4650         * pkcs1.h: Added prototypes for sha512-related functions.
4651
4652         * rsa-sha512-verify.c: New file.
4653         * rsa-sha512-sign.c: New file.
4654         * pkcs1-rsa-sha512.c: New file.
4655
4656 2010-03-22  Niels Möller  <nisse@lysator.liu.se>
4657
4658         * Makefile.in (nettle_SOURCES): Added hmac-sha512.c.
4659
4660         * testsuite/hmac-test.c (test_main): Added test cases for
4661         hmac-sha512.
4662
4663         * hmac.h: Declare functions sha512-related functions.
4664         * hmac-sha512.c (hmac_sha512_set_key): New file.
4665
4666         Basic sha512 support.
4667         * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha512-test.c.
4668         * testsuite/sha512-test.c: New file.
4669
4670         * macros.h (READ_UINT64, WRITE_UINT64): New macros.
4671
4672         * Makefile.in (nettle_SOURCES): Added sha512.c and sha512-meta.c.
4673         * sha.h: Added sha512-related declarations.
4674         * nettle-meta.h: Likewise.
4675         * sha512-meta.c: New file.
4676         * sha512.c: New file.
4677
4678 2010-03-06  Niels Möller  <nisse@lysator.liu.se>
4679
4680         * Makefile.in (distdir): Include x86_64 assembler files.
4681
4682 2010-01-20  Niels Möller  <nisse@lysator.liu.se>
4683
4684         * configure.ac: Check for mpz_powm_sec.
4685
4686 2010-01-13  Niels Möller  <nisse@lysator.liu.se>
4687
4688         * Makefile.in ($(LIBHOGWEED_FORLINK)): Depend on
4689         $(LIBNETTLE_FORLINK).
4690
4691         * configure.ac (LIBHOGWEED_LIBS): Added -lnettle -lgmp for the
4692         default case. Follows debian, and also makes dlopen of
4693         libhogweed.so work, without having to use RTLD_GLOBAL.
4694         (LIBHOGWEED_LINK): Added -L., to find our libnettle.so.
4695
4696 2009-10-21  Niels Möller  <nisse@lysator.liu.se>
4697
4698         * tools/Makefile.in (pkcs1-conv$(EXEEXT)): Added dependency on
4699         ../libhogweed.a.
4700
4701 2009-10-19  Niels Möller  <nisse@lysator.liu.se>
4702
4703         * tools/pkcs1-conv.c: Updated for dsa/der interface change.
4704
4705         * der2dsa.c (dsa_public_key_from_der_iterators): Split into two
4706         new functions...
4707         (dsa_params_from_der_iterator): New function.
4708         (dsa_public_key_from_der_iterator): New function.
4709         (dsa_openssl_private_key_from_der_iterator): Renamed, was
4710         dsa_private_key_from_der_iterator.
4711         (dsa_openssl_private_key_from_der): Likewise.
4712         * dsa.h: Corresponding changees to prototypes and #defines.
4713
4714 2009-10-12  Niels Möller  <nisse@lysator.liu.se>
4715
4716         * sexp-format.c: Removed conditioning on HAVE_LIBGMP.
4717
4718         * tools/pkcs1-conv.c: Support for DSA keys, contributed by Magnus
4719         Holmgren.
4720
4721         * Makefile.in (hogweed_SOURCES): Added dsa2sexp.c and der2dsa.c.
4722
4723         * der2dsa.c: New file, contributed by Magnus Holmgren.
4724         * dsa2sexp.c: Likewise.
4725         * dsa.h: Added prototypes.
4726
4727         * configure.ac (LIBHOGWEED_MINOR): Bumped libhogweed minor
4728         version, now it's 1.1.
4729
4730         * testsuite/rsa2sexp-test.c (test_main): Updated testcase for
4731         "rsa-pkcs1".
4732
4733 2009-10-11  Niels Möller  <nisse@lysator.liu.se>
4734
4735         * rsa2sexp.c (rsa_keypair_to_sexp): Changed default algorithm name
4736         to "rsa-pkcs1".
4737
4738 2009-09-20  Niels Möller  <nisse@lysator.liu.se>
4739
4740         * x86/sha1-compress.asm: Improved performance by 17% on AMD K7,
4741         by letting loopmix scramble the instruction order.
4742
4743 2009-09-15  Niels Möller  <nisse@lysator.liu.se>
4744
4745         * x86/sha1-compress.asm: Cleanup, removing old cruft. Slight
4746         improvement to ROUND_F1_NOEXP. Slight reduction of
4747         dependency-chains.
4748
4749 2009-08-25  Niels Möller  <nisse@lysator.liu.se>
4750
4751         * x86/sha1-compress.asm: Eliminated tmp variable for f3 rounds.
4752
4753         * examples/nettle-benchmark.c (bench_sha1_compress): New function,
4754         for precise benchmarking of the compression function.
4755
4756 2009-06-08  Niels Möller  <nisse@lysator.liu.se>
4757
4758         * Released nettle-2.0.
4759
4760 2009-06-04  Niels Möller  <nisse@lysator.liu.se>
4761
4762         * configure.ac: Set version to 2.0
4763
4764 2009-05-30  Niels Möller  <nisse@lysator.liu.se>
4765
4766         * Makefile.in (.texinfo.info): Don't use a temporary output file
4767         $@T, trust makeinfo to remove output file on errors.
4768
4769 2009-05-19  Niels Möller  <nisse@lysator.liu.se>
4770
4771         * nettle.texinfo: Changed license to public domain.
4772
4773 2009-05-11  Niels Möller  <nisse@lysator.liu.se>
4774
4775         * nettle.texinfo: Fixes from Karl Berry. Added some more index
4776         terms.
4777
4778 2009-03-06  Niels Möller  <nisse@lysator.liu.se>
4779
4780         * x86_64/aes-encrypt-internal.asm: Reduced unrolling. Keep state
4781         in %eax--%edx only.
4782         * x86_64/aes-decrypt-internal.asm: Likewise.
4783
4784         * x86_64/aes.m4 (MOVE_HREG): Deleted, no longer needed.
4785         (AES_STORE): Reduced offsets.
4786         (AES_ROUND): Use HREG directly, not MOVE_HREG.
4787
4788         * x86_64/aes-decrypt-internal.asm: Rearrange register allocation.
4789         Put SA--SD in %eax--%edx, so the second byte can be accessed as
4790         %ah-%dh. TD is not needed, SD can be reused. Use the register that
4791         is saved for the outer loop counter, getting it off the stack.
4792         * x86_64/aes-encrypt-internal.asm: Likewise.
4793
4794         * x86_64/aes.m4 (HREG, MOVE_HREG): New macros.
4795         (XREG): Fixed bug in handling of %r8 and %r9.
4796         (AES_ROUND): Use MOVE_HREG.
4797
4798 2009-02-10  Niels Möller  <nisse@lysator.liu.se>
4799
4800         * base16-meta.c (base16_encode_update_wrapper): Mark ctx argument
4801         as UNUSED.
4802
4803         * testsuite/sexp-conv-test: Updated testcases for improved
4804         handling of comments.
4805
4806         * tools/sexp-conv.c (sexp_convert_item): Use sexp_put_soft_newline
4807         to terminate comments, and modify indentation for the case that a
4808         list starts with a comment.
4809
4810         * tools/output.c (sexp_output_init): Initialize soft_newline.
4811         (sexp_put_raw_char): Clear soft_newline.
4812         (sexp_put_newline): Check and reset soft_newline.
4813         (sexp_put_soft_newline): New function.
4814
4815         * tools/output.h (struct sexp_output): Removed union with single
4816         element, and updated all users. New attribute soft_newline.
4817
4818 2008-12-22  Niels Möller  <nisse@lysator.liu.se>
4819
4820         * Makefile.in ($(des_headers)): Create files in $(srcdir).
4821
4822 2008-11-28  Niels Möller  <nisse@lysator.liu.se>
4823
4824         * testsuite/cxx-test.cxx: Include <cstdio>.
4825
4826 2008-11-22  Niels Möller  <nisse@lysator.liu.se>
4827
4828         * yarrow256.c (yarrow256_fast_reseed): Set ctx->seeded = 1, so
4829         that it is set if and only if the aes context has been initialized
4830         with aes_set_encrypt_key.
4831         (yarrow256_seed): No need to set ctx->seeded here.
4832         (yarrow256_update): Likewise.
4833
4834 2008-11-04  Niels Möller  <nisse@lysator.liu.se>
4835
4836         * examples/next-prime.c (main): Avoid using gmp_fprintf, to stay
4837         compatible with gmp-3.1.
4838
4839 2008-11-01  Niels Möller  <nisse@lysator.liu.se>
4840
4841         * nettle.texinfo: Updated for 2.0. New section on linking.
4842
4843         * nettle-types.h, nettle-meta.h: Moved all typedefs for function
4844         types to nettle-types.h. Use non-pointer types, so that the types
4845         can be used to declare functions. Updated all users.
4846
4847 2008-10-31  Niels Möller  <nisse@lysator.liu.se>
4848
4849         * testsuite/yarrow-test.c (test_main): Updated for seed file
4850         changes.
4851
4852         * sha-example.c (display_hex): Use %02x, not %2x.
4853
4854 2008-10-30  Niels Möller  <nisse@lysator.liu.se>
4855
4856         * tools/sexp-conv.c (main): Fixed file locking.
4857
4858 2008-10-25  Niels Möller  <nisse@lysator.liu.se>
4859
4860         * configure.ac: Set version to 2.0rc1.
4861
4862         * examples/Makefile.in (next-prime$(EXEEXT)): Added -lnettle to
4863         linker.
4864
4865 2008-10-24  Niels Möller  <nisse@lysator.liu.se>
4866
4867         * sha256.c (ROUND): Simplified macro.
4868
4869         * yarrow256.c (yarrow256_fast_reseed): Renamed (was
4870         yarrow_fast_reseed) and made non-static. Don't generate seed file
4871         here, let the application use yarrow256_random instead.
4872         (yarrow256_slow_reseed): Renamed (was yarrow_slow_reseed) and made
4873         non-static.
4874         (yarrow256_force_reseed): Deleted function, use
4875         yarrow256_slow_reseed instead. For backwards compatibility,
4876         yarrow.h defines yarrow256_force_reseed as an alias for that
4877         function.
4878
4879         * yarrow.h (struct yarrow256_ctx): Deleted seed_file buffer.
4880
4881 2008-09-17  Niels Möller  <nisse@lysator.liu.se>
4882
4883         * x86/arcfour-crypt.asm: Improved loop logic, and unrolled
4884         loop twice. Gave a modest speedup.
4885
4886 2008-09-15  Niels Möller  <nisse@lysator.liu.se>
4887
4888         * yarrow256.c (yarrow256_seed): Disallow length == 0.
4889
4890         * base64-decode.c (decode_table): Added vertical tab (VT) and form
4891         feed (FF) as white space characters.
4892
4893         * x86_64/aes-decrypt-internal.asm: New file.
4894
4895 2008-09-13  Niels Möller  <nisse@lysator.liu.se>
4896
4897         * x86/aes-encrypt-internal.asm: Replaced pushl and popl in the
4898         loop with movl. Eliminated redundant movl.
4899         * x86/aes-decrypt-internal.asm: Likewise.
4900
4901         * x86_64/aes.m4: New file.
4902
4903         * x86/aes-encrypt-internal.asm: Updated for AES_FINAL_ROUND. Only
4904         three times through the substitution loop.
4905         * x86/aes-decrypt-internal.asm: Likewise.
4906         * x86_64/aes-encrypt-internal.asm: Likewise.
4907
4908         * x86/aes.m4 (AES_FINAL_ROUND): Do the substitution on the least
4909         significant byte here.
4910
4911         * x86/aes-encrypt-internal.asm: Updated use of AES_SUBST_BYTE. USe
4912         decl for outer loop.
4913         * x86/aes-decrypt-internal.asm: Likewise.
4914
4915         * x86/aes.m4 (LREG, HREG): New macros.
4916         (AES_SUBST_BYTE): Take state registers as argument. Use LREG to
4917         get the corresponding byte register.
4918         (AES_ROUND): Use movzbl together with LREG and HREG.
4919         (AES_SUBST_BYTE): Likewise.
4920
4921 2008-09-10  Niels Möller  <nisse@lysator.liu.se>
4922
4923         * x86_64/sha1-compress.asm: Avoid using registers %rbx and %rbp,
4924         which must be preserved.
4925
4926 2008-09-08  Niels Möller  <nisse@lysator.liu.se>
4927
4928         * Makefile.in (stamp-h.in): Use $(AUTOHEADER).
4929
4930         * x86_64/sha1-compress.asm: New x86_64 assembler, based on the x86
4931         version.
4932
4933         * configure.ac (asm_path): Set up asm_path for x86_64.
4934
4935         * x86_64/machine.m4: New file, new directory.
4936
4937 2008-08-28  Niels Möller  <nisse@lysator.liu.se>
4938
4939         * examples/eratosthenes.c (main): Rewrote block-wise sieving to
4940         use less memory. New options -s and -v.
4941
4942 2008-08-27  Niels Möller  <nisse@lysator.liu.se>
4943
4944         * testsuite/sexp-conv-test (print_raw, print_nl): Use printf.
4945         Updated testcases with comments; comments are now preserved.
4946
4947         * tools/sexp-conv.c (sexp_convert_item): Keep comments in advanced
4948         output.
4949         (parse_options): New --lock option.
4950         (main): Optionally lock output file.
4951
4952         * tools/parse.c (sexp_check_token): Removed check for "any" token.
4953         All callers specify the token they expect.
4954         (sexp_parse): Pass on comment tokens.
4955
4956         * tools/output.c (sexp_put_data): Made non-static.
4957
4958         * tools/input.c (sexp_get_comment): New function.
4959         (sexp_get_token): Use sexp_get_comment.
4960
4961         * tools/misc.h (enum sexp_token): Start enumeration with zero, zero
4962         is no longer used to mean any type. New type SEXP_COMMENT.
4963
4964         * configure.ac: Check for fcntl file locking.
4965
4966 2008-08-26  Niels Möller  <nisse@lysator.liu.se>
4967
4968         * Makefile.in (tags-here): Put TAGS file in the source directory.
4969         * examples/Makefile.in (tags): Likewise.
4970         * testsuite/Makefile.in (tags): Likewise.
4971         * tools/Makefile.in (tags): Likewise.
4972
4973 2008-02-29  Niels Möller  <nisse@lysator.liu.se>
4974
4975         * examples/Makefile.in (SOURCES): Added next-prime.c.
4976
4977 2008-01-05  Niels Möller  <nisse@lysator.liu.se>
4978
4979         * examples/Makefile.in (TARGETS): Added eratosthenes and next-prime.
4980         (next-prime, eratosthenes): New rules.
4981         (nettle-benchmark): Don't rely on $@.
4982
4983         * examples/eratosthenes.c (find_first_one): Optimized, using
4984         slightly larger table.
4985         (main): Use atol, rather than atoi.
4986
4987         * testsuite/symbols-test: Check symbols also in libhogweed.
4988
4989         * examples/next-prime.c: New file.
4990         Deleted code for detailed timing.
4991
4992         * Makefile.in (hogweed_SOURCES): Added bignum-next-prime.c.
4993         (DISTFILES): Added prime-list.h.
4994         (hogweed_OBJS): Removed $(LIBOBJS).
4995
4996         * bignum-next-prime.c (nettle_next_prime): Renamed function, for
4997         name space reasons. Was bignum_next_prime. Updated call in
4998         rsa-keygen.c.
4999         (primes): Use prime-list.h.
5000         (nettle_next_prime): Skip Fermat test. Use mpz_millerrabin
5001         directly, rather than mpz_probab_prime_p, when the former is
5002         available.
5003
5004         * bignum.h (nettle_next_prime): New prototype.
5005
5006         * rsa-keygen.c (bignum_next_prime): Deleted, moved to
5007         bignum-next-prime.c. Call with a larger prime limit, this improves
5008         the running time of lsh-keygen by roughly 25%.
5009
5010         * prime-list.h: List of odd primes < 2^16.
5011
5012         * configure.ac: Check for sizeof(long).
5013
5014 2008-01-03  Niels Möller  <nisse@lysator.liu.se>
5015
5016         * examples/nettle-benchmark.c (main): Removed incorrect UNUSED
5017         from declaration.
5018
5019         * bignum-next-prime.c: Moved the bignum_next_prime function to a
5020         separate file.
5021
5022 2007-09-08  Niels Möller  <nisse@lysator.liu.se>
5023
5024         * sparc64/aes-encrypt-internal.asm: The directory with the aes.m4
5025         include file was renamed from "sparc" to "sparc32". Updated include.
5026         * sparc64/aes-decrypt-internal.asm: Likewise.
5027         * sparc32/aes-encrypt-internal.asm: Likewise.
5028         * sparc32/aes-decrypt-internal.asm: Likewise.
5029
5030 2007-09-07  Niels Möller  <nisse@lysator.liu.se>
5031
5032         * examples/read_rsa_key.c: Include stdlib.h.
5033
5034 2007-06-02  Niels Möller  <nisse@lysator.liu.se>
5035
5036         * Makefile.in: Typo fixes to install targets, spotted by Magnus
5037         Holmgren.
5038
5039 2007-05-14  Niels Möller  <niels@s3.kth.se>
5040
5041         * configure.ac: Fixed copy-and-paste errors in shared library
5042         name setup.
5043
5044         * config.make.in (LIBNETTLE_SONAME, LIBHOGWEED_SONAME): Define.
5045
5046         * Makefile.in (libnettle.so, libhogweed.so): Fixed rules.
5047
5048         * Makefile.in: Split nettle library into two files, libnettle.a
5049         and libhogweed.a, and similarly for the shared libraries.
5050
5051         * configure.ac: Bumped nettle so-versions to 3.0. Set hogweed
5052         so-versions to 1.0. New makefile conditionals IF_SHARED and
5053         IF_HOGWEED. Renamed WITH_PUBLIC_KEY to WITH_HOGWEED. Deleted
5054         SHLIBTARGET, SHLIBINSTALL, RSA_EXAMPLES and RSA_TOOLS.
5055
5056         * config.make.in: Updated for hogweed split.
5057
5058         * C source files: Don't use WITH_PUBLIC_KEY / WITH_HOGWEED, the
5059         Makefile sorts out which files should be compiled.
5060
5061         * pgp.h: Include bignum.h, don't pretend to work without bignums.
5062
5063         * pgp-encode.c (pgp_put_mpi, pgp_put_public_rsa_key)
5064         (pgp_put_rsa_sha1_signature): Define unconditionally. Removed the
5065         checking of HAVE_LIBGMP and WITH_PUBLIC_KEY.
5066
5067         * examples/io.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5068         * examples/io.c (read_rsa_key): Deleted, moved to...
5069         * examples/read_rsa_key.c: New file, extracted from io.c.
5070
5071         * examples/Makefile.in: Use IF_HOGWEED instead of RSA_EXAMPLES.
5072         Link appropriate programs with -lhogweed.
5073         (SOURCES): Added read_rsa_key.c.
5074
5075         * tools/Makefile.in (pkcs1-conv): Use IF_HOGWEED, not @RSA_TOOLS@,
5076         for configuration. Link with -lhogweed.
5077
5078         * testsuite/testutils.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5079         * testsuite/testutils.c: Likewise.
5080
5081         * testsuite/Makefile.in (TS_NETTLE_SOURCES, TS_HOGWEED_SOURCES):
5082         Separate test cases using nettle and those also using hogweed.
5083
5084 2007-04-05  Niels Möller  <nisse@lysator.liu.se>
5085
5086         * Moved in CVS tree. Also renamed directory sparc to sparc32.
5087
5088 2007-02-24  Niels Möller  <nisse@lysator.liu.se>
5089
5090         * Makefile.in (clean-here): Remove .lib directory.
5091         (distclean-here): Remove machine.m4.
5092
5093 2006-12-05  Niels Möller  <nisse@lysator.liu.se>
5094
5095         * configure.ac: AC_PREREQ 2.61, for AC_PROG_MKDIR_P.
5096
5097         * config.make.in (datarootdir): New directory variable (for
5098         autoconf-2.61).
5099
5100 2006-11-28  Niels Möller  <nisse@lysator.liu.se>
5101
5102         * configure.ac: Bumped version to 1.16.
5103
5104         * Released nettle-1.15.
5105
5106 2006-11-27  Niels Möller  <nisse@lysator.liu.se>
5107
5108         * NEWS: New entry for nettle-1.15.
5109
5110         * configure.ac (SHLIBMINOR): Bumped version. Library name is now
5111         libnettle.so.2.6.
5112
5113         * sha256.c: Changed copyright notice to use the LGPL.
5114
5115         * Makefile.in (DISTFILES): Added COPYING.LIB.
5116
5117         * COPYING.LIB: New file (previously only the plain GPL was
5118         included in the distribution).
5119
5120         * nettle.texinfo: Updated vor nettle-1.15.
5121
5122         * testsuite/rsa-test.c (test_main): Use test_rsa_sha256.
5123         * testsuite/testutils.c (test_rsa_sha256): New function.
5124
5125         * testsuite/Makefile.in (DISTFILES): Replaces rfc1750.txt by
5126         gold-bug.txt.
5127
5128         * rsa.h (rsa_sha256_sign, rsa_sha256_verify)
5129         (rsa_sha256_sign_digest, rsa_sha256_verify_digest): New declarations.
5130         (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased to
5131         62 octets and  489 bits, respectively, for supporting sha256.
5132
5133         * pkcs1.h (pkcs1_rsa_sha256_encode)
5134         (pkcs1_rsa_sha256_encode_digest): New declarations and name
5135         mangling symbols.
5136
5137         * Makefile.in (nettle_SOURCES): Added pkcs1-rsa-sha256.c,
5138         rsa-sha256-sign.c, rsa-sha256-verify.c.
5139
5140         * pkcs1-rsa-sha256.c, rsa-sha256-sign.c, rsa-sha256-verify.c: New
5141         files.
5142
5143         * COPYING, INSTALL, install-sh, texinfo.tex: Updated files, from
5144         automake-1.10.
5145
5146 2006-11-27  Niels Möller  <niels@s3.kth.se>
5147
5148         * tools/Makefile.in (install): Use MKDIR_P to create installation
5149         directory. Install only one file at a time.
5150
5151         * Makefile.in (MKDIR_P): Use MKDIR_P for creating installation
5152         directories.
5153
5154         * configure.ac: Use AC_PROG_MKDIR_P.
5155
5156 2006-11-24  Niels Möller  <nisse@lysator.liu.se>
5157
5158         * testsuite/yarrow-test.c (test_main): Use gold-bug.txt as input
5159         file, instead of rfc1750.txt.
5160
5161         * testsuite/gold-bug.txt: New test input file for yarrow-test.
5162         The copyright on this short story by Edgar Allan Poe has expired.
5163
5164         * testsuite/rfc1750.txt: Deleted file. Debian considers RFC:s
5165         non-free, and it was expired anyway. Replaced by gold-bug.txt.
5166
5167 2006-11-24  Niels Möller  <niels@s3.kth.se>
5168
5169         * Almost all header files: Added C++ guards.
5170
5171         * configure.ac: Test if the system has any C++ compiler.
5172
5173         * config.make.in (CXX, CXXFLAGS, COMPILE_CXX, LINK_CXX): New variables.
5174
5175         * testsuite/Makefile.in: New variables TS_C and TS_CXX. Setup for
5176         compiling the C++ file cxx-test.cxx.
5177
5178         * testsuite/cxx-test.cxx: New testcase, trying to use nettle from
5179         a C++ program.
5180
5181 2006-08-28  Niels Möller  <niels@s3.kth.se>
5182
5183         * index.html: Added section on language bindings.
5184
5185 2006-06-10  Niels Möller  <niels@s3.kth.se>
5186
5187         * configure.ac: Darwin shared library support, from Grant
5188         Robinsson.
5189
5190 2006-05-18  Niels Möller  <nisse@lysator.liu.se>
5191
5192         * src/nettle/x86/aes.asm: Deleted unused file.
5193
5194         * aes-decrypt.c (_aes_decrypt_table): Deleted the indexing array,
5195         previously commented out.
5196         * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5197
5198         * Makefile.in (.texinfo.info, .dvi.ps): Use more quotes with
5199         basename.
5200         (install-here, install-shared, install-info, install-headers): Use
5201         plain mkdir, not $(INSTALL) -d.
5202
5203 2006-05-16  Niels Möller  <niels@s3.kth.se>
5204         Merged from the lsh experimental branch.
5205
5206 2006-04-26  Niels Möller  <nisse@lysator.liu.se>
5207
5208         * examples/rsa-decrypt.c: Don't include "getopt.h", since it's not used.
5209         * examples/nettle-benchmark.c: Include "getopt.h".
5210
5211         * examples/Makefile.in (GETOPT_OBJS): New variable.
5212         (rsa-keygen, rsa-encrypt, nettle-benchmark): Depend on and link
5213         with $(GETOPT_OBJS).
5214
5215         * x86/aes-decrypt-internal.asm: Use ALIGN.
5216         * x86/aes-encrypt-internal.asm: Likewise.
5217         * x86/arcfour-crypt.asm: Likewise.
5218         * x86/md5-compress.asm: Likewise.
5219         * x86/sha1-compress.asm: Likewise.
5220
5221         * config.m4.in (ASM_ALIGN_LOG): Substitute.
5222         * configure.ac (ASM_ALIGN_LOG): Check if .align directive is
5223         logarithmic.
5224         * asm.m4 (ALIGN): New macro. Takes a logarithmic argument, and
5225         expands to a .align directive.
5226
5227 2006-04-21  Niels Möller  <nisse@lysator.liu.se>
5228
5229         * nettle.texinfo (Public-key algorithms): Say that the public key
5230         operations are undocumented, not unsupported. Reported by Jeronimo
5231         Pellegrini.
5232
5233 2006-04-08  Niels Möller  <nisse@lysator.liu.se>
5234
5235         * tools/pkcs1-conv.c (read_pem): Fixed c99-style declaration.
5236         Reported by Henrik Grubbström.
5237
5238 2006-01-31  Niels Möller  <niels@s3.kth.se>
5239
5240         * examples/rsa-verify.c: Fixed typo in usage message.
5241
5242 2005-12-05  Niels Möller  <nisse@lysator.liu.se>
5243
5244         * configure.ac: Bumped version to 1.15,
5245
5246         * Released nettle-1.14.
5247
5248         * NEWS: Updated for 1.14.
5249
5250         * configure.ac (SHLIBMINOR): Increased minor number. Library
5251         version is now libnettle.so.2.5, soname still libnettle.so.2.
5252
5253 2005-11-28  Niels Möller  <nisse@lysator.liu.se>
5254
5255         * config.make.in (INSTALL): Don't substitute INSTALL, INSTALL_DATA
5256         and friends here, to get a correct a relative filename for
5257         install-sh when used in tools/Makefile.
5258
5259         * tools/Makefile.in (INSTALL): Substitute INSTALL, INSTALL_DATA
5260         and friends here.
5261         * Makefile.in (INSTALL): Likewise.
5262
5263 2005-11-27  Niels Möller  <nisse@lysator.liu.se>
5264
5265         * Makefile.in (.texinfo.pdf): New rule. Avoid dependency on
5266         intermediate .dvi and .ps files.
5267
5268         * testsuite/Makefile.in (clean): Delete sha1-huge-test.
5269
5270         * Makefile.in (install-info, install-headers): Don't use $< and
5271         $?; Solaris make doesn't support them in explicit rules.
5272
5273 2005-11-26  Niels Möller  <nisse@lysator.liu.se>
5274
5275         * testsuite/Makefile.in: Include .test-rules.make, which contains
5276         the rules for all the test executables.
5277         (test-rules): New rule, to update this file.
5278         (DISTFILES): Added $(EXTRA_SOURCES).
5279
5280         * testsuite/.test-rules.make: Automatically generated file for
5281         building the test programs.
5282
5283 2005-11-25  Niels Möller  <nisse@lysator.liu.se>
5284
5285         * configure.ac: Disable assembler when compiling with rntcl.
5286
5287         * tools/Makefile.in (pkcs1_conv_SOURCES): New variable.
5288         (pkcs1-conv): Link with getopt.o and getopt1.o.
5289
5290         * Makefile.in (aesdata, desdata, shadata): Use explicit rules for
5291         executables.
5292
5293         * testsuite/Makefile.in: Use %-rules for building the -test
5294         executables, in addition to the suffix rules. Hopefully, this
5295         should make all of GNU make, BSD make and Solaris make happy.
5296         Use $(EXEEXT) and $(OBJEXT) more consistently.
5297
5298         * examples/Makefile.in: Use explicit rules for all executable
5299         targets. Use $(EXEEXT) and $(OBJEXT) more consistently.
5300
5301 2005-11-25  Niels Möller  <niels@s3.kth.se>
5302
5303         * testsuite/Makefile.in: Avoid using single-suffix rule to build
5304         executables.
5305
5306 2005-11-24  Niels Möller  <niels@s3.kth.se>
5307
5308         * Makefile.in (distdir): Use [ -f, not [ -e, since the latter
5309         is less portable, and not supported by Solaris /bin/sh.
5310
5311 2005-11-23  Niels Möller  <niels@s3.kth.se>
5312
5313         * testsuite/Makefile.in (DISTFILES): Added teardown-env.
5314         * testsuite/teardown-env: New file. Delete files created by the
5315         testsuite.
5316
5317 2005-11-21  Niels Möller  <nisse@lysator.liu.se>
5318
5319         * testsuite/testutils.c (main): Fixed check for -v option. Spotted
5320         by Goran K.
5321
5322 2005-11-21  Niels Möller  <niels@s3.kth.se>
5323
5324         * ctr.h (CTR_CTX, CTR_CRYPT): Fixed bugs, spotted by Goran K.
5325
5326 2005-11-20  Niels Möller  <nisse@lysator.liu.se>
5327
5328         * Makefile.in (nettle_SOURCES): Added der2rsa.c.
5329
5330         * testsuite/Makefile.in (TS_SH): Added pkcs1-conv-test.
5331
5332         * tools/Makefile.in (TARGETS): Added @RSA_TOOLS@.
5333         (SOURCES): Added pkcs1-conv.c.
5334         (pkcs1-conv): New rule.
5335
5336         * tools/pkcs1-conv.c: New program.
5337
5338         * testsuite/pkcs1-conv-test: New file.
5339
5340         * examples/rsa-verify-test: Use rsa-sign to create signature.
5341
5342         * examples/io.c (read_file): Fixed spelling in error message.
5343
5344         * rsa.h (rsa_public_key_from_der_iterator)
5345         (rsa_private_key_from_der_iterator, rsa_keypair_from_der): Declare
5346         functions.
5347
5348         * der2rsa.c: New file.
5349
5350         * der-iterator.c (asn1_der_iterator_init): Initialize length and
5351         data.
5352         (asn1_der_iterator_next): Support for lengths >= 0x80.
5353         (asn1_der_decode_constructed_last, asn1_der_decode_bitstring)
5354         (asn1_der_decode_bitstring_last): New functions.
5355         (asn1_der_get_bignum): Check for non-mininal encodings.
5356
5357         * configure.ac (RSA_TOOLS): New substituted variable. Includes
5358         pkcs1-conv, when public-key support is enabled.
5359
5360         * bignum.h (nettle_asn1_der_get_bignum): Include nettle_-prefix in
5361         declaration.
5362
5363         * asn1.h: Added name mangling defines, and a few new declarations.
5364
5365 2005-11-13  Niels Möller  <nisse@lysator.liu.se>
5366
5367         * Makefile.in (nettle_SOURCES): Added der-iterator.c.
5368         (HEADERS): Added asn1.h.
5369
5370         * bignum.h (asn1_der_get_bignum): Declare function.
5371
5372         * der-iterator.c: New file.
5373         * asn1.h: New file.
5374
5375 2005-11-07  Niels Möller  <nisse@lysator.liu.se>
5376
5377         * examples/nettle-benchmark.c: Check HAVE_UNISTD_H.
5378
5379         * examples/Makefile.in (TARGETS): Use $(EXEEXT).
5380         * tools/Makefile.in (TARGETS, sexp-conv, nettle-lfib-stream): Likewise.
5381
5382         * configure.ac: Use $host_cpu, not $host, when setting up the
5383         assembler path. Use $host_os, not uname, when setting up shared
5384         library flags.
5385
5386         * Makefile.in (des.$(OBJEXT)): Use OBJEXT.
5387
5388         * config.guess, config.sub: In the CVS tree, moved files to the
5389         lsh top-level directory.
5390
5391 2005-10-23  Niels Möller  <nisse@lysator.liu.se>
5392
5393         * sparc64/arcfour-crypt.asm: New file, almost the same as
5394         sparc/arcfour-crypt.asm.
5395
5396         * examples/nettle-benchmark.c (display): Use two decimal places.
5397
5398         * sparc/arcfour-crypt.asm: Reorganized. Main loop unrolled four
5399         times. Uses aligned 32-bit write accesses at DST. Still uses 8-bit
5400         read accesses at SRC; could be improved int he case that SRC and
5401         DST have compatible alignment.
5402
5403 2005-10-19  Niels Möller  <niels@s3.kth.se>
5404
5405         * testsuite/arcfour-test.c (test_main): New testcase with 512
5406         bytes of data.
5407
5408 2005-10-19  Niels Möller  <nisse@lysator.liu.se>
5409
5410         * sparc/arcfour-crypt.asm: Fixed bug, spotted by Mikael Kalms. We
5411         must order the store at [CTX+I] before the load of [CTX+SI+SJ].
5412
5413 2005-10-18  Niels Möller  <nisse@lysator.liu.se>
5414
5415         * sparc/arcfour-crypt.asm: Special unrolled code if SRC and DST
5416         have compatible alignment. Improves performance by 20%, but I'm
5417         not sure it's worth the extra complexity.
5418
5419         * bignum.c (nettle_mpz_from_octets): Removed sign argument. If
5420         mpz_import is available, define nettle_mpz_from_octets as a macro
5421         calling mpz_import.
5422         (nettle_mpz_from_octets): Start by setting x to zero; callers no
5423         longer need to do that.
5424         (nettle_mpz_set_str_256_s): New logic for the handling of negative
5425         numbers. Convert in the same way as for positive numbers, and then
5426         subtract the appropriate power of two.
5427
5428 2005-10-17  Niels Möller  <nisse@lysator.liu.se>
5429
5430         * bignum.c (nettle_mpz_from_octets): Improved loop. Removed the
5431         digit temporary (suggested by Torbjörn Granlund).
5432
5433         * sparc/arcfour-crypt.asm: Improved instruction scheduling.
5434
5435         * sparc/arcfour-crypt.asm: Bugfix, use lduh and stuh.
5436
5437         * sparc/arcfour-crypt.asm: New file.
5438
5439         * sparc64/aes.asm: Deleted unused file.
5440
5441         * x86/arcfour-crypt.asm: Use ARCFOUR_I and ARCFOUR_J
5442         * asm.m4 (ARCFOUR): New struct.
5443
5444 2005-10-17  Niels Möller  <niels@s3.kth.se>
5445
5446         * aes-internal.h (struct aes_table): Deleted idx and sparc_idx
5447         arrays.
5448         * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5449         * aes-decrypt.c (_aes_decrypt_table): Likewise.
5450         * asm.m4 (AES): Likewise
5451
5452 2005-10-16  Niels Möller  <nisse@lysator.liu.se>
5453
5454         * tools/input.c (sexp_get_char): Use unsigned for the done flag.
5455
5456         * sparc64/aes-encrypt-internal.asm: Include sparc/aes.m4.
5457         * sparc64/aes-decrypt-internal.asm: Likewise.
5458
5459         * sparc64/machine.m4: Use .register pseudo op to say that we use
5460         %g2 and %g3 as scratch registers.
5461
5462         * sparc/aes-encrypt-internal.asm: Explicitly include sparc/aes.m4.
5463         * sparc/aes-decrypt-internal.asm: Likewise.
5464
5465         * sparc/aes.m4: New file. Moved aes-related macros here...
5466         * sparc/machine.m4: ... removed aes macros.
5467
5468         * x86/aes-encrypt-internal.asm: Explicitly include x86/aes.m4.
5469         * x86/aes-decrypt-internal.asm: Likewise.
5470
5471         * x86/aes.m4: New file. Moved aes-related macros here, from...
5472         * x86/machine.m4: ... removed aes macros.
5473
5474         * sparc64/aes-encrypt-internal.asm: New file.
5475         * sparc64/aes-decrypt-internal.asm: New file.
5476
5477         * sparc64/machine.m4: Include the same aes macros used for
5478         sparc32.
5479         (BIAS): Define magic stack bias constant.
5480
5481         * sparc/aes-encrypt-internal.asm, sparc/aes-decrypt-internal.asm:
5482         Reduced frame size to 104 bytes, since we no longer need wtxt and
5483         tmp on the stack.
5484
5485         * sparc/aes.asm: Deleted old aes implementation.
5486
5487         * sparc/aes-decrypt-internal.asm: New file.
5488
5489         * sparc/machine.m4: Don't use m4 eval, instead rely on the
5490         assembler's arithmetic.
5491
5492         * sparc/machine.m4 (AES_FINAL_ROUND): Better scheduling, by
5493         interleaving independent operations.
5494
5495         * sparc/machine.m4 (TMP3): A third temporary register.
5496         (AES_FINAL_ROUND): Prepared for scheduling.
5497
5498         * sparc/machine.m4 (AES_ROUND): Deleted unused argument T. Updated
5499         all calls in aes-encrypt-internal.asm.
5500
5501         * sparc/machine.m4 (AES_ROUND): New loop invariants T0-T3, to
5502         avoid the additions of the AES_TABLEx constants in the inner loop.
5503
5504         * sparc/machine.m4 (AES_ROUND): Better scheduling, by
5505         interleaving independent operations.
5506
5507         * sparc/machine.m4 (AES_ROUND): Alternate between using TMP1 and
5508         TMP2, to prepare for scheduling.
5509
5510         * sparc/aes-encrypt-internal.asm: Renamed Ti -> Xi.
5511
5512         * sparc/aes-encrypt-internal.asm: Fixed bugs. Now passes the
5513         testsuite.
5514
5515         * sparc/machine.m4 (AES_ROUND, AES_FINAL_ROUND): Bugfixes. Put
5516         NOPs in the load dely slots.
5517
5518         * sparc/aes-encrypt-internal.asm: Implemented. Not yet working,
5519         and not optimized.
5520
5521         * sparc/machine.m4: Use TMP1 and TMP2, so we don't need to pass
5522         them as arguments.
5523         (AES_FINAL_ROUND): New macro.
5524
5525 2005-10-15  Niels Möller  <nisse@lysator.liu.se>
5526
5527         * configure.ac (OBJDUMP): Substitute the program false if objdump
5528         is not found.
5529
5530         * asm.m4 (PROLOGUE): Use TYPE_FUNCTION.
5531
5532         * config.m4.in: Substitute ASM_TYPE_FUNCTION as TYPE_FUNCTION.
5533
5534         * configure.ac (ASM_ELF_STYLE): Check for %function and #function,
5535         but not for @function.
5536         (ASM_TYPE_FUNCTION): New substituted variable.
5537
5538         * configure.ac (ASM_ELF_STYLE): Fixed .type foo,@function statement
5539         used when checking for pseudo operations.
5540
5541         * sparc/machine.m4 (AES_LOAD, AES_ROUND): Started writing new AES
5542         macros.
5543
5544         * sparc/aes-encrypt-internal.asm: New file.
5545
5546 2005-10-14  Niels Möller  <nisse@lysator.liu.se>
5547
5548         * x86/aes-decrypt.asm, x86/aes-encrypt.asm: Deleted files.
5549
5550         * x86/aes-decrypt-internal.asm: New file.
5551
5552         * x86/machine.m4: Changed AES macros, to handle a table register.
5553         Also take more of the used registers as argument.
5554
5555         * x86/aes-encrypt-internal.asm: Rewritten to match new interface,
5556         with the table pointer as an argument. Unlike the old code, this
5557         should really be position independent.
5558
5559         * configure.ac: When looking for assembler files, link in
5560         aes-encrypt-internal.asm and aes-decrypt-internal.asm. Don't look
5561         for aes.asm, aes-encrypt.asm and aes-decrypt.asm.
5562
5563         * configure.ac (OBJDUMP): Use AC_CHECK_TOOL to check for objdump.
5564         (ASM_MARK_NOEXEC_STACK): Use $OBJDUMP when examining the object file.
5565
5566         * Makefile.in (nettle_SOURCES): Removed aes.c,
5567         aes-decrypt-table.c. Added aes-decrypt-internal.c and aes-encrypt-internal.c.
5568
5569         * aes.c, aes-decrypt-table.c: Deleted files.
5570
5571         * aes-decrypt.c (_aes_decrypt_table): Moved table here, and made
5572         static.
5573
5574         * aes-internal.h (_aes_decrypt_table): Don't declare, it's no
5575         longer globally visible.
5576
5577         * aes-decrypt-internal.c (_nettle_aes_decrypt): New AES decryption
5578         function, analogous to _nettle_aes_encrypt.
5579
5580 2005-10-14  Niels Möller  <niels@s3.kth.se>
5581
5582         * aes-internal.h (AES_ROUND, AES_FINAL_ROUND): New macros.
5583
5584         * aes-encrypt-internal.c (_nettle_aes_encrypt): New AES encryption
5585         function, avoiding the table-based indexing.
5586
5587         * sha1-compress.c: Added debugging code.
5588         * md5-compress.c: Likewise.
5589
5590 2005-10-13  Niels Möller  <niels@s3.kth.se>
5591
5592         * config.m4.in (ASM_MARK_NOEXEC_STACK): Use a diversion, to
5593         substitute the value of ASM_MARK_NOEXEC_STACK at the end of each
5594         assembler file.
5595
5596         * configure.ac (ASM_MARK_NOEXEC_STACK): Check if the C compiler
5597         generates a .note.GNU-stack section. If so, we should do the same
5598         in our assembler files.
5599
5600         * sparc64/aes.asm: New file. Copy of sparc/aes.asm, with minor
5601         changes to the stack frame layout. Patch contributed by Henrik
5602         Grubbström. Not yet tested.
5603
5604         * x86/md5-compress.asm: Skip copying of input to the stack, and
5605         don't allocate space for it.
5606         (F1): Fixed bug.
5607
5608         * testsuite/md5-test.c: Document intermediate values for first
5609         test case.
5610
5611         * configure.ac (asm_path): Check for sparc64, and use sparc64
5612         subdirectory. Link in md5-compress.asm, if it exists.
5613
5614 2005-10-13  Niels Möller  <nisse@lysator.liu.se>
5615
5616         * x86/md5-compress.asm (REF): Fixed calculation of offset.
5617
5618 2005-10-12  Niels Möller  <nisse@lysator.liu.se>
5619
5620         * x86/machine.m4 (OFFSET): Moved macro, used to be in...
5621         * x86/sha1-compress.asm (OFFSET): ... removed macro.
5622
5623         * x86/md5-compress.asm: New file, with first attempt at md5
5624         assembler. Not yet working.
5625
5626 2005-10-11  Niels Möller  <nisse@lysator.liu.se>
5627
5628         * Makefile.in (nettle_SOURCES): Added md5-compress.c.
5629
5630         * md5.c: Reorganized to use _nettle_md5_compress, in analogy with
5631         sha1.c.
5632
5633         * md5-compress.c (_nettle_md5_compress): New file and new function.
5634
5635 2005-10-10  Niels Möller  <niels@s3.kth.se>
5636
5637         * testsuite/Makefile.in (EXTRA_SOURCES, EXTRA_TARGETS): New
5638         variables, for test cases that are not run by default.
5639
5640         * testsuite/sha1-huge-test.c (test_main): New test case, with a
5641         very large sha1 input.
5642
5643         * testsuite/testutils.c (test_hash_large): New function.
5644
5645         * sha1.c (sha1_block): Deleted function; inlined where used.
5646         (SHA1_INCR): New macro for incrementing the block count.
5647
5648 2005-10-06  Niels Möller  <nisse@lysator.liu.se>
5649
5650         * configure.ac: Bumped version to 1.14.
5651
5652         * Released nettle-1.13.
5653
5654         * configure.ac: Check for openssl/aes.h.
5655
5656         * Makefile.in (distdir): Use a loop to pick up the contents of
5657         $(DISTFILES) from source and build directories. For some reason,
5658         $? failed to find stamp-h.in in the source directory.
5659
5660 2005-10-05  Niels Möller  <nisse@lysator.liu.se>
5661
5662         * x86/aes-decrypt.asm: Use C_NAME(_nettle_aes_decrypt_table) when
5663         using the AES_SUBST_BYTE macro. Use PROLOGUE and EPILOGUE.
5664         * x86/sha1-compress.asm: Use PROLOGUE and EPILOGUE.
5665         * x86/arcfour-crypt.asm: Likewise.
5666         * x86/aes-encrypt.asm: Likewise.
5667
5668         * config.m4.in (ELF_STYLE): Substitute configure's ASM_ELF_STYLE.
5669
5670         * asm.m4 (PROLOGUE, EPILOGUE): New macros, checking the value of
5671         ELF_STYLE. So far, used and tested only for the x86 assembler
5672         files, and needed to make the assembler happy both with ELF
5673         (linux, solaris) and COFF (windows).
5674
5675         * configure.ac (NM): Use AC_CHECK_TOOL to check for nm.
5676         (ASM_SYMBOL_PREFIX): Use $NM when examining the object file.
5677         (ASM_ELF_STYLE): New variable. Set to 'yes' if assembling a file
5678         with ELF-style .type and .size pseudo ops works.
5679
5680         * Makefile.in (TARGETS, DISTFILES): Added nettle.pdf.
5681         (.texinfo.dvi, .dvi.ps, .ps.pdf): New targets, to build nettle.pdf.
5682         (DOCTARGETS): New variable with targets that shouldn't be deleted
5683         by make clean.
5684         (maintainer-clean-here): New target. Deletes generated
5685         documentation files.
5686
5687         * nettle.texinfo: Define AUTHOR with accents, when running in TeX
5688         mode, which doesn't handle latin-1 properly. Set UPDATED-FOR to
5689         1.13. Updated copyright years, and introduced a COPYRIGHT-YEARS
5690         symbol. Updated copyright section, to mention assembler
5691         implementations.
5692         (Cipher modes): Transformed the Cipher Block Chaining to a section
5693         Cipher modes, describing both CBC and the new CTR mode.
5694
5695         * src/nettle/x86/aes_tables.asm: Deleted unused file.
5696
5697         * x86/aes.asm: Deleted contents. This file is needed just to
5698         override aes.c, which isn't needed for the x86 implementation.
5699
5700         * configure.ac (SHLIBMINOR): Increased minor number. Library
5701         version is now libnettle.so.2.4, soname still libnettle.so.2.
5702
5703         * examples/nettle-benchmark.c (main): Reordered hash benchmarks.
5704
5705         * x86/sha1-compress.asm (EXPAND): Use % 16 instead of & 15 to
5706         compute offsets mod 16, since m4 on FreeBSD 49.RELEASE and NetBSD
5707         doesn't implement & correctly in eval.
5708
5709 2005-10-03  Niels Möller  <nisse@lysator.liu.se>
5710
5711         * x86/sha1-compress.asm (OFFSET): New macro.
5712         (F3): Eliminated a movl.
5713         (ROUND): New argument, for k. When using F3, it's TMP3, on the
5714         stack, otherwise, it is kept in TMP2, a register.
5715
5716 2005-10-03  Niels Möller  <niels@s3.kth.se>
5717
5718         * examples/nettle-openssl.c: Use correct block sizes for openssl
5719         ciphers.
5720
5721         * examples/nettle-benchmark.c: Also display cycles per block.
5722
5723 2005-10-02  Niels Möller  <nisse@lysator.liu.se>
5724
5725         * sha1-compress.c (_nettle_sha1_compress): Updated to new
5726         interface. Now responsible for byte conversion.
5727
5728         * x86/sha1-compress.asm (_nettle_sha1_compress): Do byte order
5729         conversion, and store the input data on the stack. This leaves one
5730         more register free for other uses.
5731
5732         * examples/nettle-benchmark.c: Now display cycles/byte, if the -f
5733         option is used to say what the clock frequency is.
5734
5735         * sha1.c (sha1_block): Don't convert data from uint8_t to
5736         uint32_t, that's now the responsibility of _nettle_sha1_compress.
5737
5738         * sha.h (_nettle_sha1_compress): Changed interface. Second
5739         argument is now a pointer to the input data in unaligned,
5740         big-endian form.
5741
5742 2005-09-28  Niels Möller  <niels@s3.kth.se>
5743
5744         * sha1.c (sha1_final): Call sha1_block, don't call the compression
5745         function _nettle_sha1_compress directly.
5746
5747         * nettle-internal.h (nettle_openssl_md5)
5748         (nettle_openssl_sha1): Declare.
5749
5750         * examples/nettle-benchmark.c (main): Benchmark openssl md5 and
5751         sha1.
5752
5753         * examples/nettle-openssl.c (nettle_openssl_md5)
5754         (nettle_openssl_sha1): Added glue for openssl hash functions.
5755
5756         * nettle-internal.h (nettle_openssl_aes128, nettle_openssl_aes192)
5757         (nettle_openssl_aes256, nettle_openssl_arcfour128): Declare.
5758
5759         * examples/nettle-benchmark.c: Check WITH_OPENSSL, not
5760         HAVE_LIBCRYPTO. Benchmark openssl's aes and arcfour code.
5761
5762         * examples/nettle-openssl.c: Updated openssl des glue to use the
5763         new openssl des interface. Added glue for arcfour and aes.
5764
5765 2005-09-27  Niels Möller  <nisse@lysator.liu.se>
5766
5767         * nettle.texinfo (RSA): Improved text about the RSA patent.
5768         Use @documentencoding ISO-8859-1.
5769
5770 2005-09-07  Niels Möller  <niels@s3.kth.se>
5771
5772         * tools/sexp-conv.c (parse_options): New option --raw-hash, for
5773         compatibility with lsh-1.x. Equivalent to --hash.
5774
5775 2005-09-06  Niels Möller  <niels@s3.kth.se>
5776
5777         * tools/sexp-conv.c (main): With --hash, output a newline after
5778         each hash.
5779
5780 2005-07-02  Niels Möller  <nisse@lysator.liu.se>
5781
5782         * testsuite/Makefile.in (TS_SOURCES): Added ctr-test.c.
5783
5784         * testsuite/testutils.c (test_cipher_ctr): New function.
5785
5786         * testsuite/ctr-test.c: New file.
5787
5788         * testsuite/cbc-test.c (test_main): Use static const for msg.
5789
5790         * Makefile.in (nettle_SOURCES): Added ctr.c.
5791         (HEADERS): Added ctr.h.
5792         (HEADERS): Added nettle-types.h.
5793         (INSTALL_HEADERS): Install nettle-stdint.h.
5794         (distclean-here): Delete nettle-stdint.h, not nettle-types.h.
5795
5796         * ctr.c (ctr_crypt): New file, new function.
5797
5798         * memxor.c (memxor3): New function, suggested by Adam Langley.
5799
5800         * nettle-internal.h (NETTLE_MAX_CIPHER_BLOCK_SIZE): New constant.
5801
5802         * nettle.texinfo (Cipher functions): Fixed typo in prototype for
5803         arctwo_encrypt (noticed by Adam Langley).
5804
5805         * nettle-meta.h: No longer needs to include cbc.h.
5806
5807         * cbc.h (nettle_crypt_func): Moved typedef to nettle-types.h.
5808         (CBC_ENCRYPT, CBC_DECRYPT): Deleted older #if:ed out versions.
5809
5810         * configure.ac (AX_CREATE_STDINT_H): Use the file name
5811         nettle-stdint.h, not nettle-types.h.
5812
5813         * nettle-types.h: New file. Automatically generated declarations
5814         are now in nettle-stdint.h.
5815
5816 2005-03-17  Niels Möller  <niels@s3.kth.se>
5817
5818         * config.guess: Support Solaris on x86_64. Fix by Henrik
5819         Grubbström.
5820
5821 2005-01-03  Niels Möller  <niels@s3.kth.se>
5822
5823         * examples/io.h: Include RSA declarations only when public key
5824         algorithms are enabled. Problem reported by Meilof Veeningen
5825         <meilof@gmail.com>.
5826
5827 2004-12-07  Niels Möller  <nisse@lysator.liu.se>
5828
5829         * Makefile.in: Install directories, using $(INSTALL) -d, only if
5830         they don't exist already.
5831
5832 2004-12-05  Niels Möller  <nisse@lysator.liu.se>
5833
5834         * config.make.in (.PRECIOUS): Reverted earlier change. We need
5835         .PRECIOUS to stop GNU make from deleting object files for the test
5836         programs.
5837
5838 2004-12-02  Niels Möller  <nisse@lysator.liu.se>
5839
5840         * Makefile.in (.SUFFIXES): Moved from Makefile.in to...
5841         * config.make.in (.SUFFIXES): ... here. This helps compilation
5842         with BSD make.
5843         * testsuite/Makefile.in (.SUFFIXES): Deleted target.
5844
5845         * config.make.in (.c): Disable default rule for BSD-make.
5846
5847         * Makefile.in (all check install uninstall)
5848         (clean distclean mostlyclean maintainer-clean): Don't use the -C
5849         flag when invoking make, for compatibility with Solaris make.
5850
5851 2004-12-02  Niels Möller  <niels@s3.kth.se>
5852
5853         * Makefile.in (aesdata, desdata): Commented out the explicit
5854         targets.
5855         (shadata): Avoid using $< in non-pattern rule.
5856
5857 2004-12-01  Niels Möller  <nisse@lysator.liu.se>
5858
5859         * config.make.in: Added a default target.
5860
5861 2004-11-29  Niels Möller  <nisse@lysator.liu.se>
5862
5863         * testsuite/Makefile.in: Use .$(OBJEXT). Explicitly set .SUFFIXES.
5864
5865         * Makefile.in: Use .$(OBJEXT).
5866
5867 2004-11-28  Niels Möller  <nisse@lysator.liu.se>
5868
5869         * tools/Makefile.in (nettle-lfib-stream): Avoid using $< in
5870         non-suffix rule.
5871
5872         * Makefile.in (distdir): Handle absolute $distdir.
5873         Avoid using the GNU extension $^.
5874
5875         * examples/Makefile.in: Avoid using the GNU extension $^.
5876         * tools/Makefile.in: Likewise.
5877         * testsuite/Makefile.in: Likewise.
5878
5879 2004-11-24  Niels Möller  <niels@s3.kth.se>
5880
5881         * configure.ac: Fixed typo, preventing the creation of dependency
5882         files.
5883
5884 2004-11-23  Niels Möller  <nisse@lysator.liu.se>
5885
5886         * Makefile.in: Use DEP_INCLUDE.
5887         * tools/Makefile.in: Likewise.
5888         * testsuite/Makefile.in: Likewise.
5889         * examples/Makefile.in: Likewise.
5890
5891         * configure.ac (dummy-dep-files): Generate only of dependency
5892         tracking is enabled.
5893
5894 2004-11-18  Niels Möller  <nisse@lysator.liu.se>
5895
5896         * Makefile.in (clean-here): The clean target should not delete the
5897         dependency files. Moved to the distclean target.
5898         * examples/Makefile.in: Likewise.
5899         * testsuite/Makefile.in: Likewise.
5900         * tools/Makefile.in: Likewise.
5901
5902         * configure.ac (ASM_SYMBOL_PREFIX): Fixed test.
5903         (dummy-dep-files): Added quotes to sed command.
5904
5905 2004-11-17  Niels Möller  <nisse@lysator.liu.se>
5906
5907         * testsuite/symbols-test: Try plain nm if nm -g doesn't work.
5908
5909         * x86/sha1-compress.asm: Use C_NAME for global symbols.
5910         * x86/aes-encrypt.asm: Likewise.
5911         * x86/aes-decrypt.asm: Likewise.
5912         * x86/arcfour-crypt.asm: Likewise.
5913
5914         * Makefile.in (config.m4): New rule.
5915
5916         * config.m4.in (C_NAME): New macro.
5917
5918         * configure.ac (ASM_SYMBOL_PREFIX): Check if global symbols have a
5919         leading underscore.
5920
5921 2004-11-16  Niels Möller  <nisse@lysator.liu.se>
5922
5923         * Deleted getopt.c, getopt.h and getopt1.c from the CVS tree. Link
5924         them from shared copies in lsh/misc instead.
5925
5926 2004-11-14  Niels Möller  <nisse@lysator.liu.se>
5927
5928         * Makefile.in (DEP_FILES): Try include with only one macro
5929         argument to be expanted.
5930
5931         * configure.ac (dummy-dep-files): Create dummy dependency files,
5932         so that they can be included by the makefiles.
5933
5934 2004-11-13  Niels Möller  <nisse@lysator.liu.se>
5935
5936         * Makefile.in: Don't use -include, as it's GNU make specific.
5937         * examples/Makefile.in, tools/Makefile.in, testsuite/Makefile.in:
5938         Likewise.
5939
5940         * examples/nettle-openssl.c: Check WITH_OPENSSL, not HAVE_LIBCRYPTO.
5941
5942         * configure.ac: Check for individual openssl headers blowfish.h,
5943         cast.h, des.h. Renamed symbol HAVE_LIBCRYPTO to WITH_OPENSSL. New
5944         configure option --disable-openssl.
5945
5946 2004-11-04  Niels Möller  <nisse@lysator.liu.se>
5947
5948         * configure.ac: Bumped version to 1.13.
5949
5950         * Released nettle-1.12.
5951
5952 2004-11-04  Niels Möller  <niels@s3.kth.se>
5953
5954         * nettle.texinfo (UPDATED-FOR): Bumped to 1.12.
5955
5956 2004-11-02  Niels Möller  <nisse@lysator.liu.se>
5957
5958         * nettle.texinfo (Cipher functions): Updated AES documentation,
5959         for aes_set_encrypt_key and aes_set_decrypt_key.
5960         (UPDATED-FOR): Set to 1.11. I think the manual should be updated
5961         with all user-visible changes.
5962
5963         * aclocal.m4 (LSH_DEPENDENCY_TRACKING): Need extra quoting in case
5964         pattern. (This file really lives in the lsh tree, as
5965         lsh/acinclude.m4. For a complete ChangeLog, see lsh/Changelog).
5966
5967 2004-10-26  Niels Möller  <nisse@lysator.liu.se>
5968
5969         * configure.ac: Bumped version to 1.12.
5970
5971         * Released nettle-1.11.
5972
5973         * Makefile.in (clean-here): Delete *.s files.
5974         (PRE_CPPFLAGS): Use this variable, not INCLUDES. Removed
5975         -I$(srcdir).
5976
5977         * x86/arcfour-crypt.asm: Use movzbl when extending %cl to 32 bits.
5978
5979 2004-10-24  Niels Möller  <nisse@lysator.liu.se>
5980
5981         * x86/arcfour-crypt.asm: Reverted the latest two changes; update
5982         bost src and dst pointers in the loop, and use plain addb when
5983         updating j. These two previous changes slowed the code down on AMD
5984         Duron.
5985
5986 2004-10-21  Niels Möller  <nisse@lysator.liu.se>
5987
5988         * Makefile.in (install-shared): Use $(INSTALL_PROGRAM).
5989
5990         * configure.ac (SHLIBMINOR): Updated, shared library version is
5991         now libnettle.so.2.3, soname still libnettle.so.2.
5992
5993         * Makefile.in (DISTFILES): Added asm.m4.
5994
5995 2004-10-21  Niels Möller  <niels@s3.kth.se>
5996
5997         * examples/Makefile.in: Deleted all configure-related rules,
5998         except the one rebuilding this Makefile. One should run make at
5999         top level if other configure related files change.
6000         * tools/Makefile.in: Likewise.
6001         * testsuite/Makefile.in: Likewise.
6002
6003         * configure.ac: Replaced AC_OUTPUT(list...) with an AC_OUTPUT
6004         without arguments, and AC_CONFIG_FILES listing the files.
6005
6006         * Makefile.in: Changed the assembler rules as suffix rules.
6007         Rewrote the configure-related rules, mostly based on the example
6008         in the autoconf manual.
6009
6010 2004-10-20  Niels Möller  <nisse@lysator.liu.se>
6011
6012         * examples/nettle-openssl.c (NCOMPAT): Disable openssl backwards
6013         compatibility.
6014
6015         * config.make.in: Insert $(PRE_CPPFLAGS) and $(PRE_LDFLAGS) before
6016         $(CPPFLAGS) and $(LDFLAGS). This mechanism replaces $(INCLUDES).
6017
6018         * examples/Makefile.in (PRE_CPPFLAGS, PRE_LDFLAGS): Use these
6019         flags to get -I.. and -L.. early on the command line.
6020         * testsuite/Makefile.in: Likewise
6021         * tools/Makefile.in: Likewise.
6022
6023 2004-10-20  Niels Möller  <niels@s3.kth.se>
6024
6025         * Makefile.in: In the assembler rules, there's no need to look in
6026         $(srcdir) for the input file.
6027
6028         * x86/arcfour-crypt.asm: Reduced inner loop by one instruction, by
6029         precomputing the offset between src and dst.
6030
6031         * tools/Makefile.in (.c.$(OBJEXT)): Removed redundant -I.. flag.
6032
6033         * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replaced addb ->
6034         addl + andl $0xff, improving speed on PPro by another 15%.
6035
6036 2004-10-20  Niels Möller  <nisse@lysator.liu.se>
6037
6038         * tools/Makefile.in (install): Support DESTDIR.
6039         (uninstall): New target.
6040
6041         * testsuite/Makefile.in (uninstall): New dummy target.
6042
6043         * config.sub: Copied from automake-1.8.5.
6044
6045         * examples/Makefile.in (SOURCES): Added rsa-sign.c and rsa-verify.c.
6046         (DISTFILES): Added getopt.h.
6047         (install uninstall): New dummy targets.
6048
6049         * config.make.in (.PHONY): Added more targets.
6050
6051         * Makefile.in (.texinfo.info, .texinfo.html): New targets. Added
6052         support for uninstall and DESTDIR. Various fixes to install and
6053         distcheck.
6054
6055         * examples/Makefile.in (INCLUDES): Added -I flags.
6056         (distdir): Use $^ to refer to the files.
6057         (distclean): New target.
6058         * testsuite/Makefile.in: Likewise.
6059         * tools/Makefile.in: Likewise.
6060
6061         * Makefile.in (INCLUDES): Need -I flags for VPATH build.
6062         (clean distclean mostlyclean maintainer-clean): Clean
6063         subdirectories first.
6064         (DISTFILES): Added a bunch of files.
6065         (des_headers): Added desCore rules.
6066         (install-here): Split off target install-headers, which uses $^ to
6067         refer to the files.
6068         (distdir): Use $^ to refer to the files.
6069         distcheck): Fixes.
6070
6071         * config.make.in (COMPILE): Add $(INCLUDE) to the line.
6072
6073 2004-10-19  Niels Möller  <nisse@lysator.liu.se>
6074
6075         Stop using automake. Replaced each Makefile.am with a hand-written
6076         Makefile.in.
6077         * configure.ac: New output variable CCPIC_MAYBE. New output file
6078         config.make. Replaced automake constructions.
6079         * .bootstrap: Don't run aclocal and automake.
6080         * config.make.in: New file, with shared Makefile variables and rules.
6081
6082 2004-10-18  Niels Möller  <nisse@lysator.liu.se>
6083
6084         * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replace incb ->
6085         incl + andl, to improve speed on PPro and PII. Suggested by
6086         Fredrik Olsson.
6087
6088 2004-10-08  Niels Möller  <niels@s3.kth.se>
6089
6090         * examples/rsa-encrypt-test: Avoid reading and executing a file at
6091         the same time.
6092         * examples/setup-env: Likewise.
6093
6094 2004-10-06  Niels Möller  <niels@s3.kth.se>
6095
6096         * testsuite/symbols-test: Ignore __i686.get_pc_thunk.bx and
6097         similar symbols.
6098
6099 2004-10-05  Niels Möller  <nisse@lysator.liu.se>
6100
6101         * twofish.c (q_table): Use a const pointer array.
6102
6103         * sexp2dsa.c (dsa_keypair_from_sexp_alist): Use a const pointer
6104         array for the keywords.
6105         (dsa_signature_from_sexp): Likewise.
6106         * sexp2rsa.c (rsa_keypair_from_sexp_alist): Likewise.
6107         (rsa_keypair_from_sexp): Likewise.
6108
6109         * sexp.c (sexp_iterator_check_types): Use an argument of type
6110         "const uint8_t * const *" for the types list.
6111         (sexp_iterator_assoc): Likewise, for the keys list.
6112
6113         * list-obj-sizes.awk: Fixes to handle multiple .data and .rodata
6114         sections. Also fixed to handle the last file correctly.
6115
6116 2004-09-23  Niels Möller  <nisse@lysator.liu.se>
6117
6118         * configure.ac (SHLIBLINK, SHLIBLIBS): On cygwin, linking needs
6119         -Wl,--whole-archive $(OBJECTS) -Wl,--no-whole-archive $(LIBS).
6120
6121 2004-09-22  Niels Möller  <niels@s3.kth.se>
6122
6123         * configure.ac: Setup SHLIBFORLINK and friends for cygwin.
6124
6125         * list-obj-sizes.awk: Strip *_a-prefix from all file names.
6126
6127         * Makefile.am (libnettle_a_SOURCES): List only .c files. Headers
6128         moved to noinst_HEADERS.
6129         (SHLIBOBJECTS): Substitute from libnettle_a_SOURCES, not
6130         am_libnettle_a_OBJECTS, since the latter includes
6131         libnettle_a-prefixes with some automake versions.
6132         (SHLIBSONAME): Check if this name is empty, which is the case on
6133         cygwin, before using it.
6134
6135 2004-08-31  Niels Möller  <nisse@lysator.liu.se>
6136
6137         * configure.ac: New command line option --disable-pic. Use
6138         LSH_CCPIC.
6139
6140         * Makefile.am (libnettle_a_CFLAGS): Added $(CCPIC), to attempt to
6141         build also the static library as position independent code.
6142
6143 2004-08-24  Niels Möller  <nisse@lysator.liu.se>
6144
6145         * des-compat.c (des_cbc_cksum): Pad input with NUL's, if it's not
6146         an integral number of blocks.
6147
6148 2004-08-24  Niels Möller  <niels@s3.kth.se>
6149
6150         * testsuite/arctwo-test.c, arctwo.h, arctwo.c
6151         (arctwo_set_key_ekb): Fixed typo; it should be "ekb", not "ebk".
6152
6153         Integrated arctwo patch from Simon Josefsson.
6154         * testsuite/Makefile.am (noinst_PROGRAMS): Added arctwo-test.
6155
6156         * Makefile.am (libnettleinclude_HEADERS): Added arctwo.h.
6157         (libnettle_a_SOURCES): Added arctwo.c, arctwo.h and arctwo-meta.c.
6158
6159         * nettle-meta.h (nettle_arctwo40, nettle_arctwo64)
6160         (nettle_arctwo64, nettle_arctwo_gutmann128): Declare ciphers.
6161
6162         * arctwo-meta.c, arctwo.c, arctwo.h, testsuite/arctwo-test.c: New
6163         files.
6164
6165         * macros.h (LE_READ_UINT16, LE_WRITE_UINT16): New macros.
6166
6167 2004-08-23  Niels Möller  <nisse@lysator.liu.se>
6168
6169         * testsuite/md5-test.c (test_main): Added collision, found in 2004.
6170         (test_main): Added second collision.
6171
6172 2004-08-23  Niels Möller  <niels@s3.kth.se>
6173
6174         * testsuite/md5-test.c (test_main): Added first half of a
6175         collision test case.
6176
6177         * des-compat.c (des_cbc_cksum): Changed input argument to be of
6178         type const uint8_t * (was const des_cblock *).
6179
6180         * des-compat.h (const_des_cblock): New bogus type. Disabled use of
6181         const, for compatibility with openssl.
6182
6183 2004-06-08  Niels Möller  <niels@s3.kth.se>
6184
6185         * aesdata.c: Renamed log and ilog to gf2_log and gf2_exp.
6186
6187 2004-04-07  Niels Möller  <nisse@lysator.liu.se>
6188
6189         * aes-set-encrypt-key.c (log, ilog): Deleted unused tables.
6190
6191         * aes-set-decrypt-key.c (gf2_log, gf2_exp, mult): Renamed tables,
6192         were log and ilog.
6193
6194 2004-03-20  Niels Möller  <nisse@lysator.liu.se>
6195
6196         * configure.ac: Use AC_CONFIG_AUX_DIR([.]).
6197
6198 2004-03-18  Niels Möller  <niels@s3.kth.se>
6199
6200         * examples/io.c (read_file): Display a message if fopen fails.
6201
6202 2004-03-05  Niels Möller  <nisse@lysator.liu.se>
6203
6204         * Released nettle-1.10.
6205
6206         * configure.ac (SHLIBMINOR): Shared library version is now 2.2.
6207
6208 2004-03-04  Niels Möller  <nisse@lysator.liu.se>
6209
6210         * testsuite/symbols-test: Pass -g flag to nm.
6211
6212 2004-03-02  Niels Möller  <nisse@lysator.liu.se>
6213
6214         * configure.ac: Fixed EXEEXT workaround.
6215
6216 2004-03-02  Niels Möller  <niels@s3.kth.se>
6217
6218         * configure.ac: Added workaround to get the correct $(EXEEXT)=''
6219         when compiling with rntcl.
6220
6221 2004-03-02  Niels Möller  <nisse@lysator.liu.se>
6222
6223         * testsuite/Makefile.am (noinst_PROGRAMS): Put test program list
6224         here, to let automake add $(EXEEXT).
6225
6226         * configure.ac (RSA_EXAMPLES): Append $(EXEEXT) to the filenames.
6227
6228 2004-03-01  Niels Möller  <nisse@lysator.liu.se>
6229
6230         * examples/rsa-keygen.c, examples/rsa-encrypt.c,
6231         examples/rsa-decrypt.c: Include "getopt.h" instead of <unistd.h>.
6232
6233         * examples/Makefile.am (rsa_encrypt_SOURCES, rsa_decrypt_SOURCES)
6234         (rsa_keygen_SOURCES): Added getopt.h, getopt.c and getopt1.c.
6235
6236         * examples/getopt.h, examples/getopt.c, examples/getopt1.c: New
6237         files.
6238
6239         * testsuite/des-compat-test.c: Don't include <unistd.h>.
6240
6241         * testsuite/testutils.c (main): Don't use getopt. Then we don't
6242         need to include <unistd.h>.
6243
6244 2004-03-01  Niels Möller  <niels@s3.kth.se>
6245
6246         * config.guess: Copied from automake-1.8.2. Hacked to recognize
6247         Windows_NT (and Windows_95 and Windows_98) running on "x86" and
6248         "686".
6249
6250         * install-sh: Removed from CVS repository. Let automake supply it.
6251
6252 2004-02-26  Niels Möller  <nisse@lysator.liu.se>
6253
6254         * nettle-meta.h (nettle_crypt_func): Typedef moved to cbc.h.
6255         Include cbc.h instead.
6256
6257         * des-compat.c: Reverted const change, now all the des_key_sched
6258         arguments are not const. This is also what openssl's interface
6259         looks like.
6260         (cbc_crypt_func): Deleted typedef, use nettle_crypt_func instead.
6261
6262         * cbc.h (nettle_crypt_func): Moved typedef here.
6263         * cbc.c (cbc_encrypt, cbc_decrypt_internal, cbc_decrypt): Use it
6264         for typing the f argument. Reverted the const change, for
6265         compatibility with nettle_crypt_func.
6266
6267 2004-02-25  Niels Möller  <nisse@lysator.liu.se>
6268
6269         * testsuite/des-compat-test.c: Use des_cblock for typing more of
6270         the variables. Use const. Got rid of most of the explicit casts.
6271         Disabled the input/output alignment tests.
6272
6273         * des.c (des_encrypt, des_decrypt): Use a const context pointer.
6274         * des3.c (des3_encrypt, des3_decrypt): Likewise.
6275
6276         * cbc.c (cbc_encrypt, cbc_decrypt): Use a _const_ void *ctx argument.
6277
6278         * des-compat.c: Use const for all unchanged arguments.
6279         (des_key_sched): Use a copy of the key if we need to fix the
6280         parity.
6281
6282         * testsuite/des-compat-test.c (C_Block, Key_schedule): Deleted
6283         defines. Deleted some of the explicit casts.
6284
6285         * des-compat.c (des_cbc_cksum): Dereference DST pointer.
6286
6287 2004-02-25  Niels Möller  <niels@s3.kth.se>
6288
6289         * pgp.h: Include nettle-types.h.
6290
6291 2004-02-24  Niels Möller  <nisse@lysator.liu.se>
6292
6293         * testsuite/symbols-test: Allow symbols starting with double
6294         underscores, like on darwin.
6295
6296 2004-02-17  Niels Möller  <niels@s3.kth.se>
6297
6298         * Makefile.am: Protected %-rules used for building pure objects,
6299         and for assembler files, by automake conditionals. Needed for
6300         makes such as tru64's, which tries to understand %-patterns, but
6301         doesn't get it right.
6302         (SUFFIXES): Added .html.
6303         (.texinfo.html): Rewrote rule to use a traditional suffix target.
6304
6305         * configure.ac (enable_assembler): Explicitly set
6306         enable_assembler=no, on architectures where we have no assembler
6307         files.
6308         (ENABLE_ASSEMBLER, ENABLE_SHARED): New automake conditionals.
6309
6310         * testsuite/testutils.c (xalloc): xalloc(0) should work also on
6311         systems where malloc(0) returns NULL.
6312
6313 2004-02-16  Niels Möller  <niels@s3.kth.se>
6314
6315         * Makefile.am (%.o: %.asm): Added comment about OSF1 make problem.
6316
6317 2004-02-15  Niels Möller  <nisse@lysator.liu.se>
6318
6319         * testsuite/testutils.h: #include nettle-types.h instead of
6320         inttypes.h.
6321
6322 2004-02-12  Niels Möller  <nisse@lysator.liu.se>
6323
6324         * examples/rsa-encrypt-test: Use -r option when invoking
6325         rsa-encrypt. Needed for the test to work on systems with no
6326         /dev/urandom.
6327
6328 2004-02-12  Niels Möller  <niels@s3.kth.se>
6329
6330         * configure.ac (CPPFLAGS, LDFLAGS): No spaces after -I and -L, as
6331         some C compilers, in particular True64 cc, don't like that.
6332
6333 2004-02-08  Niels Möller  <nisse@lysator.liu.se>
6334
6335         * configure.ac: Bumped version number to 1.10.
6336
6337 2004-02-07  Niels Möller  <nisse@lysator.liu.se>
6338
6339         * Released nettle-1.9.
6340
6341         * configure.ac (SHLIBMINOR): Bumped, library version is now 2.1.
6342
6343         * testsuite/sexp-format-test.c: Include bignum.h only if HAVE_LIBGMP.
6344         * testsuite/rsa-encrypt-test.c: Include rsa.h only if WITH_PUBLIC_KEY.
6345         * testsuite/pkcs1-test.c: Include pkcs1.h only if WITH_PUBLIC_KEY.
6346
6347         * pgp-encode.c [!HAVE_LIBGMP]: Kludge around the pgp.h's
6348         dependency on gmp.h.
6349         (pgp_put_mpi): Condition on HAVE_LIBGMP.
6350
6351         * pgp.h: Don't include bignum.h, to make it possible to compile
6352         the non-bignum parts of pgp-encode.c without bignum support. Needs
6353         to be fixed properly before the pgp interface is advertised.
6354
6355         * tools/sexp-conv.c (xalloc): New function.
6356         (main): Use xalloc.
6357
6358         * tools/output.c (sexp_put_digest): Use TMP_DECL instead of alloca.
6359
6360         * testsuite/testutils.c (xalloc): New function. Made all other
6361         functions use xalloc instead of alloca.
6362
6363         * examples/rsa-keygen.c (main): Use xalloc for allocation.
6364         * examples/rsa-encrypt.c (write_bignum): Likewise.
6365         * examples/rsa-decrypt.c (read_bignum): Likewise.
6366         * testsuite/yarrow-test.c (open_file): Likewise.
6367         * testsuite/rsa-encrypt-test.c (test_main): Likewise.
6368         * testsuite/bignum-test.c (test_bignum): Likewise.
6369
6370         * examples/nettle-openssl.c: When calling des_key_sched and
6371         des_ecb_encrypt, cst arguments to (void *). Openssl's typedefs
6372         des_cblock and const_des_cblock are too broken.
6373
6374         * examples/nettle-benchmark.c (xalloc): New function. Use instead
6375         of alloca, for better portability.
6376
6377         * examples/io.c (xalloc): New function.
6378
6379         * Makefile.am (nodist_libnettleinclude_HEADERS): nettle-types.h
6380         should not be distributed.
6381
6382 2004-02-06  Niels Möller  <niels@s3.kth.se>
6383
6384         * x86/sha1-compress.asm: Rename round -> ROUND.
6385
6386         * x86/sha1-compress.asm: Store the magic constants on stack.
6387         Accessing them via %esp should be a little faster than using large
6388         immediate operands.
6389
6390         * Makefile.am (EXTRA_DIST, DISTCLEANFILES): Handle
6391         sha1-compress.asm.
6392
6393         * configure.ac: Use assembler file sha1-compress.asm if available.
6394
6395         * x86/sha1-compress.asm (EXPAND): Fixed the rotation part of the
6396         data expansion.
6397
6398 2004-02-06  Niels Möller  <nisse@lysator.liu.se>
6399
6400         * x86/sha1-compress.asm: Assembler implementation of
6401         sha1_compress. (Not yet working).
6402
6403         * Makefile.am (libnettle_a_SOURCES): Added sha1-compress.c.
6404
6405         * sha1.c (sha1_transform): Function renamed to sha1_compress, and
6406         moved to...
6407         * sha1-compress.c: ... New file.
6408
6409 2004-02-05  Niels Möller  <nisse@lysator.liu.se>
6410
6411         * examples/rsa-encrypt.c (process_file): Copy the leftover to the
6412         start of the buffer, when preparing for the final processing.
6413
6414         * examples/nettle-benchmark.c (bench_hash, time_hash): New functions.
6415         (main): Benchmark hash functions too.
6416         (BENCH_BLOCK): Increased 10K.
6417         (BENCH_INTERVAL): Decreased to 0.25s.
6418
6419         * examples/nettle-benchmark.c (time_function): Loop around calling
6420         f, until 1s has elapsed. Returns seconds per call. Updated bench
6421         functions to not loop themselves.
6422         (display): Updated MB/s calculation.
6423
6424         * testsuite/arcfour-test.c (test_main): Use test_cipher_stream.
6425
6426         * testsuite/testutils.c (test_cipher_stream): New function, that
6427         tries dividing the input into varying size blocks before
6428         processing.
6429
6430         * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Bug fix, half of
6431         the S array swap was forgotten.
6432         * arcfour.c (arcfour_stream): Likewise.
6433         * arcfour-crypt.c (arcfour_crypt): Likewise.
6434
6435 2004-02-05  Niels Möller  <niels@s3.kth.se>
6436
6437         * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Must store the new
6438         i, j at the end of the loop.
6439
6440         * Makefile.am (EXTRA_DIST): Make sure x86 assembler files are
6441         distributed.
6442         (DISTCLEANFILES): And that the symlinks and .s files are deleted.
6443
6444         * x86/aes-encrypt.asm, x86/aes-decrypt.asm, x86/arcfour-crypt.asm:
6445         Fixed debug information.
6446
6447         * x86/arcfour-crypt.asm: New file. About three times faster than
6448         the optimized C code.
6449
6450         * configure.ac: Use assembler file arcfour-crypt.asm if available.
6451
6452         * arcfour.c (arcfour_crypt): Moved function too...
6453         * arcfour-crypt.c (arcfour_crypt): New file.
6454
6455         * arcfour.c (arcfour_crypt): Optimization suggested by Jonas
6456         Walldén. Makes arcfour up to 50% faster on x86 and ppc, and
6457         probably on other architectures as well.
6458
6459 2004-01-31  Niels Möller  <nisse@lysator.liu.se>
6460
6461         * configure.ac (AX_CREATE_STDINT_H): Also look for uint32_t and
6462         friends in sys/types.h.
6463
6464 2004-01-11  Niels Möller  <nisse@harpo.hack.org>
6465
6466         * Makefile.am (libnettleinclude_HEADERS): Added bignum.h,
6467         memxor.h, pkcs1.h and rsa-compat.h.
6468
6469         * configure.ac: Bumped version to 1.9.
6470
6471 2004-01-10  Niels Möller  <nisse@harpo.hack.org>
6472
6473         * Released nettle-1.8.
6474
6475         * examples/teardown-env: Delete more test files.
6476
6477         * nettle.texinfo (Hash functions): Documented md2 and md4.
6478
6479         * configure.ac (SHLIBMAJOR): Bumped to 2.
6480
6481 2004-01-09  Niels Möller  <nisse@harpo.hack.org>
6482
6483         * examples/rsa-encrypt-test: New testcase.
6484
6485         * examples/rsa-encrypt.c, examples/rsa-session.h: Expanded the
6486         comment describing the file format, and moved to rsa-session.h.
6487
6488         * examples/rsa-decrypt.c (process_file): Finished this function.
6489         (main): Initialize x. Check the size of the session key after rsa
6490         decryption.
6491
6492         * examples/io.c (write_string): Treat short item count as an error.
6493
6494 2004-01-08  Niels Möller  <niels@s3.kth.se>
6495
6496         * index.html: Added instructions for CVS access.
6497
6498         * dsa-keygen.c (dsa_nist_gen): Fixed declaration/statement order.
6499
6500         * rsa-keygen.c (bignum_next_prime): Fixed off-by-one error when
6501         comparing input to the largest listed prime. General cleanup, as
6502         prime_limit > 0 always. Use TMP_DECL and TMP_ALLOC.
6503
6504         * nettle-internal.h (TMP_DECL, TMP_ALLOC): New macros. When alloca
6505         is unavailable, they work by allocating a fix amount of stack and
6506         imposing a hard limit on what can be allocated. Updated all users
6507         of alloca.
6508
6509 2004-01-07  Niels Möller  <nisse@harpo.hack.org>
6510
6511         * nettle-types.h: New (generated) file, to be used instead of
6512         including <inttypes.h> directly. Updated all users of inttypes.h.
6513
6514         * Makefile.am (DISTCLEANFILES, libnettleinclude_HEADERS): Added
6515         nettle-types.h.
6516
6517         * configure.ac (AX_CREATE_STDINT_H): Create nettle-types.h.
6518
6519 2003-11-16  Niels Möller  <nisse@harpo.hack.org>
6520
6521         * yarrow256.c (yarrow256_seed): Use const for the seed_file input.
6522
6523 2003-11-12  Niels Möller  <niels@s3.kth.se>
6524
6525         * list-obj-sizes.awk: New function for decoding hex values, with a
6526         new function hex2int. Also implemented calculation of total
6527         storage, removed the dependence on the .comment section, and use
6528         the $FILTER environment variable as a regexp for restricting the
6529         object files that are considered.
6530
6531 2003-09-21  Niels Möller  <nisse@cuckoo.hack.org>
6532
6533         * testsuite/rsa-encrypt-test.c (test_main): Don't use gmp_printf,
6534         as it seems it's only available with the newer gmp. Use
6535         mpz_out_str instead.
6536
6537 2003-09-19  Niels Möller  <niels@s3.kth.se>
6538
6539         * examples/Makefile.am (EXTRA_DIST): Added rsa-session.h.
6540
6541         * tools/nettle-lfib-stream.c: New tool, which outputs a sequence
6542         of pseudorandom (non-cryptographic) bytes, using Knuth's lagged
6543         fibonacci generator.
6544
6545         * examples/rsa-decrypt.c: Fixes to get the file to compile. It
6546         won't work yet.
6547
6548         * examples/Makefile.am (EXTRA_PROGRAMS): Added rsa-encrypt and
6549         rsa-decrypt.
6550
6551         * examples/io.c (write_file): New function.
6552         (write_string): Simplified error check, it's no real point in
6553         calling ferror unless we also call fflush.
6554
6555         * examples/rsa-keygen.c (main): Check return value from
6556         simple_random.
6557
6558         * examples/rsa-decrypt.c, examples/rsa-encrypt.c,
6559         examples/rsa-session.h: New files, demonstrating rsa encryption
6560         and decryption.
6561
6562         * configure.ac (RSA_EXAMPLES): Added rsa-encrypt and rsa-decrypt.
6563
6564 2003-09-01  Niels Möller  <nisse@cuckoo.hack.org>
6565
6566         * testsuite/testutils.c (print_hex): Use const.
6567
6568 2003-08-30  Niels Möller  <niels@s3.kth.se>
6569
6570         * md2.c, md2.h: Added reference to RFC 1319.
6571         * md4.c, md4.h: Added reference to RFC 1320
6572
6573 2003-08-26  Niels Möller  <niels@s3.kth.se>
6574
6575         * Makefile.am: Added md2 and md5 files. Deleted the print-path
6576         hack.
6577
6578         * configure.ac: Bumped version to 1.8.
6579
6580         * testsuite/testutils.c (test_rsa_set_key_1): New function.
6581         * testsuite/rsa-test.c (test_main): Use it.
6582
6583         * testsuite/dsa-keygen-test.c: Deleted definition of UNUSED, it's
6584         now in config.h.
6585         * testsuite/rsa-keygen-test.c: Likewise.
6586
6587         * testsuite/Makefile.am (TS_PROGS): Added rsa-encrypt-test,
6588         md4-test, and md2-test.
6589
6590         * testsuite/rsa-encrypt-test.c, testsuite/md4-test.c,
6591         testsuite/md2-test.c: New test cases.
6592
6593         * nettle-meta.h: Declare nettle_md2 and nettle_md4.
6594
6595         * md5.c: Reorderd functions, putting md5_final at the end.
6596
6597         * md2.c, md2.h, md2-meta.c: New files, implemented md2.
6598         * md4.c, md4.h, md4-meta.c: New files, implemented md4.
6599
6600 2003-08-17  Niels Möller  <nisse@cuckoo.hack.org>
6601
6602         * desCode.h (des_keymap, des_bigmap): Deleted extern declarations,
6603         they conficted with the static definition in des.c. Reported by
6604         Simon Josefsson.
6605
6606         * des.c (DesSmallFipsEncrypt, DesSmallFipsDecrypt): Moved
6607         definitions after the definition of the des_kemap array.
6608
6609 2003-08-11  Niels Möller  <nisse@cuckoo.hack.org>
6610
6611         * rsa-encrypt.c (rsa_encrypt): Bugfix contributed by
6612         leg@terra.com.br.
6613
6614 2003-06-10  Niels Möller  <niels@s3.kth.se>
6615
6616         * Makefile.am (EXTRA_DIST): Distribute sha-example.c.
6617
6618 2003-06-05  Niels Möller  <nisse@lysator.liu.se>
6619
6620         * Makefile.am (DISTCLEANFILES): Delete .s files.
6621
6622 2003-05-27  Niels Möller  <nisse@cuckoo.hack.org>
6623
6624         * testsuite/symbols-test: And allow symbols that start at the
6625         beginning of the line, as output by AIX nm.
6626
6627 2003-05-26  Niels Möller  <nisse@cuckoo.hack.org>
6628
6629         * testsuite/symbols-test: Allow symbols to start with a dot.
6630
6631 2003-05-14  Niels Möller  <niels@s3.kth.se>
6632
6633         * pgp.h (enum pgp_subpacket_tag): Copied values from RFC 2440.
6634         Renamed PGP_SUBPACKET_ISSUER to PGP_SUBPACKET_ISSUER_KEY_ID.
6635
6636 2003-05-13  Niels Möller  <nisse@cuckoo.hack.org>
6637
6638         * pgp.h: Do proper namemangling for pgp_put_public_rsa_key and
6639         pgp_put_rsa_sha1_signature.
6640
6641         * pgp-encode.c (pgp_put_mpi): Fixed nettle_mpz_get_str_256 call.
6642
6643 2003-05-12  Niels Möller  <nisse@cuckoo.hack.org>
6644
6645         * rsa2openpgp.c (rsa_keypair_to_openpgp): Some bugfixes.
6646
6647         * pgp.h (enum pgp_subpacket_tag): New enum. Definition is bogus
6648         and needs to be fixed.
6649         Added forward declarations of structs, and prototypes for
6650         pgp_put_public_rsa_key and pgp_put_rsa_sha1_signature.
6651
6652         * pgp-encode.c (pgp_put_mpi): Take a const mpz_t argument. Gugfix,
6653         use nettle_mpz_get_str_256.
6654         (pgp_put_public_rsa_key, pgp_put_rsa_sha1_signature):
6655         Constification. Some bugfixes.
6656
6657         * Use "config.h", not <config.h>.
6658
6659         * Reordered includes in most or all .c-files. All should now
6660         include config.h.
6661
6662 2003-05-12  Niels Möller  <niels@s3.kth.se>
6663
6664         * configure.ac: Use LSH_FUNC_ALLOCA.
6665
6666 2003-04-25  Niels Möller  <niels@s3.kth.se>
6667
6668         * Makefile.am (libnettle_a_SOURCES): Added hmac-sha256.c.
6669
6670         * testsuite/hmac-test.c (test_main): Added tests for hmac-sha256,
6671         from draft-ietf-ipsec-ciph-sha-256-01.txt.
6672
6673         * hmac-sha256.c (hmac_sha256_digest): New file.
6674
6675 2003-04-22  Niels Möller  <nisse@cuckoo.hack.org>
6676
6677         * sha-example.c (display_hex): Simplified by using printf better.
6678
6679         * nettle.texinfo (Example): Use @verbatiminclude to include the
6680         example program.
6681
6682         * sha-example.c: Example program, for inclusion in the manual.
6683         Fixed bugs reported by Mark Arking.
6684
6685 2003-04-14  Niels Möller  <niels@s3.kth.se>
6686
6687         * x86/aes-encrypt.asm (nettle_aes_encrypt): Fixed references to
6688         _nettle_aes_encrypt_table.
6689         * x86/aes-decrypt.asm (nettle_aes_decrypt): Fixed references to
6690         _nettle_aes_decrypt_table.
6691
6692 2003-04-12  Niels Möller  <nisse@cuckoo.hack.org>
6693
6694         * testsuite/Makefile.am (TS_SH): New test case symbols-test.
6695         (EXTRA_PROGRAMS): Added testutils, as a kludge to
6696         get automake to track dependencies for testutils.o.
6697
6698         * x86/aes-encrypt.asm (nettle_aes_encrypt): Renamed function to
6699         use the nettle_ prefix.
6700         * x86/aes-decrypt.asm (nettle_aes_decrypt): Likewise.
6701         * sparc/aes.asm (_nettle_aes_crypt): Likewise.
6702
6703         * examples/Makefile.am (EXTRA_PROGRAMS): Add "io", as a kludge to
6704         get automake to track dependencies for io.o.
6705         (LDADD): Added ../libnettle.a, for the dependency.
6706
6707         * des-compat.c: Use names with the nettle_ prefix when using
6708         Nettle's des functions.
6709
6710         * base16-meta.c (base16_encode_update): Need to undef before
6711         redefining.
6712
6713         * New name mangling, to reduce the risk of link collisions. All
6714         functions (except memxor) now use a nettle_ or _nettle prefix when
6715         seen by the linker. For most functions, the header file that
6716         declares a function also use #define to provide a shorter more
6717         readable name without the prefix.
6718
6719 2003-03-11  Niels Möller  <nisse@cuckoo.hack.org>
6720
6721         * Released nettle-1.7.
6722
6723         * configure.ac: Bumped version to 1.7.
6724
6725         * nettle.texinfo (DSA): New section.
6726         (RSA): Updated documentation.
6727
6728 2003-03-02  Niels Möller  <nisse@cuckoo.hack.org>
6729
6730         * examples/nettle-benchmark.c (time_cipher): Don't use GNU C
6731         non-constant initializers.
6732
6733 2003-02-23  Niels Moller  <nisse@carduelis>
6734
6735         * configure.ac: Use LSH_GCC_ATTRIBUTES.
6736
6737 2003-02-19  Niels Möller  <nisse@cuckoo.hack.org>
6738
6739         * acinclude.m4: Deleted file from cvs, use a link to lsh's
6740         acinclude.m4 instead.
6741
6742 2003-02-16  Niels Möller  <nisse@cuckoo.hack.org>
6743
6744         * Makefile.am (libnettleinclude_HEADERS): Added macros.h.
6745
6746         * tools/Makefile.am (EXTRA_DIST): Added getopt.h.
6747
6748 2003-02-14  Niels Möller  <niels@s3.kth.se>
6749
6750         * Makefile.am (print_path): Added target to print the used PATH,
6751         for debugging.
6752         (print-path): Moved dependency to all-local.
6753
6754 2003-02-11  Niels Möller  <niels@s3.kth.se>
6755
6756         * buffer.c (nettle_buffer_copy): Bug fix, it didn't return any
6757         value.
6758
6759 2003-02-11  Niels Möller  <nisse@cuckoo.hack.org>
6760
6761         * testsuite/sexp-format-test.c (test_main): Added test for %( and
6762         %).
6763
6764         * sexp-format.c (sexp_vformat): Handle %( and %).
6765
6766         * realloc.c (nettle_xrealloc): Fixed out-of-memory check.
6767
6768         * configure.ac (SHLIBMAJOR): Bumped version number to 1.
6769
6770         * buffer.c (nettle_buffer_init_realloc): New function.
6771         * buffer-init.c (nettle_buffer_init): Use nettle_buffer_init_realloc.
6772
6773 2003-02-10  Niels Möller  <nisse@cuckoo.hack.org>
6774
6775         * testsuite/sexp-format-test.c (test_main): New test with tokens
6776         in the format string.
6777         (test_main): Test space-searated literals too.
6778
6779         * rsa2sexp.c (rsa_keypair_to_sexp): New argument ALGORITHM_NAME.
6780         * examples/rsa-keygen.c (main): Updated call to rsa_keypair_to_sexp.
6781         * testsuite/rsa2sexp-test.c (test_main): Likewise.
6782
6783         * sexp-format.c (sexp_vformat): Allow whitespace in format string.
6784
6785         * rsa2sexp.c (rsa_keypair_to_sexp): Use literals with sexp_format.
6786
6787         * sexp-format.c (format_string): New function.
6788         (sexp_vformat): Implemented support for literals in the format
6789         string.
6790
6791 2003-02-06  Niels Möller  <nisse@lysator.liu.se>
6792
6793         * testsuite/sexp-conv-test (print_raw, print_nl): New functions.
6794         The testfunctions use these instead of using echo directly.
6795         Use the test input '3:"\x' instead of '2:"\', to be friendlier to
6796         sysv echo.
6797
6798 2003-02-05  Niels Möller  <nisse@lysator.liu.se>
6799
6800         * des-compat.h (des_set_key): Different name mangling, if this
6801         file is included, des_set_key should refer to a function that
6802         behaves like openssl's.
6803
6804         * des-compat.c (des_key_sched, des_is_weak_key): Use the name
6805         nettle_des_set_key for referring to Nettle's function.
6806
6807         * des.h (des_set_key): Name mangling, linker symbols should use a
6808         "nettle_" prefix, and this one collided with openssl. Perhaps all
6809         symbols should be mangled in a similar way, but that's for later.
6810
6811         * configure.ac (LDFLAGS): --with-lib-path should add to LDFLAGS,
6812         not replace it.
6813
6814 2003-01-30  Niels Möller  <nisse@cuckoo.hack.org>
6815
6816         * tools/output.c (sexp_put_string): Fixed handling of escapable
6817         characters. The code generated random escape sequences for
6818         characters in the 0x10-0x1f range.
6819
6820         * testsuite/sexp-conv-test: More tests for hex and base64 input
6821         and output.
6822
6823 2003-01-30  Niels Möller  <niels@s3.kth.se>
6824
6825         * sexp2bignum.c (nettle_mpz_set_sexp): Call sexp_iterator_next on
6826         success. That means the iterator argument can't be const.
6827
6828 2003-01-29  Niels Möller  <niels@s3.kth.se>
6829
6830         * tools/Makefile.am (LDADD): Add libnettle.a, for the dependency.
6831
6832 2003-01-27  Niels Möller  <nisse@cuckoo.hack.org>
6833
6834         * sexp2dsa.c (dsa_signature_from_sexp): New function.
6835
6836         RSA renaming. Updated all callers.
6837         * rsa-sign.c (rsa_private_key_init, rsa_private_key_clear)
6838         (rsa_private_key_prepare): Renamed functions.
6839         * rsa.c (rsa_public_key_init, rsa_public_key_clear)
6840         (rsa_public_key_prepare): Renamed functions.
6841
6842 2003-01-23  Niels Möller  <nisse@cuckoo.hack.org>
6843
6844         * Makefile.am (libnettle_a_SOURCES): Added new rsa and pkcs1
6845         files. Removed old rsa_md5.c and rsa_sha1.c.
6846
6847         * testsuite/Makefile.am (TS_PROGS): Added pkcs1-test.
6848
6849         * dsa-verify.c (dsa_verify_digest): New function.
6850         (dsa_verify): Most of the code moved to dsa_verify_digest, which
6851         is used here.
6852         * dsa-sign.c (dsa_sign_digest): New function.
6853         (dsa_sign): Most of the code moved to dsa_sign_digest, which is
6854         used here.
6855         * dsa.c (_dsa_hash): Deleted function.
6856
6857         * rsa_md5.c, rsa_sha1.c: Deleted files, contents spread over
6858         several files for signing and verification.
6859         * rsa-sign.c, rsa-sha1-verify.c, rsa-sha1-sign.c,
6860         rsa-md5-verify.c, rsa-md5-sign.c:  New files.
6861
6862         * rsa-sha1-verify.c (rsa_sha1_verify_digest): New function.
6863         * rsa-sha1-sign.c (rsa_sha1_sign_digest):  New function.
6864         * rsa-md5-verify.c (rsa_md5_verify_digest):  New function.
6865         * rsa-md5-sign.c (rsa_md5_sign_digest):  New function.
6866         * rsa-verify.c (_rsa_verify): New file, new function.
6867
6868         * rsa.c (_rsa_check_size): Renamed from rsa_check_size, and made
6869         non-static. Private key functions moved to rsa-sign.c.
6870
6871         * pkcs1.c, pkcs1.h, pkcs1-rsa-md5.c, pkcs1-rsa-sha1.c: New files.
6872         (pkcs1_signature_prefix): New function.
6873
6874         * testsuite/pkcs1-test.c: New test.
6875
6876 2003-01-22  Niels Möller  <niels@s3.kth.se>
6877
6878         * examples/Makefile.am (nettle_benchmark_LDADD): Use
6879         OPENSSL_LIBFLAGS.
6880
6881         * configure.ac (OPENSSL_LIBFLAGS): If libcrypto is found, add
6882         -lcrypto to OPENSSL_LIBFLAGS, not the plain LDFLAGS.
6883
6884 2003-01-20  Niels Möller  <nisse@cuckoo.hack.org>
6885
6886         * testsuite/Makefile.am (CLEANFILES): Delete test.in, test1.out
6887         and test2.out.
6888
6889 2003-01-17  Niels Möller  <niels@s3.kth.se>
6890
6891         * examples/Makefile.am (AM_CPPFLAGS): Use AM_CPPFLAGS instead of
6892         AM_CFLAGS.
6893         * testsuite/Makefile.am (AM_CPPFLAGS): Likewise.
6894
6895 2003-01-16  Niels Möller  <niels@s3.kth.se>
6896
6897         * testsuite/Makefile.am (check): Can't use quotes around
6898         $(srcdir).
6899
6900 2003-01-14  Niels Möller  <nisse@lysator.liu.se>
6901
6902         * testsuite/Makefile.am (check): Don't use "run-tests" as a
6903         target, as it's confused with the file with the same name.
6904
6905         * .bootstrap: Added missing #! /bin/sh.
6906
6907 2003-01-12  Niels Möller  <nisse@cuckoo.hack.org>
6908
6909         * buffer.c (nettle_buffer_reset): New function.
6910         (nettle_buffer_copy): New function.
6911
6912         * tools/input.c, tools/input.h, tools/output.c, tools/output.h,
6913         tools/parse.c, tools/parse.h, tools/misc.c, tools/misc.h: Moved
6914         parts ov sexp-conv.c to separate files
6915
6916         * tools/sexp-conv.c (sexp_convert_list): Inlined into
6917         sexp_convert_item.
6918
6919         * tools/sexp-conv.c (struct sexp_input): Deleted string attribute.
6920         Changed all related functions to take a struct nettle_buffer *
6921         argument instead.
6922         (struct sexp_compound_token): New struct.
6923         (sexp_compound_token_init, sexp_compound_token_clear): New
6924         functions.
6925         (struct sexp_parser): Added a struct sexp_compound_token
6926         attribute, as a temporary measure.
6927         (sexp_parse): Take a struct sexp_compound_token * as argument.
6928         Updated all callers. Simplified handling of display types and
6929         transport encoding.
6930
6931         * tools/sexp-conv.c (struct sexp_parser): Renamed struct (was
6932         struct sexp_parse_state). Added input pointer. Updated users to
6933         not pass around both parser and input.
6934         (sexp_check_token): handle token == 0.
6935         (sexp_parse): Simplified a little by calling sexp_check_token
6936         unconditionally.
6937
6938         * tools/sexp-conv.c (sexp_convert_string): Deleted function.
6939         (sexp_skip_token): Likewise.
6940
6941         * tools/sexp-conv.c (enum sexp_token): New constant SEXP_DISPLAY.
6942         Start constants from 1, to keep 0 free for special uses.
6943         (struct sexp_parse_state): New struct for keeping track of parser
6944         state.
6945         (sexp_parse_init): New function.
6946         (sexp_check_token): New function, replacing sexp_skip_token.
6947         (sexp_parse): New function.
6948         (sexp_convert_item): Simplified by using sexp_parse.
6949         (sexp_convert_list): Use sexp_parse.
6950         (main): Likewise.
6951
6952 2003-01-08  Niels Möller  <niels@s3.kth.se>
6953
6954         * tools/sexp-conv.c (parse_options): Initialize prefer_hex.
6955
6956 2003-01-07  Niels Möller  <nisse@cuckoo.hack.org>
6957
6958         * Makefile.am (des_headers): Refer to the desdata binary using
6959         $(EXEEXT).
6960
6961 2003-01-01  Niels Möller  <nisse@cuckoo.hack.org>
6962
6963         * testsuite/sexp-conv-test: New tests for hex and base64 literal
6964         output.
6965
6966         * tools/sexp-conv.c (sexp_put_string): Print binary strings using
6967         either hex or base 64 (in advanced mode).
6968         (parse_options): Implemented -s hex, for output using hex rather
6969         than base64.
6970
6971 2002-12-30  Niels Möller  <nisse@cuckoo.hack.org>
6972
6973         * testsuite/rsa2sexp-test.c: Don't include rsa.h (done by
6974         testutils.h, if enabled).
6975         * testsuite/sexp2rsa-test.c: Likewise.
6976
6977         * rsa-decrypt.c: Make compilation conditional on WITH_PUBLIC_KEY.
6978         * rsa-encrypt.c: Likewise.
6979         * rsa-compat.c: Likewise.
6980
6981 2002-12-04  Niels Möller  <niels@s3.kth.se>
6982
6983         * testsuite/Makefile.am (LDADD): Added path to ../libnettle.a,
6984         which is redundant except for the dependency.
6985
6986 2002-12-04  Niels Möller  <nisse@cuckoo.hack.org>
6987
6988         * testsuite/sexp-format-test.c (test_main): Use %0s instead of %z.
6989         New test for %t.
6990
6991         * sexp-format.c (format_length_string): Deleted function.
6992         (format_string): Deleted function.
6993         (sexp_vformat): New %t specifier, formatting an optional display
6994         type. Deleted %z specifier. Instead, introduced a new modifier "0"
6995         that can be used with %s, %l and %t, which says that the data is
6996         NUL-terminated.
6997
6998         * rsa2sexp.c (rsa_keypair_to_sexp): Use %0s rather than %z, when
6999         formatting s-expressions.
7000
7001         * buffer.c (nettle_buffer_grow): Fixed assertion.
7002
7003 2002-11-22  Niels Möller  <niels@s3.kth.se>
7004
7005         * buffer.c: Include assert.h.
7006
7007 2002-11-21  Niels Möller  <nisse@cuckoo.hack.org>
7008
7009         * testsuite/testutils.c (print_hex): Add line breaks.
7010
7011         * Makefile.am (libnettleinclude_HEADERS): Added realloc.h.
7012         (libnettle_a_SOURCES): Added buffer-init.c and realloc.c.
7013
7014         * sexp.c (sexp_iterator_exit_lists): New function, #if:ed out for
7015         now.
7016
7017         * desdata.c: Include config.h, to get definition of UNUSED.
7018         * shadata.c: Likewise.
7019
7020         * buffer.c (nettle_buffer_grow): New function, replacing
7021         grow_realloc.
7022         (nettle_buffer_clear): Rewritten to use buffer->realloc.
7023
7024         * buffer.h (struct nettle_buffer): Replaced the GROW function
7025         pointer with a nettle_realloc_func pointer and a
7026         void *realloc_ctx.
7027         (NETTLE_BUFFER_GROW): Deleted macro, use function instead.
7028
7029         * buffer-init.c (nettle_buffer_init): Moved to a separate file.
7030
7031         * realloc.c (nettle_realloc): New function.
7032         (nettle_xrealloc): New function.
7033
7034         * realloc.h (nettle_realloc_func): New typedef.
7035
7036         * configure.ac: Check for gcc:s __attribute__.
7037
7038 2002-11-16  Niels Möller  <nisse@cuckoo.hack.org>
7039
7040         * sexp2dsa.c, sexp2rsa.c: (macro GET): Check sign of parsed
7041         numbers.
7042
7043         * sexp2bignum.c (nettle_mpz_set_sexp): In the first check against
7044         limit, added some margin to allow for sign octets.
7045
7046 2002-11-15  Niels Möller  <nisse@cuckoo.hack.org>
7047
7048         * testsuite/testutils.h (LDATA): Use sizeof instead of strlen. Now
7049         handles strings including NUL-characters. But works only with
7050         literals and character arrays, no char pointers.
7051         (LLENGTH): New macro, computing length the same way as LDATA.
7052
7053         * testsuite/sexp-test.c (test_main): Test sexp_iterator_get_uint32.
7054
7055         * testsuite/sexp-format-test.c (test_main): Check that %i and %b
7056         generate leading zeroes when needed. Check that %b handles
7057         negative numbers.
7058
7059         * testsuite/rsa2sexp-test.c (test_main): Updated test, one leading
7060         zero is needed in the private key expression. In verbose mode,
7061         print the generated keys.
7062
7063         * testsuite/sexp2rsa-test.c (test_main): Added a leading zero in
7064         the private key expression.
7065
7066         * testsuite/bignum-test.c (test_bignum): Use
7067         nettle_mpz_init_set_str_256_s.
7068         (test_size): New function.
7069         (test_main): Test size computation and formatting of negative
7070         numbers.
7071
7072         * sexp2bignum.c (nettle_mpz_set_sexp): Use
7073         nettle_mpz_set_str_256_s, to handle negative numbers correctly.
7074
7075         * sexp-format.c (sexp_vformat): For %i, output a leading zero when
7076         needed to get a correct, positive, sign. For %b, use
7077         nettle_mpz_sizeinbase_256_s, to handle negative numbers properly.
7078
7079         * bignum.c (nettle_mpz_sizeinbase_256_s): New function.
7080         (nettle_mpz_sizeinbase_256_u): New name, was
7081         nettle_mpz_sizeinbase_256. Updated all callers.
7082         (nettle_mpz_to_octets): New function.
7083         (nettle_mpz_get_str_256): Handle negative numbers.
7084         (nettle_mpz_from_octets): New function.
7085         (nettle_mpz_set_str_256_u): New name, was nettle_mpz_set_str_256.
7086         (nettle_mpz_init_set_str_256_u): New name, was
7087         nettle_mpz_init_set_str_256.
7088         (nettle_mpz_set_str_256_s): New function, handling negative two's
7089         complement numbers.
7090         (nettle_mpz_init_set_str_256_s): And an init variant.
7091
7092         * sexp.c (sexp_iterator_get_uint32): New function.
7093
7094 2002-11-10  Niels Möller  <nisse@cuckoo.hack.org>
7095
7096         * testsuite/sexp-conv-test: Use input files without any trailing
7097         newline character, in order to stress the end of file handling.
7098
7099         * tools/sexp-conv.c (sexp_get_token_string): Fixed end of file
7100         handling.
7101         (sexp_get_string): Fixed end of encoding/end of file handling.
7102         (parse_options): Check for negative width and complain.
7103
7104         * tools/sexp-conv.c: Use supplied getopt.
7105         (werror): New function.
7106         (sexp_output_hash_init): New function.
7107         (sexp_put_char): Made base64 linebreaking configurable.
7108         Implemented hashing.
7109         (sexp_put_code_start, sexp_put_code_end): Don't output any
7110         delimiters here.
7111         (sexp_put_string): Output base64 delimiters.
7112         (sexp_put_digest): New function.
7113         (sexp_convert_item): Output transport delimiters.
7114         (sexp_convert_file): Deleted function, folded with main.
7115         (parse_options): New function.
7116         (main): Implemented --hash and --once, needed by lsh-authorize.
7117
7118         * sexp.h (struct sexp_iterator): New field start.
7119
7120         * sexp.c (sexp_iterator_subexpr): New function.
7121         (sexp_iterator_parse): Initialize ITERATOR->start.
7122
7123         * sexp-format.c (sexp_vformat): Abort if format string contains
7124         unhandled characters.
7125
7126 2002-11-08  Niels Möller  <niels@s3.kth.se>
7127
7128         * des-compat.c (des_ecb3_encrypt): Don't use struct initialization
7129         (c89 doesn't allow non-constant initializers). Reported by James
7130         Ralston.
7131         (des_ede3_cbc_encrypt): Likewise.
7132
7133         * examples/nettle-openssl.c: Moved from the top-level directory.
7134         Should *not* be included in the nettle library.
7135
7136 2002-11-08  Niels Möller  <nisse@cuckoo.hack.org>
7137
7138         * testsuite/testutils.c (test_dsa_key): Bugfix for renamed DSA
7139         constant (noted by James Ralston).
7140
7141 2002-11-07  Niels Möller  <niels@s3.kth.se>
7142
7143         * testsuite/run-tests: Copied new version rom lsh/src/testsuite.
7144         This version handles test scripts located in $srcdir.
7145
7146         * examples/Makefile.am (AM_CFLAGS): We need -I$(top_srcdir).
7147         * tools/Makefile.am (AM_CFLAGS): Likewise.
7148         * testsuite/Makefile.am (AM_CFLAGS): Likewise.
7149
7150 2002-11-07  Niels Möller  <nisse@cuckoo.hack.org>
7151
7152         * Makefile.am (SUBDIRS): Added tools.
7153         (libnettle_a_SOURCES): Added sexp-transport-format.c,
7154         sexp2bignum.c, sexp2dsa.c.
7155
7156         * sexp2dsa.c (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp):
7157         New file, new functions.
7158
7159         * rsa2sexp.c (rsa_keypair_to_sexp): %s -> %z renaming.
7160
7161         * sexp-transport.c (sexp_transport_iterator_first): Fixed bug,
7162         length was mishandled.
7163
7164         * sexp-transport-format.c (sexp_transport_format,
7165         sexp_transport_vformat): New file, new functions.
7166
7167         * sexp-format.c (sexp_format): Return length of output. Allow
7168         buffer == NULL, and only compute the needed length in this case.
7169         Renamed %s to %z. New format specifiers %s, %i, and %l.
7170         (sexp_vformat): New function.
7171         (format_prefix): Rewrote to not use snprintf.
7172
7173         * sexp2rsa.c (rsa_keypair_from_sexp): New limit argument. Use
7174         nettle_mpz_set_sexp.
7175
7176         * dsa-keygen.c (dsa_generate_keypair): Added some newlines to
7177         progress display. Use DSA_P_MIN_BITS.
7178
7179         * dsa.h (DSA_MIN_P_BITS): New constant (was DSA_MINIMUM_BITS).
7180         (DSA_Q_OCTETS, DSA_Q_BITS): New constants.
7181         (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp): New
7182         prototypes.
7183
7184         * configure.ac: Output tools/Makefile.
7185
7186         * sexp2bignum.c (nettle_mpz_set_sexp): New file, and new function.
7187         Moved from sexp2rsa.c:get_value.
7188
7189         * examples/io.c (read_rsa_key): New limit argument in
7190         call of rsa_keypair_from_sexp_alist.
7191
7192         * examples/Makefile.am (noinst_PROGRAMS): Removed sexp-conv.
7193
7194         * tools/sexp-conv.c: Moved file from examples directory.
7195
7196         * testsuite/Makefile.am (TS_SH): New variable. Added
7197         sexp-conv-test.
7198
7199         * testsuite/testutils.h (LDUP): New macro.
7200
7201         * testsuite/sexp2rsa-test.c (test_main): New limit argument in
7202         call of rsa_keypair_from_sexp_alist.
7203
7204         * testsuite/sexp-test.c (test_main): Added test for lengths with
7205         more than one digit. Added tests for transport mode decoding.
7206
7207         * testsuite/sexp-format-test.c (test_main): Added tests for %i and
7208         %l.
7209
7210         * testsuite/sexp-conv-test: Moved test from examples directory.
7211         Updated path to sexp-conv, now in ../tools/sexp-conv.
7212
7213 2002-11-03  Niels Möller  <nisse@cuckoo.hack.org>
7214
7215         * sexp-format.c, sexp_format.c: Renamed sexp_format.c to
7216         sexp-format.c.
7217         * Makefile.am (libnettle_a_SOURCES): Renamed sexp_format.c to
7218         sexp-format.c.
7219
7220         * examples/Makefile.am: Don't set CFLAGS or CPPFLAGS explicitly,
7221         let automake handle that.
7222         * testsuite/Makefile.am: Likewise.
7223
7224         * sexp2rsa.c (rsa_keypair_from_sexp_alist): New function.
7225         (rsa_keypair_from_sexp): Use it.
7226
7227 2002-11-01  Niels Möller  <niels@s3.kth.se>
7228
7229         * examples/Makefile.am (LDADD): Use -lnettle, instead of an
7230         explicit filename libnettle.a, so that we will use the shared
7231         library, if it exists.
7232         (AM_LDFLAGS): Added -L.., so we can find -lnettle.
7233         (run-tests): Set LD_LIBRARY_PATH to ../.lib, when running the
7234         testsuite.
7235         * testsuite/Makefile.am: Similar changes.
7236
7237         * Makefile.am (LIBOBJS): Put @LIBOBJS@ into the make variable
7238         LIBOBJS.
7239         (CLEANFILES): Delete libnettle.so.
7240         (clean-local): Delete the .lib linkfarm.
7241         ($(SHLIBFORLINK)): When building libnettle.so, create a link from
7242         .lib/$SHLIBSONAME. Needed at runtime, for the testsuite.
7243
7244 2002-11-01  Niels Möller  <nisse@lysator.liu.se>
7245
7246         * configure.ac: Fixed definitions using SHLIBMAJOR and SHLIBMINOR.
7247         Also AC_SUBST SHLIBMAJOR and SHLIBMINOR. Reported by James
7248         Ralston.
7249
7250 2002-10-31  Niels Möller  <niels@s3.kth.se>
7251
7252         * examples/sexp-conv.c(sexp_put_list_start): Deleted function.
7253         (sexp_put_list_end): Likewise.
7254         (sexp_put_display_start): Likewise.
7255         (sexp_put_display_end): Likewise.
7256         (sexp_puts): Likewise.
7257
7258         * examples/sexp-conv.c (sexp_get_quoted_string): Deleted function.
7259         Merged with sexp_get_String.
7260         (sexp_get_hex_string): Likewise.
7261         (sexp_get_base64_string): Likewise.
7262         (sexp_get_string): Do hex and base64 decoding.
7263
7264         * examples/sexp-conv.c (enum sexp_char_type): New enum, for end
7265         markers in the input strem.
7266         (struct sexp_input): Deleted LEVEL attribute. Deleted all usage of
7267         it.
7268         (sexp_get_raw_char): Use INPUT->c and INPUT->ctype to store
7269         results. Deleted OUT argument.
7270         (sexp_get_char): Likewise. Also removed the
7271         INPUT->coding->decode_final call, for symmetry.
7272         (sexp_input_end_coding): Call INPUT->coding->decode_final.
7273         (sexp_next_char): New function.
7274         (sexp_push_char): New function.
7275         (sexp_get_token_char): Deleted function.
7276         (sexp_get_quoted_char): Simplified. Deleted output argument.
7277         (sexp_get_quoted_string): Simplified.
7278         (sexp_get_base64_string): Likewise.
7279         (sexp_get_token_string): Likewise.
7280         (sexp_get_string_length): Skip the character that terminates the
7281         string.
7282         (sexp_get_token): Cleared upp calling conventions. Always consume
7283         the final character of the token.
7284         (sexp_convert_list): Take responsibility for converting the start
7285         and end of the list.
7286         (sexp_convert_file): Call sexp_get_char first, to get the token
7287         reading started.
7288         (sexp_convert_item): Cleared up calling conventions. Should be
7289         called with INPUT->token being the first token of the expression,
7290         and returns with INPUT->token being the final token of the
7291         expression. Return value changed to void..
7292
7293         * examples/sexp-conv-test: Added test for transport mode input.
7294
7295         * examples/sexp-conv.c (sexp_get_char): Use the nettle_armor
7296         interface for decoding.
7297         (sexp_input_start_coding): New function.
7298         (sexp_input_end_coding): New function.
7299         (sexp_get_base64_string): Rewrote to use sexp_input_start_coding
7300         and sexp_input_end_coding.
7301         (sexp_get_token): Generate SEXP_TRANSPORT_START tokens.
7302         (sexp_convert_list): Lists are ended only by SEXP_LIST_END.
7303         (sexp_convert_item): Implemented transport mode, using
7304         sexp_input_start_coding and sexp_input_end_coding.
7305
7306 2002-10-30  Niels Möller  <nisse@cuckoo.hack.org>
7307
7308         * Makefile.am: Added base16 files.
7309
7310         * examples/sexp-conv-test: New tests for transport output.
7311
7312         * examples/sexp-conv.c: Deleted hex functions, moved to Nettle's
7313         base16 files.
7314         (struct sexp_output): Represent the current encoding as a
7315         nettle_armor pointer and a state struct.
7316         (sexp_output_init): Deleted MODE argument. Now passed to functions
7317         that need it.
7318         (sexp_get_char): Updated to new base64 conventions.
7319         (sexp_get_base64_string): Likewise.
7320         (sexp_put_raw_char): New function.
7321         (sexp_put_newline): Use sexp_put_raw_char.
7322         (sexp_put_char): Use nettle_armor interface for encoding data.
7323         Use OUTPUT->coding_indent for line breaking, so the INDENT
7324         argument was deleted.
7325         (sexp_put_code_start): New function, replacing sexp_put_base64_start.
7326         (sexp_put_code_end): New function, replacing sexp_put_base64_end.
7327         (sexp_put_data): Deleted argument INDENT.
7328         (sexp_puts): Likewise.
7329         (sexp_put_length): Likewise.
7330         (sexp_put_list_start): Likewise.
7331         (sexp_put_list_end): Likewise.
7332         (sexp_put_display_start): Likewise.
7333         (sexp_put_display_end): Likewise.
7334         (sexp_put_string): Likewise. Also changed base64 handling.
7335         (sexp_convert_string): Deleted argument INDENT. New argument
7336         MODE_OUT.
7337         (sexp_convert_list): New argument MODE_OUT.
7338         (sexp_convert_file): Likewise.
7339         (sexp_convert_item): Likewise. Also handle output in transport
7340         mode.
7341         (match_argument): Simple string comparison.
7342         (main): Adapted to above changes.
7343
7344         * testsuite/testutils.c (test_armor): Allocate a larger buffer
7345         CHECK, to make decode_update happy. Updated to new base64
7346         conventions.
7347
7348         * testsuite/base64-test.c (test_main): Fixed overlap test to not
7349         change the base64 before decoding. Updated to new base64
7350         conventions.
7351
7352         * testsuite/Makefile.am (TS_PROGS): Added base16-test.
7353
7354         * testsuite/base16-test.c: New test.
7355
7356         * sexp-transport.c (sexp_transport_iterator_first): Updated to new
7357         conventions for base64_decode_update and base64_decode_final.
7358
7359         * nettle-meta.h: Updated ascii armor declarations. New declaration
7360         for nettle_base16.
7361
7362         * base64-decode.c (base64_decode_single): Return -1 on error.
7363         Also keep track of the number of padding characters ('=') seen.
7364         (base64_decode_update): New argument dst_length. Return -1 on error.
7365         (base64_decode_status):  Renamed function...
7366         (base64_decode_final): ... to this.
7367
7368         * base64.h (struct base64_decode_ctx): Deleted STATUS attribute.
7369         Added PADDING attribute.
7370
7371         * base16.h, base16-encode.c, base16-decode.c, base16-meta.c: New
7372         files.
7373
7374 2002-10-28  Niels Möller  <nisse@cuckoo.hack.org>
7375
7376         * examples/sexp-conv.c (struct hex_decode_ctx): New hex decoding
7377         functions.
7378         (sexp_get_raw_char): New function.
7379         (sexp_get_char): Use sexp_get_raw_char.
7380
7381 2002-10-26  Niels Möller  <nisse@cuckoo.hack.org>
7382
7383         * examples/sexp-conv.c (sexp_put_length): Bugfix, don't output any
7384         leading zero.
7385         (main): Implemented -s option.
7386
7387         * examples/sexp-conv-test: Test for echo -n vs echo '\c'. Added a
7388         few tests for canonical output.
7389
7390 2002-10-25  Niels Möller  <niels@s3.kth.se>
7391
7392         * examples/sexp-conv.c (struct sexp_input): Deleted the mode from
7393         the state, that should be passed as argument to relevant
7394         functions. Instead, introduces enum sexp_coding, to say if base64
7395         coding is in effect.
7396         (struct sexp_output): Added coding attribute.
7397         (sexp_put_char): Use output->coding.
7398         (sexp_put_base64_start): Likewise.
7399         (sexp_put_base64_end): Likewise.
7400
7401         * base64-decode.c (base64_decode_single): Simplified, got rid of
7402         the done variable.
7403
7404 2002-10-25  Niels Möller  <nisse@cuckoo.hack.org>
7405
7406         * examples/sexp-conv.c (sexp_put_newline): Return void, die on
7407         error.
7408         (sexp_put_char, sexp_put_data, sexp_puts, sexp_put_length,
7409         sexp_put_base64_start, sexp_put_base64_end, sexp_put_string,
7410         sexp_put_list_start, sexp_put_list_end, sexp_put_display_start,
7411         sexp_put_display_end, sexp_convert_string, sexp_convert_list,
7412         sexp_skip_token): Likewise.
7413         (sexp_convert_item): Die on error.
7414
7415 2002-10-24  Niels Möller  <nisse@cuckoo.hack.org>
7416
7417         * examples/sexp-conv-test: Doesn't need echo -n anymore.
7418
7419         * examples/sexp-conv.c (die): New function.
7420         (struct sexp_input): Deleted field ITEM.
7421         (sexp_get_char): Die on failure, never return -1.
7422         (sexp_get_quoted_char): Likewise.
7423         (sexp_get_quoted_string): Die on failure, no returned value.
7424         (sexp_get_base64_string): Likewise.
7425         (sexp_get_token_string): Likewise.
7426         (sexp_get_string): Likewise.
7427         (sexp_get_string_length): Likewise.
7428         (sexp_get_token): Likewise.
7429         (sexp_convert_string): Adapted to sexp_get_token.
7430         (sexp_convert_list): Likewise.
7431         (sexp_convert_file): New function.
7432         (main): Use sexp_convert_file.
7433
7434 2002-10-23  Niels Möller  <nisse@cuckoo.hack.org>
7435
7436         * examples/Makefile.am (TS_PROGS): Added sexp-conv-test.
7437
7438         * examples/sexp-conv.c (sexp_input_init): Initialize input->string
7439         properly.
7440         (sexp_get_char): Fixed non-transport case.
7441         (sexp_get_quoted_char): Fixed default case.
7442         (sexp_get_token): Loop over sexp_get_char (needed for handling of
7443         white space). Don't modify input->level. Fixed the code that skips
7444         comments.
7445         (sexp_put_char): Fixed off-by-one bug in assertion.
7446         (sexp_put_string): Fixed escape handling for output of quoted
7447         strings.
7448         (sexp_convert_list): Prettier output, hanging indent after the
7449         first list element.
7450         (sexp_skip_token): New function.
7451         (sexp_convert_item): Use sexp_skip_token to skip the end of a
7452         "[display-type]".
7453
7454 2002-10-22  Niels Möller  <nisse@cuckoo.hack.org>
7455
7456         * examples/sexp-conv-test: New test program.
7457
7458         * examples/Makefile.am (noinst_PROGRAMS): Added sexp-conv.
7459
7460         * examples/sexp-conv.c (sexp_convert_list): New function.
7461         (sexp_convert_item): New function.
7462         (main): New function. Compiles and runs now, but doesn't work.
7463
7464         * base64-decode.c (base64_decode_single): New function.
7465         (base64_decode_update): Use base64_decode_single.
7466
7467         * examples/sexp-conv.c: Added output functions.
7468
7469 2002-10-21  Pontus Sköld  <pont@soua.net>
7470
7471         * base64-encode.c (base64_encode_raw): Fixed null statement
7472         amongst variable declarations, broke compilation for non C99
7473         compilers.
7474
7475 2002-10-21  Niels Möller  <nisse@lysator.liu.se>
7476
7477         * examples/sexp-conv.c: New sexp conversion program.
7478
7479 2002-10-21  Niels Möller  <niels@s3.kth.se>
7480
7481         * Makefile.am (libnettle_a_SOURCES): Added
7482         sexp-format-transport.c.
7483
7484         * sexp-transport.c (sexp_transport_iterator_first): New file and
7485         function.
7486         * sexp.h (sexp_transport_iterator_first): Added protoype.
7487
7488         * sexp.c (sexp_iterator_next): Abort if iterator type is boogus.
7489
7490 2002-10-19  Niels Möller  <nisse@cuckoo.hack.org>
7491
7492         * testsuite/testutils.c (test_armor): Updated to new armor
7493         conventions.
7494
7495         * testsuite/base64-test.c (test_main): Test BASE64_ENCODE_LENGTH
7496         and BASE64_DECODE_LENGTH. Updated test of base64_encode_raw (used
7497         to be base64_encode).
7498
7499         * base64.h (BASE64_ENCODE_LENGTH, BASE64_DECODE_LENGTH): Fixed and
7500         documented macros.
7501
7502         * base64-meta.c (base64_encode_length, base64_decode_length): New
7503         functions, corresponding to the macros with the same name.
7504
7505         * Makefile.am (libnettle_a_SOURCES): base64.c replaced by
7506         base64-encode.c and base64-decode.c.
7507
7508         * pgp-encode.c (pgp_armor): Use new base64 conventions.
7509
7510         * nettle-meta.h: Updated nettle_armor definitions.
7511
7512         * base64.h: Major reorganization.
7513
7514         * base64.c: Deleted file, contents moved to base64-encode.c or
7515         base64-decode.c.
7516
7517         * base64-encode.c: New file. New supporting both encode-at-once
7518         and streamed operation.
7519
7520         * base64-decode.c: New file.
7521
7522 2002-10-09  Niels Möller  <nisse@cuckoo.hack.org>
7523
7524         * testsuite/Makefile.am (TS_PROGS): Added dsa-keygen-test.
7525
7526         * dsa-keygen.c: Call the progress callback only if it's non-NULL.
7527
7528         * Makefile.am (libnettle_a_SOURCES): Added bignum-random.c and
7529         dsa-keygen.c.
7530
7531         * testsuite/testutils.c (test_dsa_key): New function to sanity
7532         check a dsa keypair.
7533
7534         * testsuite/dsa-test.c (test_main): Call dsa_test_key.
7535
7536         * testsuite/dsa-keygen-test.c: New test case.
7537
7538         * dsa.h (DSA_MINIMUM_BITS): New constant.
7539
7540         * bignum.h (nettle_mpz_random, nettle_mpz_random_size): Added
7541         prototypes.
7542
7543         * dsa-keygen.c: New file.
7544
7545         * bignum-random.c: New file.
7546         (nettle_mpz_random): New function, moved from...
7547         * dsa-sign.c (nettle_mpz_random): ... here. Also changed argument
7548         ordering and updated callers.
7549
7550         * bignum-random.c: (nettle_mpz_random_size): New function, renamed
7551         and moved here from...
7552         * rsa-keygen.c (bignum_random_size): ... here. Updated all
7553         callers.
7554
7555         * testsuite/testutils.c (test_dsa): Needs both public and private
7556         key as arguments.
7557
7558         * testsuite/dsa-test.c (test_main): Updated to changes of the
7559         private key struct.
7560
7561         * testsuite/Makefile.am (TS_PROGS): Added dsa-test.
7562
7563         * rsa-decrypt.c (rsa_decrypt): Constification.
7564         * rsa-encrypt.c (rsa_encrypt): Likewise.
7565         * rsa.c (rsa_compute_root): Likewise.
7566         * rsa_md5.c (rsa_md5_sign): Likewise.
7567         (rsa_md5_verify): Likewise.
7568         * rsa_sha1.c (rsa_sha1_sign): Likewise.
7569         (rsa_sha1_verify): Likewise.
7570
7571         * dsa-verify.c (dsa_verify): Use const for the public key
7572         argument.
7573
7574         * dsa-sign.c (dsa_sign): Needs the public key as argument, in
7575         addition to the private key. Use const.
7576
7577         * dsa.h (struct dsa_private_key): Don't include the public
7578         information here.
7579         * dsa.c (dsa_private_key_init, dsa_private_key_clear): Updated to
7580         new struct dsa_private_key.
7581
7582         * dsa-sign.c (dsa_sign): Bugfix, added missing mpz_init call.
7583
7584         * Makefile.am (libnettle_a_SOURCES): Added dsa files.
7585         (libnettleinclude_HEADERS): Added dsa.h.
7586
7587         * testsuite/testutils.c (test_dsa): New function.
7588
7589         * testsuite/dsa-test.c: New test.
7590
7591         * dsa.h, dsa.c, dsa-sign.c, dsa-verify.c: New files.
7592
7593         * nettle-meta.h: Moved the nettle_random_func and
7594         nettle_progress_func typedefs here...
7595         * rsa.h: ... from here.
7596
7597 2002-10-07  Niels Möller  <nisse@cuckoo.hack.org>
7598
7599         * sexp.h (enum sexp_type): Deleted SEXP_START.
7600
7601         * sexp.c (sexp_iterator_parse): New function, similar to the old
7602         sexp_iterator_next, but independent of the previous value of the
7603         iterator->type.
7604         (sexp_iterator_first): Use sexp_iterator_parse.
7605         (sexp_iterator_next): Likewise.
7606         (sexp_iterator_enter_list): Use sexp_iterator_parse. SEXP_START
7607         not needed anymore.
7608         (sexp_iterator_exit_list): Likewise.
7609
7610 2002-10-06  Niels Möller  <nisse@cuckoo.hack.org>
7611
7612         * sexp2rsa.c (get_value): No need to call sexp_iterator_next
7613         anymore.
7614
7615         * sexp.c (sexp_iterator_assoc): Advance the iterator to the
7616         element after a matching tag, before recording it.
7617         * testsuite/sexp-test.c (test_main): Updated test.
7618
7619         * testsuite/sexp-test.c (test_main): No need to call
7620         sexp_iterator_next after sexp_iterator_exit_list.
7621
7622         * sexp2rsa.c (rsa_keypair_from_sexp): No need to call
7623         sexp_iterator_next anymore.
7624
7625         * sexp.c (sexp_iterator_next): Updated to new sexp_iterator_exit_list.
7626         (sexp_iterator_exit_list): Return with iterator pointing to the
7627         element after the list.
7628         (sexp_iterator_check_type): Call sexp_iterator_next before
7629         returning.
7630         (sexp_iterator_check_types): Likewise.
7631         (sexp_iterator_assoc): Rearranged calls of sexp_iterator_next.
7632
7633         * sexp.c (sexp_iterator_enter_list): Call sexp_iterator_next to
7634         get to the first element of the list. Updated callers.
7635
7636         * base64.c (base64_encode_group): New function, used by openpgp
7637         armoring code.
7638
7639         * Makefile.am: Added openpgp files.
7640
7641         * sexp2rsa.c (rsa_keypair_from_sexp): Use sexp_iterator_first.
7642         * testsuite/sexp-test.c (test_main): Likewise.
7643
7644         * sexp.c (sexp_iterator_init): Made this function static.
7645         (sexp_iterator_first): New, friendlier, initialization function.
7646
7647         * pgp-encode.c: New file. Functions for writing openpgp data
7648         packets.
7649
7650         * pgp.h: New file, with pgp related declarations.
7651
7652         * rsa2openpgp.c (rsa_keypair_to_openpgp): New file, new function.
7653
7654 2002-10-04  Niels Möller  <niels@s3.kth.se>
7655
7656         * examples/rsa-keygen.c: Use malloc, instead of asprintf.
7657
7658 2002-10-03  Niels Möller  <nisse@cuckoo.hack.org>
7659
7660         * Released nettle-1.6.
7661
7662         * NEWS: Note the aes api change.
7663
7664         * examples/Makefile.am (EXTRA_DIST): Distribute setup-env and
7665         teardown-env.
7666
7667 2002-10-02  Niels Möller  <nisse@cuckoo.hack.org>
7668
7669         * examples/rsa-keygen.c (main): Comment on the lax security of the
7670         private key file.
7671
7672         * index.html: Added link to mailing list.
7673
7674 2002-10-02  Niels Möller  <niels@s3.kth.se>
7675
7676         * Makefile.am: Fixed assembler rules, and shared libraries.
7677
7678         * configure.ac: Fixed the enable-shared option.
7679
7680 2002-10-01  Niels Möller  <nisse@cuckoo.hack.org>
7681
7682         * configure.ac: New option --enable-shared, and a first attempt at
7683         building a shared library (*without* using libtool).
7684
7685         * Makefile.am: A first attempt at rules for building a shared
7686         libnettle.so.
7687
7688 2002-10-01  Niels Möller  <niels@s3.kth.se>
7689
7690         * examples/run-tests (test_program): Use basename.
7691
7692         * examples/teardown-env: Delete some more files.
7693
7694         * examples/run-tests (test_program): Strip directory part of
7695         displayed name.
7696
7697         * examples/Makefile.am (TS_PROGS): New variable. Run tests.
7698
7699         * examples/io.c (read_file): Bug fix, used to overwrite pointer.
7700
7701         * examples/rsa-keygen.c (main): Bug fix, private key wasn't
7702         written properly.
7703
7704         * testsuite/Makefile.am: Some cleanup of make check.
7705
7706         * examples/setup-env, examples/teardown-env: Test environment scripts.
7707         * examples/rsa-verify-test, examples/rsa-sign-test: New test cases.
7708
7709         * examples/run-tests: New file (copied from lsh testsuite).
7710
7711         * examples/Makefile.am: Use EXTRA_PROGRAMS and @RSA_EXAMPLES@.
7712
7713         * examples/rsa-sign.c: No need to include config.h. Use werror
7714         instead of fprintf.
7715         * examples/rsa-verify.c: Likewise.
7716         * examples/rsa-keygen.c: Likewise.
7717
7718         * examples/io.h: Forward declare struct rsa_public_key and struct
7719         rsa_private_key, to avoid dependences on config.h.
7720
7721         * configure.ac (RSA_EXAMPLES): New substituted variable,
7722         controlling which example programs to build.
7723
7724         * examples/rsa-verify.c: New example program.
7725
7726         * examples/rsa-keygen.c: Use functions from io.c.
7727         * examples/rsa-sign.c: Likewise.
7728
7729         * examples/Makefile.am (noinst_PROGRAMS): Added rsa-verify.
7730         (LDADD): Added io.o.
7731
7732         * configure.ac: New define WITH_PUBLIC_KEY, and new configure flag
7733         --disable-public-key. Updated rsa-files to check for that, rather
7734         than for HAVE_LIBGMP.
7735
7736         * examples/io.c, examples/io.c: New files. Miscellaneous functions
7737         used by the example programs.
7738
7739         * base64.h (BASE64_DECODE_LENGTH): Comment fix.
7740
7741 2002-09-30  Niels Möller  <nisse@cuckoo.hack.org>
7742
7743         * sexp2rsa.c (rsa_keypair_from_sexp): Bugfix: Call
7744         rsa_prepare_public_key and rsa_prepare_private_key.
7745
7746         * examples/Makefile.am (noinst_PROGRAMS): Added rsa-sign.
7747
7748         * examples/rsa-sign.c: New example program.
7749
7750         * testsuite/base64-test.c (test_main): Test encoding and decoding
7751         in place.
7752
7753         * base64.c (base64_encode): Encode from the end of the data
7754         towards the start, in order to support overlapping areas.
7755         (base64_encode): Broke out some common code from the switch..
7756
7757 2002-09-30  Niels Möller  <niels@s3.kth.se>
7758
7759         * sexp_format.c (sexp_format): Don't mix code and declarations.
7760
7761 2002-09-29  Niels Möller  <nisse@cuckoo.hack.org>
7762
7763         * testsuite/Makefile.am (TS_PROGS): Added buffer-test
7764         sexp-format-test rsa2sexp-test sexp2rsa-test.
7765
7766
7767         * testsuite/sexp-test.c (test_main): Updated calls to
7768         sexp_iterator_assoc.
7769
7770         * testsuite/testutils.h (MEMEQH): New macro.
7771
7772         * testsuite/sexp2rsa-test.c: New test.
7773         * testsuite/sexp-format-test.c: New test.
7774         * testsuite/rsa2sexp-test.c: New test.
7775         * testsuite/buffer-test.c: New test.
7776
7777         * testsuite/testutils.c (test_rsa_key): Copied this function
7778         from...
7779         testsuite/rsa-keygen-test.c: ... here.
7780
7781         * examples/rsa-keygen.c: New file.
7782
7783         * Makefile.am: Added new source files and headers buffer.h,
7784         buffer.c, sexp_format.c, sexp2rsa.c, rsa2sexp.c.
7785
7786         * rsa.h (rsa_keypair_to_sexp, rsa_keypair_from_sexp): New
7787         prototypes.
7788
7789         * rsa2sexp.c, sexp2rsa.c: New files.
7790
7791         * sexp.c (sexp_iterator_assoc): Don't enter the list, associate
7792         keys within the current list. Still exit the list when done.
7793         (sexp_iterator_assoc): Represent keys as plain NUL-terminated
7794         strings.
7795         (sexp_iterator_check_type, sexp_iterator_check_types): New
7796         functions.
7797
7798         * sexp_format.c: New file, implementing an sexp canonical syntax
7799         formatter.
7800
7801         * buffer.c, buffer.h: New files, implementing a bare-bones string
7802         stream.
7803
7804         * bignum.c (nettle_mpz_sizeinbase_256): New function.
7805
7806 2002-09-28  Niels Möller  <nisse@cuckoo.hack.org>
7807
7808         * sexp.c (sexp_iterator_assoc): Return 0 for missing or duplicate
7809         keys. Now passes all the tests.
7810
7811         * sexp.c (sexp_iterator_simple): Bugfixes. Check earlier that
7812         length doesn't grow too large.
7813         (sexp_iterator_next): Skip the current list only if type is
7814         SEXP_LIST. Handle ')'.
7815         (sexp_iterator_enter_list): Set type to SEXP_START.
7816         (sexp_iterator_exit_list): Likewise. Don't skip the ')' here.
7817         (sexp_iterator_assoc): Bug fix.
7818
7819         * testsuite/sexp-test.c (test_main): Reordered sexp_iterator_assoc
7820         tests.
7821
7822         * nettle.texinfo (Randomness): Documented that yarrow256_init can
7823         be called with a zero number of sources.
7824
7825         * testsuite/testutils.h (ASSERT): New macro.
7826
7827         * testsuite/sexp-test.c: Test sexp parser.
7828
7829         * Makefile.am (SUBDIRS): Added sexp files.
7830
7831         * sexp.c, sexp.h: New files, implementing an sexp-parser.
7832
7833 2002-08-27  Niels Möller  <niels@s3.kth.se>
7834
7835         * Makefile.am (DISTCLEANFILES): make distclean should delete the
7836         assembler-related symlinks.
7837
7838 2002-08-26  Niels Möller  <nisse@cuckoo.hack.org>
7839
7840         * Makefile.am (%.o: %.asm): Create an empty (and unused)
7841         dependency file, to make the make/automake dependency tracking
7842         happier.
7843
7844 2002-07-18  Niels Möller  <niels@s3.kth.se>
7845
7846         * examples/nettle-benchmark.c (main): Try openssl's ciphers as
7847         well, if available.
7848
7849         * Makefile.am (libnettle_a_SOURCES): Added nettle-openssl.c.
7850
7851         * nettle-openssl.c: New file.
7852
7853         * nettle-internal.h: Declare openssl glue ciphers.
7854
7855         * des-compat.h: Extra name-mangling, to avoid collisions in case a
7856         program links with both nettle and libcrypto (the nettle-benchmark
7857         program does).
7858
7859         * configure.ac: Don't use -ggdb3 with gcc-2.96.
7860         Check for openssl's libcrypto (for benchmarking).
7861
7862 2002-05-16  Niels Möller  <nisse@cuckoo.hack.org>
7863
7864         * sparc/aes.asm: Deleted registers i and t3.
7865         (_aes_crypt): Moved some registers around. We now use input
7866         registers only for arguments, local registers for loop invariants,
7867         output registers for temporaries and loop variables, and no global
7868         registers at all.
7869
7870         * sparc/aes.asm (AES_FINAL_ROUND): New macro.
7871         (_aes_crypt): Use AES_FINAL_ROUND for the first word of the final
7872         round.
7873         (_aes_crypt): And for the rest of the final round.
7874         (AES_FINAL_ROUND): Don't update dst, just access it offseted by i.
7875         (_aes_crypt): Add 16 to dst at the end of the final round.
7876         (AES_ROUND): Use ldub, not ld + and, to get the third byte
7877         of wtxt.
7878         (AES_ROUND): Use ldub, not lduh + and, to get the second
7879         byte of a word.
7880         (AES_ROUND): Reordered instructions, so that we can save one
7881         register.
7882         (AES_ROUND): Eliminated use of t3.
7883         (AES_FINAL_ROUND): Eliminated ands.
7884         (AES_FINAL_ROUND): Reordered, so that we can save one register.
7885         (AES_FINAL_ROUND): Eliminated t3.
7886         (AES_LOAD): New macro.
7887         (_aes_crypt): Unrolled source loop.
7888         (_aes_crypt): Use AES_LOAD macro.
7889         (_aes_crypt): Deleted cruft from the old source loop.
7890         (AES_LOAD): Eliminated t3.
7891
7892 2002-05-15  Niels Möller  <nisse@cuckoo.hack.org>
7893
7894         * sparc/aes.asm (AES_ROUND): New macro.
7895         (_aes_crypt): Use AES_ROUND for first word of the
7896         round function.
7897         (_aes_crypt): And for the rest of the round function.
7898
7899         * sparc/aes.asm (_aes_crypt): Deleted a bunch of additions,
7900         after accessing IDX1.
7901
7902         * aes-internal.h (struct aes_table): sparc_idx[0] should now
7903         contain index values shifted by the size of a word, and with 2
7904         added. This saves some additions in the sparc assembler code.
7905         Updates aes-encrypt-table.c and aes-decrypt-table.c.
7906
7907         * sparc/aes.asm (_aes_crypt): Unrolled final loop, preparing for
7908         optimizations.
7909         (_aes_crypt): Eliminated i from forst copy of the loop. Some
7910         cleanup.
7911         (_aes_crypt): And from second copy.
7912         (_aes_crypt): And from third.
7913         (_aes_crypt): And fourth.
7914         (_aes_crypt): Eliminated updates of i from the loop.
7915         (_aes_crypt): Access IDX1 and IDX3 through the T pointer, saving
7916         two registers.
7917
7918         * aes-internal.h (struct aes_table): Renamed the shift_idx field
7919         to sparc_idx, as it will be tweaked to improve the sparc code.
7920         Also reduced its size to [2][4].
7921         (IDX_FACTOR): Deleted constant.
7922         * aes-encrypt-table.c (_aes_encrypt_table): Adapted initializer of
7923         sparc_idx.
7924         * aes-decrypt-table.c (_aes_decrypt_table): Likewise.
7925         * asm.m4: Deleted AES_SIDX2, to match struct aes_table.
7926
7927         * sparc/aes.asm (_aes_crypt): Unrolled the inner loop, preparing
7928         for optimizations suggested by Marcus Comstedt.
7929         (_aes_crypt): Eliminated i from the first copy of the inner loop.
7930         (_aes_crypt): And from the second copy.
7931         (_aes_crypt): And from the third copy.
7932         (_aes_crypt): And from the fourth copy.
7933         (_aes_crypt): Renamed .Linner_loop to .Lround_loop.
7934         (_aes_crypt): Eliminated the loop variable i from the unrolled
7935         loop.
7936         (_aes_crypt): Deleted moves of constants into t2.
7937
7938 2002-05-15  Niels Möller  <niels@s3.kth.se>
7939
7940         * x86/aes-encrypt.asm (aes_encrypt): Use AES_SUBST_BYTE.
7941         * x86/aes-decrypt.asm (aes_decrypt): Likewise.
7942         (aes_decrypt): Use AES_STORE.
7943         (aes_decrypt): Deleted first xchgl instruction into, permuting the
7944         AES_ROUND calls instead.
7945         (aes_decrypt): Likewise for the final round.
7946         (aes_decrypt): Got rid if the xchgl instruction after the final
7947         round, folding it into the final round.
7948
7949         * x86/machine.m4: Renamed AES_LAST_ROUND to AES_FINAL_ROUND.
7950         Updated users.
7951
7952         * x86/aes-decrypt.asm (aes_decrypt): Use the AES_LOAD macro.
7953         (aes_decrypt): Start using AES_ROUND.
7954         (aes_decrypt): Use AES_LAST_ROUND.
7955
7956         * x86/aes-decrypt.asm (aes_decrypt): Moved function to a separate
7957         file...
7958         * x86/aes.asm: ... from here.
7959
7960         * x86/aes.asm (aes_decrypt): Use _aes_decrypt_table instead of
7961         itbl1-4. Commented out the inclusion of aes_tables.asm.
7962         (aes_decrypt): Use _aes_decrypt_table instead of isbox.
7963
7964
7965         * x86/aes-decrypt.asm: New file, empty at the start.
7966
7967         * Makefile.am (libnettle_a_SOURCES): Added aes-decrypt-table.c.
7968
7969         * aes-decrypt.c (_aes_decrypt_table): Moved from this file...
7970         * aes-decrypt-table.c (_aes_decrypt_table): ... to a new file.
7971
7972         * testsuite/aes-test.out: New file, with the output of
7973         testsuite/aes-test, when aes.c has been compiled with debugging
7974         printouts of intermediate state.
7975
7976 2002-05-15  Niels Möller  <nisse@cuckoo.hack.org>
7977
7978         * sparc/aes.asm: (_aes_crypt): Restore %fp at end of function, to
7979         make %fp available for other uses.
7980
7981         * sparc/aes.asm: The frame setup was broken. Tried to fix it.
7982         Reverted to revision 1.70 + minor changes from the head revision.
7983
7984         * x86/aes-encrypt.asm (aes_encrypt): Use test instead of cmpl $0,.
7985
7986         * x86/machine.m4 (AES_SUBST_BYTE): New macro.
7987
7988         * sparc/aes.asm: wtxt needs no register of it's own, as its
7989         pointed to by %sp. %g5 moved to %l0, the register previously
7990         allocated for wtxt, so that we stay clean of the reserved %g
7991         registers.
7992
7993 2002-05-14  Niels Möller  <nisse@cuckoo.hack.org>
7994
7995         * sparc/aes.asm: Avoid using %g6 and %g7, as they are reserved for
7996         operating sytem use. Use %i5 and %o7 instead. Also moved %g4 to %g1.
7997         (_aes_crypt): Allocate only 32 bytes local storage on the stack.
7998         Calculate wtxt and tmp using offsets from %sp, not %fp.
7999
8000 2002-05-14  Niels Möller  <niels@s3.kth.se>
8001
8002         * x86/aes-encrypt.asm (aes_encrypt): Replaced first quarter of the
8003         round function with an invocation of AES_ROUND.
8004         (aes_encrypt): Similarly for the second column.
8005         (aes_encrypt): Similarly for the rest of the round function.
8006
8007         * x86/machine.m4 (AES_ROUND): New macro.
8008
8009         * x86/aes-encrypt.asm (aes_encrypt): Use AES_LOAD macro.
8010
8011         * x86/machine.m4 (AES_LOAD): New macro.
8012
8013         * x86/aes-encrypt.asm (aes_encrypt): Use AES_STORE.
8014
8015         * x86/machine.m4 (AES_STORE): New macro.
8016
8017         * x86/aes-encrypt.asm (aes_encrypt): Use the AES_LAST_ROUND macro
8018         for the first column of the final round.
8019         (aes_encrypt): Similarly for the second column.
8020         (aes_encrypt): Similarly for the third and fourth column.
8021
8022         (aes_encrypt): Deleted xchgl instruction in final round, by
8023         reordering the second and fourth round.
8024
8025         * x86/machine.m4 (AES_LAST_ROUND): New macro.
8026
8027         * x86/aes-encrypt.asm (aes_encrypt): Move code here...
8028         * x86/aes.asm: ...from here.
8029
8030         * x86/aes.asm: Use addl and subl, not add and sub. Replaced
8031         references to dtbl1-4 with references to _aes_encrypt_table.
8032
8033         * configure.ac (asm_path): Enable x86 assembler.
8034
8035         * x86/aes.asm (aes_decrypt): Adapted to the current interface.
8036         Notably, the order of the subkeys was reversed. Single block
8037         encrypt/decrypt works now.
8038         (aes_encrypt, aes_decrypt): Added an outer loop, so that we can
8039         encrypt more than one block at a time.
8040
8041 2002-05-07  Niels Möller  <niels@s3.kth.se>
8042
8043         * configure.ac: Generate config.m4.
8044
8045         * x86/aes.asm: Use C for comments, include the tables using
8046         include_src, and commented out the key setup functions.
8047         Fixed the processing of the first handling of the round function.
8048         Now, encryption of a single block works! Multiple blocks, and
8049         decryption, is still broken.
8050
8051         * x86/machine.m4: New file (empty).
8052
8053         * x86/aes-encrypt.asm: New file, empty for now.
8054
8055         * Makefile.am (%.asm): Added asm.m4, machine.m4 and config.m4 to
8056         the m4 command line.
8057         (libnettle_a_SOURCES): Added aes-encrypt-table.c.
8058
8059         * sparc/aes.asm: No need to include asm.m4, that is taken care of
8060         by the Makefile.
8061
8062         * config.m4.in: New file, configuration for asm.m4.
8063
8064         * asm.m4 (C, include_src): New macros.
8065
8066         * aes-encrypt-table.c: New file, table moved out from
8067         aes-encrypt.c.
8068
8069 2002-05-06  Niels Möller  <niels@s3.kth.se>
8070
8071         * configure.ac (CFLAGS): Don't enable -Waggregate-return.
8072
8073 2002-05-05  Niels Möller  <nisse@lysator.liu.se>
8074
8075         * configure.ac: Pass no arguments to AM_INIT_AUTOMAKE.
8076
8077 2002-05-05  Niels Möller  <nisse@cuckoo.hack.org>
8078
8079         * configure.ac: Update for automake-1.6.
8080
8081         * configure.ac: Renamed file, used to be configure.in.
8082
8083 2002-03-20  Niels Möller  <nisse@cuckoo.hack.org>
8084
8085         * testsuite/run-tests (test_program): Added missing single quote.
8086
8087 2002-03-20  Niels Möller  <nisse@lysator.liu.se>
8088
8089         * testsuite/run-tests (test_program): Test the exit status of the
8090         right process.
8091
8092 2002-03-19  Pontus Sköld  <pont@it.uu.se>
8093
8094         * testsuite/run-tests: Removed /bin/bashisms to use with /bin/sh.
8095
8096 2002-03-18  Niels Möller  <nisse@cuckoo.hack.org>
8097
8098         * rsa-keygen.c (rsa_generate_keypair): Output a newline after a
8099         non-empty line of 'e':s (bad e was chosen, try again).
8100
8101 2002-03-16  Niels Möller  <nisse@cuckoo.hack.org>
8102
8103         * configure.in (asm_path): AC_CONFIG_LINKS adds $srcdir
8104         automatically.
8105
8106 2002-03-14  Niels Möller  <nisse@cuckoo.hack.org>
8107
8108         * sparc/aes.asm, x86/aes.asm: Added copyright notice.
8109
8110         * Makefile.am (libnettle_a_SOURCES): Added aes-internal.h.
8111         (EXTRA_DIST): Added assembler files.
8112
8113         * configure.in (asm_path): Use $srcdir when looking for the files.
8114         * configure.in (asm_path): For now, disable x86 assembler code.
8115         Bumped version to 1.6.
8116
8117 2002-02-25  Niels Möller  <nisse@cuckoo.hack.org>
8118
8119         * sparc/aes.asm (_aes_crypt): Moved increment of src into the
8120         source_loop. Also fixed stop condition, the loop was run 5 times,
8121         not 4, as it should.
8122         (_aes_crypt): Use src directly when accessing the source data,
8123         don't use %o5.
8124         (_aes_crypt): Renamed variables in source_loop.
8125         (_aes_crypt): Changed stop condition in source_loop to not depend
8126         on i. Finally reduced the source_loop to 16 instructions. Also
8127         increased the alignment of the code to 16.
8128         (_aes_crypt): In final_loop, use preshifted indices.
8129         (_aes_crypt): In final_loop, construct the result in t0. Use t0-t3
8130         for intermediate values.
8131         (_aes_crypt): In final_loop, use the register idx.
8132         (_aes_crypt): In final_loop, keep i multiplied by 4. Use key to
8133         get to the current roundkey.
8134         (_aes_crypt): In final_loop, use i for indexing.
8135         (_aes_crypt): Update dst in the output loop. This yields a delay
8136         slot that isn't filled yet.
8137         (_aes_crypt): Decrement round when looping, saving yet some
8138         instructions.
8139         (_aes_crypt): Reformatted code as blocks of four instructions
8140         each.
8141         (_aes_crypt): Copy the addresses of the indexing tables into
8142         registers at the start. No more need for the idx register.
8143         (_aes_crypt): Deleted idx register.
8144         (_aes_crypt): Some peep hole optimizations, duplicating some
8145         instructions to fill nop:s, and put branch instructions on even
8146         word addresses.
8147
8148 2002-02-22  Niels Möller  <nisse@cuckoo.hack.org>
8149
8150         * sparc/aes.asm (_aes_crypt): Moved some more additions out of the
8151         inner loop, using additional registers.
8152         (_aes_crypt): Deleted one more addition from the inner loop, by
8153         using the subkey pointer.
8154
8155 2002-02-19  Niels Möller  <nisse@cuckoo.hack.org>
8156
8157         * configure.in (asm_path): Renamed "path" to "asm_path". Also look
8158         for a machine.m4.
8159
8160 2002-02-16  Niels Möller  <nisse@cuckoo.hack.org>
8161
8162         * sparc/aes.asm: Use that IDX2(j) == j ^ 2
8163
8164         * Makefile.am (libnettle_a_SOURCES): Reordered aes-decrypt.c and
8165         aes-encrypt.c. For some strange reason it makes the benchmark go
8166         faster...
8167
8168         * sparc/aes.asm (_aes_crypt): Use double-buffering, and no
8169         separate loop for adding the round key.
8170         (round): Keep round index muliplied by 16, so it can be used
8171         directly for indexing the subkeys.
8172         (_aes_crypt): In the final loop, use ctx+round to access the
8173         subkeys, no need for an extra register.
8174
8175 2002-02-15  Niels Möller  <nisse@cuckoo.hack.org>
8176
8177         * sparc/aes.asm (_aes_crypt): Renaming variables, allocating
8178         locals starting from %l0.
8179         (_aes_crypt): Consistently use %l4, aka i, as the variable for the
8180         innermost loops.
8181         (_aes_crypt): Moved reading of ctx->nrounds out of the loop.
8182         (_aes_crypt): In final_loop, deleted a redundant mov, and use i as
8183         loop variable.
8184         (_aes_crypt): Started renumbering registers in the inner loop. The
8185         computation for the table[j] sub-expression should be kept in
8186         register %o[j].
8187         (_aes_crypt): Renamed more variables in the inner loop. Now the
8188         primary variables are t0, t1, t2, t3.
8189
8190         * sparc/aes.asm (_aes_crypt): Swapped register %i0 and %o5, %i1
8191         and %o0, %i2 and %o4, %i3 and %o3, %i4 and %o2.
8192         (_aes_crypt): wtxt was stored in both %l1 and %l2 for the entire
8193         function. Freed %l2 for other uses.
8194         (_aes_crypt): Likewise for tmp, freeing register %o1.
8195
8196         * sparc/machine.m4: New file, for sparc-specific macros.
8197
8198         * sparc/aes.asm (_aes_crypt): Hacked the source_loop, to get rid
8199         of yet another redundant loop variable, and one instruction.
8200         (_aes_crypt): Strength reduce loop variable in the
8201         inner loop, getting rid of one register.
8202         (_aes_crypt): Use pre-shifted indices (aes_table.idx_shift), to
8203         avoid some shifts in the inner loop.
8204         (_aes_crypt): Don't check for nrounds==0 at the start of the loop.
8205
8206         * asm.m4: Define and use structure-defining macros.
8207
8208         * Makefile.am (%.asm): Use a GNU pattern rule, to make %.o depend
8209         on both %.asm and asm.m4.
8210
8211         * aes-internal.h (struct aes_table): New subtable idx_shift.
8212         Updated tables in aes_encrypt.c and aes_decrypt.c.
8213
8214         * asm.m4: Use eval to compute values.
8215
8216         * sparc/aes.asm (_aes_crypt): Deleted commented out old version of
8217         the code.
8218
8219         * asm.m4: Added constants for individual rows of the aes table.
8220
8221         * aes.c (IDX0, IDX1, IDX2, IDX3): New macros, encapsualting the
8222         structure of the idx table.
8223
8224         * asm.m4: Define various aes struct offsets.
8225
8226         * testsuite/cbc-test.c (test_cbc_bulk): Use aes_set_encrypt_key
8227         and aes_set_decrypt_key.
8228
8229         * sparc/aes.asm (_aes_crypt): Use symbolic names for the fucntion
8230         arguments.
8231
8232 2002-02-14  Niels Möller  <nisse@cuckoo.hack.org>
8233
8234         * sparc/aes.asm: Copied gcc assembler code for _aes_crypt.
8235
8236         * aesdata.c: New program for generating AES-related tables.
8237
8238         * testsuite/testutils.c (print_hex): New function (moved from
8239         yarrow-test.c).
8240
8241         * testsuite/rsa-keygen-test.c (progress): Declare the ctx argument
8242         as UNUSED.
8243
8244         * testsuite/cbc-test.c (test_cbc_bulk): New function, testing CBC
8245         with larger blocks.
8246
8247         * yarrow256.c: Replaced uses of aes_set_key with
8248         aes_set_encrypt_key.
8249
8250         * nettle-meta.h (_NETTLE_CIPHER_SEP): New macro, useful for
8251         algorithms with separate encyption and decryption key setup.
8252
8253         * aes-internal.h (struct aes_table): New structure, including all
8254         constant tables needed by the unified encryption or decryption
8255         function _aes_crypt.
8256
8257         * aes.c (_aes_crypt): New function, which unifies encryption and
8258         decryption.
8259
8260         AES key setup now uses two separate functions for setting
8261         encryption and decryption keys. Applications that don't do
8262         decryption need no inverted subkeys and no code to generate them.
8263         Similarly, the tables (about 4K each for encryption and
8264         decryption), are put into separate files.
8265
8266         * aes.h (struct aes_ctx): Deleted space for inverse subkeys. For
8267         decryption, the inverse subkeys replace the normal subkeys, and
8268         they are stored _in the order they are used_.
8269
8270         * aes-set-key.c (aes_set_key): Deleted file, code moved...
8271         * aes-set-decrypt-key.c, aes-set-encrypt-key.c: New files,
8272         separated normal and inverse key setup.
8273
8274         * aes-tables.c: Deleted, tables moved elsewhere...
8275         * aes-encrypt.c, aes-decrypt.c: New files; moved encryption and
8276         decryption funktions, and needed tables, into separate files.
8277
8278 2002-02-13  Niels Möller  <nisse@cuckoo.hack.org>
8279
8280         * aes.c (aes_encrypt): Don't unroll the innerloop.
8281         (aes_encrypt): Don't unroll the loop for the final round.
8282         (aes_decrypt): Likewise, no loop unrolling.
8283
8284         * aes-set-key.c (aes_set_key): Reversed the order of the inverted
8285         subkeys. They are now stored in the same order as they are used.
8286
8287         * aes-tables.c (itable): New bigger table, generated by aesdata.c.
8288
8289         * aes.c (aes_decrypt): Rewrote to use the bigger tables.
8290
8291 2002-02-12  Niels Möller  <nisse@cuckoo.hack.org>
8292
8293         * aes.c (aes_encrypt): Interleave computation and output in the
8294         final round.
8295
8296         * aes-internal.h (AES_SMALL): New macro.
8297
8298         * aes.c (aes_encrypt): Optionally use smaller rotating inner loop.
8299
8300         * aes-tables.c (dtbl): Replaced with table generated by aesdata.
8301
8302         * aes.c (aes_encrypt): Rewrite, now uses larger tables in order to
8303         avoid rotates.
8304
8305         * sparc/aes.asm (aes_encrypt): Strength reduced on j, getting rid
8306         of one register and one instruction in the inner loop.
8307
8308         * sparc/aes.asm (idx, aes_encrypt): Multiplied tabled values by 4,
8309         making it possible to get rid of some shifts in the inner loop.
8310
8311         * configure.in: Fixed spelling of --enable-assembler. Commented
8312         out debug echo:s.
8313
8314         * asm.m4: New file. For now, only doing changequote and changecom.
8315
8316         * sparc/aes.asm (aes_encrypt): Added comments.
8317         (aes_encrypt): Cut off redundant instruction per block, also
8318         saving one redundant register pointing to idx.
8319         (idx_row): New macro. Include asm.m4.
8320
8321 2002-02-11  Niels Möller  <nisse@cuckoo.hack.org>
8322
8323         * sparc/aes.asm (key_addition_8to32): Cleaned up.
8324         Deleted gcc-generated debugging information.
8325
8326         * sparc/aes.asm (key_addition32): First attempt at optimization.
8327         Made it slower ;-)
8328
8329         * sparc/aes.asm (key_addition32): Unrolled loop, gained 4%
8330         speed, payed four instructions compared to gcc
8331         generated code.
8332
8333         * Makefile.am (.asm.o): New rule for assembling via m4.
8334         (libnettle_a_SOURCES): Added new rsa and aes files.
8335
8336         * configure.in: New command line option --enable-assembler.
8337         Selects assembler code depending on the host system.
8338
8339         * rsa-decrypt.c, rsa-encrypt.c: New files for rsa pkcs#1
8340         encryption.
8341
8342         * aes-set-key.c, aes-tables.c: New files, split off from aes.c.
8343         Tables are now not static, but use a _aes_ prefix on their names.
8344
8345         * aes-internal.h: New file.
8346
8347         * cast128-meta.c (_NETTLE_CIPHER_FIX): Use _NETTLE_CIPHER_FIX.
8348
8349         * cbc.c (cbc_decrypt_internal): New function, doing the real CBC
8350         procesing and requiring that src != dst.
8351         (cbc_decrypt): Use cbc_decrypt_internal. If src == dst, use a
8352         buffer of limited size to copy the ciphertext.
8353
8354         * nettle-internal.c (nettle_blowfish128): Fixed definition, with
8355         key size in bits.
8356
8357         * nettle-meta.h (_NETTLE_CIPHER_FIX): New macro, suitable for
8358         ciphers with a fixed key size.
8359
8360         * examples/nettle-benchmark.c (display): New function for
8361         displaying the results, including MB/s figures.
8362
8363         * sparc/aes.asm: New file. Not yet tuned in any way (it's just the
8364         code generated by gcc).
8365
8366 2002-02-11  Niels Möller  <nisse@lysator.liu.se>
8367
8368         * x86/aes.asm, x86/aes_tables.asm: New assembler implementation by
8369         Rafael Sevilla.
8370
8371 2002-02-06  Niels Möller  <nisse@cuckoo.hack.org>
8372
8373         Applied patch from Dan Egnor improving the base64 code.
8374         * base64.h (BASE64_ENCODE_LENGTH): New macro.
8375         (struct base64_ctx): New context struct, for decoding.
8376         (BASE64_DECODE_LENGTH): New macro.
8377         * base64.c (base64_decode_init): New function.
8378         (base64_decode_update): New function, replacing base64_decode.
8379         Takes a struct base64_ctx argument.
8380         * nettle-meta.h: Updated nettle_armor, and related typedefs and
8381         macros.
8382         * testsuite/testutils.c (test_armor): Updated.
8383         * configure.in: Use AC_PREREQ(2.50).
8384
8385 2002-02-01  Niels Möller  <nisse@cuckoo.hack.org>
8386
8387         * Released nettle-1.5.
8388
8389 2002-01-31  Niels Möller  <nisse@cuckoo.hack.org>
8390
8391         * acinclude.m4: Commented out gmp-related macros, they're probably
8392         not needed anymore.
8393
8394 2002-01-31  Niels Möller  <nisse@lysator.liu.se>
8395
8396         * configure.in: Added command line options --with-lib-path and
8397         --with-include-path. Use the RPATH-macros to get correct flags for
8398         linking the test programs with gmp.
8399
8400         * acinclude.m4: New file.
8401
8402 2002-01-31  Niels Möller  <nisse@cuckoo.hack.org>
8403
8404         * nettle.texinfo (Randomness): New subsection on Yarrow.
8405
8406 2002-01-30  Niels Möller  <nisse@cuckoo.hack.org>
8407
8408         * nettle.texinfo (Randomness): New chapter.
8409         Spell checking and ispell configuration.
8410
8411         * md5.c: Added reference to RFC 1321.
8412
8413 2002-01-24  Niels Möller  <nisse@cuckoo.hack.org>
8414
8415         * nettle.texinfo (Public-key algorithms): Minor fixes.
8416
8417 2002-01-22  Niels Möller  <nisse@cuckoo.hack.org>
8418
8419         * nettle.texinfo (Nettle soup): New chapter.
8420         (Hash functions): New subsection on struct nettle_hash.
8421         (Hash functions): New subsection on struct nettle_cipher.
8422         (Keyed hash functions): New section, describing MAC:s and HMAC.
8423         (Public-key algorithms): New chapter.
8424
8425         * testsuite/testutils.c (test_armor): New function.
8426
8427         * testsuite/base64-test.c: New testcase.
8428
8429         * testsuite/Makefile.am (TS_PROGS): Added base64-test.
8430
8431         * nettle-meta.h (struct nettle_armor): New struct.
8432
8433         * configure.in: Bumped version to 1.5.
8434
8435         * Makefile.am (libnettle_a_SOURCES): Added base64 files, and some
8436         missing header files.
8437
8438         * base64.c, base64.h, base64-meta.c: New files, hacked by Dan
8439         Egnor.
8440
8441 2002-01-16  Niels Möller  <nisse@cuckoo.hack.org>
8442
8443         * testsuite/yarrow-test.c: Deleted ran_array code, use
8444         knuth-lfib.h instead.
8445
8446         * testsuite/testutils.c (test_rsa_md5, test_rsa_sha1): Moved
8447         functions here...
8448         * testsuite/rsa-test.c: ...from here.
8449
8450         * testsuite/rsa-keygen-test.c: New file.
8451
8452         * testsuite/knuth-lfib-test.c: New file.
8453
8454         * Makefile.am (libnettle_a_SOURCES): Added knuth-lfib.c and
8455         rsa-keygen.c.
8456
8457         * rsa-keygen.c: New file.
8458
8459         * rsa.h (RSA_MINIMUM_N_OCTETS): New constant.
8460         (RSA_MINIMUM_N_BITS): New constant.
8461         (nettle_random_func, nettle_progress_func): New typedefs. Perhaps
8462         they don't really belong in this file.
8463         (rsa_generate_keypair): Added progress-callback argument.
8464
8465         * macros.h (READ_UINT24, WRITE_UINT24, READ_UINT16, WRITE_UINT16):
8466         New macros.
8467
8468         * knuth-lfib.c, knuth-lfib.h: New files, implementing a
8469         non-cryptographic prng.
8470
8471 2002-01-15  Niels Möller  <nisse@cuckoo.hack.org>
8472
8473         * hmac-sha1.c: New file.
8474
8475 2002-01-14  Niels Möller  <nisse@cuckoo.hack.org>
8476
8477         * configure.in: Bumped version to 1.1.
8478
8479         * testsuite/hmac-test.c (test_main): Added hmac-sha1 test cases.
8480
8481         * rsa.c (rsa_init_private_key, rsa_clear_private_key): Handle d.
8482
8483         * rsa.h (struct rsa_private_key): Reintroduced d attribute, to be
8484         used only for key generation output.
8485         (rsa_generate_keypair): Wrote a prototype.
8486
8487         * Makefile.am (libnettle_a_SOURCES): Added hmac-sha1.c and
8488         nettle-internal.h.
8489
8490         * des.c: Use static const for all tables.
8491         (des_set_key): Use a new const * variable for the parity
8492         procesing, for constness reasons.
8493
8494         * list-obj-sizes.awk: New file.
8495
8496         * nettle-internal.c, nettle-internal.h: New files.
8497
8498         * testsuite/Makefile.am (TS_PROGS): Added hmac-test. Deleted old
8499         m4-stuff.
8500
8501         * testsuite/testutils.h (LDATA): Moved this macro here,...
8502         * testsuite/rsa-test.c: ... from here.
8503
8504         * testsuite/hmac-test.c: New file.
8505
8506         * hmac.h: General cleanup. Added declarations of hmac-md5,
8507         hmac-sha1 and hmac-sha256.
8508
8509         * hmac.c: Bug fixes.
8510
8511         * hmac-md5.c: First working version.
8512
8513         * Makefile.am (libnettle_a_SOURCES): Added hmac.c and hmac-md5.c.
8514         (libnettleinclude_HEADERS): Added hmac.h.
8515
8516         * testsuite/rsa-test.c: Also test a 777-bit key.
8517
8518         * rsa.c (rsa_check_size): Changed argument to an mpz_t. Updated
8519         callers.
8520         (rsa_prepare_private_key): Compute the size of the key by
8521         computing n = p * q.
8522
8523         * rsa-compat.c: Adapted to new private key struct.
8524         * rsa_md5.c: Likesize.
8525         * rsa_sha1.c: Likesize.
8526
8527         * rsa.c (rsa_check_size): New function, for computing and checking
8528         the size of the modulo in octets.
8529         (rsa_prepare_public_key): Usa rsa_check_size.
8530         (rsa_init_private_key): Removed code handling n, e and d.
8531         (rsa_clear_private_key): Likewise.
8532         (rsa_compute_root): Always use CRT.
8533
8534         * rsa.h (struct rsa_private_key): Deleted public key and d from
8535         the struct, as they are not needed. Added size attribute.
8536
8537 2002-01-12  Niels Möller  <nisse@cuckoo.hack.org>
8538
8539         * Makefile.am: Added *-meta files.
8540
8541         * rsa.c (rsa_init_public_key): New function.
8542         (rsa_clear_public_key): Likewise.
8543         (rsa_init_private_key): Likewise.
8544         (rsa_clear_private_key): Likewise.
8545
8546         * aes-meta.c: New file.
8547         * arcfour-meta.c: New file.
8548         * cast128-meta.c: New file.
8549         * serpent-meta.c: New file.
8550         * twofish-meta.c: New file.
8551
8552         * examples/nettle-benchmark.c: Use the interface in nettle-meta.h.
8553
8554 2002-01-11  Niels Möller  <nisse@cuckoo.hack.org>
8555
8556         Don't use m4 for generating test programs, it's way overkill. Use
8557         the C preprocessor instead.
8558         * testsuite/*-test.c: New file.
8559
8560         * hmac.c, hmac.h, hmac-md5.c: New files.
8561
8562         Defined structures describing the algoriths. Useful for code that
8563         wants to treat an algorithm as a black box.
8564         * nettle-meta.h, md5-meta.c, sha1-meta.c, sha256-meta.c: New
8565         files.
8566
8567 2002-01-09  Niels Möller  <nisse@cuckoo.hack.org>
8568
8569         * rsa-compat.c: Updated for new md5 and rsa conventions.
8570
8571         * rsa_md5.c: Represent a signature as an mpz_t, not a string.
8572         Updated calls of md5 functions.
8573         * rsa_sha1.c: Likewise.
8574
8575         * rsa.c (rsa_prepare_public_key): Renamed function, was
8576         rsa_init_public_key.
8577         (rsa_prepare_private_key): Renamed function, was
8578         rsa_init_private_key.
8579
8580         * nettle.texinfo (Hash functions): Update for the changed
8581         interface without *_final. Document sha256.
8582
8583         * testsuite/md5-test.m4, testsuite/sha1-test.m4,
8584         testsuite/sha256-test.m4, testsuite/yarrow-test.c: Updated for new
8585         hash function interface.
8586
8587         * yarrow256.c: Removed calls of sha256_final and and some calls of
8588         sha256_init.
8589
8590         * md5-compat.c (MD5Final): Call only md5_digest.
8591
8592         * md5.c (md5_digest): Call md5_final and md5_init.
8593         (md5_final): Declared static.
8594         sha1.c, sha256.c: Analogous changes.
8595
8596         * bignum.c (nettle_mpz_get_str_256): Declare the input argument
8597         const.
8598
8599 2001-12-14  Niels Möller  <nisse@cuckoo.hack.org>
8600
8601         * Makefile.am (EXTRA_DIST): Added $(des_headers). Changed
8602         dependencies for $(des_headers) to depend only on the source file
8603         desdata.c, not on the executable.
8604
8605 2001-12-12  Niels Möller  <nisse@cuckoo.hack.org>
8606
8607         * testsuite/yarrow-test.c (main): Updated testcase to match fixed
8608         generator. Send verbose output to stdout, not stderr.
8609
8610         * yarrow256.c (yarrow_slow_reseed): Bug fix, update the fast pool
8611         with the digest of the slow pool.
8612         (yarrow256_init): Initialize seed_file and counter to zero, to
8613         ease debugging.
8614
8615 2001-12-07  Niels Möller  <nisse@cuckoo.hack.org>
8616
8617         * bignum.c (nettle_mpz_get_str_256): Fixed handling of leading
8618         zeroes.
8619
8620 2001-12-05  Niels Möller  <nisse@cuckoo.hack.org>
8621
8622         * testsuite/yarrow-test.c (main): Updated test to match the fixed
8623         key event estimator.
8624
8625         * yarrow_key_event.c (yarrow_key_event_estimate): Fixed handling
8626         of timing info.
8627
8628         * nettle.texinfo (Copyright): Say that under certain
8629         circumstances, Nettle can be used as if under the LGPL.
8630
8631         * README: Added a paragraph on copyright.
8632
8633 2001-11-15  Niels Möller  <nisse@cuckoo.hack.org>
8634
8635         * yarrow256.c (yarrow256_force_reseed): New function.
8636
8637 2001-11-14  Niels Möller  <nisse@ehand.com>
8638
8639         * testsuite/yarrow-test.c (main): Use yarrow256_is_seeded.
8640
8641         * yarrow256.c (yarrow256_needed_sources): New function.
8642         (yarrow256_is_seeded): New function.
8643         (yarrow256_update): Use yarrow256_needed_sources.
8644
8645 2001-11-14  Niels Möller  <nisse@cuckoo.hack.org>
8646
8647         * testsuite/yarrow-test.out: Updated, to match the seed-file aware
8648         generator.
8649
8650         * testsuite/yarrow-test.c: Updated expected_output. Check the seed
8651         file contents at the end.
8652
8653         * yarrow256.c (yarrow256_seed): New function.
8654         (yarrow_fast_reseed): Create new seed file contents.
8655
8656 2001-11-13  Niels Möller  <nisse@cuckoo.hack.org>
8657
8658         * yarrow.h: Deleted yarrow160 declarations.
8659
8660 2001-11-02  Niels Möller  <nisse@ehand.com>
8661
8662         * yarrow256.c (yarrow256_init): Fixed order of code and
8663         declarations.
8664
8665 2001-10-30  Niels Möller  <nisse@ehand.com>
8666
8667         * rsa-compat.h: Added real prototypes and declarations.
8668
8669         * Makefile.am (libnettle_a_SOURCES): Added rsa-compat.h and
8670         rsa-compat.c.
8671
8672         * rsa-compat.c: New file, implementing RSA ref signature and
8673         verification functions.
8674
8675         * configure.in: Check for libgmp. Deleted tests for SIZEOF_INT and
8676         friends.
8677
8678         * rsa_sha1.c: New file, PKCS#1 rsa-sha1 signatures.
8679         * rsa_md5.c: New file, PKCS#1 rsa-md5 signatures.
8680
8681         * rsa.c: New file with general rsa functions.
8682
8683         * Makefile.am (libnettle_a_SOURCES): Added rsa and bignum files.
8684
8685         * bignum.c, bignum.h: New file, with base256 functions missing in
8686         gmp.
8687
8688         * testsuite/Makefile.am: Added bignum-test.
8689
8690         * testsuite/run-tests (test_program): Check the exit code more
8691         carefully, and treat 77 as skip. This convention was borrowed from
8692         autotest.
8693
8694         * testsuite/macros.m4: New macro SKIP which exits with code 77.
8695
8696         * testsuite/bignum-test.m4: New file.
8697
8698 2001-10-15  Niels Möller  <nisse@ehand.com>
8699
8700         * testsuite/Makefile.am (EXTRA_DIST): Include rfc1750.txt in the
8701         distribution.
8702
8703 2001-10-14  Niels Möller  <nisse@cuckoo.hack.org>
8704
8705         * testsuite/des-test.m4: Added testcase taken from applied
8706         cryptography.
8707
8708         * testsuite/yarrow-test.c: Use sha256 instead of sha1 for checking
8709         input and output. Updated the expected values.
8710
8711         * yarrow256.c (YARROW_RESEED_ITERATIONS): New constant.
8712         (yarrow_iterate): New function.
8713         (yarrow_fast_reseed): Call yarrow_iterate.
8714
8715         * testsuite/yarrow-test.c: Added verbose flag, disabled by
8716         default.
8717
8718 2001-10-12  Niels Möller  <nisse@ehand.com>
8719
8720         * examples/nettle-benchmark.c: Added more ciphers.
8721
8722         * Makefile.am (SUBDIRS): Added the examples subdir.
8723
8724         * configure.in: Output examples/Makefile.
8725
8726 2001-10-12  Niels Möller  <nisse@cuckoo.hack.org>
8727
8728         * examples/nettle-benchmark.c: New benchmarking program.
8729
8730 2001-10-10  Niels Möller  <nisse@ehand.com>
8731
8732         * testsuite/yarrow-test.c: Open rfc1750.txt. Hash input and
8733         output, and compare to expected values.
8734
8735         * testsuite/Makefile.am (CFLAGS): Don't disable optimization.
8736         (run-tests): Set srcdir in the environment when running run-tests.
8737
8738         * testsuite/rfc1750.txt: Added this rfc as test input for yarrow.
8739
8740         * yarrow_key_event.c (yarrow_key_event_estimate): Check if
8741         previous is zero.
8742         (yarrow_key_event_init): Initialize previous to zero.
8743
8744         * yarrow256.c: Added debug some output.
8745
8746         * testsuite/yarrow-test.c (main): Better output of entropy
8747         estimates at the end.
8748
8749 2001-10-09  Niels Möller  <nisse@ehand.com>
8750
8751         * testsuite/Makefile.am (TS_PROGS): Added yarrow-test.
8752
8753         * testsuite/yarrow-test.c: New file.
8754
8755         * yarrow256.c (yarrow256_init): Initialize the sources.
8756         (yarrow256_random): Fixed loop condition.
8757
8758         * yarrow.h (YARROW_KEY_EVENT_BUFFER): New constant.
8759
8760         * yarrow_key_event.c: New file.
8761
8762         * Makefile.am (libnettle_a_SOURCES): Added yarrow_key_event.c.
8763
8764 2001-10-08  Niels Möller  <nisse@cuckoo.hack.org>
8765
8766         * yarrow.h (struct yarrow_key_event_ctx): New struct.
8767
8768         * yarrow256.c (yarrow_fast_reseed): Generate two block of output
8769         using the old key and feed into the pool.
8770
8771         * yarrow.h (struct yarrow256_ctx): Deleted buffer, index and
8772         block_count.
8773
8774         * yarrow256.c (yarrow_fast_reseed): New function.
8775         (yarrow_slow_reseed): New function.
8776         (yarrow256_update): Check seed/reseed thresholds.
8777         (yarrow_gate): New function, extracted from
8778         yarrow_generate_block_with_gate which was deleted.
8779         (yarrow_generate_block_with_gate): Deleted function.
8780         (yarrow256_random): Don't buffer any output, instead gate after
8781         each request.
8782         (YARROW_GATE_THRESHOLD): Deleted constant.
8783
8784 2001-10-07  Niels Möller  <nisse@cuckoo.hack.org>
8785
8786         * Makefile.am: Added yarrow files.
8787
8788         * yarrow256.c: New file, implementing Yarrow. Work in progress.
8789
8790         * sha256.c: New file, implementing sha256.
8791
8792         * testsuite/Makefile.am (CFLAGS): Added sha256-test.
8793
8794         * testsuite/sha256-test.m4: New testcases for sha256.
8795
8796         * shadata.c: New file, for generating sha256 constants.
8797
8798         * sha.h: Renamed sha1.h to sha.h, and added declarations for
8799         sha256.
8800
8801 2001-10-05  Niels Möller  <nisse@ehand.com>
8802
8803         * testsuite/aes-test.m4: Added a comment with NIST test vectors.
8804
8805 2001-10-04  Niels Möller  <nisse@ehand.com>
8806
8807         * rsa.h, rsa-compat.h, yarrow.h: New files.
8808
8809 2001-09-25  Niels Möller  <nisse@cuckoo.hack.org>
8810
8811         * Released version 1.0.
8812
8813 2001-09-25  Niels Möller  <nisse@ehand.com>
8814
8815         * sha1.c: Include stdlib.h, for abort.
8816
8817         * md5.c: Include string.h, for memcpy.
8818
8819         * testsuite/Makefile.am (M4_FILES): New variable. Explicitly list
8820         those C source files that should be generated by m4.
8821
8822         * configure.in: Changed package name from "libnettle" to "nettle".
8823
8824         * Makefile.am (EXTRA_DIST): Added .bootstrap.
8825
8826         * AUTHORS: Added a reference to the manual.
8827
8828 2001-09-25  Niels Möller  <nisse@lysator.liu.se>
8829
8830         * des-compat.c (des_cbc_cksum): Bug fix, local variable was
8831         declared in the middle of a block.
8832
8833 2001-09-19  Niels Möller  <nisse@cuckoo.hack.org>
8834
8835         * nettle.texinfo (Compatibility functions): New section,
8836         mentioning md5-compat.h and des-compat.h.
8837
8838 2001-09-18  Niels Möller  <nisse@ehand.com>
8839
8840         * index.html: New file.
8841
8842 2001-09-16  Niels Möller  <nisse@cuckoo.hack.org>
8843
8844         * nettle.texinfo: Added description of des3. Minor fixes.
8845
8846         * testsuite/des-compat-test.c (cbc_data): Shorten to 32 bytes (4
8847         blocks), the last block of zeroes wasn't used anyway.
8848
8849         * des-compat.c (des_compat_des3_decrypt): Decrypt in the right
8850         order.
8851         (des_ncbc_encrypt): Bug fixed.
8852         (des_cbc_encrypt): Rewritten as a wrapper around des_ncbc_encrypt.
8853
8854 2001-09-14  Niels Möller  <nisse@ehand.com>
8855
8856         * testsuite/des-compat-test.c: New file, copied from libdes
8857         (freeswan). All implemented functions but des_cbc_cksum seems to
8858         work now.
8859
8860         * testsuite/Makefile.am (TS_PROGS): Added des-compat-test.
8861
8862         * des-compat.c: Added libdes typedef:s. Had to remove all use of
8863         const in the process.
8864         (des_check_key): New global variable, checked by des_set_key.
8865
8866         * des.c (des_set_key): Go on and expand the key even if it is
8867         weak.
8868
8869         * des-compat.c (des_cbc_cksum): Implemented.
8870         (des_key_sched): Fixed return values.
8871
8872 2001-09-11  Niels Möller  <nisse@cuckoo.hack.org>
8873
8874         * Makefile.am: Added des-compat.c and des-compat.h
8875
8876         * des-compat.c: Bugfixes, more functions implemented.
8877
8878         * des-compat.h: Define DES_ENCRYPT and DES_DECRYPT. Bugfixes.
8879
8880 2001-09-10  Niels Möller  <nisse@ehand.com>
8881
8882         * nettle.texinfo (Copyright): Added copyright information for
8883         serpent.
8884         (Miscellaneous functions): Started writing documentation on the CBC
8885         functions.
8886         (Cipher Block Chaining): This section more or less complete now.
8887
8888 2001-09-09  Niels Möller  <nisse@cuckoo.hack.org>
8889
8890         * testsuite/cbc-test.m4: Record intermediate values in a comment.
8891         * testsuite/des3-test.m4: Likewise.
8892
8893         * testsuite/aes-test.m4: Added test case that appeared broken in
8894         the cbc test.
8895
8896         * cbc.c (cbc_encrypt): Bug fix, encrypt block *after* XOR:ing the
8897         iv.
8898
8899         * Makefile.am (libnettleinclude_HEADERS): Added cbc.h. Deleted
8900         des3.h.
8901         (libnettle_a_SOURCES): Added des3.c.
8902
8903         * testsuite/Makefile.am (TS_PROGS): Added des3-test and cbc-test.
8904
8905         * testsuite/cbc-test.m4: New testcase.
8906
8907         * testsuite/des3-test.m4: New testcase.
8908
8909         * cbc.h (CBC_CTX): New macro.
8910         (CBC_ENCRYPT): New macro.
8911         (CBC_DECRYPT): New macro.
8912
8913         * des.c (des_fix_parity): New function.
8914
8915         * des3.c: New file, implementing triple des.
8916
8917 2001-09-06  Niels Möller  <nisse@cuckoo.hack.org>
8918
8919         * cbc.c, cbc.h: New files, for general CBC encryption.
8920
8921         * des-compat.h: Added some prototypes.
8922
8923 2001-09-05  Niels Möller  <nisse@ehand.com>
8924
8925         * testsuite/Makefile.am (TS_PROGS): Added md5-compat-test.
8926
8927         * README: Copied introduction from the manual.
8928
8929         * configure.in: Bumped version to 1.0.
8930
8931         * Makefile.am (libnettleinclude_HEADERS): Added missing includes.
8932         (libnettle_a_SOURCES): Added md5-compat.c and md5-compat.h.
8933
8934         * md5-compat.c, md5-compat.h: New files, implementing an RFC
8935         1321-style interface.
8936
8937 2001-09-02  Niels Möller  <nisse@cuckoo.hack.org>
8938
8939         * twofish.c (twofish_decrypt): Fixed for();-bug in the block-loop.
8940         Spotted by Jean-Pierre.
8941         (twofish_encrypt): Likewise.
8942
8943 2001-07-03  Niels Möller  <nisse@ehand.com>
8944
8945         * testsuite/testutils.c: Include string.h.
8946
8947         * twofish.c: Include string.h.
8948
8949 2001-06-17  Niels Möller  <nisse@lysator.liu.se>
8950
8951         * Makefile.am (des_headers): Dont use $(srcdir)/-prefixes as that
8952         seems to break with GNU make 3.79.1.
8953
8954         * testsuite/testutils.c, testsuite/testutils.h: Use <inttypes.h>,
8955         not <stdint.h>.
8956         Include <stdlib.h>.
8957
8958 2001-06-17  Niels Möller  <nisse@cuckoo.hack.org>
8959
8960         * Use <inttypes.h>, not <stdint.h>.
8961
8962         * blowfish.h (BLOWFISH_MAX_KEY_SIZE): Fixed, should be 56.
8963
8964         * Fixed copyright notices.
8965
8966         * Makefile.am (libnettle_a_SOURCES): Added desinfo.h and
8967         desCode.h.
8968         (info_TEXINFOS): Added manual.
8969         (EXTRA_DIST): Added nettle.html.
8970         (%.html): Added rule for building nettle.html.
8971
8972         * nettle.texinfo: New manual.
8973
8974         * configure.in: Bumped version to 0.2.
8975
8976         * testsuite/Makefile.am (TS_PROGS): Added cast128 test.
8977
8978         * Added CAST128.
8979
8980         * testsuite/serpent-test.m4: Added a few rudimentary tests
8981         extracted from the serpent package.
8982
8983         * twofish.c: Adapted to nettle. Made constant tables const.
8984         Deleted bytes_to_word and word_to_bytes; use LE_READ_UINT32 and
8985         LE_WRITE_UINT32 instead.
8986         (twofish_selftest): Deleted. Moved the tests to the external
8987         testsuite.
8988         (twofish_set_key): Don't silently truncate too large keys.
8989
8990         * sha1.c (sha1_update): Use unsigned for length.
8991
8992         * serpent.c (serpent_set_key): Read the key backwards. Fixed
8993         padding (but there are no test vectors for key_size not a multiple
8994         of 4).
8995         (serpent_encrypt): Read and write data in the strange order used
8996         by the reference implementation.
8997         (serpent_decrypt): Likewise.
8998
8999         * macros.h (FOR_BLOCKS): New macro, taken from lsh.
9000
9001         * blowfish.h (struct blowfish_ctx): Use a two-dimensional array
9002         for s.
9003
9004         * blowfish.c (initial_ctx): Arrange constants into a struct, to
9005         simplify key setup.
9006         (F): Deleted all but one definitions of the F function/macro.
9007         Added a context argument, and use that to find the subkeys.
9008         (R): Added context argument, and use that to find the subkeys.
9009         (blowfish_set_key): Some simplification.
9010
9011         (encrypt): Deleted code for non-standard number of rounds. Deleted
9012         a bunch of local variables. Using the context pointer for
9013         everything should consume less registers.
9014         (decrypt): Likewise.
9015
9016         * Makefile.am (libnettle_a_SOURCES): Added twofish.
9017
9018 2001-06-16  Niels Möller  <nisse@cuckoo.hack.org>
9019
9020         * testsuite/blowfish-test.m4: Fixed test.
9021
9022         * Added twofish implementation.
9023
9024         * blowfish.h (struct blowfish_ctx): Use the correct size for the p
9025         array.
9026
9027 2001-06-15  Niels Möller  <nisse@ehand.com>
9028
9029         * testsuite/blowfish-test.m4: Fixed testcase, use correct key
9030         length.
9031
9032         * Makefile.am (libnettle_a_SOURCES): Added blowfish files.
9033         ($(des_headers)): Strip directory part when passing file name to
9034         desdata.
9035
9036         * testsuite/blowfish-test.m4: Added one test, from GNUPG.
9037
9038         * Created blowfish.c and blowfish.h (from GNUPG via LSH). Needs
9039         more work.
9040
9041         * aes.h: Fixed copyright notice to not mention GNU MP. XXX: Review
9042         all nettle copyrights.
9043
9044         * testsuite/Makefile.am (TS_PROGS): Added tests for twofish and
9045         blowfish.
9046
9047 2001-06-13  Niels Möller  <nisse@ehand.com>
9048
9049         * Makefile.am (libnettle_a_SOURCES): Added serpent files.
9050
9051 2001-06-12  Niels Möller  <nisse@cuckoo.hack.org>
9052
9053         * des.c (des_encrypt, des_decrypt): Assert that the key setup was
9054         successful.
9055
9056         * testsuite/Makefile.am (TS_PROGS): Added tests for des and sha1.
9057
9058         * testsuite/sha1-test.m4: New file.
9059
9060         * testsuite/des-test.m4: New file.
9061
9062         * Added sha1 files.
9063
9064         * Added desCore files.
9065
9066         * Makefile.am: Added desCore and sha1.
9067
9068 2001-04-17  Niels Möller  <nisse@cuckoo.hack.org>
9069
9070         * install-sh: Copied the standard install script.
9071
9072         * testsuite/Makefile.am (CFLAGS): Disable optimization. Add
9073         $(top_srcdir) to the include path.
9074         (EXTRA_DIST): Added testutils.h, testutils.c and run-tests.
9075         (run-tests): Fixed path to run-tests.
9076
9077         * Makefile.am (EXTRA_DIST): Added memxor.h.
9078         (libnettleinclude_HEADERS): Install headers in
9079         $(libnettleincludedir).
9080
9081 2001-04-13  Niels Möller  <nisse@cuckoo.hack.org>
9082
9083         * Initial checkin.