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