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