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