1 2014-08-06 Niels Möller <nisse@lysator.liu.se>
3 * gmp-glue.c (mpn_set_base256_le, mpn_get_base256_le): New functions.
4 * gmp-glue.h: Declare them.
6 2014-08-02 Niels Möller <nisse@lysator.liu.se>
8 * testsuite/curve25519-dh-test.c (curve25519_sqrt): Fixed memory
9 leak, a mpz_clear call was missing.
11 * ecc-internal.h (ECC_MUL_A_EH_WBITS): Set to 4, to enable
12 window-based scalar multiplication.
14 * ecc-mul-a-eh.c (table_init) [ECC_MUL_A_EH_WBITS > 0]: Fixed
15 initialization of TABLE(1).
17 2014-07-29 Niels Möller <nisse@lysator.liu.se>
19 * ecc-internal.h (ECC_MUL_A_EH_WBITS): New constant.
20 (ECC_A_TO_EH_ITCH, ECC_MUL_A_EH_ITCH): New macros.
21 * ecc-a-to-eh.c (ecc_a_to_eh, ecc_a_to_eh_itch): New file, new
23 * ecc-mul-a-eh.c: New file.
24 (ecc_mul_a_eh): New function. The case [ECC_MUL_A_EH_WBITS > 0]
26 (ecc_mul_a_eh_itch): New function.
27 * ecc.h: Declare new functions.
28 * Makefile.in (hogweed_SOURCES): Added ecc-a-to-eh.c and
31 * testsuite/curve25519-dh-test.c (curve25519_sqrt): New function.
32 (curve_25519): Use ecc_mul_a_eh.
33 (test_a): New function.
34 (test_main): Test construction of shared secret, using scalar
35 multiplication with points other than the fix generator.
37 2014-07-26 Niels Möller <nisse@lysator.liu.se>
39 * ecc-add-ehh.c (ecc_add_ehh): Reduce scratch need.
40 * ecc-internal.h (ECC_ADD_EHH_ITCH): Reduced to 7*size.
42 2014-07-23 Niels Möller <nisse@lysator.liu.se>
44 * testsuite/curve25519-dh-test.c: New test case, based on
45 draft-josefsson-tls-curve25519-05 test vectors.
46 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added curve25519-dh-test.c.
48 2014-07-18 Niels Möller <nisse@lysator.liu.se>
50 * ecc-mul-g-eh.c (ecc_mul_g_eh, ecc_mul_g_eh_itch): New file and
52 * ecc.h (ecc_mul_g_eh_itch): Declare new functions.
53 * ecc-internal.h (ECC_MUL_G_EH_ITCH): New macro.
54 * Makefile.in (hogweed_SOURCES): Added ecc-mul-g-eh.c.
56 2014-07-17 Niels Möller <nisse@lysator.liu.se>
58 * ecc-add-eh.c (ecc_add_eh): Reduce scratch need.
59 * ecc-internal.h (ECC_ADD_EH_ITCH): Reduced to 6*size.
61 * testsuite/curve25519-dup-test.c (test_main): Free allocated
64 2014-07-15 Niels Möller <nisse@lysator.liu.se>
66 * ecc-add-eh.c (ecc_add_eh, ecc_add_eh_itch): New file, new
68 * ecc.h: Declare new functions.
69 * ecc-internal.h (ECC_ADD_EH_ITCH): New macro.
70 * Makefile.in (hogweed_SOURCES): Added ecc-add-eh.c.
71 * testsuite/curve25519-add-test.c (test_main): Test ecc_add_eh.
72 Additional test for g2+g2. Free allocated storage.
74 2014-07-14 Niels Möller <nisse@lysator.liu.se>
76 * testsuite/curve25519-add-test.c: New test case.
77 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
78 curve25519-add-test.c.
80 * ecc-add-ehh.c (ecc_add_ehh, ecc_add_ehh_itch): New file, new
82 * ecc.h (ecc_add_ehh, ecc_add_ehh_itch): Declare them.
83 * ecc-internal.h (ECC_ADD_EHH_ITCH): New macro.
84 * Makefile.in (hogweed_SOURCES): Added ecc-add-ehh.c.
86 * ecc-25519.c (nettle_curve25519): Use ecc_d instead of ecc_b.
88 * eccdata.c: For curve25519, output the Edwards curve constant,
89 ecc_d = (121665/121666) mod p.
91 * testsuite/curve25519-dup-test.c (test_main): Add test for 4g.
92 Delete some left-over debug output.
94 2014-07-11 Niels Möller <nisse@lysator.liu.se>
96 * misc/ecc-formulas.tex: Some ECC notes.
98 * testsuite/curve25519-dup-test.c: New testcase.
99 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
100 curve25519-dup-test.c.
102 * testsuite/testutils.c (test_ecc_point): Made non-static.
103 * testsuite/testutils.h (struct ecc_ref_point): Moved here, from
105 (test_ecc_point): Declare it.
107 * ecc-dup-eh.c (ecc_dup_eh, ecc_dup_eh_itch): New file, new functions.
108 * ecc-eh-to-a.c (ecc_eh_to_a, ecc_eh_to_a_itch): New file, new
110 * ecc.h: Declare new functions.
111 * ecc-internal.h (ECC_EH_TO_A_ITCH, ECC_DUP_EH_ITCH): New macros.
112 * Makefile.in (hogweed_SOURCES): Added ecc-dup-eh.c and
115 * ecc-internal.h (struct ecc_curve): New constant edwards_root.
116 * ecc-192.c (nettle_secp_192r1): Updated accordingly, additional
118 * ecc-224.c (nettle_secp_224r1): Likewise.
119 * ecc-256.c (nettle_secp_256r1): Likewise.
120 * ecc-384.c (nettle_secp_384r1): Likewise.
121 * ecc-521.c (nettle_secp_521r1): Likewise.
122 * ecc-25519.c (nettle_curve25519): Initialize new constant.
124 * eccdata.c (ecc_curve_init): For curve 25519, use correct
125 constant for edwards coordinate transform, and output the constant
128 2014-07-06 Niels Möller <nisse@lysator.liu.se>
130 * eccdata.c: Use separate is_zero flag to represent the neutral
132 (output_point, output_point_redc): Unified to a single function,
133 with a use_redc flag argument. Also support conversion to Edwards
135 (ecc_curve_init_str): New argument for Edwards curve conversion
138 2014-07-04 Niels Möller <nisse@lysator.liu.se>
140 * ecc-25519.c: New file.
141 (ecc_25519_modp): New function.
142 (nettle_curve25519): New curve.
144 * ecc-curve.h (nettle_curve25519): Declare it.
146 * Makefile.in (hogweed_SOURCES): Added ecc-25519.c.
147 (ecc-25519.h): New generated file. Add as explicit dependency for
150 * testsuite/ecc-mod-test.c (test_curve): New function, extracted
151 from test_main. Tolerate NULL modq function pointer.
152 (test_main): Use test_curve, iterate over supported curves, and
153 also test curve_25519 for the new modp function.
155 2014-07-02 Niels Möller <nisse@lysator.liu.se>
157 * eccdata.c (ecc_dup): Use mpz_submul_ui, now available in
159 (ecc_type): New enum, for Weierstrass and Montgomery curves
160 (ecc_curve): New field type.
161 (ecc_dup): Support montgomery curves.
163 (ecc_curve_init_str): New argument, for the curve type.
164 (ecc_curve_init): Pass curve type to all ecc_curve_init_str calls.
165 Recognize curve25519, for bit_size 255.
166 (output_modulo): Deleted assert, which isn't true for curve25519.
168 2014-06-30 Niels Möller <nisse@lysator.liu.se>
170 * camellia-absorb.c: Include <limits.h>, needed for correct use of
171 HAVE_NATIVE_64_BIT. Reported and debugged by Magnus Holmgren.
172 Fixes debian build failure on s390x.
174 2014-06-26 Niels Möller <nisse@lysator.liu.se>
177 * configure.ac (IF_NOT_SHARED): New substituted variable.
178 * hogweed.pc.in: Use @LIBS@, instead of hardcoding -lgmp. When
179 shared libraries are disabled, move needed libraries from
180 Requires.private: to Requires: and from Libs.private: to Libs:.
182 From Nikos Mavrogiannopoulos.
183 * examples/hogweed-benchmark.c (bench_alg): Tolerate alg->init
185 (bench_openssl_ecdsa_init): Return NULL if
186 EC_KEY_new_by_curve_name fails, indicating the curve is not
189 2014-06-25 Niels Möller <nisse@lysator.liu.se>
191 Support for building with mini-gmp instead of the real GMP. Loosely
192 based on work by Nikos Mavrogiannopoulos.
193 * configure.ac: New command line option --enable-mini-gmp. Also
194 disable all libgmp-related checks when enabled.
195 (NETTLE_USE_MINI_GMP): New substituted variable.
196 (LIBHOGWEED_LIBS): Use $(LIBS) instead of -lgmp.
197 (IF_MINI_GMP): New Makefile conditional.
198 (GMP_NUMB_BITS): Alternative test for the mini-gmp case.
199 Substituted also in bignum.h.
200 (HAVE_MPZ_POWM_SEC): Drop this unused check.
202 * bignum.h: Renamed, to...
203 * bignum.h.in: New name.
204 (NETTLE_USE_MINI_GMP): Substituted by configure.
205 (GMP_NUMB_BITS): Substituted by configure, for the mini-gmp case.
207 * Makefile.in (OPT_HOGWEED_SOURCES): New variable, value
208 conditional on @IF_MINI_GMP@.
209 (hogweed_SOURCES): Add $(OPT_HOGWEED_SOURCES).
210 (PRE_CPPFLAGS): Add -I$(srcdir).
211 (HEADERS): Delete bignum.h.
212 (INSTALL_HEADERS): Add bignum.h. Also add mini-gmp.h, if mini-gmp
214 (DISTFILES): Added bignum.h.in.
215 (bignum.h): New target.
216 (distclean-here): Delete bignum.h.
218 * examples/ecc-benchmark.c (modinv_gcd) [NETTLE_USE_MINI_GMP]:
219 Disable this benchmark.
220 (mpn_random) [NETTLE_USE_MINI_GMP]: Provide a simple implementation.
222 * testsuite/ecc-mod-test.c [NETTLE_USE_MINI_GMP]: Skip test, it
223 depends on gmp_randstate_t.
224 * testsuite/ecc-modinv-test.c [NETTLE_USE_MINI_GMP]: Likewise.
225 * testsuite/ecc-mul-a-test.c [NETTLE_USE_MINI_GMP]: Likewise.
226 * testsuite/ecc-mul-g-test.c [NETTLE_USE_MINI_GMP]: Likewise.
227 * testsuite/ecc-redc-test.c [NETTLE_USE_MINI_GMP]: Likewise.
229 Various preparations for mini-gmp support.
230 * testsuite/bignum-test.c: Use WITH_HOGWEED instead of HAVE_LIBGMP
231 for preprocessor conditionals.
232 * testsuite/testutils.h: Likewise.
233 * testsuite/sexp-format-test.c: Likewise.
235 * testsuite/ecdsa-keygen-test.c (test_main): Use printf,
236 mpz_out_str and write_mpn instead of gmp_fprintf.
237 * testsuite/ecdsa-sign-test.c (test_ecdsa): Likewise.
238 * testsuite/ecdsa-verify-test.c (test_ecdsa): Likewise.
240 * dsa.h: Include bignum.h instead of gmp.h.
241 * ecc-internal.h: Likewise.
243 * gmp-glue.h: Likewise.
247 * testsuite/testutils.c (die): Use plain vfprintf, not
249 (write_mpn): New function.
250 (test_ecc_point): Use it, replacing gmp_fprintf.
251 * testsuite/testutils.h (write_mpn): Declare it.
253 * der-iterator.c: Deleted HAVE_LIBGMP conditionals.
255 2014-06-07 Niels Möller <nisse@lysator.liu.se>
257 * Released nettle-3.0
259 2014-06-04 Niels Möller <nisse@lysator.liu.se>
261 * NEWS: List des-compat.h as a candidate for removal in the next
264 * testsuite/des-compat-test.c (test_main): Fixed out of bounds
265 memory read, reported by Nikos Mavrogiannopoulos.
267 * nettle-write.h: Include <stddef.h>, fixing compilation on
270 * aclocal.m4 (ac_stdint): Fixed "unsinged" typo, spotted by Andy
273 2014-06-01 Niels Möller <nisse@lysator.liu.se>
275 * x86_64/gcm-hash8.asm: Pass correct argument count to W64_EXIT.
276 * x86_64/camellia-crypt-internal.asm: Pass correct argument count
277 to W64_ENTRY and W64_EXIT.
279 * x86_64/machine.m4 [W64_ABI]: Fix for the case of 6 function
280 arguments. Also push %rdi unconditionally, and use aligned
281 accesses for save and restore %xmm registers (movdqa).
283 2014-05-31 Niels Möller <nisse@lysator.liu.se>
285 * configure.ac: Check for COFF type directives.
286 (ASM_COFF_STYLE): New substituted variable.
287 * config.m4.in: Set COFF_STYLE from configure.
288 * asm.m4 (PROLOGUE): Use COFF type directive, if enabled by
289 configure. Fixes problem with windows dll linking.
291 * asm.m4: Deleted unused offsets for struct aes_ctx.
293 2014-05-28 Niels Möller <nisse@lysator.liu.se>
295 * testsuite/nettle-pbkdf2-test: Delete carriage return characters
298 * configure.ac (LIBHOGWEED_LIBS): Be explicit and link
299 libhogweed.so with libnettle.so, not -lnettle.
300 (LIBHOGWEED_LINK): Drop -L. flag, no longer needed, and previously
301 not at the correct position in the link command line.
303 2014-05-27 Niels Möller <nisse@lysator.liu.se>
305 * examples/ecc-benchmark.c: If mpn_sec_powm is available,
306 benchmark it, for modinv.
307 (bench_modinv_powm): New function.
308 (bench_curve): Use it.
310 2014-05-22 Niels Möller <nisse@lysator.liu.se>
313 * Makefile.in ($(des_headers)): Use the EXEEXT_FOR_BUILD.
315 2014-05-15 Niels Möller <nisse@lysator.liu.se>
317 * NEWS: Updated with library version numbers.
319 * configure.ac (dummy-dep-files): Use simpler and more portable
320 sed expression. Problem reported by Peter Eriksson.
321 (LIBHOGWEED_MAJOR): Bumped shared library version to 3.0.
322 (LIBHOGWEED_MINOR): Reset to zero. Also increased the package
323 version number to 3.0.
325 * getopt.c: Don't use gettext.
327 2014-05-14 Niels Möller <nisse@lysator.liu.se>
329 * testsuite/nettle-pbkdf2-test: Avoid the bash construction
332 * getopt.c: Copied from glibc tree, tag glibc-2.19.
333 * getopt.h: Likewise.
334 * getopt1.c: Likewise.
335 * getopt_int.h: New file, also copied from glibc.
336 * Makefile.in (DISTFILES): Added getopt_int.h.
338 2014-05-09 Niels Möller <nisse@lysator.liu.se>
340 * mini-gmp.c: Updated, use version from gmp-6.0.0.
341 * mini-gmp.h: Likewise.
343 * testsuite/Makefile.in (all): Drop dependency on $(TARGETS), to
344 delay building of test programs until make check.
346 2014-05-08 Niels Möller <nisse@lysator.liu.se>
348 * nettle.texinfo (nettle_aead abstraction): Document nettle_aead.
350 * Makefile.in (nettle_SOURCES): Added nettle-meta-aeads.c.
351 * nettle-meta.h (nettle_aeads): Declare array.
352 * nettle-meta-aeads.c (nettle_aeads): New file, new array.
353 * testsuite/meta-aead-test.c: New test case.
354 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
357 * aclocal.m4 (GMP_PROG_CC_FOR_BUILD): If CC_FOR_BUILD is gcc, add
358 -O option. This makes eccdata twice as fast.
360 2014-05-06 Niels Möller <nisse@lysator.liu.se>
362 * nettle.texinfo: Document SHA3 and ChaCha-Poly1305 as
365 2014-05-05 Niels Möller <nisse@lysator.liu.se>
367 * nettle.texinfo (POLY1305): Document poly1305-aes.
368 (Authenticated encryption): Move AEAD algorithms to their own
370 (RSA, DSA, ECDSA): Change some subsections to subsubsections.
371 (ChaCha-Poly1305): Document ChaCha-Poly1305.
373 2014-05-04 Niels Möller <nisse@lysator.liu.se>
375 * nettle.texinfo (DSA): Document new DSA interface.
376 (Salsa20): Update salsa20 docs.
377 (ChaCha): Document ChaCha.
379 2014-05-03 Niels Möller <nisse@lysator.liu.se>
381 * configure.ac: Check for SIZEOF_SIZE_T.
382 * ccm.c (ccm_set_nonce): Skip code for 64-bit encoding when size_t
385 * nettle.texinfo (CCM): Document new ccm macros and constants.
386 Describe ccm restrictions.
388 * ccm.h (CCM_DIGEST_SIZE): New constant.
390 2014-04-30 Niels Möller <nisse@lysator.liu.se>
392 * ccm.c (CCM_IV_MAX_SIZE, CCM_IV_MIN_SIZE): Deleted, replaced by
393 public constants CCM_MIN_NONCE_SIZE and CCM_MAX_NONCE_SIZE.
394 (ccm_build_iv): Updated for above rename.
395 (CCM_L_MAX_SIZE): Deleted, no longer used.
397 * ccm.h (CCM_MIN_NONCE_SIZE, CCM_MAX_NONCE_SIZE): New constants.
398 (CCM_MAX_MSG_SIZE): New macro.
400 2014-04-27 Niels Möller <nisse@lysator.liu.se>
402 * nettle.texinfo (Cipher modes): Subsection on AEAD constructions.
403 (GCM): Update GCM documentation, including functions for
404 gcm_aes128, gcm_camellia128, ...
406 2014-04-26 Niels Möller <nisse@lysator.liu.se>
408 * nettle.texinfo: Update for introduction of nettle_cipher_func.
409 (GCM): Document GCM_DIGEST_SIZE.
410 (UMAC): Document new UMAC constants.
411 (Keyed hash functions): Make HMAC and UMAC their own info nodes.
414 * umac.h (UMAC_MIN_NONCE_SIZE, UMAC_MAX_NONCE_SIZE): New
417 2014-04-25 Niels Möller <nisse@lysator.liu.se>
419 * All hash-related files: Renamed all _DATA_SIZE constants to
420 _BLOCK_SIZE, for consistency. Old names kept for backwards
423 * nettle.texinfo (CCM): Documentation for CCM mode, contributed by
426 * testsuite/ccm-test.c (test_cipher_ccm): And tests.
428 * ccm.c (ccm_decrypt_message): Change length argument, should now
429 be clear text (dst) length.
430 * ccm-aes128.c (ccm_aes128_decrypt_message): Likewise.
431 * ccm-aes192.c (ccm_aes192_decrypt_message): Likewise.
432 * ccm-aes256.c (ccm_aes256_decrypt_message): Likewise.
433 * ccm.h: Updated prototypes.
435 2014-04-22 Niels Möller <nisse@lysator.liu.se>
437 * nettle.texinfo (Recommended hash functions): Document additional
440 * sha2.h (sha512_224_ctx, sha512_256_ctx): New aliases for the
441 sha512_ctx struct tag.
443 2014-04-17 Niels Möller <nisse@lysator.liu.se>
445 * examples/Makefile.in (SOURCES): Deleted next-prime.c (forgotten
446 in 2014-04-13 change).
448 2014-04-16 Niels Möller <nisse@lysator.liu.se>
450 * testsuite/ccm-test.c (test_cipher_ccm): Deleted check for NULL
453 * sha3-224.c (sha3_224_init): Pass pointer to context struct, not
454 pointer to first element, to memset.
455 * sha3-256.c (sha3_256_init): Likewise.
456 * sha3-384.c (sha3_384_init): Likewise.
457 * sha3-512.c (sha3_512_init): Likewise.
459 * examples/eratosthenes.c (vector_alloc): Use sizeof(*vector)
460 instead of explicit type in malloc call.
461 (vector_init): Make constant explicitly unsigned long.
463 * tools/input.c (sexp_get_quoted_char): Deleted useless for loop.
465 2014-04-13 Niels Möller <nisse@lysator.liu.se>
467 * rsa-compat.c: Deleted file.
468 * rsa-compat.h: Deleted file.
469 * Makefile.in (hogweed_SOURCES): Deleted rsa-compat.c.
470 (HEADERS): Deleted rsa-compat.h.
472 * examples/next-prime.c: Deleted file.
473 * bignum-next-prime.c (nettle_next_prime): Deleted file and
475 * prime-list.h: Deleted file.
476 * bignum.h (nettle_next_prime): Deleted prototype.
477 * Makefile.in (hogweed_SOURCES): Deleted bignum-next-prime.c.
478 (DISTFILES): Deleted prime-list.h.
479 * examples/Makefile.in (HOGWEED_TARGETS): Deleted next-prime, and
480 corresponding make target.
482 2014-04-12 Niels Möller <nisse@lysator.liu.se>
484 * nettle.texinfo (Copyright): Updated licensing info.
487 * Makefile.in (DISTFILES): Distribute new COPYING* files.
489 * COPYING.LESSERv3: New file.
490 * COPYINGv3: New file.
491 * COPYING.LIB: Deleted.
492 * COPYINGv2: New name for GPL version 2 file.
493 * COPYING: Old name, deleted.
495 * Update license headers for LGPL3+ and GPL2+ dual licensing.
497 2014-04-11 Niels Möller <nisse@lysator.liu.se>
499 * testsuite/testutils.c (test_aead): Use aead->digest_size.
501 * configure.ac: Skip GMP tests if public key support is disabled.
503 * eax.c (block16_xor): Fixed bug effecting 32-bit platforms.
505 * Makefile.in (DISTFILES): Deleted memxor.c, already included via
507 * tools/Makefile.in (SOURCES): Add nettle-pbkdf2.c.
509 2014-04-10 Niels Möller <nisse@lysator.liu.se>
511 From Nikos Mavrogiannopoulos:
512 * examples/hogweed-benchmark.c (bench_openssl_ecdsa_init): Support
513 for secp192r1 and secp256r1.
514 (alg_list): Add them.
516 2014-04-09 Niels Möller <nisse@lysator.liu.se>
518 * examples/nettle-benchmark.c (main): Benchmark sha512_224 and
521 * testsuite/sha512-224-test.c: New file.
522 * testsuite/sha512-256-test.c: New file.
523 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new files.
525 * nettle-meta.h (nettle_sha512_224, nettle_sha512_256): Declare.
526 * sha512-224-meta.c (nettle_sha512_224): New file, new nettle_hash.
527 * sha512-256-meta.c (nettle_sha512_256): New file, new nettle_hash.
529 * sha2.h (SHA512_224_DIGEST_SIZE, SHA512_224_DATA_SIZE)
530 (SHA512_256_DIGEST_SIZE, SHA512_256_DATA_SIZE): New constants.
532 * sha512.c (sha512_256_digest): Typo fix, call sha512_256_init.
534 * testsuite/testutils.c (test_hash): Removed redundant init call.
535 Tests that digest implies init.
537 2014-03-28 Niels Möller <nisse@lysator.liu.se>
539 * testsuite/dsa-keygen-test.c (test_main): Explicitly use
540 dsa_compat_generate_keypair.
541 (test_main): Test dsa_generate_params and dsa_generate_keypair
542 with a large q; p_bits = 1024, q_bits = 768.
544 * testsuite/testutils.h: Undo dsa-compat.h name mangling.
546 * dsa-keygen.c (dsa_generate_keypair): New interface, generating
547 only a keypair, and no new parameters.
548 * dsa-compat-keygen.c (dsa_compat_generate_keypair): New file.
549 Moved old key generation function here. Use dsa_generate_keypair.
551 2014-03-27 Niels Möller <nisse@lysator.liu.se>
553 * dsa-compat.c (dsa_public_key_init, dsa_public_key_clear)
554 (dsa_private_key_init, dsa_private_key_clear): : Move deprecated
555 DSA functions to a separate file...
556 * dsa.c: ...from here.
557 * dsa-compat.h: New file, declaring deprecated DSA interface.
558 Include in corresponding C files.
559 * Makefile.in (hogweed_SOURCES): Add dsa-compat.c.
560 (HEADERS): Add dsa-compat.h.
562 * dsa-gen-params.c (dsa_generate_params): New file and function,
563 extracted from DSA key generation.
564 * dsa-keygen.c (dsa_generate_keypair): Use dsa_generate_params.
566 2014-03-26 Niels Möller <nisse@lysator.liu.se>
568 * der2dsa.c (dsa_params_from_der_iterator): Converted to new DSA
569 interface. Allow q_size == 0, meaning any q < p is allowed.
570 Additional validity checks.
571 (dsa_public_key_from_der_iterator): Converted to new DSA
572 interface. Also check that the public value is in the correct
574 (dsa_openssl_private_key_from_der_iterator): Converted
575 to new DSA interface. Additional validity checks.
576 (dsa_openssl_private_key_from_der): Converted to new DSA
578 * tools/pkcs1-conv.c (convert_dsa_private_key): Update to use
579 struct dsa_params, and adapt to the der decoding changes.
580 (convert_public_key): Likewise.
582 * examples/hogweed-benchmark.c: Update dsa benchmarking to use new
585 * dsa.c (dsa_params_init, dsa_params_clear): New functions.
586 (dsa_public_key_init): Use dsa_params_init.
587 (dsa_public_key_clear): Use dsa_params_clear.
589 * sexp2dsa.c (dsa_keypair_from_sexp_alist): Converted to new DSA
590 interface. Allow q_size == 0, meaning any q < p is allowed.
591 Additional validity checks.
592 (dsa_sha1_keypair_from_sexp, dsa_sha256_keypair_from_sexp):
593 Converted to new DSA interface.
595 * dsa2sexp.c (dsa_keypair_to_sexp): Converted to new DSA
597 * tools/pkcs1-conv.c: Updated uses of dsa_keypair_to_sexp.
599 * dsa.h (struct dsa_params): New struct.
601 * dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
603 * dsa-verify.c (dsa_verify): Likewise.
604 * dsa-sha1-verify.c (dsa_sha1_verify_digest, dsa_sha1_verify): Use
605 dsa_verify, cast the struct dsa_public_key * input to a struct
607 * dsa-sha256-verify.c (dsa_sha256_verify_digest)
608 (dsa_sha256_verify): Likewise.
609 * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise
610 use dsa_sign, with a cast from struct dsa_public_key * to struct
612 * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
615 * testsuite/testutils.c (test_dsa_verify): Use struct dsa_params.
616 (test_dsa_key): Likewise.
617 * testsuite/dsa-test.c (test_main): Adapt to test_dsa_key and
618 test_dsa_verify changes.
619 * testsuite/dsa-keygen-test.c (test_main): Adapt to
622 * testsuite/testutils.c (test_dsa_sign): #if out, currently
625 2014-03-23 Niels Möller <nisse@lysator.liu.se>
630 * ccm-aes128.c: New file.
631 * ccm-aes192.c: New file.
632 * ccm-aes256.c: New file.
633 * Makefile.in (nettle_SOURCES): Added ccm source files.
634 (HEADERS): Added ccm.h.
635 * testsuite/ccm-test.c: New file.
636 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added ccm-test.c.
638 2014-03-20 Niels Möller <nisse@lysator.liu.se>
640 From Joachim Strömbergson:
641 * sha512.c (K): Indentation fix.
642 (sha512_224_init, sha512_224_digest, sha512_256_init)
643 (sha512_256_digest): New functions.
644 * sha2.h: Add prototypes.
645 (sha512_224_update, sha512_256_update): New aliases for
648 2014-03-18 Niels Möller <nisse@lysator.liu.se>
650 * examples/nettle-benchmark.c (main): Add benchmarking of arcfour,
651 salsa20 and chacha, via time_aead.
653 * nettle-internal.c (nettle_arcfour128): Define, as a struct
654 nettle_aead (with NULL set_nonce, update, and digest methods).
655 * examples/nettle-openssl.c (nettle_openssl_arcfour128): Likewise.
656 * nettle-internal.h (nettle_arcfour128)
657 (nettle_openssl_arcfour128): Declare.
659 * nettle-types.h (nettle_cipher_func): New typedef, similar to
660 nettle_crypt_func, but with a const context, intended for block
662 * nettle-meta.h (struct nettle_cipher): Use the nettle_cipher_func
664 * Many other files affected: aes*-meta.c, camellia*-meta.c,
665 cast128-meta.c, serpent-meta.c, twofish-meta.c, cbc.[ch],
666 ctr.[ch], ctr.[ch], des-compat.c, eax.[ch], gcm*.[ch],
667 nettle-internal.*, testsuite/aes-test.c,
668 examples/nettle-benchmark.c, examples/nettle-openssl.c.
670 2014-03-16 Niels Möller <nisse@lysator.liu.se>
672 * chacha-set-key.c: Include string.h.
674 * arcfour-meta.c: Deleted file.
675 * nettle-meta.h (nettle_arcfour128): Deleted declaration.
676 * nettle-meta-ciphers.c (nettle_ciphers): Deleted
677 nettle_arcfour128 from list.
678 * Makefile.in (nettle_SOURCES): Deleted arcfour-meta.c.
679 * examples/nettle-openssl.c (nettle_openssl_arcfour128): Deleted.
680 * testsuite/meta-cipher-test.c: Adjust test for removal of
683 2014-03-15 Niels Möller <nisse@lysator.liu.se>
685 * examples/nettle-benchmark.c (struct bench_aead_info): New
687 (bench_aead_crypt, bench_aead_update, init_nonce, time_aead): New
688 functions, for benchmarking aead algorithms.
689 (time_gcm, time_eax): Deleted functions.
690 (main): Use time_aead to benchmark gcm, eax and chacha-poly1305.
692 * salsa20.h (SALSA20_NONCE_SIZE): Renamed constant, old name
693 SALSA20_IV_SIZE kept as an alias.
694 (salsa20_set_nonce): Update prototype for the 2014-01-20 rename.
696 * Makefile.in (.asm.s): Add dependencies.
697 (.s.o, .s.po): Empty any dependency .d file.
699 2014-03-04 Niels Möller <nisse@lysator.liu.se>
701 * testsuite/chacha-test.c (test_main): Additional test cases, for
704 * Makefile.in (nettle_SOURCES): Deleted chacha128-set-key.c and
707 * chacha.h (CHACHA256_KEY_SIZE): Deleted.
708 (chacha_set_key): Updated prototype.
709 * chacha256-set-key.c (chacha256_set_key): Deleted file and
710 function, moved to...
711 * chacha-set-key.c (chacha_set_key): Do 256-bit keys only. Deleted
712 length argument. Updated all callers.
714 * chacha128-set-key.c (chacha128_set_key): Deleted file and
715 function. Support for 128-bit chacha keys may be reintroduced
716 later, if really needed.
717 * chacha.h: Deleted chacha128-related declarations.
718 * chacha-set-key.c (chacha_set_key): Drop support for 128-bit
720 * testsuite/chacha-test.c (test_main): #if:ed out all tests with
723 2014-02-16 Niels Möller <nisse@lysator.liu.se>
725 * gcm.h: Declarations for gcm-camellia256.
726 * gcm-camellia256.c: New file.
727 * gcm-camellia256-meta.c: New file.
728 * nettle-meta.h (nettle_gcm_camellia256): Declare.
729 * Makefile.in (nettle_SOURCES): Added gcm-camellia256.c and
730 gcm-camellia256-meta.c.
731 * testsuite/gcm-test.c (test_main): Test cases for
732 nettle_gcm_camellia256.
734 * gcm.h: Include camellia.h. Declarations for gcm-camellia128.
735 * gcm-camellia128.c: New file.
736 * gcm-camellia128-meta.c: New file.
737 * nettle-meta.h (nettle_gcm_camellia128): Declare.
738 * Makefile.in (nettle_SOURCES): Added gcm-camellia128.c and
739 gcm-camellia128-meta.c.
740 * testsuite/gcm-test.c (test_main): Test cases for
741 nettle_gcm_camellia128. From Nikos Mavrogiannopoulos.
743 2014-02-13 Niels Möller <nisse@lysator.liu.se>
745 * Makefile.in (nettle_SOURCES): Added eax-aes128.c
747 * examples/nettle-benchmark.c: Include eax.h.
748 * nettle-meta.h (nettle_eax_aes128): Declare, moved from
750 * eax.h: Declare eax_aes128_ctx and related functions. Moved from
752 (EAX_IV_SIZE): New constant.
753 * eax-aes128-meta.c (nettle_eax_aes128): Moved definition to new
755 * eax-aes128.c (eax_aes128_set_key, eax_aes128_set_nonce)
756 (eax_aes128_update, eax_aes128_encrypt, eax_aes128_decrypt)
757 (eax_aes128_digest): Moved functions to a new file.
758 * nettle-internal.c: ... from old location.
759 * nettle-internal.h: Moved eax declarations elsewhere.
761 * tools/nettle-pbkdf2.c (main): Added missing deallocation.
763 2014-02-12 Niels Möller <nisse@lysator.liu.se>
765 * chacha-poly1305.h: New file.
766 * chacha-poly1305.c: New file.
767 * chacha-poly1305-meta.c (nettle_chacha_poly1305): New file, new
769 * nettle-meta.h (nettle_chacha_poly1305): Declare.
771 * Makefile.in (nettle_SOURCES): Added chacha-poly1305.c and
772 chacha-poly1305-meta.c.
773 (HEADERS): Added chacha-poly1305.h.
775 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
776 chacha-poly1305-test.c.
777 * testsuite/chacha-poly1305-test.c: New file.
779 * nettle-meta.h (struct nettle_aead): New generalized version
781 (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256)
782 (nettle_eax_aes128): Declare, moved from nettle-internal.h.
783 * nettle-internal.h (struct nettle_aead): Deleted struct, moved to
784 nettle-meta.h. Deleted declarations of unused instances.
785 (_NETTLE_AEAD): Deleted macro.
786 * nettle-internal.c (nettle_eax_aes128): Updated for new
788 (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256):
789 Deleted, moved to new files.
790 * gcm-aes128-meta.c (nettle_gcm_aes128): Moved to new file,
791 updated for new nettle_aead struct.
792 * gcm-aes192-meta.c (nettle_gcm_aes192): Likewise.
793 * gcm-aes256-meta.c (nettle_gcm_aes256): Likewise.
794 * testsuite/testutils.c (test_aead): Take alternative set_nonce
795 function as argument, and use it when nonce size differs from
797 * testsuite/testutils.h (test_aead): Updated prototype.
798 * testsuite/gcm-test.c (nettle_gcm_unified_aes128): Updated for
799 new nettle_aead struct.
800 (test_main): Pass additional argument to test_aead.
801 * testsuite/eax-test.c (test_main): Pass additional NULL argument
804 * eax.h (EAX_DIGEST_SIZE): New constant.
805 * gcm.h (GCM_DIGEST_SIZE): Likewise.
807 2014-02-10 Niels Möller <nisse@lysator.liu.se>
809 * chacha-set-nonce.c (chacha_set_nonce): Renamed file and
810 function, updated callers and Makefile.in.
811 * chacha-set-iv.c (chacha_set_iv): ... from old names.
813 2014-02-08 Niels Möller <nisse@lysator.liu.se>
815 * testsuite/chacha-test.c (test_chacha): For 20 rounds, use
816 chacha_crypt, and test varying the message length.
817 (test_main): Add second key stream block, for all testcases with
820 * chacha-crypt.c (chacha_crypt): Fixed block counter update.
822 2014-02-07 Niels Möller <nisse@lysator.liu.se>
824 * nettle.texinfo (ASCII encoding): Document that
825 base16_encode_update and base64_encode_update now uses dst_length
828 * testsuite/base64-test.c (test_main): Updated
829 base64_decode_update test case.
831 * sexp-transport.c (sexp_transport_iterator_first): For
832 base64_decode_update, omit initialization of coded_length.
833 * examples/base64dec.c (main): Likewise.
834 * examples/base16dec.c (main): Likewise, for base16_decode_update.
836 * base64-decode.c (base64_decode_update): Use *dst_length for
837 output only. Don't require callers to pass a sane value.
838 * base16-decode.c (base16_decode_update): Likewise.
840 2014-02-06 Niels Möller <nisse@lysator.liu.se>
842 * NEWS: List _set_key incompatibilities.
844 * nettle-meta.h (_NETTLE_CIPHER_SEP, _NETTLE_CIPHER_SEP_SET_KEY)
845 (_NETTLE_CIPHER_FIX, _NETTLE_CIPHER): Deleted unused macros.
847 * nettle-internal.c (nettle_blowfish128): Deleted only use of
850 * blowfish.c (blowfish128_set_key): New function.
851 * blowfish.h (BLOWFISH128_KEY_SIZE): New constant.
853 * cast128-meta.c (nettle_cast128): Deleted only use of
856 * examples/nettle-benchmark.c (time_cipher): Fixed memset calls.
858 2014-01-30 Niels Möller <nisse@lysator.liu.se>
860 * Makefile.in (nettle_SOURCES): Arrange in alphabetic order.
862 * nettle.texinfo: Updated, document size_t for length arguments.
863 Document new AES and Camellia interfaces.
865 * ecc-size.c (ecc_bit_size): New function.
866 * ecc.h (ecc_bit_size): Declare it.
868 2014-01-29 Niels Möller <nisse@lysator.liu.se>
870 * nettle-types.h (typedef nettle_set_key_func): Deleted length
873 * arctwo.c (arctwo40_set_key, arctwo64_set_key)
874 (arctwo128_set_key, arctwo128_set_key_gutmann): New functions.
875 * arctwo.h: Declare them.
876 * arctwo-meta.c (ARCTWO): New macro.
877 (nettle_arctwo40, nettle_arctwo64, nettle_arctwo128)
878 (nettle_arctwo_gutmann128): Use new _set_key functions.
880 * arcfour.h (ARCFOUR128_KEY_SIZE): New constant.
881 * arcfour.c (arcfour128_set_key): New function.
882 * arcfour-meta.c (nettle_arcfour128): Use arcfour128_set_key and
885 * cast128.c (cast5_set_key): Renamed, was cast128_set_key.
886 (cast128_set_key): New definition, with fixed key size.
887 * cast128.h (CAST128_MIN_KEY_SIZE, CAST128_MAX_KEY_SIZE): Renamed
889 (CAST5_MIN_KEY_SIZE, CAST5_MAX_KEY_SIZE): ... new names.
891 * eax.h (EAX_SET_KEY): Deleted length argument.
893 * aes128-meta.c: Deleted _set_key wrappers.
894 * aes192-meta.c: Likewise.
895 * aes256-meta.c: Likewise.
896 * camellia128-meta.c: Likewise.
897 * camellia192-meta.c: Likewise.
898 * camellia256-meta.c: Likewise.
900 * gcm-aes128.c (gcm_aes128_set_key): Deleted length argument.
901 * gcm-aes192.c (gcm_aes192_set_key): Likewise.
902 * gcm-aes256.c (gcm_aes256_set_key): Likewise.
903 * gcm.h: Updated prototypes.
905 * serpent-set-key.c (serpent128_set_key, serpent192_set_key)
906 (serpent256_set_key): New functions.
907 * serpent.h: Declare new functions.
908 (SERPENT128_KEY_SIZE, SERPENT192_KEY_SIZE)
909 (SERPENT256_KEY_SIZE): New constants.
910 * serpent-meta.c (SERPENT): New macro.
911 (nettle_serpent128, nettle_serpent192, nettle_serpent256): Use new
914 * twofish-set-key.c (twofish128_set_key, twofish192_set_key)
915 (twofish256_set_key): New functions.
916 * twofish.h: Declare new functions.
917 (TWOFISH128_KEY_SIZE, TWOFISH192_KEY_SIZE)
918 (TWOFISH256_KEY_SIZE): New constants.
919 * twofish-meta.c (TWOFISH): New macro.
920 (nettle_twofish128, nettle_twofish192, nettle_twofish256): Use new
923 * nettle-internal.h (struct nettle_aead): Use
924 nettle_hash_update_func for the set_iv function pointer.
926 * nettle-internal.c (des_set_key_hack, des3_set_key_hack): Deleted
928 (chacha_set_key_hack): Deleted length argument. Use
930 (salsa20_set_key_hack): Deleted length argument. Use
932 (nettle_unified_aes128, nettle_unified_aes192)
933 (nettle_unified_aes256): Deleted, moved to test program.
934 (eax_aes128_set_key): Deleted length argument. Use EAX_SET_KEY.
936 * examples/nettle-benchmark.c: Updated for _set_key changes.
937 * examples/nettle-openssl.c: Likewise.
938 * testsuite/testutils.c: Likewise.
939 * testsuite/gcm-test.c: Likewise.
941 * testsuite/aes-test.c (UNIFIED_AES): New macro. Moved glue for
942 testing the old aes interface (struct aes_ctx) here.
944 * testsuite/arcfour-test.c (test_arcfour): New function, for key
948 * testsuite/blowfish-test.c (test_blowfish): New function.
949 (test_main): Use it. Also deleted old #if:ed out code.
951 * testsuite/cast128-test.c (test_cast5): New function.
952 (test_main): Use it, for 40-bit and 80-bit tests.
954 * testsuite/serpent-test.c (test_serpent): New function.
957 2014-01-27 Niels Möller <nisse@lysator.liu.se>
959 * eax.h (struct eax_key, struct eax_ctx): Use union
960 nettle_block16, for alignment.
961 * eax.c: Updated everything to use nettle_block16.
962 (block16_xor): New function.
964 * examples/nettle-benchmark.c (time_eax): New function.
967 * x86_64/chacha-core-internal.asm: Use pshufhw + pshuflw for the
970 * configure.ac (asm_replace_list): Added chacha-core-internal.asm.
971 * x86_64/chacha-core-internal.asm: New file.
973 * examples/nettle-benchmark.c (main): Add benchmarking of chacha.
974 * nettle-internal.c (nettle_chacha): New const struct, for the
977 Chacha implementation, based on contribution by Joachim
979 * chacha.h: New file.
980 * chacha256-set-key.c (chacha256_set_key): New file and function.
981 * chacha128-set-key.c (chacha128_set_key): New file and function.
982 * chacha-set-key.c (chacha_set_key): New file and function.
983 * chacha-set-iv.c (chacha_set_iv): New file and function.
984 * chacha-core-internal.c (_chacha_core): New file and function.
985 * chacha-crypt.c (chacha_crypt): New file and function.
986 * Makefile.in (nettle_SOURCES): Added chacha files.
987 (HEADERS): Added chacha.h.
988 * testsuite/chacha-test.c: New file.
989 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added chacha-test.c.
991 2014-01-26 Niels Möller <nisse@lysator.liu.se>
993 * nettle-internal.h (_NETTLE_AEAD_FIX): Renamed to...
994 (_NETTLE_AEAD): ... new name, and deleted old definition. Also use
995 _set_nonce instead of _set_iv.
996 * nettle-internal.c (nettle_gcm_aes128, nettle_gcm_aes192)
997 (nettle_gcm_aes256): Define in terms of new interface.
998 (nettle_eax_aes128): Updated for _NETTLE_AEAD changes.
1000 * testsuite/gcm-test.c (test_gcm_hash): Likewise use struct
1002 (test_main): Added a testcase using the old interface based on
1005 * examples/nettle-benchmark.c (time_gcm): Update to use new struct
1006 gcm_aes128_ctx. Also use name "gcm-aes128" in output.
1008 * gcm.h: New interface for gcm_aes128, gcm_aes192, gcm_aes256,
1009 using the new AES interface.
1010 (GCM_CTX): Reorder fields, putting the cipher context
1013 * Makefile.in (nettle_SOURCES): Added gcm-aes128.c, gcm-aes192.c,
1016 * gcm-aes128.c: New file.
1017 * gcm-aes192.c: New file
1018 * gcm-aes256.c: New file.
1020 2014-01-25 Niels Möller <nisse@lysator.liu.se>
1022 * gcm.h (GCM_SET_KEY): Deleted length argument.
1023 * gcm-aes.c (gcm_aes_set_key): Use aes_set_encrypt_key and
1024 gcm_set_key, can no longer use GCM_SET_KEY macro.
1026 2014-01-23 Niels Möller <nisse@lysator.liu.se>
1028 * testsuite/gcm-test.c (test_main): Use the correct
1029 nettle_gcm_aes128/192/256 object.
1031 2014-01-21 Niels Möller <nisse@lysator.liu.se>
1033 Merged camellia-reorg changes (starting at 2013-10-07).
1035 2013-10-10 Niels Möller <nisse@lysator.liu.se>
1037 * Makefile.in (nettle_SOURCES): Updated list of camellia files.
1039 * testsuite/camellia-test.c (test_invert): Updated for new
1042 * camellia.h: Reorganized camellia interface, with distinct
1043 context structs and functions for camellia128 and camellia256.
1045 * camellia-meta.c: Deleted file.
1046 * camellia256-meta.c: New file.
1047 * camellia192-meta.c: New file.
1048 * camellia128-meta.c: New file.
1050 * camellia-set-decrypt-key.c: Deleted file, code moved to:
1051 * camellia128-set-decrypt-key.c: New file.
1052 (camellia128_invert_key, camellia128_set_decrypt_key): New
1054 * camellia256-set-decrypt-key.c: New file.
1055 (camellia256_invert_key, camellia256_set_decrypt_key)
1056 (camellia192_set_decrypt_key): New functions.
1057 * camellia-invert-key.c (_camellia_invert_key): New file and
1060 * camellia-set-encrypt-key.c: Deleted file, code moved to:
1061 * camellia128-set-encrypt-key.c: New file.
1062 (camellia128_set_encrypt_key): New function.
1063 * camellia256-set-encrypt-key.c: New file.
1064 (_camellia256_set_encrypt_key, camellia256_set_encrypt_key)
1065 (camellia192_set_encrypt_key): New functions.
1066 * camellia-absorb.c (_camellia_absorb): New file and function.
1067 * camellia-internal.h: Moved key schedule macros here.
1069 * camellia-crypt.c: Deleted file, code moved to:
1070 * camellia128-crypt.c (camellia128_crypt): New file and function.
1071 * camellia256-crypt.c (camellia256_crypt): New file and function.
1073 2013-10-07 Niels Möller <nisse@lysator.liu.se>
1075 * configure.ac: Delete check for ALIGNOF_UINT64_T, no longer
1077 * config.m4.in: Likewise delete ALIGNOF_UINT64_T.
1079 * camellia-crypt.c (camellia_crypt): Updated call to
1081 * camellia-internal.h (_camellia_crypt): Updated prototype.
1082 * camellia-crypt-internal.c (_camellia_crypt): Take separate
1083 arguments for rounds and subkey array.
1084 * x86_64/camellia-crypt-internal.asm: Likewise. Also corrected
1086 * x86/camellia-crypt-internal.asm: Likewise.
1088 2014-01-20 Niels Möller <nisse@lysator.liu.se>
1090 * poly1305-internal.c (poly1305_digest): Use union nettle_block16
1092 * poly1305-aes.c (poly1305_aes_digest): Update for poly1305_digest
1095 Merged poly1305 changes (starting at 2013-11-08).
1096 * x86_64/poly1305-internal.asm: Update to new interface.
1097 poly1305_digest much simplified.
1099 * poly1305.h (struct poly1305_ctx): Moved block and index
1101 (struct poly1305_aes_ctx): ... to here.
1102 * asm.m4: Delete also from the assembly definition of struct
1105 * poly1305-internal.c (poly1305_digest): Don't do final padding
1106 here, leave that to caller. Add digest to the provided nonce s,
1107 and deleted length and dst arguments. Also reset h0-h4 to zero
1109 (_poly1305_block): Renamed, from...
1110 (poly1305_block): ...old name.
1112 * poly1305-aes.c (poly1305_aes_update): New function.
1113 (poly1305_aes_digest): Update for poly1305_digest changes, do
1116 * poly1305.c (poly1305_update): Deleted file and function. Moved
1118 * Makefile.in (nettle_SOURCES): Deleted poly1305.c.
1120 2014-01-17 Niels Möller <nisse@lysator.liu.se>
1122 * poly1305-internal.c (poly1305_block): Additional argument with
1124 (poly1305_block_internal): Deleted function, code moved into the
1126 (poly1305_digest): Simplified padding code, call poly1305_block
1128 * poly1305.h (poly1305_block): Update prototype.
1129 * poly1305.c (poly1305_update): Call poly1305_block with high bit 1.
1130 * x86_64/poly1305-internal.asm (poly1305_block): Handle new
1133 * poly1305.h (struct poly1305_ctx): Moved nonce field from here...
1134 (struct poly1305_aes_ctx): ... to here.
1135 * poly1305-aes.c (poly1305_aes_set_nonce, poly1305_aes_digest):
1137 * poly1305.c (poly1305_set_nonce): Deleted function.
1138 * asm.m4: Delete nonce also from the assembly definition of struct
1141 2014-01-16 Niels Möller <nisse@lysator.liu.se>
1143 * poly1305-aes.c: Include poly1305.h. Rewrite functions without
1144 using the POLY1305_* macros.
1146 * Makefile.in (HEADERS): Deleted poly1305-aes.h.
1148 * poly1305.h (POLY1305_CTX, POLY1305_SET_KEY, POLY1305_SET_NONCE)
1149 (POLY1305_DIGEST): Deleted macros. Only implemented variant is
1151 (POLY1305_DIGEST_SIZE, POLY1305_BLOCK_SIZE, POLY1305_KEY_SIZE):
1153 (POLY1305_AES_KEY_SIZE, POLY1305_AES_DIGEST_SIZE): Moved here,
1154 from poly1305-aes.h.
1155 (struct poly1305_aes_ctx): Likewise.
1156 (poly1305_aes_set_key, poly1305_aes_set_nonce)
1157 (poly1305_aes_update, poly1305_aes_digest): Likewise.
1158 * poly1305-aes.h: Deleted file, declarations moved to poly1305.h.
1161 * poly1305-internal.c (s2, s3, s4): Fixed macros.
1163 * poly1305-aes.h (struct poly1305_aes_ctx): Replace struct aes_ctx
1164 by struct aes128_ctx.
1165 * poly1305-aes.c (poly1305_aes_set_key, poly1305_aes_digest):
1166 Update to use aes128_* functions.
1167 * poly1305.h (POLY1305_SET_KEY): Drop key size argument when
1170 2013-12-19 Niels Möller <nisse@lysator.liu.se>
1172 * poly1305-aes.h (poly1305_aes_update): Define as an alias for
1173 poly1305_update, using preprocessor and a type cast.
1175 * poly1305-aes.c (poly1305_aes_update): Deleted function.
1177 * poly1305.h (poly1305_update): Declare.
1178 (_POLY1305_BLOCK, POLY1305_UPDATE): Deleted macros.
1180 * poly1305.c (poly1305_update): New function.
1182 2013-11-21 Niels Möller <nisse@lysator.liu.se>
1184 * x86_64/poly1305-internal.asm: New file. Almost a factor of two
1187 * configure.ac (asm_replace_list): Added poly1305-internal.asm.
1189 * asm.m4: Define struct offsets for 64-bit poly1305_ctx.
1191 * poly1305.h (POLY1305_DIGEST): Pass the encrypted nonce as an
1192 additional argument to poly1305_digest.
1193 (struct poly1305_ctx): Introduce unions, to support either 26-bit
1194 or 64-bit implementation.
1196 * poly1305-internal.c (poly1305_digest): Added s argument.
1198 * poly1305.c (poly1305_set_s): Deleted function.
1200 2013-11-12 Niels Möller <nisse@lysator.liu.se>
1202 * poly1305-internal.c: New file, for poly1305 functions depending
1203 on the internal mod (2^130 - 5) representation.
1204 (poly1305_block_internal): New helper function.
1205 (poly1305_block, poly1305_digest): Use it.
1207 2013-11-08 Nikos Mavrogiannopoulos <nmav@gnutls.org>
1209 * poly1305.h: New file.
1210 * poly1305.c: New file.
1211 * poly1305-aes.h: New file.
1212 * poly1305-aes.c: New file.
1213 * Makefile.in (nettle_SOURCES): Added poly1305-aes.c and poly1305.c.
1214 (HEADERS): Added poly1305-aes.h and poly1305.h.
1216 * testsuite/poly1305-test.c: New file.
1217 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added poly1305-test.c.
1219 * examples/nettle-benchmark.c (time_poly1305_aes): New function.
1220 (main): Benchmark poly1305.
1222 2014-01-20 Niels Möller <nisse@lysator.liu.se>
1224 * Makefile.in (nettle_SOURCES): Added salsa20-set-nonce.c,
1225 salsa20-128-set-key.c, and salsa20-256-set-key.c.
1227 * salsa20.h: Declare new functions.
1228 (SALSA20_128_KEY_SIZE, SALSA20_256_KEY_SIZE): New constants.
1229 (salsa20_set_iv): Define as an alias for salsa20_set_nonce.
1231 * salsa20-set-key.c (salsa20_set_key): Use salsa20_128_set_key and
1232 salsa20_256_set_key.
1233 (salsa20_set_iv): Renamed and moved...
1234 * salsa20-set-nonce.c (salsa20_set_nonce): ... new file, new name.
1236 * salsa20-256-set-key.c (salsa20_256_set_key): New file and
1238 * salsa20-128-set-key.c (salsa20_128_set_key): New file and
1241 2014-01-13 Niels Möller <nisse@lysator.liu.se>
1243 * nettle-types.h (union nettle_block16): New type, replacing union
1245 * gcm.h (union gcm_block): Deleted. Replaced by nettle_block16.
1246 * gcm.c: Replaced all use of gcm_block by nettle_block16.
1248 2014-01-04 Niels Möller <nisse@lysator.liu.se>
1250 * config.guess: Updated to 2014-01-01 version, from
1251 git://git.sv.gnu.org/config.git.
1252 * config.sub: Likewise.
1254 * testsuite/memxor-test.c [HAVE_VALGRIND_MEMCHECK_H] (test_mark):
1256 (test_memxor, test_memxor3): Use test_mark to tell valgrind the
1257 start and end of src and destination areas.
1259 * configure.ac: Check for valgrind/memcheck.h.
1261 * testsuite/Makefile.in (VALGRIND): Added --partial-loads-ok=yes,
1262 needed for the way unaligned data is handled in, e.g., memxor.
1264 2014-01-03 Niels Möller <nisse@lysator.liu.se>
1266 * shadata.c (main): Zero-pad output values to 8 hex digits.
1267 * sha256.c (K): Updated table.
1269 2013-12-17 Niels Möller <nisse@lysator.liu.se>
1271 * configure.ac (ASM_RODATA): New substituted variable. Needed for
1272 portability to darwin.
1273 * config.m4.in: Define RODATA, using configure variable ASM_RODATA
1274 * x86_64/gcm-hash8.asm: Use RODATA macro.
1276 * bignum-random-prime.c (_nettle_generate_pocklington_prime): Use
1277 stronger variants of Pocklington's theorem, to allow p0 of size
1280 2013-12-15 Niels Möller <nisse@lysator.liu.se>
1282 * nettle-internal.h (NETTLE_MAX_BIGNUM_BITS)
1283 (NETTLE_MAX_BIGNUM_SIZE): Deleted arbitrary limits.
1285 2013-12-15 Nikos Mavrogiannopoulos <nmav@redhat.com>
1287 Introduced TMP_GMP_ALLOC macro for temporary allocations of
1288 potentially large data, e.g, sized as an RSA key.
1289 * gmp-glue.h (TMP_GMP_DECL, TMP_GMP_ALLOC, TMP_GMP_FREE): New
1291 * gmp-glue.c (gmp_alloc, gmp_free): New functions.
1292 * bignum-next-prime.c (nettle_next_prime): Use TMP_GMP_ALLOC.
1293 * bignum-random.c (nettle_mpz_random_size): Likewise.
1294 * pkcs1-decrypt.c (pkcs1_decrypt): Likewise.
1295 * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
1296 * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): Likewise.
1297 * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
1298 (pkcs1_rsa_sha512_encode_digest): Likewise.
1299 * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
1300 (pkcs1_rsa_sha256_encode_digest): Likewise.
1301 * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
1302 (pkcs1_rsa_sha1_encode_digest): Likewise.
1303 * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
1304 (pkcs1_rsa_md5_encode_digest): Likewise.
1306 2013-12-14 Niels Möller <nisse@lysator.liu.se>
1308 * x86_64/gcm-hash8.asm: Use .short rather than .hword, for
1309 compatibility with apple's assembler.
1311 2013-12-03 Niels Möller <nisse@lysator.liu.se>
1313 * x86_64/sha1-compress.asm: Reorganized, to get closer to the x86
1314 version. No difference in running time.
1316 * configure.ac (dummy-dep-files): Don't overwrite any existing
1319 * x86_64/md5-compress.asm: New file, similar to the x86 version.
1320 35% speedup on AMD, 15% speedup on Intel.
1322 2013-11-25 Niels Möller <nisse@lysator.liu.se>
1324 * testsuite/dsa-test.c (test_main): Additional tests from NIST
1327 * testsuite/testutils.c (test_dsa_sign, test_dsa_verify): New
1328 functions, supporting arbitrary digest size.
1330 * testsuite/testutils.h (ASSERT): Improved failure message.
1332 * dsa-verify.c (dsa_verify): Renamed, from _dsa_verify.
1333 * dsa-sign.c (dsa_sign): Renamed, from _dsa_sign.
1335 2013-11-24 Niels Möller <nisse@lysator.liu.se>
1337 * testsuite/dsa-keygen-test.c (test_main): Test generating a
1340 * dsa-verify.c (_dsa_verify): Use _dsa_hash.
1342 * dsa-sign.c (_dsa_sign): Use _dsa_hash. Fix memory leak in
1343 error case, spotted by Nikos.
1345 * dsa-keygen.c (dsa_generate_keypair): Allow q_bits == 224.
1347 * dsa-hash.c (_dsa_hash): New file and function. Allows digest
1348 sizes not matching the bitsize of q.
1349 * dsa.h (_dsa_hash): Declare it.
1350 * Makefile.in (hogweed_SOURCES): Added dsa-hash.c.
1352 2013-11-23 Niels Möller <nisse@lysator.liu.se>
1354 * configure.ac: Check also for openssl/ecdsa.h.
1356 2013-10-05 Niels Möller <nisse@lysator.liu.se>
1358 * Makefile.in (nettle_SOURCES): Added eax.c.
1359 (HEADERS): Added eax.h.
1361 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added eax-test.c.
1363 * testsuite/eax-test.c: New file.
1365 * nettle-internal.c (nettle_eax_aes128): New aead algorithm.
1366 (eax_aes128_set_key, eax_aes128_set_nonce, eax_aes128_update)
1367 (eax_aes128_encrypt, eax_aes128_decrypt, eax_aes128_digest): New
1373 * aes.h: Fixed typo in name mangling for new aes functions.
1375 2013-09-28 Niels Möller <nisse@lysator.liu.se>
1377 * Merge aes-reorg branch. Changes below,
1378 dated 2013-05-17 - 2013-08-13.
1380 2013-08-13 Niels Möller <nisse@lysator.liu.se>
1382 * yarrow.h (struct yarrow256_ctx): Use aes256_ctx, not aes_ctx.
1383 * yarrow256.c: Adapted to use new aes256 interface.
1385 2013-08-07 Niels Möller <nisse@lysator.liu.se>
1387 * umac.h (_UMAC_STATE): Use struct aes128_ctx, not aes_ctx.
1388 * umac-set-key.c (umac_kdf, _umac_set_key): Use aes128 interface.
1389 * umac32.c (umac32_digest): Likewise.
1390 * umac64.c (umac64_digest): Likewise.
1391 * umac96.c (umac96_digest): Likewise.
1392 * umac128.c (umac128_digest): Likewise.
1394 2013-06-25 Niels Möller <nisse@lysator.liu.se>
1396 * aes-meta.c: Deleted file.
1398 Analogous changes for new aes192 and aes256 interface.
1400 * aes.h (struct aes128_ctx): New aes128 declarations.
1401 * aes-decrypt.c (aes128_decrypt): New function.
1402 * aes-encrypt.c (aes128_encrypt): New function.
1403 * aes128-meta.c: New file.
1404 * aes128-set-encrypt-key.c (aes128_set_encrypt_key): New file and
1406 * aes128-set-decrypt-key.c (aes128_set_decrypt_key)
1407 (aes128_invert_key): New file and functions.
1408 * Makefile.in (nettle_SOURCES): Added aes128-set-encrypt-key.c,
1409 aes128-set-decrypt-key.c and aes128-meta.c.
1411 * nettle-internal.c (nettle_unified_aes128): For testing the old
1413 * testsuite/aes-test.c (test_cipher2): New function.
1414 (test_main): Test both nettle_aes128 and nettle_unified_aes128.
1416 2013-05-22 Niels Möller <nisse@lysator.liu.se>
1418 * Makefile.in (nettle_SOURCES): Added aes-invert-internal.c and
1419 aes-set-key-internal.c.
1421 * aes.h (AES128_KEY_SIZE, _AES128_ROUNDS): New constants.
1422 Similarly also for aes192 and aes256.
1424 * aes-internal.h: Declare new functions.
1426 * aes-set-key-internal.c (_aes_set_key): New file and funxtion
1427 extracted from aes_set_encrypt_key.
1428 * aes-set-encrypt-key.c (aes_set_encrypt_key): Use _aes_set_key.
1430 * aes-invert-internal.c (_aes_invert): New file and function,
1431 extracted from aes_invert_key.
1432 * aes-set-decrypt-key.c (aes_invert_key): Use _aes_invert.
1434 * arm/v6/aes-encrypt-internal.asm: Adapted to new interface.
1435 Unfortunately, 4% slowdown on Cortex-A9, for unknown reason.
1436 * arm/v6/aes-decrypt-internal.asm: Likewise.
1437 * arm/aes-encrypt-internal.asm: Adapted to new interface.
1438 * arm/aes-decrypt-internal.asm: Likewise.
1440 2013-05-21 Niels Möller <nisse@lysator.liu.se>
1442 * sparc32/aes-encrypt-internal.asm: Adapted to new interface.
1443 * sparc32/aes-decrypt-internal.asm: Likewise.
1444 * sparc64/aes-encrypt-internal.asm: Likewise.
1445 * sparc64/aes-decrypt-internal.asm: Likewise.
1447 * x86/aes-encrypt-internal.asm: Adapted to new interface.
1448 * x86/aes-decrypt-internal.asm: Likewise.
1450 2013-05-20 Niels Möller <nisse@lysator.liu.se>
1452 * x86_64/aes-encrypt-internal.asm: Adapted to new interface.
1453 * x86_64/aes-decrypt-internal.asm: Likewise.
1455 2013-05-17 Niels Möller <nisse@lysator.liu.se>
1457 * aes.h (struct aes_ctx): Renamed nrounds to rounds, and moved
1458 first in the structure.
1459 * aes-set-encrypt-key.c (aes_set_encrypt_key): Updated for renaming.
1460 * aes-set-decrypt-key.c (aes_invert_key): Likewise.
1462 * aes-encrypt-internal.c (_nettle_aes_encrypt): Take rounds and
1463 subkeys as separate arguments, not a struct aes_ctx *. Updated
1465 * aes-decrypt-internal.c (_nettle_aes_decrypt): Likewise.
1466 * aes-internal.h: Updated prototypes.
1468 * Start of aes-reorg changes.
1470 2013-09-28 Niels Möller <nisse@lysator.liu.se>
1472 * md4.h (struct md4_ctx): Use single uint64_t variable for block
1474 * md4.c: Use new block count variable.
1475 * md5.c, md5.h (struct md5_ctx): Likewise.
1476 * ripemd160.c, ripemd160.h (struct ripemd160_ctx): Likewise.
1477 * sha1.c, sha1.h (struct sha1_ctx): Likewise.
1478 * sha256.c, sha2.h (struct sha256_ctx): Likewise.
1480 * testsuite/testutils.c (test_hash_large): Added simple progress
1483 * macros.h (MD_PAD): Use size argument, don't depend on
1484 sizeof of the count field(s).
1486 2013-09-22 Niels Möller <nisse@lysator.liu.se>
1488 * x86_64/gcm-hash8.asm: New file.
1489 * x86_64/gcm-gf-mul-8.asm: Deleted.
1491 * configure.ac (asm_nettle_optional_list): Look for gcm-hash8.asm,
1492 not gcm-gf-mul-8.asm.
1493 * gcm.c [HAVE_NATIVE_gcm_hash8]: Make use of (optional) assembly
1496 2013-09-21 Niels Möller <nisse@lysator.liu.se>
1498 * Makefile.in (des.po): Add same dependencies as for des.o.
1499 Reported by Vincent Torri.
1501 2013-09-20 Niels Möller <nisse@lysator.liu.se>
1503 * testsuite/gcm-test.c: Added tests with associated data of
1506 * testsuite/testutils.c (tstring_alloc): Add NUL-termination.
1508 2013-09-18 Niels Möller <nisse@lysator.liu.se>
1510 * Makefile.in: New stampfiles, libnettle.stamp and
1511 libhogweed.stamp, updated when both static and shared libraries
1512 are rebuilt. Used as link dependencies in subdirectories.
1513 * examples/Makefile.in: Make executable targets depend on
1514 ../libnettle.stamp and libhogweed.stamp, not directly on the
1515 static library files.
1516 * testsuite/Makefile.in: Likewise.
1517 * tools/Makefile.in: Likewise.
1519 2013-09-09 Niels Möller <nisse@lysator.liu.se>
1521 * gcm.c [HAVE_NATIVE_gcm_gf_mul_8]: Make use of (optional)
1522 assembly implementation.
1524 * configure.ac: Support optional assembly files for both nettle
1525 and hogweed. Replaced OPT_ASM_SOURCES with OPT_ASM_NETTLE_SOURCES,
1526 OPT_ASM_HOGWEED_SOURCES, and asm_optional_list with
1527 asm_nettle_optional_list and asm_hogweed_optional_list.
1528 (asm_nettle_optional_list): Added gcm-gf-mul-8.asm.
1530 2013-06-25 Niels Möller <nisse@lysator.liu.se>
1532 * testsuite/gcm-test.c: Deleted redundant include of aes.h.
1534 * testsuite/testutils.c (test_aead): Allow digest size smaller
1535 than the block size.
1537 * tools/nettle-pbkdf2.c: New command line tool.
1538 * tools/Makefile.in (TARGETS): Added nettle-pbkdf2.
1539 (nettle-pbkdf2$(EXEEXT)): New target.
1540 * testsuite/nettle-pbkdf2-test: New test case.
1541 * testsuite/Makefile.in (TS_SH): Added nettle-pbkdf2-test.
1543 * tools/nettle-hash.c (digest_file): Use stack allocation for the
1544 small hex output buffer.
1546 * examples/io.c (MIN): Deleted unused macro.
1548 2013-05-21 Niels Möller <nisse@lysator.liu.se>
1550 From nettle-2.7-fixes branch:
1551 * Makefile.in (distdir): Distribute files in arm/v6 subdirectory.
1553 2013-05-20 Niels Möller <nisse@lysator.liu.se>
1555 * arm/v6/sha1-compress.asm: Moved into v6 directory, since it uses
1556 the v6 instruction uadd8, sel and rev.
1557 * arm/v6/sha256-compress.asm: Likewise.
1559 * nettle-types.h: Include <stddef.h>, for size_t.
1561 2013-05-17 Niels Möller <nisse@lysator.liu.se>
1563 * macros.h (ROTL32, ROTL64): Avoid undefined behaviour for zero
1564 rotation count. Unfortunately makes CAST128 a bit slower with
1567 * ecc-j-to-a.c (ecc_j_to_a): Fixed ecc_modp_mul call, to avoid
1568 invalid overlap of arguments to mpn_mul_n. Problem tracked down by
1571 2013-05-16 Niels Möller <nisse@lysator.liu.se>
1573 * arm/aes-encrypt-internal.asm: New file, for pre-v6 processors.
1574 * arm/aes-decrypt-internal.asm: New file, likewise.
1576 * arm/aes.m4 (AES_FINAL_ROUND_V5): Variant without using uxtb.
1577 (AES_FINAL_ROUND_V6): New name, updated callers.
1578 (AES_FINAL_ROUND): ... old name. Also eliminated one uxtb
1580 (AES_ENCRYPT_ROUND, AES_DECRYPT): Moved macros to the
1583 * arm/v6/aes-encrypt-internal.asm: Use ALIGN macro. Use 16-byte
1584 alignment for loops.
1585 * arm/v6/aes-decrypt-internal.asm: Likewise. Also added a nop
1586 which mysteriously improves benchmark performance on Cortex-A9.
1588 2013-05-15 Niels Möller <nisse@lysator.liu.se>
1590 * configure.ac (asm_path): Handle armv6 and armv7 differently from
1591 older ARMs. Add the arm/v6 directory to asm_path when appropriate.
1593 * arm/v6/aes-encrypt-internal.asm: Moved into v6 directory. Uses
1594 the uxtb instruction which is not available for older ARMs.
1595 * arm/v6/aes-decrypt-internal.asm: Likewise.
1597 2013-05-03 Niels Möller <nisse@lysator.liu.se>
1599 * cast128.c: Adapt to new struct cast128_ctx.
1600 (cast128_set_key): Rewrite, eliminating lots of conditions and
1601 some false warnings.
1603 * cast128.h (struct cast128_ctx): Separate the small 5-bit
1604 rotation subkeys and the larger 32-bit masking subkeys.
1606 2013-05-02 Niels Möller <nisse@lysator.liu.se>
1608 * testsuite/testutils.c (mpz_combit): Renamed. Define only if not
1609 provided GMP. Updated all uses.
1610 (mpz_togglebit): ... old name.
1612 * sexp-format.c (sexp_vformat): Use type mpz_srcptr rather
1613 than the old MP_INT *.
1615 2013-04-26 Niels Möller <nisse@lysator.liu.se>
1617 * Many files: Use size_t rather than unsigned for data sizes.
1618 * x86_64/aes-encrypt-internal.asm: Accept 64-bit length.
1619 * x86_64/aes-decrypt-internal.asm: Likewise.
1621 2013-04-25 Niels Möller <nisse@lysator.liu.se>
1623 * configure.ac: Changed version number, to 2.8.
1624 (LIBNETTLE_MAJOR): Bumped major number, following
1625 nettle_memxor ABI break.
1626 (LIBNETTLE_MINOR): Reset to zero.
1628 * examples/hogweed-benchmark.c: Add benchmarking of OpenSSL's RSA
1630 (all functions): Deleted unneeded casts.
1632 2013-04-24 Niels Möller <nisse@lysator.liu.se>
1634 * nettle.texinfo (Miscellaneous functions): Updated memxor
1635 prototype. Document memxor3.
1637 * salsa20-crypt.c (salsa20_crypt): Deleted cast of memxor
1638 argument, no longer needed.
1639 * salsa20r12-crypt.c (salsa20r12_crypt): Likewise.
1640 * sha3.c (sha3_absorb): Likewise.
1642 * memxor.h: Updated prototypes. Drop include of nettle-types.h.
1644 * memxor.c: Include nettle-types.h, for uintptr_t. Replace all
1645 internal uses of uint8_t by plain char.
1646 (memxor): Use void * rather than uint8_t * for
1648 (memxor3): Likewise.
1650 * x86_64/memxor.asm: Added nettle_ prefix to symbols.
1651 * arm/memxor.asm: Likewise.
1653 * testsuite/symbols-test: Don't allow memxor functions without
1656 * memxor.h (memxor3): Added name mangling to add "nettle_" prefix
1657 to memxor and memxor3 symbols.
1659 * Makefile.in (nettle_OBJS): Deleted $(LIBOBJS), and also deleted
1660 LIBOBJS substitution.
1661 (nettle_SOURCES): Added memxor.c, to include it in the library
1664 * configure.ac: Deleted AC_REPLACE_FUNCS for memxor.
1666 * Released nettle-2.7.
1668 2013-04-23 Niels Möller <nisse@lysator.liu.se>
1670 From Martin Storsjö:
1671 * x86_64/sha256-compress.asm: Add forgotten W64_EXIT.
1672 * x86_64/sha512-compress.asm: Likewise.
1673 * x86_64/salsa20-crypt.asm (Lpartial): Don't return via W64_EXIT
1674 within this subfunction.
1675 * x86_64/machine.m4 (W64_ENTRY): Use movdqu instead of movdqa for
1676 saving xmm registers, since the stack is not guaranteed to be
1677 16-byte aligned on win64. Take pushed xmm registers into account
1678 when reading the fifth parameter from the stack.
1680 * Makefile.in: Consistently use EXEEXT_FOR_BUILD.
1682 2013-04-21 Niels Möller <nisse@lysator.liu.se>
1684 * Makefile.in (DISTFILES): Added mini-gmp.c and mini-gmp.h.
1685 (distdir): Use find, for identifying assembly files to copy.
1687 2013-04-18 Niels Möller <nisse@lysator.liu.se>
1689 * configure.ac: Recognize cpu type "arm*", not just "armv7*'.
1691 * arm/aes-encrypt-internal.asm: Updated include of aes.m4.
1692 * arm/aes-decrypt-internal.asm: Likewise.
1694 * Makefile.in (distdir): Updated for ARM reorganization.
1696 * configure.ac (asm_path): Generalized, can now be a list of
1697 directories. On ARM, check for neon instructions, and add arm/neon
1698 if appropriate. New command line options
1699 --enable-arm-neon/--disable-arm-neon, for overriding the default.
1701 arm/neon: New subdirectory, for assembly files making use of neon
1704 arm: Renamed directory, from...
1707 * aclocal.m4 (NETTLE_CHECK_ARM_NEON): New macro.
1709 * nettle.texinfo (Keyed hash functions): Document UMAC.
1711 * umac.h (UMAC32_DIGEST_SIZE, UMAC64_DIGEST_SIZE)
1712 (UMAC96_DIGEST_SIZE, UMAC128_DIGEST_SIZE): New constants.
1713 (UMAC_DATA_SIZE): New name, for consistency with hash functions.
1715 (UMAC_BLOCK_SIZE): ... old name.
1717 2013-04-17 Niels Möller <nisse@lysator.liu.se>
1719 * examples/nettle-benchmark.c (main): Benchmark salsa20r12.
1721 * nettle-internal.c (nettle_salsa20r12): Cipher struct for
1723 * nettle-internal.h (nettle_salsa20): Declare it.
1725 * Makefile.in (eccdata): Depend on mini-gmp files. Drop -lgmp.
1727 * eccdata.c: Use mini-gmp, to avoid gmp dependency and associated
1728 configure tests for the *build* system. Replaced mpz_submul_ui by
1729 mpz_mul_ui + mpz_sub, and gmp_printf and gmp_fprintf by calls to
1732 * mini-gmp.h, mini-gmp.c: New files, copied from gmp-5.1.1.
1734 2013-04-16 Niels Möller <nisse@lysator.liu.se>
1736 * umac-set-key.c (BE_SWAP32_N): Fixed dummy definition used for
1739 * Makefile.in (TARGETS): Deleted eccdata, it should be build only
1740 when public key support is enabled.
1741 (clean-here): Exlicitly list it here.
1743 * asm.m4 (m4_log2): New macro, similar to the one in gmp.
1744 (ALIGN): Changed to take alignment in bytes. Updated all callers,
1745 currently used only in x86 and x86_64 files.
1747 * umac.h (umac32_ctx, umac64_ctx, umac96_ctx, umac128_ctx): Make
1748 block count an uint64_t. Reorder some elements to put short values
1750 * umac-l2.c (_umac_l2, _umac_l2_final): Make count argument an uint64_t.
1751 (_umac_l2): Deleted redundant memcpy.
1752 (_umac_l2, _umac_l2_final): Store input buffer at end of the
1753 poly64/poly128 state. Deleted l1_out from corresponding context
1754 structs, and updated all callers.
1756 * configure.ac: Changed version number to 2.7.
1757 (LIBNETTLE_MINOR): Bumped library version, to 4.6.
1758 (LIBHOGWEED_MINOR): And to 2.4.
1760 * Makefile.in (distdir): Include files from armv7 subdirectory.
1762 * x86_64/umac-nh-n.asm: New file, 3.5 time speedup.
1764 * umac32.c (umac32_digest): Fix nonce caching.
1765 * umac64.c (umac64_digest): Likewise.
1767 * testsuite/umac-test.c (test_incr): New function.
1768 (test_main): Test nonce increment.
1770 * misc/umac/umac.py: UMAC reference implementation.
1771 * misc/umac/rijndael.py: AES implementation used by umac.py.
1772 * misc/umac/mkvectors: Script to generate UMAC test vectors.
1773 * misc/umac/vectors.out: Generated test vectors.
1775 * umac32.c (umac32_digest): Fix nonce increment, use INCREMENT
1777 * umac64.c (umac64_digest): Likewise.
1778 * umac96.c (umac96_digest): Likewise.
1779 * umac128.c (umac128_digest): Likewise.
1781 * macros.h (INCREMENT): Allow size == 1.
1783 2013-04-15 Niels Möller <nisse@lysator.liu.se>
1785 * x86_64/umac-nh.asm: New file. 4.4 time speedup.
1787 * armv7/umac-nh-n.asm: New file. 2.0-2.3 time speedup.
1789 * testsuite/umac-test.c (test_align): Fixed memory leak.
1791 2013-04-12 Niels Möller <nisse@lysator.liu.se>
1793 * armv7/umac-nh.asm: New file. 2.4 time speedup.
1795 * armv7/machine.m4 (D0REG, D1REG): New macros.
1797 * configure.ac (asm_replace_list): Added umac-nh.asm and
1800 * testsuite/umac-test.c: Test different alignments for the
1803 2013-04-11 Niels Möller <nisse@lysator.liu.se>
1805 * umac-nh-n.c (_umac_nh_n): Rewrote as a single pass over the
1808 * examples/nettle-benchmark.c (time_umac): New function.
1811 * umac-set-key.c (_umac_set_key): Drop byteswapping of l3_key2, it
1812 can be xored directly to the pad in native byteorder.
1813 * umac-l3.c (_umac_l3): Drop key_2 argument, let caller do that
1814 xor. Updated all callers.
1815 * umac32.c (umac32_digest): Adapt to l3 changes.
1816 * umac64.c (umac64_digest): Likewise.
1817 * umac96.c (umac96_digest): Likewise.
1818 * umac128.c (umac128_digest): Likewise.
1820 Initial implementation of umac.
1822 * umac-nh.c: New file.
1823 * umac-nh-n.c: New file.
1824 * umac-poly64.c: New file.
1825 * umac-poly128.c: New file.
1826 * umac-l2.c: New file.
1827 * umac-l3.c: New file.
1828 * Makefile.in (nettle_SOURCES): Added umac source files.
1829 (HEADERS): Added umac.h.
1830 * testsuite/umac-test.c: New file.
1831 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added umac-test.c.
1833 * ecc-mul-a.c (ecc_mul_a): Avoid using mp_bitcnt_t, for
1834 compatibility with older GMP versions.
1835 * ecc-mul-g.c (ecc_mul_g): Likewise.
1836 * eccdata.c (ecc_mul_binary): Likewise.
1837 * sec-modinv.c (sec_modinv): Likewise.
1839 * x86_64/sha3-permute.asm: Go via memory for moves between general
1840 registers and xmm registers.
1842 2013-04-06 Niels Möller <nisse@lysator.liu.se>
1844 From Edgar E. Iglesias:
1845 * sha3.c (_sha3_update): Fix condition for when the block buffer
1848 2013-04-04 Niels Möller <nisse@lysator.liu.se>
1850 * ecc-point.c (ecc_point_get): Allow NULL x or y, ignore
1851 corresponding coordinate.
1853 * nettle.texinfo (Elliptic curves): Document high-level ECDSA
1856 From Martin Storsjö. Fallback functions for older GMP releases.
1857 * gmp-glue.c (mpn_copyd, mpn_copyi, mpn_zero): New functions.
1858 * gmp-glue.h: Declare them.
1859 (mpn_sqr): Fallback macro.
1861 * gmp-glue.h (cnd_add_n, cnd_sub_n): Moved here, define in terms
1862 of mpn_cnd_add_n and mpn_sub_n if available, otherwise in terms of
1863 mpn_addmul_1 and mpn_submul_1. This seems to be an improvement for
1864 subtraction, but more questionable for addition.
1866 * ecc-internal.h: Include gmp-glue.h. Deleted corresponding
1867 include in all files using ecc-internal.h.
1868 (cnd_add_n, cnd_sub_n): Moved from here.
1870 2013-04-03 Niels Möller <nisse@lysator.liu.se>
1872 * ecc-point-mul-g.c (ecc_point_mul_g): New file and function.
1873 * ecc-point-mul.c (ecc_point_mul): New file and function.
1874 * ecc.h: Updated declarations and name mangling.
1875 * Makefile.in (hogweed_SOURCES): Added ecc-point-mul.c and
1878 * testsuite/salsa20-test.c (test_main): Tests for salsa20r12,
1879 contributed by Nikos Mavrogiannopoulos.
1881 2013-03-26 Niels Möller <nisse@lysator.liu.se>
1883 * armv7/salsa20-core-internal.asm: New file. 45% speedup.
1885 2013-03-25 Niels Möller <nisse@lysator.liu.se>
1887 From Martin Storsjö:
1888 * examples/timing.c: New file, extracted from nettle-benchmark.c.
1889 * examples/timing.h: New file.
1890 * examples/Makefile.in (SOURCES): Added timing.c.
1891 (DISTFILES): Added timing.h.
1892 (BENCH_OBJS, ECC_BENCH_OBJS, HOGWEED_BENCH_OBJS): Added timing.o.
1893 * examples/nettle-benchmark.c: Use timing.h.
1894 * examples/hogweed-benchmark.c: Likewise.
1895 * examples/ecc-benchmark.c: Likewise.
1897 From Nikos Mavrogiannopoulos:
1898 * salsa20r12-crypt.c (salsa20r12_crypt): New file and function.
1899 * salsa20.h (salsa20r12_crypt): Declare.
1900 * Makefile.in (nettle_SOURCES): Added salsa20r12-crypt.c.
1902 From Martin Storsjö:
1903 * examples/hogweed-benchmark.c: Include local headers.
1904 * testsuite/ecdsa-keygen-test.c: Likewise.
1905 * x86_64/sha3-permute.asm: Workaround for Apple's assembler; write
1906 movq instructions as movd.
1908 * Makefile.in (hogweed_PURE_OBJS): Don't include OPT_ASM_SOURCES
1911 2013-03-15 Niels Möller <nisse@lysator.liu.se>
1913 * armv7/sha3-permute.asm: New file. 4.5 time speedup.
1915 * armv7/machine.m4 (QREG): New macro.
1917 2013-03-14 Niels Möller <nisse@lysator.liu.se>
1919 * configure.ac (asm_replace_list): Added sha3-permute.asm,
1920 revering 2012-12-30 change. 34% speedup on intel i5, from 2190
1921 cycles for the C implementation down to 1630.
1923 * armv7/sha512-compress.asm: Optimized. Keep expanded data in
1924 registers, exploit parallelism. Another 70% speedup.
1926 * testsuite/sha512-test.c (test_main): Additional test vectors,
1927 including some longer than 128 bytes.
1929 2013-03-13 Niels Möller <nisse@lysator.liu.se>
1931 * armv7/sha512-compress.asm: New file, using neon instructions.
1934 * configure.ac (asm_replace_list): Added sha512-compress.asm.
1935 * x86_64/machine.m4 (OFFSET64): New macro.
1936 * x86_64/sha512-compress.asm: New file, 20% speedup.
1938 * sha512-compress.c (ROUND): Eliminated a temporary, analogous to
1939 sha256 change below.
1941 * x86_64/sha256-compress.asm: New file, 16% speedup (benchmarked
1944 2013-03-11 Niels Möller <nisse@lysator.liu.se>
1946 * armv7/sha256-compress.asm: New file, 25% speedup.
1948 * configure.ac (asm_replace_list): Added sha256-compress.asm.
1950 * sha256-compress.c (ROUND): Eliminated a temporary.
1952 * armv7/sha1-compress.asm: New file, 9% speedup.
1954 * testsuite/testutils.c (test_hash): Test different alignments for
1957 2013-03-08 Niels Möller <nisse@lysator.liu.se>
1959 * armv7/aes-decrypt-internal.asm: New file, 15% speedup.
1960 * armv7/aes-encrypt-internal.asm: New file, 25% speedup.
1961 * armv7/aes.m4: New file.
1963 2013-03-07 Niels Möller <nisse@lysator.liu.se>
1965 * gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros.
1967 * Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata)
1968 (eccdata): Arrange for compiling these programs for running on the
1969 build system, also when cross compiling everything else.
1971 * config.make.in (CC_FOR_BUILD, EXEEXT_FOR_BUILD): New variables.
1973 * configure.ac: Use GMP_PROG_CC_FOR_BUILD and
1974 GMP_PROG_EXEEXT_FOR_BUILD.
1976 * aclocal.m4 (GMP_PROG_CC_FOR_BUILD, GMP_PROG_CC_FOR_BUILD_WORKS)
1977 (GMP_PROG_EXEEXT_FOR_BUILD): New macros, based on GMP's.
1979 * aesdata.c: Deleted includes of config.h and nettle-types.h. Use
1980 unsigned char and unsigned long instead of stdint.h types.
1982 * desdata.c: Deleted includes of config.h and desCode.h.
1983 (main): Return 1 on invalid argument. Don't use ROR macro. Use
1984 unsigned long instead of uint32_t, and make it work if unsigned
1985 long is larger than 32 bits.
1987 * gcmdata.c: Deleted include of config.h and use UNUSED macro.
1988 * shadata.c: Likewise.
1990 * twofishdata.c: Deleted include of nettle-types.h. Use unsigned
1991 char instead of stdint.h types.
1993 * x86_64/ecc-521-modp.asm: New file. 2.4 time speedup.
1995 2013-03-06 Niels Möller <nisse@lysator.liu.se>
1997 * x86_64/ecc-384-modp.asm: New file, 3 time speedup.
1998 * x86_64/ecc-256-redc.asm: New file, 2.5 time speedup.
1999 * x86_64/ecc-224-modp.asm: New file, 5 time speedup over C
2002 2013-03-05 Niels Möller <nisse@lysator.liu.se>
2004 * configure.ac (asm_optional_list): Added ecc-521-modp.asm.
2005 * ecc-521.c: Check HAVE_NATIVE_ecc_521_modp, and use native
2006 version if available.
2007 * armv7/ecc-521-modp.asm: New file, 2 time speedup over C version.
2009 2013-03-04 Niels Möller <nisse@lysator.liu.se>
2011 * configure.ac (asm_optional_list): Added ecc-384-modp.asm. Deleted
2012 bogus reference to $asm_search_list.
2013 * ecc-384.c: Check HAVE_NATIVE_ecc_384_modp, and use native
2014 version if available.
2015 * armv7/ecc-384-modp.asm: New file, 3 time speedup over C version.
2017 2013-03-03 Niels Möller <nisse@lysator.liu.se>
2019 * ecc-256.c: Fixed definition of USE_REDC.
2021 2013-03-01 Niels Möller <nisse@lysator.liu.se>
2023 * ecc-256.c: Check HAVE_NATIVE_ecc_256_redc, and use native
2024 version if available.
2025 * armv7/ecc-256-redc.asm: New file, 4 time speedup over C version.
2027 * testsuite/ecc-redc-test.c: Increased test count.
2029 * ecc-224.c: Check HAVE_NATIVE_ecc_224_modp, and use native
2030 version if available.
2031 * armv7/ecc-224-modp.asm: New file, 4.5 time speedup over C
2034 * configure.ac (asm_optional_list): Added ecc-224-modp.asm.
2035 (OPT_ASM_SOURCES): Fixed assignment.
2037 2013-02-28 Niels Möller <nisse@lysator.liu.se>
2039 * x86_64/ecc-192-modp.asm: Reorganized to reduce number of
2040 additions. Use setc instruction.
2042 * examples/Makefile.in: Let $(HOGWEED_TARGETS) depend on
2045 * armv7/ecc-192-modp.asm: New file. 2.5 time speedup over C
2048 2013-02-27 Niels Möller <nisse@lysator.liu.se>
2050 * ecc-192.c: Check HAVE_NATIVE_ecc_192_modp, and use native
2051 version if available.
2052 (ecc_192_modp): Fixed carry handling bug in 32-bit version.
2054 * x86_64/ecc-192-modp.asm: New file. 3.8 times speedup over C
2057 * configure.ac (OPT_ASM_SOURCES): New substituted variable.
2058 (asm_replace_list, asm_optional_list): New variables. For files in
2059 asm_optional_list, also add them to OPT_ASM_SOURCES and define
2060 appropriate HAVE_NATIVE_* symbols found.
2062 * Makefile.in (OPT_ASM_SOURCES): New variable. Used for setting
2063 hogweed_OBJS and hogweed_PURE_OBJS.
2065 * testsuite/ecc-mod-test.c: Increased test count.
2067 * ecc-384.c (ecc_384_modp): Fixed typo which broke carry handling
2068 in the 64-bit version.
2070 * examples/ecc-benchmark.c (bench_add_jjj): Typo fix, benchmark
2073 * gmp-glue.h: Check if GMP provides mpz_limbs_read (expected in
2075 * gmp-glue.c: Use GMP's mpz_limbs_read and friends if available.
2076 Renamed all functions for consistency with GMP. Updated all
2079 2013-02-20 Niels Möller <nisse@lysator.liu.se>
2081 * examples/Makefile.in (HOGWEED_TARGETS): Added
2082 hogweed-benchmark$(EXEEXT).
2083 (SOURCES): Added hogweed-benchmark.c.
2084 (hogweed-benchmark$(EXEEXT)): New target.
2086 * examples/hogweed-benchmark.c: New file.
2088 * ecdsa-keygen.c (ecdsa_generate_keypair): New file and function.
2089 * Makefile.in (hogweed_SOURCES): Added ecdsa-keygen.c.
2090 * testsuite/ecdsa-keygen-test.c: New testcase.
2091 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2092 ecdsa-keygen-test.c.
2094 * nettle-internal.h (TMP_ALLOC): Added missing parentheses.
2096 2013-02-18 Niels Möller <nisse@lysator.liu.se>
2098 * testsuite/ecdsa-verify-test.c: New testcase.
2099 * testsuite/ecdsa-sign-test.c: New testcase.
2100 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2101 ecdsa-sign-test.c and ecdsa-verify-test.c.
2102 * testsuite/testutils.h: Include ecdsa.h.
2103 (SHEX): Deleted const cast.
2105 * ecc-point.c: New file, struct ecc_point abstraction.
2106 * ecc-scalar.c: New file, struct ecc_scalar abstraction.
2107 * ecc-random.c (ecc_modq_random, ecc_scalar_random): New file, new
2109 * ecc-hash.c (ecc_hash): New file and function.
2110 * ecc-ecdsa-sign.c: New file, low-level signing interface.
2111 * ecc-ecdsa-verify.c: New file, low-level ecdsa verify.
2112 * ecdsa-sign.c: (ecdsa_sign): New file and function.
2113 * ecdsa-verify.c (ecdsa_verify): New file and function.
2114 * ecdsa.h: New header file.
2115 * ecc.h: Declare ecc_point and ecc_scalar functions.
2116 * ecc-internal.h: Added declarations.
2117 * Makefile.in (hogweed_SOURCES): Added new source files.
2118 (HEADERS): Added ecdsa.h.
2120 * gmp-glue.c (_mpz_set_mpn): New convenience function.
2121 (_mpn_set_base256): New function.
2122 (_gmp_alloc_limbs): New function.
2123 (_gmp_free_limbs): New function.
2124 * gmp-glue.h: Corresponding declarations. Include nettle-stdinh.h.
2126 * examples/Makefile.in (HOGWEED_TARGETS): Renamed, was
2127 RSA_TARGETS. Added ecc-benchmark$(EXEEXT).
2128 (SOURCES): Added ecc-benchmark.c.
2129 (ecc-benchmark$(EXEEXT)): New target.
2131 * examples/ecc-benchmark.c: New file, benchmarking ecc primitives.
2133 2013-02-15 Niels Möller <nisse@lysator.liu.se>
2135 Integrate ecc_mul_a.
2136 * ecc-a-to-j.c: New file.
2137 * ecc-add-jjj.c: New file.
2138 * ecc-mul-a.c: New file.
2139 * Makefile.in (hogweed_SOURCES): Added new files.
2140 * testsuite/ecc-mul-a-test.c: New file.
2141 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2144 * testsuite/testutils.c: Removed redundant includes.
2145 (die): New function.
2147 Integrate ecc_mul_g.
2149 * ecc-j-to-a.c: New file.
2150 * ecc-size.c: New file.
2151 * ecc-add-jja.c: New file.
2152 * ecc-dup-jj.c: New file.
2153 * ecc-mul-g.c: New file.
2154 * sec-tabselect.c: New file.
2155 * Makefile.in (hogweed_SOURCES): Added new files.
2156 (HEADERS): Added ecc.h
2157 * testsuite/ecc-mul-g-test.c: New file.
2158 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2160 * testsuite/testutils.c (xalloc_limbs): New function.
2161 (test_mpn): New function.
2162 (test_ecc_point): New function.
2163 (test_ecc_mul_a): New function.
2164 (test_ecc_mul_j): New function.
2165 * testsuite/testutils.h: Corresponding declarations.
2167 Integrate ECC internals.
2168 * ecc-curve.h: New file.
2169 * ecc-internal.h: New file.
2170 * cnd-copy.c: New file.
2171 * ecc-192.c: New file.
2172 * ecc-224.c: New file.
2173 * ecc-256.c: New file.
2174 * ecc-384.c: New file.
2175 * ecc-521.c: New file.
2176 * ecc-generic-modp.c: New file.
2177 * ecc-generic-modq.c: New file.
2178 * ecc-generic-redc.c: New file.
2179 * ecc-mod.c: New file.
2180 * ecc-modp.c: New file.
2181 * ecc-modq.c: New file.
2182 * sec-add-1.c: New file.
2183 * sec-modinv.c: New file.
2184 * sec-sub-1.c: New file.
2185 * Makefile.in (hogweed_SOURCES): Added new files.
2186 (HEADERS): Added ecc-curve.h.
2187 (DISTFILES): Added ecc-internal.h.
2188 * testsuite/ecc-mod-test.c: New file.
2189 * testsuite/ecc-modinv-test.c: New file.
2190 * testsuite/ecc-redc-test.c: New file.
2191 * testsuite/testutils.c (ecc_curves): New constant array.
2192 * testsuite/testutils.h: Include ecc-related headers. Declare
2194 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added ecc-mod-test.c
2195 ecc-modinv-test.c ecc-redc-test.c.
2197 * gmp-glue.c: New file, mpn <-> mpz conversions.
2198 * gmp-glue.h: New file.
2199 * Makefile.in: Added to hogweed_SOURCES and DISTFILES, respectively.
2201 * eccdata.c: New program, for generating ECC-related tables.
2202 * Makefile.in (ecc-192.h, ecc-224.h, ecc-256.h, ecc-384.h)
2203 (ecc-512.h): New generated files.
2205 2013-02-19 Niels Möller <nisse@lysator.liu.se>
2207 * armv7/memxor.asm (memxor): Software pipelining for the aligned
2208 case. Runs at 6 cycles (0.5 cycles per byte). Delayed push of
2209 registers until we know how many registers we need.
2210 (memxor3): Use 3-way unrolling also for aligned memxor3.
2211 Runs at 8 cycles (0.67 cycles per byte)
2213 2013-02-14 Niels Möller <nisse@lysator.liu.se>
2215 * configure.ac: Find GMP's GMP_NUMB_BITS. Substitute in Makefile.
2216 * config.make.in (GMP_NUMB_BITS): New variable.
2218 * examples/rsa-keygen.c (uint_arg): New function.
2219 (main): New options -s and -e, to specify key size and public
2220 exponent. Increased default key size to 2048.
2222 2013-02-12 Niels Möller <nisse@lysator.liu.se>
2224 * armv7/memxor.asm (memxor): Optimized aligned case, using 3-way
2227 2013-02-06 Niels Möller <nisse@lysator.liu.se>
2229 * armv7/memxor.asm (memxor, memxor3): Optimized aligned case, now
2230 runs at 0.75 cycles/byte.
2232 * armv7/README: New file.
2233 * armv7/machine.m4: New (empty) file.
2234 * armv7/memxor.asm: Initial assembly implementation.
2236 * config.m4.in: Substitute ASM_TYPE_PROGBITS as TYPE_PROGBITS.
2238 * config.make.in: Added .s to the suffix list.
2240 * Makefile.in (.asm.s): Use a separate make target for .asm
2241 preprocessing. Include asm.d, which the corresponding
2244 * configure.ac (asm_file_list): Collect assembly files into this
2246 (asm.d): Make config.status write dependencies for .s files into
2248 (ASM_ALIGN_LOG): Set to "no" when appropriate.
2249 (ASM_TYPE_FUNCTION): Default to "@function".
2250 (ASM_TYPE_PROGBITS): New substituted variable, set in the same way
2251 as ASM_TYPE_FUNCTION.
2252 (ASM_MARK_NOEXEC_STACK): Use TYPE_PROGBITS.
2253 (asm_path): Set up asm_path for armv7.
2255 * asm.m4: Use changecom to disable m4 quoting. Use divert to
2258 2013-02-05 Niels Möller <nisse@lysator.liu.se>
2260 * testsuite/rsa-keygen-test.c (test_main): Updated expected
2261 signatures, after the nettle_mpz_random change below.
2262 * testsuite/dsa-test.c (test_main): Likewise. Also fixed the
2263 dsa256 test to actually use the expected signature.
2265 2013-01-31 Niels Möller <nisse@lysator.liu.se>
2267 * bignum-random.c (nettle_mpz_random): Increased number of extra
2268 bits to 64, following FIPS 186-3.
2270 2013-01-16 Niels Möller <nisse@lysator.liu.se>
2272 * Released nettle-2.6.
2274 2013-01-12 Niels Möller <nisse@lysator.liu.se>
2276 * configure.ac: Use AC_LANG_SOURCE.
2278 2013-01-02 Niels Möller <nisse@lysator.liu.se>
2280 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.5.
2281 (LIBHOGWEED_MINOR): And to 2.3.
2283 * examples/Makefile.in: Explicit rules for building objects in
2285 * tools/Makefile.in: Likewise.
2286 * testsuite/Makefile.in: Likewise.
2288 2013-01-01 Niels Möller <nisse@lysator.liu.se>
2290 * nettle.texinfo (Recommended hash functions): Document additional
2293 * examples/nettle-benchmark.c (main): Benchmark additional sha3
2296 2012-12-30 Niels Möller <nisse@lysator.liu.se>
2298 * sha3-224.c, sha3-224-meta.c: New files.
2299 * sha3-384.c, sha3-384-meta.c: New files.
2300 * sha3-512.c, sha3-512-meta.c: New files.
2301 * sha3.h: Prototypes for sha3 with sizes 224, 384 and 512.
2302 * nettle-meta.h: Declare nettle_sha3_224, nettle_sha3_384 and
2304 * Makefile.in (nettle_SOURCES): Added new sha3 files.
2306 * testsuite/sha3-224-test.c: New file.
2307 * testsuite/sha3-384-test.c: New file.
2308 * testsuite/sha3-512-test.c: New file.
2309 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new sha3 test files.
2311 * configure.ac: Disabled use of sha3-permute.asm.
2313 2012-12-20 Niels Möller <nisse@lysator.liu.se>
2316 * testsuite/des-compat-test.c (pt): Use proper prototype, use
2318 * testsuite/testutils.c (test_dsa_key): Deleted spurious
2321 2012-12-15 Niels Möller <nisse@lysator.liu.se>
2323 Based on a patch from Alon Bar-Lev:
2324 * Makefile.in (LIBTARGETS, SHLIBTARGET): Define as empty if static
2325 or shared libraries, respectively, are disabled.
2326 (TARGETS): Deleted @IF_SHARED@ conditional, now in the definition
2330 * configure.ac: Check for ar program. New option --disable-static.
2331 * config.make.in (AR): Use configured value.
2333 2012-12-13 Niels Möller <nisse@lysator.liu.se>
2335 * x86_64/sha3-permute.asm: Rewrote, to keep all state in
2336 registers. 2400 cycles on x86_64, only slightly faster than the
2339 2012-12-09 Niels Möller <nisse@lysator.liu.se>
2341 * sha3-permute.c (sha3_permute): Rewrote to do permutation in
2342 place. 80% speedup on x86_64, 2500 cycles.
2344 2012-12-04 Niels Möller <nisse@lysator.liu.se>
2346 * ctr.c (ctr_crypt): Fix bug reported by Tim Kosse. Don't
2347 increment the counter when length is zero (was broken for the
2350 * testsuite/ctr-test.c (test_main): Added test with zero-length
2352 * testsuite/testutils.c (test_cipher_ctr): Check the ctr value
2353 after encrypt and decrypt.
2355 2012-12-03 Niels Möller <nisse@lysator.liu.se>
2357 * sha3-permute.c (sha3_permute): Optimized, to reduce number of
2358 passes over the data. 20% speedup on x86_64, 4700 cycles.
2360 * configure.ac: Added sha3-permute.asm.
2362 * x86_64/sha3-permute.asm: New file. 30% speedup over current C
2365 * nettle.texinfo (Hash functions): Split into several sections,
2366 separating recommended hash functions and legacy hash functions.
2369 2012-12-02 Niels Möller <nisse@lysator.liu.se>
2371 Split sha.h into new files sha1.h and sha2.h. Replaced all
2372 internal usage of sha.h in all files.
2373 * sha.h: Kept for compatibility, just includes both new files.
2376 * Makefile.in (HEADERS): Added sha1.h and sha2.h.
2378 2012-11-28 Niels Möller <nisse@lysator.liu.se>
2380 From Fredrik Thulin:
2381 * testsuite/pbkdf2-test.c (test_main): Add PBKDF2-HMAC-SHA512 test
2384 2012-11-15 Niels Möller <nisse@lysator.liu.se>
2386 * sha3-permute.c (sha3_permute): Use ULL suffix on round
2387 constants. Avoid passing shift count 0 to ROTL64.
2389 * sha3.c (sha3_absorb): Fixed big-endian code. Need macros.h.
2391 * macros.h (LE_READ_UINT64): New macro.
2393 2012-11-13 Niels Möller <nisse@lysator.liu.se>
2395 * sha3-permute.c (sha3_permute): Micro optimizations. Partial
2396 unrolling. Use lookup table for the permutation. On an x86_64,
2397 execution time reduced from appr. 13000 cycles to appr. 6000.
2399 * examples/nettle-benchmark.c (TIME_CYCLES): New macro.
2400 (bench_sha1_compress, bench_salsa20_core): Use it.
2401 (bench_sha3_permute): New function.
2402 (main): Call bench_sha3_permute.
2404 2012-11-12 Niels Möller <nisse@lysator.liu.se>
2406 * examples/nettle-benchmark.c (main): Benchmark sha3_256.
2408 * sha3-permute.c: New file. Permutation function for sha3, aka
2410 * sha3.h: New header file.
2411 * sha3.c: New file, absorption and padding for sha3.
2412 * sha3-256.c: New file.
2413 * sha3-256-meta.c: New file.
2414 * nettle-meta.h (nettle_sha3_256): Declare.
2415 * Makefile.in (nettle_SOURCES): Added sha3 files.
2416 (HEADERS): Added sha3.h.
2417 * testsuite/sha3.awk: New file. Script to extract test vectors.
2418 * testsuite/sha3-256-test.c: New file.
2419 * testsuite/sha3-permute-test.c: New file.
2420 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2421 sha3-permute-test.c and sha3-256-test.c.
2422 (DISTFILES): Added sha3.awk.
2423 * testsuite/.test-rules.make: Added sha3 targets.
2425 * macros.h (LE_WRITE_UINT64): New macro.
2426 * write-le64.c (_nettle_write_le64): New file and function.
2427 * nettle-write.h (_nettle_write_le64): Declare. Also deleted
2428 declaration of non-existent _nettle_write_be64.
2429 * Makefile.in (nettle_SOURCES): Added write-le64.c.
2431 * macros.h (ROTL64): New macro, moved from...
2432 * sha512-compress.c (ROTL64): ... old location, deleted.
2434 * serpent-internal.h [HAVE_NATIVE_64_BIT] (DROTL32): Renamed from...
2435 (ROTL64): ... old name.
2436 (DRSHIFT32): Renamed from ...
2437 (RSHIFT64): ... old name.
2438 * serpent-encrypt.c (LINEAR_TRANSFORMATION64): Updated for above
2440 * serpent-decrypt.c (LINEAR_TRANSFORMATION64_INVERSE): Likewise.
2442 2012-11-11 Niels Möller <nisse@lysator.liu.se>
2444 From Nikos Mavrogiannopoulos:
2445 * nettle.texinfo (Hash functions): Added documentation for
2447 * examples/nettle-benchmark.c (main): Benchmark gosthash94.
2449 2012-11-10 Niels Möller <nisse@lysator.liu.se>
2451 * nettle.texinfo (nettle_hashes, nettle_ciphers): Use deftypevr,
2452 not deftypevrx. Spotted by Nikos Mavrogiannopoulos.
2454 2012-11-08 Niels Möller <nisse@lysator.liu.se>
2456 Gost hash function, ported from Aleksey Kravchenko's rhash library
2457 by Nikos Mavrogiannopoulos.
2458 * gosthash94.c: New file.
2459 * gosthash94.h: New file.
2460 * gosthash94-meta.c: New file.
2461 * nettle-meta.h (nettle_gosthash94): Declare.
2462 * Makefile.in (nettle_SOURCES): Added gosthash94.c and
2464 (HEADERS): Added gosthash94.h.
2465 * testsuite/gosthash94-test.c: New file.
2466 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2469 2012-10-29 Niels Möller <nisse@lysator.liu.se>
2471 From Martin Storsjö:
2472 * configure.ac (dummy-dep-files): Avoid non-posix \|-operator in
2475 2012-10-29 Niels Möller <nisse@lysator.liu.se>
2477 * x86_64/salsa20-core-internal.asm: New file.
2478 * configure.ac: Added salsa20-core-internal.asm.
2479 * examples/nettle-benchmark.c (bench_salsa20_core): New function.
2481 2012-10-27 Niels Möller <nisse@lysator.liu.se>
2483 * testsuite/Makefile.in (TS_SOURCES, CXX_SOURCES): Include sources
2485 (TS_CXX): Moved @IF_CXX@ conditional here.
2486 (DISTFILES): Use $(SOURCES), which now includes all C source
2487 files. testutils.c was lost in a the 2012-09-20 change.
2489 * x86_64/salsa20-crypt.asm: Include x86_64/salsa20.m4.
2490 Make all exits go via .Lend and W64_EXIT.
2492 * x86_64/salsa20.m4: New file, extracted from
2493 x86_64/salsa20-crypt.asm.
2495 2012-10-26 Niels Möller <nisse@lysator.liu.se>
2497 * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LIBS): Add $(CFLAGS) on
2498 the link command line. Reported by Dennis Clarke.
2500 2012-10-03 Niels Möller <nisse@lysator.liu.se>
2502 From: Nikos Mavrogiannopoulos:
2503 * testsuite/testutils.c (test_hash): On failure, print the
2504 expected and returned hash values.
2506 2012-09-23 Niels Möller <nisse@lysator.liu.se>
2508 * Makefile.in (nettle_SOURCES): Added salsa20-core-internal.c.
2510 * salsa20-core-internal.c (_salsa20_core): New file and function,
2511 extracted from salsa20_crypt.
2512 * salsa20.h (_salsa20_core): Declare it.
2513 * salsa20-crypt.c (salsa20_crypt): Use _salsa20_core.
2515 2012-09-21 Niels Möller <nisse@lysator.liu.se>
2517 * pbkdf2.c (pbkdf2): assert that iterations > 0. Reorganized
2520 * nettle.texinfo (Cipher functions): Stress that the salsa20 hash
2521 function is not suitable as a general hash function.
2523 2012-09-20 Simon Josefsson <simon@josefsson.org>
2525 * pbkdf2-hmac-sha1.c, pbkdf2-hmac-sha256.c: New files.
2526 * pbkdf2.h (pbkdf2_hmac_sha1, pbkdf2_hmac_sha256): New prototypes.
2527 * Makefile.in (nettle_SOURCES): Add pbkdf2-hmac-sha1.c and
2528 pbkdf2-hmac-sha256.c.
2529 * nettle.texinfo (Key derivation functions): Improve.
2530 * testsuite/pbkdf2-test.c (test_main): Test new functions.
2532 2012-09-20 Niels Möller <nisse@lysator.liu.se>
2534 * pbkdf2.c (pbkdf2): Reordered arguments, for consistency.
2535 * pbkdf2.h (PBKDF2): Analogous reordering.
2536 * testsuite/pbkdf2-test.c: Adapted to new argument order. Also use
2538 * nettle.texinfo (Key derivation functions): Updated documented
2541 * testsuite/Makefile.in (VALGRIND): New variable, to make valgrind
2544 * configure.ac: New substitution IF_CXX, replacing CXX_TESTS.
2545 (dummy-dep-files): Handle .cxx files.
2547 * testsuite/Makefile.in: Use IF_CXX. Include dependency file for
2550 2012-09-19 Niels Möller <nisse@lysator.liu.se>
2553 * examples/rsa-encrypt.c (main): Added missing mpz_clear.
2554 * examples/rsa-keygen.c (main): Added missing deallocation.
2556 * testsuite/meta-hash-test.c (test_main): Validate
2557 NETTLE_MAX_HASH_DIGEST_SIZE.
2559 * pbkdf2.h (PBKDF2): New macro.
2560 * testsuite/pbkdf2-test.c: Use it.
2562 2012-09-12 Simon Josefsson <simon@josefsson.org>
2564 * NEWS: Mention addition of PBKDF2.
2565 * pbkdf2.c (pbkdf2): New file and function.
2566 * pbkdf2.h: Declare it.
2567 * Makefile.in (nettle_SOURCES): Add pbkdf2.c.
2568 (HEADERS): Add pbkdf2.h.
2569 * nettle.texinfo (Key derivation functions): New section.
2570 * testsuite/pbkdf2-test.c: New test case.
2571 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Add pbkdf2-test.c.
2572 * testsuite/.test-rules.make (pbkdf2-test): New target.
2574 2012-09-16 Niels Möller <nisse@lysator.liu.se>
2576 * testsuite/: Overhaul of testsuite, affecting almost all files.
2577 + Use struct tstring for allocated strings, and deallocate before
2579 + Changed most test functions to take struct tstring as arguments.
2580 + Made all test_main return on success.
2582 * testsuite/testutils.h (struct tstring): New struct type.
2583 (H2, HL, MEMEQH, SUCCESS): Deleted macros.
2584 (SHEX, SDATA): New macros.
2585 (H): Redefined to track storage.
2587 * testsuite/testutils.c (tstring_alloc): New function.
2588 (tstring_clear): New function.
2589 (tstring_data): New function.
2590 (tstring_hex): New function.
2591 (tstring_print_hex): New function.
2592 (decode_hex_length): Made static.
2593 (decode_hex): Made static. No return value, abort on error.
2594 (main): Expect test_main to return, and call tstring_clear before
2596 (test_dsa_key): Added missing mpz_clear.
2597 (test_mac): Deleted unused function.
2599 * testsuite/rsa2sexp-test.c (test_main): Added missing
2600 nettle_buffer_clear.
2602 * testsuite/yarrow-test.c (open_file): Don't leak filename.
2603 (test_main): fclose input file properly.
2605 * testsuite/sexp-format-test.c (test_main): Added missing calls to
2606 nettle_buffer_clear and mpz_clear.
2608 * testsuite/serpent-test.c (tstring_hex_reverse): New function,
2610 (decode_hex_reverse): ... deleted function.
2611 (RHEX): New macro, replacing...
2612 (RH, RHL): ... deleted macros.
2614 * testsuite/rsa2sexp-test.c (test_main): Added missing
2615 nettle_buffer_clear.
2617 * testsuite/random-prime-test.c (test_main): Added missing
2620 * realloc.c (nettle_realloc): Only call libc realloc if length >
2621 0, otherwise call free. Fixes a small memory leak.
2622 (nettle_xrealloc): Likewise.
2624 * run-tests (test_program): Don't quote $EMULATOR; allow it to
2625 expand to program and arguments (e.g., valgrind).
2627 * tools/pkcs1-conv.c (convert_public_key): Added missing calls to
2628 dsa_public_key_clear and rsa_public_key_clear.
2629 (main): Added missing nettle_buffer_clear.
2631 2012-09-10 Niels Möller <nisse@lysator.liu.se>
2633 * examples/eratosthenes.c (main): Explicitly deallocate storage
2636 * examples/io.c (read_file): Explicitly treat an empty file as an
2637 error. Rearrange loop, check for short fread return value.
2639 * desdata.c: Don't declare printf, include <stdio.h> instead. Also
2640 deleted casts of printf return value.
2643 * examples/nettle-benchmark.c (die): Use PRINTF_STYLE attribute.
2644 * pgp-encode.c (pgp_put_rsa_sha1_signature): Deleted unused variable.
2645 * rsa2openpgp.c (rsa_keypair_to_openpgp): Likewise.
2646 * examples/base16enc.c (main): Deleted useless allocations.
2648 2012-09-07 Niels Möller <nisse@lysator.liu.se>
2650 * examples/nettle-benchmark.c (die): Add NORETURN attribute. Patch
2652 * tools/misc.h (die, werror): Use PRINTF_STYLE and NORETURN macros
2653 for attributes. Patch from Tim Rühsen.
2655 * examples/io.h (werror): Use PRINTF_STYLE macro.
2657 2012-08-22 Niels Möller <nisse@lysator.liu.se>
2659 From Sam Thursfield <sam.thursfield@codethink.co.uk>:
2660 * configure.ac: Make documentation optional, to avoid requiring
2661 TeX. New option --disable-documentation, and Makefile substitution
2663 * Makefile.in: Use IF_DOCUMENTATION.
2665 2012-07-12 Niels Möller <nisse@lysator.liu.se>
2667 * asm.m4 (ALIGN): Use << operator rather than **, with m4 eval.
2668 The latter is not supported by BSD m4.
2670 2012-07-07 Niels Möller <nisse@lysator.liu.se>
2672 Copyright headers: Updated FSF address. Patch from David Woodhouse.
2674 * examples/Makefile.in (BENCH_LIBS): Added -lm, needed for the
2675 ldexp function. Reported by Anthony G. Basile.
2677 * configure.ac: Changed version number to 2.6.
2679 * Released nettle-2.5.
2681 2012-07-05 Niels Möller <nisse@lysator.liu.se>
2683 * x86_64/salsa20-crypt.asm (salsa20_crypt): Write the 64-bit movq
2684 instructions as "movd", since that makes the osx assembler
2685 happier. Assembles to the same machine code on gnu/linux.
2687 2012-07-03 Niels Möller <nisse@lysator.liu.se>
2689 * aclocal.m4 (LSH_FUNC_ALLOCA): In the config.h boilerplate,
2690 include malloc.h if it exists, also when compiling with gcc.
2691 Needed for cross-compiling with --host=i586-mingw32msvc.
2693 * examples/base16dec.c: Don't #include files using <nettle/...>,
2694 we don't want to pick up installed versions. On windows, include
2695 <fcntl.h>, needed for _setmode.
2696 * examples/base16enc.c: Likewise.
2697 * examples/base64dec.c: Likewise.
2698 * examples/base64enc.c: Likewise
2700 * nettle.texinfo (Cipher functions): Document Salsa20.
2702 2012-06-25 Niels Möller <nisse@lysator.liu.se>
2704 * pkcs1.c (_pkcs1_signature_prefix): Renamed function, adding a
2705 leading underscore. Updated all callers.
2707 * bignum-next-prime.c (nettle_next_prime): Consistently use the
2708 type nettle_random_func * (rather then just nettle_random_func)
2709 when passing the function pointer as argument. Similar change for
2710 nettle_progress_func. Should have been done for the 2.0 release,
2711 but a few arguments were overlooked.
2712 * bignum-random-prime.c (_nettle_generate_pocklington_prime)
2713 (nettle_random_prime): Likewise.
2714 * bignum-random.c (nettle_mpz_random_size, nettle_mpz_random):
2716 * dsa-keygen.c (dsa_generate_keypair): Likewise.
2717 * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise.
2718 * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
2720 * dsa-sign.c (_dsa_sign): Likewise.
2721 * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
2722 * rsa-blind.c (_rsa_blind): Likewise.
2723 * rsa-decrypt-tr.c (rsa_decrypt_tr): Likewise.
2724 * rsa-encrypt.c (rsa_encrypt): Likewise.
2725 * rsa-keygen.c (rsa_generate_keypair): Likewise.
2726 * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): Likewise.
2728 * cbc.c (cbc_encrypt, cbc_decrypt): Similarly, use the type
2729 nettle_crypt_func * rather than just nettle_crypt_func.
2730 * ctr.c (ctr_crypt): Likewise.
2731 * gcm.c (gcm_set_key): Likewise.
2733 * testsuite/des-compat-test.c (test_main): Disable declarations of
2734 disabled functions and variables, to avoid warnings. No verbose
2735 output unless verbose flag is set.
2737 2012-06-09 Niels Möller <nisse@lysator.liu.se>
2739 * examples/Makefile.in (SOURCES): Added base16dec.c, forgotten
2742 General pkcs1 signatures, with a "DigestInfo" input. Suggested by
2743 Nikos Mavrogiannopoulos.
2744 * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-digest.c,
2745 rsa-pkcs1-sign.c, rsa-pkcs1-sign-tr.c, and rsa-pkcs1-verify.c.
2747 * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): New file and
2749 * pkcs1.h: Declare it.
2751 * rsa-pkcs1-verify.c (rsa_pkcs1_verify): New file and function.
2752 * rsa-pkcs1-sign.c (rsa_pkcs1_sign): New file and function.
2753 * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): New file and function,
2754 contributed by Nikos Mavrogiannopoulos.
2755 * rsa.h: Declare new functions.
2757 * rsa.h (_rsa_blind, _rsa_unblind): Declare functions.
2758 * rsa-blind.c (_rsa_blind, _rsa_unblind): Functions moved to a
2759 separate file, renamed and made non-static. Moved from...
2760 * rsa-decrypt-tr.c: ... here.
2762 2012-06-03 Niels Möller <nisse@lysator.liu.se>
2764 * testsuite/pkcs1-test.c (test_main): Include leading zero in
2767 * pkcs1.c (pkcs1_signature_prefix): Return pointer to where the
2768 digest should be written. Let the size input be the key size in
2769 octets, rather then key size - 1.
2770 * pkcs1-rsa-*.c: Updated for above.
2771 * rsa-*-sign.c, rsa-*-verify.c: Pass key->size, not key->size - 1.
2773 2012-05-18 Niels Möller <nisse@lysator.liu.se>
2775 * pkcs1-encrypt.c (pkcs1_encrypt): New file and function.
2776 * rsa-encrypt.c (rsa_encrypt): Use pkcs1_encrypt.
2778 2012-05-09 Niels Möller <nisse@lysator.liu.se>
2780 * rsa-decrypt-tr.c (rsa_decrypt_tr): Added missing mpz_clear,
2781 spotted by Nikos Mavrogiannopoulos.
2783 2012-05-07 Niels Möller <nisse@lysator.liu.se>
2785 * nettle-types.h (_STDINT_HAVE_INT_FAST32_T): Define here, to
2786 force nettle-stdint.h to not try to define the int_fast*_t types.
2787 Avoids compilation problems with gnutls on SunOS-5.8, where the
2788 definitions here collide with gnulib's.
2790 2012-04-23 Niels Möller <nisse@lysator.liu.se>
2792 * nettle-internal.h (NETTLE_MAX_BIGNUM_SIZE): New constant. Based
2793 on NETTLE_MAX_BIGNUM_BITS, rounded upwards. Replaced all uses of
2794 NETTLE_MAX_BIGNUM_BITS.
2796 2012-04-19 Niels Möller <nisse@lysator.liu.se>
2798 * list-obj-sizes.awk: Use decimal rather than hexadecimal output.
2799 (hex2int): Use local variables.
2801 2012-04-18 Niels Möller <nisse@lysator.liu.se>
2803 * x86_64/salsa20-crypt.asm: New file.
2805 2012-04-17 Niels Möller <nisse@lysator.liu.se>
2807 * testsuite/salsa20-test.c (test_salsa20_stream): Check that
2808 salsa20_crypt doesn't write beyond the given destination area.
2809 (test_salsa20): Likewise.
2811 * salsa20-crypt.c: Renamed file, from...
2812 * salsa20.c: ... old name.
2814 * x86_64/machine.m4 (WREG): New macro.
2816 * salsa20.c (salsa20_hash): Deleted function, inlined into
2818 (salsa20_set_key, salsa20_set_iv): Moved, to...
2819 * salsa20-set-key.c: ...new file.
2821 2012-04-15 Niels Möller <nisse@lysator.liu.se>
2823 * testsuite/salsa20-test.c (test_salsa20_stream): New function.
2824 (test_main): Tests for encrypting more than one block at a time.
2826 2012-04-14 Niels Möller <nisse@lysator.liu.se>
2828 * examples/io.c (write_file): Use write_string.
2830 * examples/Makefile.in (base64enc): New targets. Also
2831 added missing io.o dependency to several other targets.
2832 (base64dec, base16enc, base16dec): Likewise.
2834 * examples/base64enc.c: New file, based on example code
2835 contributed by Jeronimo Pellegrini.
2836 * examples/base64dec.c: Likewise.
2837 * examples/base16enc.c: Likewise.
2838 * examples/base16dec.c: Likewise.
2840 * examples/rsa-encrypt.c (process_file): Reorganized fread loop.
2841 (usage): New function.
2842 (main): Implemented --help option.
2844 * examples/rsa-decrypt.c (process_file): Improved error message
2845 for too short input file.
2847 * aes-set-decrypt-key.c (gf2_log, gf2_exp): Deleted tables.
2848 (mult, inv_mix_column): Deleted functions.
2849 (mtable): New table.
2850 (MIX_COLUMN): New macro.
2851 (aes_invert_key): Use MIX_COLUMN and mtable.
2853 * aesdata.c (compute_mtable): New table, for the inv mix column
2854 operation in aes_invert_key.
2856 2012-04-13 Niels Möller <nisse@lysator.liu.se>
2858 * aes-set-encrypt-key.c (aes_set_encrypt_key): Use LE_READ_UINT32.
2859 Tabulate the needed "round constants".
2860 (xtime): Deleted function.
2862 * aes-internal.h (SUBBYTE): Cast to uint32_t. Use B0, ..., B3
2865 2012-04-09 Niels Möller <nisse@lysator.liu.se>
2867 Timing resistant RSA decryption, based on RSA blinding code
2868 contributed by Nikos Mavrogiannopoulos.
2869 * rsa-decrypt-tr.c (rsa_decrypt_tr): New function.
2870 (rsa_blind): Helper function.
2871 (rsa_unblind): Helper function.
2872 * rsa.h: Declare rsa_decrypt_tr. Some cleanups, no longer include
2873 nettle-meta.h, more consistent declarations of function pointer
2875 * testsuite/rsa-encrypt-test.c (test_main): Test rsa_decrypt_tr.
2876 Check for writes past the end of the message area.
2878 * Makefile.in (hogweed_SOURCES): Added pkcs1-decrypt.c.
2879 * rsa-decrypt.c (rsa_decrypt): Use pkcs1_decrypt.
2880 * pkcs1-decrypt.c (pkcs1_decrypt): New file and function,
2881 extracted from rsa_decrypt.
2883 2012-04-01 Niels Möller <nisse@lysator.liu.se>
2885 * salsa20.c (LE_SWAP32): Typo fix for big-endian case.
2886 (QROUND): New macro.
2887 (salsa20_hash): Use it.
2889 2012-03-31 Niels Möller <nisse@lysator.liu.se>
2891 * salsa20.c: (salsa20_set_iv): Deleted size argument, only one
2893 (U8TO32_LITTLE): Deleted macro. Use LE_READ_UINT32 instead, which
2894 avoids unaligned reads.
2895 (salsa20_set_key): Rearranged slightly, to avoid unnecessary
2896 byte-to-word conversions.
2898 (LE_SWAP32): Renamed macro from...
2899 (U32TO32_LITTLE): ... old name.
2900 (U32TO8_LITTLE): Deleted macro.
2901 (salsa20_wordtobyte): Renamed function to...
2902 (salsa20_hash): ... new name. Changed output argument from byte
2903 array to word array. Use memxor3, which brings a considerable
2906 * nettle-internal.c (salsa20_set_key_hack): Updated salsa20_set_iv
2908 * testsuite/salsa20-test.c (test_salsa20): Deleted iv_length
2909 argument, updated all calls.
2911 * salsa20.h (SALSA20_BLOCK_SIZE): New constant.
2912 (_SALSA20_INPUT_LENGTH): New constant.
2913 * salsa20.c: Use these constants.
2915 * salsa20.c (ROTL32): Deleted macro, use the one from macros.h
2916 instead, with reversed order of arguments.
2917 (ROTATE, XOR, PLUS, PLUSONE): Deleted macros, use ROTL32 and
2918 builtin operators directly.
2920 Unification of rotation macros.
2921 * macros.h (ROTL32): New macro, to replace (almost) all other
2924 * aes-set-encrypt-key.c: Include macros.h.
2925 (aes_set_encrypt_key): Use ROTL32.
2926 * aes-internal.h (ROTBYTE, ROTRBYTE): Deleted macros.
2928 * camellia-internal.h (ROL32): Deleted macro.
2929 (ROTL128): Renamed for consistency, from...
2930 (ROL128): ... old name.
2931 * camellia-crypt-internal.c: Updated for renamed rotation macros.
2932 * camellia-set-encrypt-key.c: Likewise.
2933 * cast128.c (ROL): Deleted macro.
2934 (F1, F2, F3): Updated to use ROTL32 (reversed order of arguments).
2935 Also added proper do { ... } while (0) wrappers.
2937 * ripemd160-compress.c (ROL32): Deleted macro.
2938 (R): Updated to use ROTL32 (reversed order of arguments).
2940 * serpent-internal.h (ROL32): Deleted macro.
2941 (ROTL64): Renamed (from ROL64) and reorderd arguments, for
2943 (RSHIFT64): Reordered arguments, for consistency.
2944 * serpent-decrypt.c: Updated for renamed rotation macros, with
2945 reversed argument order.
2946 * serpent-encrypt.c: Likewise.
2947 * serpent-set-key.c: Likewise.
2949 * sha1-compress.c (ROTL): Deleted macro, use ROTL32 instead.
2951 * sha256-compress.c (ROTR): Deleted macro. Replaced by ROTL32,
2952 with complemented shift count.
2953 (SHR): Deleted macro, use plain shift operator instead.
2955 * sha512-compress.c (ROTR): Deleted macro, replaced by...
2956 (ROTL64): ...new macro, with complemented shift count
2957 (SHR): Deleted macro, use plain shift operator instead.
2958 (S0, S1, s0, s1): Updated accordingly.
2960 2012-03-30 Niels Möller <nisse@lysator.liu.se>
2962 * nettle-internal.c (nettle_salsa20): Cipher struct for
2963 benchmarking only. Sets a fix zero IV, and ignores block size.
2964 * nettle-internal.h (nettle_salsa20): Declare it.
2966 * examples/nettle-benchmark.c (block_cipher_p): New function.
2967 (time_cipher): Use block_cipher_p.
2968 (main): Include salsa20 in benchmark.
2970 * Makefile.in (soname link): Fixed logic.
2971 (nettle_SOURCES): Removed nettle-internal.c, so that it's not
2972 part of the library...
2973 (internal_SOURCES): ...and put it here.
2974 * testsuite/Makefile.in (TEST_OBJS): Added ../nettle-internal.o.
2975 * examples/Makefile.in (BENCH_OBJS): New variable, to simplify the
2976 nettle-benchmark rule. Also link with ../nettle-internal.o.
2978 2012-03-29 Niels Möller <nisse@lysator.liu.se>
2980 Implementation of Salsa20, contributed by Simon Josefsson.
2981 * salsa20.h: New file.
2982 * salsa20.c: New file.
2983 * Makefile.in (nettle_SOURCES): Added salsa20.c
2984 (HEADERS): Added salsa20.h.
2985 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added salsa20-test.c.
2986 * testsuite/salsa20-test.c: New test case.
2988 * Makefile.in (soname links): Adding missing space before ].
2990 2012-03-23 Niels Möller <nisse@lysator.liu.se>
2992 * arcfour.h (arcfour_stream): Deleted obsolete prototype.
2994 2012-03-05 Niels Möller <nisse@lysator.liu.se>
2996 * configure.ac (enable_shared): Build shared libraries by default.
2998 2012-03-04 Niels Möller <nisse@lysator.liu.se>
3000 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.4.
3001 (LIBHOGWEED_MINOR): And to 2.2.
3003 2012-02-27 Niels Möller <nisse@lysator.liu.se>
3005 * list-obj-sizes.awk: Recognize elf64 objects.
3007 * Makefile.in (.texinfo.dvi): Pass -b option to texi2dvi.
3009 * Makefile.in (TARGETS): Added twofishdata.
3010 (SOURCES): Added twofishdata.c.
3011 (twofishdata): New rule.
3013 * twofish.c (q0, q1): Made const, and reformatted to match the
3014 twofishdata program.
3016 * twofishdata.c: Resurrected old file. Used to be called
3017 generate_q.c, when the twofish code was contributed back in 1999.
3019 * nettle.texinfo: Documentation for base16 and base64 encoding.
3020 Text contributed by Jeronimo Pellegrini
3021 <pellegrini@mpcnet.com.br>, back in April 2006.
3023 2012-02-18 Niels Möller <nisse@lysator.liu.se>
3025 * run-tests, getopt.c, getopt1.c, getopt.h: These files were moved
3026 to the top-level in the conversion to an independent git
3027 repository. They used to be symlinks to lsh files, from the
3028 subdirectories which use them.
3030 * Makefile.in: Build and distribute getopt files. Distribute
3032 * examples/Makefile.in: Adapt to getopt files and the run-tests
3033 script now located in the parent directory.
3034 * testsuite/Makefile.in: Likewise.
3035 * tools/Makefile.in: Likewise.
3037 * index.html: Converted to xhtml (from lsh repository, change
3038 dated 2012-02-03). Updated git instructions.
3040 * nettle.texinfo: Updated charset declaration.
3041 * misc/plan.html: Likewise.
3043 2012-01-17 Niels Möller <nisse@lysator.liu.se>
3045 * testsuite/Makefile.in (DISTFILES): Added setup-env.
3047 * examples/rsa-decrypt.c (main): Use _setmode rather than setmode,
3048 suggested by Eli Zaretskii. Affects windows builds only.
3049 * examples/rsa-encrypt.c: Likewise.
3051 * Makefile.in ($(LIBNETTLE_FORLINK)): Always create a .lib symlink
3052 to the library file. Use LN_S.
3053 ($(LIBHOGWEED_FORLINK)): Likewise.
3055 (install-shared-nettle): Use LN_S.
3056 (install-shared-hogweed): Likewise.
3058 * configure.ac: Use AC_PROG_LN_S.
3059 * config.make.in (LN_S): New substitution.
3061 * testsuite/setup-env: New file. Wine workaround. Can't get
3062 ../.lib into wine's dll search path, so create additional
3064 * testsuite/teardown-env: ...and delete them here. Also delete
3066 * examples/setup-env: Similar links setup here.
3067 * examples/teardown-env: ... and deleted.
3069 2012-01-07 Niels Möller <nisse@lysator.liu.se>
3071 * examples/Makefile.in (check): Add ../.lib to PATH, like in
3072 testsuite/Makefile. Needed for w*ndows. Reported by Eli Zaretskii.
3074 2011-11-25 Niels Möller <nisse@lysator.liu.se>
3076 From Martin Storsjö:
3077 * x86_64/machine.m4 (W64_ENTRY, W64_EXIT): New macros for
3079 * x86_64: Updated all assembly files to use them.
3081 * configure.ac (W64_ABI): New variable, set when compiling for
3082 W64 ABI (64-bit M$ windows).
3083 * config.m4.in (W64_ABI): Define, from configure substitution.
3085 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3087 From Martin Storsjö:
3088 * examples/Makefile.in (check): Pass $(EMULATOR) and $(EXEEXT) in
3089 the environment of run-tests.
3090 * examples/rsa-encrypt-test: Use $EXEEXT and $EMULATOR.
3091 * examples/rsa-sign-test: Likewise.
3092 * examples/rsa-verify-test: Likewise.
3093 * examples/setup-env: Likewise.
3095 * testsuite/Makefile.in (check): Pass $(EXEEXT) in the environment of
3097 * testsuite/pkcs1-conv-test: Use $EXEEXT and $EMULATOR. Ignore \r
3100 * examples/rsa-decrypt.c (main) [WIN32]: Set stdout/stdin to
3102 * examples/rsa-encrypt.c (main): Likewise.
3104 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3106 * configure.ac (HAVE_NATIVE_64_BIT): Workaround to get it set to 1
3109 * serpent-internal.h (ROL64): Use (uint64_t) 1 rather than 1L, for
3111 (RSHIFT64): Likewise. Also added a missing parenthesis.
3113 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3115 From Martin Storsjö:
3116 * testsuite/symbols-test: Use $NM, falling back to nm if undefined.
3117 * testsuite/Makefile.in (check): Pass $(NM) in the environment of
3119 * config.make.in (NM): Set NM.
3121 * testsuite/sexp-conv-test: Use $EMULATOR when running test
3122 programs. Also ignore \r for output in the non-canonical output
3124 * testsuite/Makefile.in (check): Pass $(EMULATOR) in the
3125 environment of run-tests.
3126 * configure.ac (EMULATOR): New substituted variable. Set to wine
3127 or wine64 when cross compiling for windows, otherwise empty.
3128 * config.make.in (EMULATOR): Set from autoconf value.
3130 2011-11-20 Niels Möller <nisse@lysator.liu.se>
3132 * x86/camellia-crypt-internal.asm: Take ALIGNOF_UINT64_T into
3133 account when getting the offset for the subkeys. Differs between
3134 w32 and other systems. w32 problem identified by Martin Storsjö.
3136 * config.m4.in: Define ALIGNOF_UINT64_T (from configure).
3138 * configure.ac: Check alignment of uint64_t, and also use AC_SUBST
3139 for use in config.m4.in.
3141 2011-11-19 Niels Möller <nisse@lysator.liu.se>
3143 Cygwin/mingw32 improvements contributed by Martin Storsjö:
3144 * Makefile.in (IMPLICIT_TARGETS): New variable for DLL link
3146 (clean-here): Delete the DLL import libraries.
3148 * configure.ac: Setup installation of DLL files in $bindir.
3149 (IF_DLL, LIBNETTLE_FILE_SRC, LIBHOGWEED_FILE_SRC): New
3152 * config.make.in (LIBNETTLE_FILE_SRC): Substitute new autoconf
3154 (LIBHOGWEED_FILE_SRC): Likewise.
3156 * Makefile.in (install-dll-nettle, uninstall-dll-nettle): New
3157 target for installing the DLL file in $bindir.
3158 (install-shared-nettle): Conditionally
3159 depend on install-dll-nettle. Use LIBNETTLE_FILE_SRC.
3160 (uninstall-shared-nettle): Conditionally depend on
3162 (various hogweed targets): Analogous changes.
3164 * configure.ac: Unify shared lib setup for cygwin and mingw.
3166 2011-10-31 Niels Möller <nisse@lysator.liu.se>
3168 * configure.ac (LIBHOGWEED_LIBS): Typo fix for the darwin case.
3169 Spotted by Martin Storsjö.
3171 2011-10-25 Niels Möller <nisse@lysator.liu.se>
3173 * configure.ac (LIBHOGWEED_LIBS): cygwin fix, added
3174 libnettle.dll.a. Reported by Volker Zell.
3176 2011-10-18 Niels Möller <nisse@lysator.liu.se>
3178 * configure.ac: Improved setup för darwin shared libraries.
3179 Patch contributed by Ryan Schmidt.
3181 2011-10-03 Niels Möller <nisse@lysator.liu.se>
3183 * x86_64/memxor.asm: Implemented sse2-loop. Configured at compile
3184 time, and currently disabled.
3186 * testsuite/testutils.h (ASSERT): Write message to stderr.
3188 * testsuite/memxor-test.c: Use 16-byte alignment for "fully
3191 2011-09-03 Niels Möller <nisse@lysator.liu.se>
3193 * x86/camellia-crypt-internal.asm: Use "l"-suffix on instructions
3194 more consistently. Reportedly, freebsd and netbsd systems with
3195 clang are more picky about this.
3197 * configure.ac: Changed version number to 2.5.
3199 * Released nettle-2.4.
3201 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.3.
3203 * gcm-aes.c: Include config.h.
3204 * tools/nettle-lfib-stream.c: Likewise.
3206 * ripemd160-compress.c: Added missing include of config.h. Needed
3207 for correct operation on big-endian systems.
3209 2011-09-02 Niels Möller <nisse@amfibolit.hack.org>
3211 * configure.ac: Changed version number to 2.4.
3213 * Released nettle-2.3.
3215 2011-08-30 Niels Möller <nisse@lysator.liu.se>
3217 * testsuite/hmac-test.c: Added tests for hmac-ripemd160.
3219 * hmac.h: Declare hmac-ripemd160 related functions.
3221 * Makefile.in (nettle_SOURCES): Added hmac-ripemd160.c.
3223 2011-08-30 Niels Möller <nisse@amfibolit.hack.org>
3225 * nettle.texinfo (Hash functions): Document ripemd-160.
3227 * hmac-ripemd160.c: New file.
3229 * hmac.h: Declare hmac-ripemd160 functions.
3231 2011-08-29 Niels Möller <nisse@lysator.liu.se>
3233 * sha256.c (sha256_update): Updated MD_UPDATE call for new
3235 (sha256_write_digest): Use MD_PAD rather than MD_FINAL, and insert
3236 the length manually.
3237 * sha512.c: Analogous changes.
3239 * sha1.c (COMPRESS): New macro.
3240 (sha1_update): Updated MD_UPDATE call for new conventions.
3241 (sha1_digest): Use MD_PAD rather than MD_FINAL, and insert the
3244 * ripemd160.c (ripemd160_init): Use memcpy for initializing the
3246 (COMPRESS): New macro.
3247 (ripemd160_update): Use MD_UPDATE.
3248 (ripemd160_digest): Inline ripemd160_final processing. Use MD_PAD
3249 and _nettle_write_le32.
3250 (ripemd160_final): Deleted function.
3252 * ripemd160.h (struct ripemd160_ctx): Use a 64-bit block count.
3253 Renamed digest to state.
3255 * md5.c (md5_init): Use memcpy for initializing the state vector.
3256 (COMPRESS): New macro, wrapping _nettle_md5_compress.
3257 (md5_update): Use MD_UPDATE.
3258 (md5_digest): Inline md5_final processing. Use MD_PAD and
3260 (md5_final): Deleted.
3262 * md5.h (struct md5_ctx): Renamed some fields, for consistency.
3264 * md4.h (struct md4_ctx): Renamed some fields, for consistency.
3266 * md4.c (md4_init): Use memcpy for initializing the state vector.
3267 (md4_update): Use MD_UPDATE.
3268 (md4_digest): Inline md4_final processing, using MD_PAD. Use
3270 (md4_block): Renamed, to...
3271 (md4_compress): ... new name. Take ctx pinter as argument.
3272 (md4_final): Deleted function.
3274 * md2.c (md2_update): Use MD_UPDATE.
3276 * macros.h (MD_UPDATE): Added incr argument. Invoke compression
3277 function with ctx pointer as argument, rather than ctx->state.
3278 (MD_FINAL): Just pad, don't store length field. Renamed to MD_PAD.
3279 (MD_PAD): Analogous change of compression invocations.
3281 * sha512.c: (COMPRESS): New macro wrapping _nettle_sha512_compress.
3282 (sha512_update): Use MD_UPDATE.
3283 (sha512_final): Deleted function.
3284 (sha512_write_digest): Use MD_FINAL.
3286 * sha256.c (COMPRESS): New macro wrapping _nettle_sha256_compress.
3287 (SHA256_INCR): Deleted macro.
3288 (sha256_update): Use MD_UPDATE.
3289 (sha256_final): Deleted function.
3290 (sha256_write_digest): New function, replacing sha256_final, and
3292 (sha256_digest): Use sha256_write_digest.
3293 (sha224_digest): Likewise.
3295 * tools/nettle-hash.c (list_algorithms): Fixed typo in header.
3297 * sha1.c (SHA1_DATA_LENGTH): Deleted unused macro.
3298 (sha1_init): Use memcpy to initialize the state vector.
3299 (SHA1_INCR): Deleted macro.
3300 (sha1_update): Use MD_UPDATE macro, to reduce code duplication.
3301 (sha1_digest): Use MD_FINAL macro.
3302 (sha1_final): Deleted function.
3304 * sha.h (struct sha1_ctx): Renamed attribute digest to state.
3306 * macros.h (MD_UPDATE): New macro.
3307 (MD_FINAL): New macro.
3309 2011-08-28 Niels Möller <nisse@lysator.liu.se>
3311 * ripemd160.c (ripemd160_final): Use LE_WRITE_UINT32. Deleted byte
3312 swapping at the end, leaving it to ripemd160_digest.
3313 (ripemd160_digest): Use _nettle_write_le32.
3315 * Makefile.in (nettle_SOURCES): Added write-le32.c.
3317 * md5.c (md5_digest): Use _nettle_write_le32.
3319 * write-le32.c (_nettle_write_le32): New file and function.
3321 * ripemd160-compress.c (ROL32): Renamed macro (was "rol"). Deleted
3322 x86 version using inline assembly; at least gcc-4.4.5 recognizes
3323 shift-and-or expressions which are in fact rotations.
3324 (_nettle_ripemd160_compress): Use LE_READ_UINT32.
3326 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.2.
3328 * testsuite/meta-hash-test.c: Updated for the addition of
3331 * testsuite/.test-rules.make: Added rule for ripemd160-test.
3333 * examples/nettle-benchmark.c (main): Benchmark ripemd-160.
3335 2011-08-28 Niels Möller <nisse@lysator.liu.se>
3337 RIPEMD-160 hash function. Ported from libgcrypt by Andres Mejia.
3338 * testsuite/ripemd160-test.c: New file.
3339 * ripemd160.h: New file.
3340 * nettle-meta.h: Declare nettle_ripemd160.
3341 * ripemd160.c: New file, ported from libgcrypt.
3342 * ripemd160-compress.c: Likewise.
3343 * ripemd160-meta.c: New file.
3344 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3346 * nettle-meta-hashes.c (nettle_hashes): Added nettle_ripemd160.
3347 * Makefile.in (nettle_SOURCES): Added ripemd160.c,
3348 ripemd160-compress.c, and ripemd160-meta.c.
3349 (HEADERS): Added ripemd160.h.
3351 2011-08-10 Niels Möller <nisse@amfibolit.hack.org>
3353 * nettle.texinfo: Fixed mis-placed const in various prototypes.
3354 Spotted by Tatsuhiro Tsujikawa.
3356 2011-07-24 Niels Möller <nisse@lysator.liu.se>
3358 * Makefile.in (PKGCONFIG_FILES, pkgconfigdir): New variables.
3359 (DISTFILES): Added nettle.pc.in and hogweed.pc.in.
3360 (nettle.pc, hogweed.pc): New targets (invoking config.status).
3361 (install-pkgconfig, uninstall-pkgconfig): New targets.
3362 (install-here): Depend on install-pkgconfig.
3363 (uninstall-here): Depend on uninstall-pkgconfig.
3364 (distclean-here): Delete nettle.pc and hogweed.pc.
3366 2011-07-20 Niels Möller <nisse@lysator.liu.se>
3368 * configure.ac: Generate nettle.pc and hogweed.pc.
3370 * nettle.pc.in, hogweed.pc.in: New files.
3372 2011-07-17 Niels Möller <nisse@lysator.liu.se>
3374 * nettle-internal.h: Added missing extern declarations.
3376 2011-07-11 Niels Möller <nisse@lysator.liu.se>
3378 * configure.ac: Changed version number to 2.3.
3380 * Released nettle-2.2.
3382 * Makefile.in (DISTFILES): Distribute COPYING.LIB, not COPYING,
3384 2011-07-07 Niels Möller <nisse@lysator.liu.se>
3386 * tools/misc.h (werror): Removed incorrect noreturn attribute from
3389 * examples/io.c (read_file): Bug fix, in dependence of initial
3392 2011-07-01 Niels Möller <nisse@lysator.liu.se>
3394 * cbc.c (CBC_BUFFER_LIMIT): Reduced to 512 bytes.
3395 (cbc_decrypt): For in-place operation, use overlapping memxor3 and
3398 * ctr.c (ctr_crypt): Reorganized to call the encryption function
3399 with several blocks at a time. Handle the case of a single block
3402 * x86_64/memxor.asm: Added ALIGN for shifting loop. Deleted
3405 2011-06-30 Niels Möller <nisse@lysator.liu.se>
3407 * configure.ac: Link in serpent-decrypt.asm, if found.
3409 * x86_64/serpent-decrypt.asm: Added an SSE2 loop, doing four
3410 blocks at a time in parallel.
3412 * x86_64/serpent-encrypt.asm: Include serpent.m4. Deleted a
3415 * x86_64/serpent.m4: New file, with serpent-related macros.
3417 2011-06-29 Niels Möller <nisse@lysator.liu.se>
3419 * x86_64/serpent-decrypt.asm: Wrote main (32-bit) loop.
3420 (SBOX0I, SBOX1I, SBOX7I): Fixed bugs.
3422 * nettle.texinfo (Copyright): Updated for license change to
3423 LGPLv2+. Updated copyright info on serpent.
3425 * NEWS: Updated information for nettle-2.2.
3427 * x86_64/serpent-decrypt.asm: New file.
3429 * x86_64/serpent-encrypt.asm: Fixed .file pseudo op.
3431 * testsuite/testutils.c (test_cipher_ctr): Display more info on
3434 * examples/nettle-benchmark.c (bench_ctr): New function.
3435 (time_cipher): Also benchmark CTR mode.
3437 * configure.ac (LIBNETTLE_MINOR): Updated library version number
3439 (LIBHOGWEED_MINOR): And to 2.1.
3441 2011-06-22 Niels Möller <nisse@lysator.liu.se>
3443 * configure.ac: Use pwd -P when examining lib directories.
3444 Link in serpent-encrypt.asm, if found.
3446 2011-06-21 Niels Möller <nisse@lysator.liu.se>
3448 * serpent-decrypt.c (SBOX3_INVERSE): Eliminated temporaries.
3449 (SBOX4_INVERSE): Likewise.
3450 (SBOX5_INVERSE): Likewise.
3451 (SBOX6_INVERSE): Likewise.
3452 (SBOX7_INVERSE): Likewise.
3453 (All SBOX_INVERSE-macros): Deleted type argument, and updated users.
3455 2011-06-20 Niels Möller <nisse@lysator.liu.se>
3457 * serpent-decrypt.c: Renamed arguments in sbox macros.
3458 (SBOX0_INVERSE): Eliminated temporaries.
3459 (SBOX1_INVERSE): Likewise.
3460 (SBOX2_INVERSE): Likewise.
3462 * x86_64/serpent-encrypt.asm: Added an SSE2 loop, doing four
3463 blocks at a time in parallel.
3465 * testsuite/serpent-test.c (test_main): Added some more multiple
3468 2011-06-15 Niels Möller <nisse@lysator.liu.se>
3470 * configure.ac (libdir): On 64-bit Linux, we used to assume that
3471 libraries are installed according to the FHS. Since at least
3472 Fedora and Gentoo follow the FHS convention, while at least Debian
3473 doesn't, we have to try to figure out which convention is used.
3475 2011-06-14 Niels Möller <nisse@lysator.liu.se>
3477 * x86_64/serpent-encrypt.asm: Slight simplification of loop logic.
3479 * x86_64/serpent-encrypt.asm: New file.
3481 2011-06-12 Niels Möller <nisse@lysator.liu.se>
3483 * testsuite/serpent-test.c (test_main): Added tests with multiple
3486 * serpent-encrypt.c (SBOX6): Renamed arguments. Eliminated
3489 (All SBOX-macros): Deleted type argument, and updated users.
3491 * configure.ac: Display summary at the end of configure..
3492 (asm_path): Set only if enable_assember is yes.
3494 2011-06-10 Niels Möller <nisse@lysator.liu.se>
3496 * serpent-encrypt.c (SBOX5): Renamed arguments. Eliminated
3499 2011-06-09 Niels Möller <nisse@lysator.liu.se>
3501 * serpent-encrypt.c (SBOX4): Renamed arguments. Eliminated
3504 * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LINK): Cygwin fix, from
3507 2011-06-08 Niels Möller <nisse@lysator.liu.se>
3509 * examples/eratosthenes.c (find_first_one): Fixed c99-style
3510 declaration. Reported by Sebastian Reitenbach.
3511 (find_first_one): Declare the lookup table as static const, and
3512 use unsigned char rather than unsigned..
3514 2011-06-07 Niels Möller <nisse@lysator.liu.se>
3516 * serpent-encrypt.c (SBOX0): Renamed arguments. Eliminated
3522 2011-06-06 Niels Möller <nisse@lysator.liu.se>
3524 * Makefile.in (DISTFILES): Added serpent-internal.h.
3525 (nettle_SOURCES): Replaced serpent.c by serpent-set-key.c,
3526 serpent-encrypt.c, and serpent-decrypt.c.
3528 * serpent.c: Replaced by several new files.
3529 * serpent-set-key.c: New file.
3530 * serpent-encrypt.c: New file.
3531 * serpent-decrypt.c: New file.
3532 * serpent-internal.h: New file.
3534 * serpent.c [HAVE_NATIVE_64_BIT]: Process two blocks at a time in
3535 parallel. Measured speedup of 10%--25% (higher for encryption) on
3538 2011-06-01 Niels Möller <nisse@lysator.liu.se>
3540 * serpent.c (ROUNDS): Deleted macro.
3541 (serpent_block_t): Deleted array typedef.
3542 (KEYXOR): New macro, replacing BLOCK_XOR.
3543 (BLOCK_COPY, SBOX, SBOX_INVERSE): Deleted macros.
3544 (LINEAR_TRANSFORMATION): Use four separate arguments.
3545 (LINEAR_TRANSFORMATION_INVERSE): Likewise.
3546 (ROUND): Take separate arguments for all input and output words.
3547 (ROUND_INVERSE): Likewise.
3548 (ROUND_LAST, ROUND_FIRST_INVERSE): Deleted macros.
3549 (serpent_set_key): Moved loop termination test.
3550 (serpent_encrypt): Rewrote with unrolling of just eight rounds,
3551 and without serpent_block_t.
3552 (serpent_decrypt): Likewise.
3554 * serpent.c: Added do { ... } while (0) around block macros.
3555 (serpent_key_t): Deleted array typedef.
3556 (ROL32, ROR32): Renamed macros, were rol and ror.
3557 (KS_RECURRENCE, KS): New macros.
3558 (serpent_key_pad): Renamed, from...
3559 (serpent_key_prepare): ...old name.
3560 (serpent_subkeys_generate): Deleted function.
3561 (serpent_set_key): Rewrote the generation of subkeys. Reduced both
3562 temporary storage and code size (less unrolling)
3564 2011-05-31 Niels Möller <nisse@lysator.liu.se>
3566 * testsuite/serpent-test.c (test_main): Enabled test with short,
3569 * serpent.c (byte_swap_32): Deleted macro.
3570 (serpent_key_prepare): Use LE_READ_UINT32. Don't require aligned
3571 input, and support arbitrary key sizes.
3573 2011-05-30 Simon Josefsson <simon@josefsson.org>
3575 * serpent.c: Rewrite, based on libgcrypt code. License changed
3577 * serpent_sboxes.h: Removed.
3578 * Makefile.in: Drop serpent_sboxes.h.
3580 2011-05-31 Niels Möller <nisse@lysator.liu.se>
3582 * testsuite/serpent-test.c (test_main): Added some tests for
3583 padding of keys of length which is not a multiple of four bytes.
3585 2011-05-30 Simon Josefsson <simon@josefsson.org>
3587 * testsuite/serpent-test.c (test_main): Add test vectors from
3590 2011-05-21 Niels Möller <nisse@lysator.liu.se>
3592 * dsa-keygen.c (dsa_generate_keypair): Avoid double init of mpz
3593 variable. Spotted by Nikos Mavrogiannopoulos.
3595 2011-05-06 Niels Möller <nisse@lysator.liu.se>
3597 * configure.ac: Fix link flags for shared libraries on Solaris,
3598 which needs -h to set the soname. Patch contributed by Dagobert
3601 2011-05-06 Niels Möller <nisse@lysator.liu.se>
3603 * configure.ac: New configure option --enable-gcov.
3605 * arcfour.h (arcfour_stream): Deleted obsolete define.
3607 2011-04-27 Niels Möller <nisse@lysator.liu.se>
3609 * tools/nettle-hash.c (find_algorithm): Require exact match.
3611 2011-04-15 Niels Möller <nisse@lysator.liu.se>
3613 Reverted broken byte-order change from 2001-06-17:
3614 * serpent.c (serpent_set_key): Use correct byteorder.
3615 (serpent_encrypt): Likewise.
3616 (serpent_decrypt): Likewise.
3618 * testsuite/serpent-test.c (decode_hex_reverse): New function.
3619 (RH, RHL): New macros.
3620 (test_main): Byte reverse inputs and outputs for the testvectors
3621 taken from the serpent submission package. Enable test vectors
3622 from http://www.cs.technion.ac.il/~biham/Reports/Serpent/.
3624 2011-03-23 Niels Möller <nisse@lysator.liu.se>
3626 * tools/sexp-conv.c (xalloc): Deleted function, now it's in misc.c
3629 * configure.ac: Use LSH_FUNC_STRERROR.
3631 * tools/Makefile.in (TARGETS): Added nettle-hash, and related
3633 (SOURCES): Added nettle-hash.c.
3635 * tools/misc.c (xalloc): New function.
3637 * tools/pkcs1-conv.c (main): Made the OPT_* constants local, and
3638 fixed numerical values to start with non-ASCII 0x300.
3640 * tools/nettle-hash.c: New file.
3642 2011-03-23 Niels Möller <nisse@lysator.liu.se>
3644 Contributed by Daniel Kahn Gillmor:
3645 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3646 meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.
3648 * testsuite/meta-hash-test.c: New file.
3649 * testsuite/meta-cipher-test.c: New file.
3650 * testsuite/meta-armor-test.c: New file.
3652 * nettle.texinfo: Document nettle_hashes and nettle_ciphers.
3654 * nettle-meta.h: Declare algorithm lists nettle_ciphers,
3655 nettle_hashes, nettle_armors.
3657 * Makefile.in (nettle_SOURCES): Added nettle-meta-hashes.c,
3658 nettle-meta-ciphers.c, and nettle-meta-armors.c.
3660 * nettle-meta-armors.c: New file.
3661 * nettle-meta-ciphers.c: New file.
3662 * nettle-meta-hashes.c: New file.
3664 2011-02-18 Niels Möller <nisse@lysator.liu.se>
3666 * arcfour.c (arcfour_stream): Deleted function. It's not very
3667 useful, and neither documented nor tested.
3669 2011-02-16 Niels Möller <nisse@lysator.liu.se>
3671 * cbc.h (CBC_ENCRYPT): Avoid using NULL; we don't ensure that it
3673 (CBC_DECRYPT): Likewise.
3675 * gcm-aes.c (gcm_aes_set_iv): Use GCM_SET_IV.
3676 (gcm_aes_set_key): Deleted cast.
3677 (gcm_aes_encrypt): Likewise.
3678 (gcm_aes_decrypt): Likewise.
3679 (gcm_aes_digest): Likewise.
3680 (gcm_aes_update): One less argument to GCM_UPDATE.
3682 * gcm.h (GCM_SET_KEY): Added cast to nettle_crypt_func *. Help
3683 compiler type checking despite this cast.
3684 (GCM_ENCRYPT): Likewise.
3685 (GCM_DECRYPT): Likewise.
3686 (GCM_DIGEST): Likewise.
3687 (GCM_SET_IV): New macro, for completeness.
3688 (GCM_UPDATE): Deleted unused argument encrypt.
3690 2011-02-14 Niels Möller <nisse@lysator.liu.se>
3692 * nettle.texinfo: Split node on cipher modes, and started on
3693 the GCM documentation.
3695 * testsuite/gcm-test.c (test_gcm_aes): Deleted function, replaced
3697 (test_main): Use test_aead.
3699 * testsuite/testutils.c (test_aead): New function, replacing
3700 test_gcm_aes and before that test_cipher_gcm.
3702 * nettle-internal.c (nettle_gcm_aes128): New const struct.
3703 (nettle_gcm_aes192): Likewise.
3704 (nettle_gcm_aes256): Likewise.
3706 * nettle-internal.h (struct nettle_aead): Tentative interface for
3707 authenticated encryption with associated data.
3709 * examples/nettle-benchmark.c (time_gcm): Renamed. Updated for
3710 gcm_aes_auth to gcm_aes_update renaming. Benchmark both encryption
3712 (time_gmac): ...old name.
3714 * nettle-internal.c (des_set_key_hack): Don't touch the bits
3715 parity, since thay are now ignored.
3716 (des3_set_key_hack): Likewise.
3718 * cast128-meta.c (nettle_cast128): Don't pass keysize.
3719 * nettle-meta.h (_NETTLE_CIPHER_FIX): Deleted keysize parameter
3720 derived from the appropriate constant instead.
3722 * testsuite/gcm-test.c (test_gcm_aes): Updated for gcm_aes_auth to
3723 gcm_aes_update renaming.
3725 2011-02-13 Niels Möller <nisse@lysator.liu.se>
3727 * gcm.h (GCM_UPDATE): Renamed, from...
3728 (GCM_AUTH): ...old name.
3730 * gcm-aes.c (gcm_aes_update): Renamed, from...
3731 (gcm_aes_auth): ...old name.
3733 * gcm.c (gcm_update): Renamed, and fixed an assert. From...
3734 (gcm_auth): ...old name.
3736 * gcm.h (GCM_TABLE_BITS): Increase table size to 8 bits,
3737 corresponding to 4 KByte of key-dependent tables.
3739 2011-02-10 Niels Möller <nisse@lysator.liu.se>
3741 * x86_64/memxor.asm: New file. Improves performance by 22% for the
3742 unaligned01 case and 35% for the unaligned12 case, benchmarked on
3745 * examples/nettle-benchmark.c (cgt_works_p): New function.
3746 (cgt_time_start): Likewise.
3747 (cgt_time_end): Likewise.
3748 (clock_time_start): Likewise.
3749 (clock_time_end): Likewise.
3750 (time_function): Read clock via function pointers time_start and
3751 time_end, so we can select method at runtime.
3752 (xalloc): Use die function.
3753 (main): Choose timing function. If available, try clock_gettime,
3754 and fall back to clock if it doesn't exist.
3756 * examples/nettle-benchmark.c (die): New function.
3757 (TIME_END, TIME_START): Check return value from clock_gettime.
3759 * gcm.h (union gcm_block): Use correct length for w array.
3761 * testsuite/gcm-test.c (test_main): Added the rest of the
3762 testcases from the spec.
3764 2011-02-09 Niels Möller <nisse@lysator.liu.se>
3766 * testsuite/gcm-test.c (test_main): Enabled testcases 5 and 6,
3767 with different IV lengths.
3769 * gcm-aes.c (gcm_aes_set_iv): Updated for gcm_set_iv change.
3771 * gcm.c (gcm_hash_sizes): New function.
3772 (gcm_set_iv): Added support for IVs of arbitrary size. Needed
3773 another argument, for the hash subkey.
3774 (gcm_digest): Use gcm_hash_sizes.
3776 * examples/nettle-benchmark.c (time_gmac): Use gcm_aes interface.
3778 * testsuite/gcm-test.c (test_gcm_aes): New function, replacing
3779 test_cipher_gcm and using the new gcm_aes interface.
3780 (test_main): Updated to use test_gcm_aes.
3781 * testsuite/testutils.c (test_cipher_gcm): Deleted function.
3783 * Makefile.in (nettle_SOURCES): Added gcm-aes.c.
3785 * gcm.c (gcm_set_key): Replaced context argument by a struct
3787 (gcm_hash): Replaced context argument by a struct gcm_key * and a
3788 pointer to the hashing state block.
3789 (gcm_auth): Added struct gcm_key * argument.
3790 (gcm_encrypt): Likewise.
3791 (gcm_decrypt): Likewise.
3792 (gcm_digest): Likewise.
3794 * gcm-aes.c: New file.
3795 (gcm_aes_set_key): New function.
3796 (gcm_aes_set_iv): Likewise.
3797 (gcm_aes_auth): Likewise.
3798 (gcm_aes_encrypt): Likewise.
3799 (gcm_aes_decrypt): Likewise.
3800 (gcm_aes_digest): Likewise.
3802 * gcm.h (struct gcm_key): Moved the key-dependent and
3803 message-independent state to its own struct.
3804 (struct gcm_ctx): ... and removed it here.
3805 (GCM_CTX): New macro.
3806 (GCM_SET_KEY): Likewise.
3807 (GCM_AUTH): Likewise.
3808 (GCM_ENCRYPT): Likewise.
3809 (GCM_DECRYPT): Likewise.
3810 (GCM_DIGEST): Likewise.
3811 (struct gcm_aes_ctx): New struct.
3813 2011-02-08 Niels Möller <nisse@lysator.liu.se>
3815 * gcm.h (struct gcm_ctx): The hash key is now always an array,
3816 named h, with array size depending on GCM_TABLE_BITS.
3817 * gcm.c (gcm_gf_shift): Added a separate result argument.
3818 (gcm_gf_mul): Compile bitwise version only when GCM_TABLE_BITS ==
3819 0. Simplified interface with just two arguments pointing to
3821 (gcm_gf_shift_4, gcm_gf_shift_8): Renamed table-based functions, from...
3822 (gcm_gf_shift_chunk): ... old name.
3823 (gcm_gf_mul): Renamed both table-based versions and made the
3824 argument types compatible with the bitwise gcm_gf_mul.
3825 (gcm_gf_mul_chunk): ... the old name.
3826 (gcm_set_key): Initialize the table using adds and shifts only.
3827 When GCM_TABLE_BITS > 0, this eliminates the only use of the
3828 bitwise multiplication.
3829 (gcm_hash): Simplified, now that we have the same interface for
3830 gcm_gf_mul, regardless of table size.
3832 * gcm.c (GHASH_POLYNOMIAL): Use unsigned long for this constant.
3833 (gcm_gf_shift_chunk): Fixed bugs for the big endian 64-bit case,
3834 e.g., sparc64. For both 4-bit and 8-bit tables.
3836 * gcm.c: Use the new union gcm_block for all gf operations.
3838 * gcm.h (union gcm_block): New union, used to enforce alignment.
3840 2011-02-07 Niels Möller <nisse@lysator.liu.se>
3842 * gcm.c (gcm_gf_shift_chunk) : Bug fix for little-endian 8-bit
3845 * gcm.c (gcm_gf_mul_chunk): Special case first and last iteration.
3846 (gcm_gf_add): New function, a special case of memxor. Use it for
3847 all memxor calls with word-aligned 16 byte blocks. Improves
3848 performance to 152 cycles/byte with no tables, 28 cycles per byte
3849 with 4-bit tables and 10.5 cycles per byte with 8-bit tables.
3851 Introduced 8-bit tables. If enabled, gives gmac performance of 19
3852 cycles per byte (still on intel x86_64).
3853 * gcm.c (gcm_gf_shift_chunk): New implementation for 8-bit tables.
3854 (gcm_gf_mul_chunk): Likewise.
3855 (gcm_set_key): Generate 8-bit tables.
3857 * Makefile.in (SOURCES): Added gcmdata.c.
3859 * gcm.h (GCM_TABLE_BITS): Set to 4.
3861 2011-02-06 Niels Möller <nisse@lysator.liu.se>
3863 * Makefile.in (TARGETS): Added gcmdata.
3864 (gcmdata): New rule.
3866 Introduced 4-bit tables. Gives gmac performance of 45 cycles per
3867 byte (still on intel x86_64).
3868 * gcm.c (gcm_gf_shift): Renamed. Tweaked little-endian masks.
3869 (gcm_rightshift): ... old name.
3870 (gcm_gf_mul): New argument for the output. Added length argument
3871 for one of the inputs (implicitly padding with zeros).
3872 (shift_table): New table (in 4-bit and 8-bit versions), generated
3874 (gcm_gf_shift_chunk): New function shifting 4 bits at
3876 (gcm_gf_mul_chunk): New function processing 4 bits at a time.
3877 (gcm_set_key): Generation of 4-bit key table.
3878 (gcm_hash): Use tables, when available.
3880 * gcmdata.c (main): New file.
3882 * gcm.c (gcm_rightshift): Moved the reduction of the shifted out
3884 (gcm_gf_mul): Updated for gcm_rightshift change. Improves gmac
3885 performance to 181 cycles/byte.
3887 * gcm.c (gcm_gf_mul): Rewrote. Still uses the bitwise algorithm from the
3888 specification, but with separate byte and bit loops. Improves gmac
3889 performance a bit further, to 227 cycles/byte.
3891 * gcm.c (gcm_rightshift): Complete rewrite, to use word rather
3892 than byte operations. Improves gmac performance from 830 cycles /
3893 byte to (still poor) 268 cycles per byte on intel x86_64.
3895 2011-02-05 Niels Möller <nisse@lysator.liu.se>
3897 * examples/nettle-benchmark.c (time_gmac): New function.
3898 (main): Call time_gmac.
3900 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added gcm-test.c.
3902 * testsuite/testutils.c (test_cipher_gcm): New function,
3903 contributed by Nikos Mavrogiannopoulos.
3905 * testsuite/gcm-test.c: New file, contributed by Nikos
3908 * Makefile.in (nettle_SOURCES): Added gcm.c.
3909 (HEADERS): Added gcm.h.
3911 * gcm.c: New file, contributed by Nikos Mavrogiannopoulos.
3912 * gcm.h: New file, contributed by Nikos Mavrogiannopoulos.
3914 * macros.h (INCREMENT): New macro, moved from ctr.c. Deleted third
3916 * ctr.c: Use INCREMENT macro from macros.h, deleted local version.
3918 2011-01-07 Niels Möller <nisse@lysator.liu.se>
3920 * testsuite/Makefile.in (check): Add ../.lib to PATH, since that's
3921 where w*ndows looks for dlls.
3923 * testsuite/testutils.c (test_cipher_stream): More debug output on
3926 2010-12-14 Niels Möller <nisse@lysator.liu.se>
3928 * nettle-types.h: Deleted some unnecessary parenthesis from
3930 (nettle_realloc_func): Moved typedef here...
3931 * realloc.h: ...from here.
3933 * buffer.c (nettle_buffer_init_realloc): Use an explicit pointer
3934 for realloc argument.
3936 2010-12-07 Niels Möller <nisse@lysator.liu.se>
3938 * nettle.texinfo (Copyright): Updated info on blowfish.
3940 2010-11-26 Niels Möller <nisse@lysator.liu.se>
3942 Reapplied optimizations (150% speedup on x86_32) and other fixes,
3943 relicensing them as LGPL.
3944 * blowfish.c (do_encrypt): Renamed, to...
3945 (encrypt): ...new name.
3946 (F): Added context argument. Shift input explicitly, instead of
3947 reading individual bytes via memory.
3948 (R): Added context argument.
3949 (encrypt): Deleted a bunch of local variables. Using the context
3950 pointer for everything should consume less registers.
3951 (decrypt): Likewise.
3952 (initial_ctx): Arrange constants into a struct, to simplify key
3954 (blowfish_set_key): Some simplification.
3956 2010-11-26 Simon Josefsson <simon@josefsson.org>
3958 * blowfish.c: New version ported from libgcrypt. License changed
3961 2010-11-25 Niels Möller <nisse@lysator.liu.se>
3963 * Makefile.in (install-shared-nettle): Use INSTALL_DATA, which
3964 clears the execute permission bits.
3965 (install-shared-hogweed): Likewise.
3967 2010-11-16 Niels Möller <nisse@lysator.liu.se>
3969 * configure.ac: Updated gmp url.
3971 2010-11-01 Niels Möller <nisse@lysator.liu.se>
3973 * tools/misc.c (werror): Don't call exit (copy&paste-error).
3975 2010-10-26 Niels Möller <nisse@lysator.liu.se>
3977 * examples/rsa-encrypt.c (main): No extra message for bad options.
3979 * examples/rsa-keygen.c (main): Added long options. Deleted -?,
3980 and fixed handling of bad options.
3982 * examples/next-prime.c (main): Deleted -?, and fixed handling of
3984 * examples/random-prime.c (main): Likewise.
3986 2010-10-22 Niels Möller <nisse@lysator.liu.se>
3988 * examples/nettle-benchmark.c (main): Added long options. Deleted -?,
3989 and fixed handling of bad options.
3991 * examples/eratosthenes.c (main): Added long options. Deleted -?,
3992 and fixed handling of bad options. Renamed -s to -q (long option
3995 * tools/pkcs1-conv.c (main): Deleted short alias -? for --help,
3996 and fixed handling of bad options.
3997 * tools/sexp-conv.c (parse_options): Likewise.
3999 2010-10-06 Niels Möller <nisse@lysator.liu.se>
4001 * memxor.c (memxor3): Optimized.
4002 (memxor3_common_alignment): New function.
4003 (memxor3_different_alignment_b): New function.
4004 (memxor3_different_alignment_ab): New function.
4005 (memxor3_different_alignment_all): New function.
4007 * examples/nettle-benchmark.c (time_function): Reorganized, to
4009 (time_memxor): Also benchmark memxor3.
4011 * x86_64/memxor.asm: New file.
4013 * examples/nettle-benchmark.c (overhead): New global variable.
4014 (time_function): Compensate for call overhead.
4015 (bench_nothing, time_overhead): New functions.
4016 (time_memxor): Tweaked src size, making it an integral number of
4018 (main): Call time_overhead.
4020 2010-10-01 Niels Möller <nisse@lysator.liu.se>
4022 * x86_64/camellia-crypt-internal.asm (ROUND): Reordered sbox
4025 * testsuite/memxor-test.c: Also test memxor3.
4027 2010-09-30 Niels Möller <nisse@lysator.liu.se>
4029 * configure.ac: Link in memxor.asm, if found.
4031 * testsuite/testutils.c (test_cipher_cbc): Print more info when
4034 * testsuite/memxor-test.c (test_xor): Added verbose printout.
4036 * examples/nettle-benchmark.c (time_memxor): Count size of
4037 unsigned long as "block size" for memxor.
4039 2010-09-24 Niels Möller <nisse@lysator.liu.se>
4041 * testsuite/.test-rules.make: Added rule for memxor-test.
4042 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added memxor-test.c
4043 * testsuite/memxor-test.c: New file.
4045 * memxor.c (memxor_common_alignment): New function.
4046 (memxor_different_alignment): New function.
4047 (memxor): Optimized to do word-operations rather than byte
4050 * configure.ac (HAVE_NATIVE_64_BIT): New config.h define.
4052 Partial revert of 2010-09-20 changes.
4053 * camellia-set-encrypt-key.c (camellia_set_encrypt_key):
4054 Reintroduce CAMELLIA_F_HALF_INV, for 32-bit machines.
4055 * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Two variants,
4056 differing in where addition of the key is done.
4057 * x86/camellia-crypt-internal.asm: Moved addition of key.
4059 2010-09-22 Niels Möller <nisse@lysator.liu.se>
4061 * examples/nettle-benchmark.c (BENCH_INTERVAL): Changed unit to
4063 (time_function): Use clock_gettime with CLOCK_PROCESS_CPUTIME_ID,
4064 if available. This gives better accuracy, at least on recent
4066 (BENCH_INTERVAL): Reduced to 0.1 s.
4067 (struct bench_memxor_info): New struct.
4068 (bench_memxor): New function.
4069 (time_memxor): New function.
4070 (main): Use time_memxor. Added optional argument used to limit the
4071 algorithms being benchmarked.
4072 (GET_CYCLE_COUNTER): Define also for x86_64.
4073 (time_memxor): Improved display.
4075 * examples/Makefile.in (nettle-benchmark): Link using
4076 $(BENCH_LIBS) rather than $(LIBS).
4078 * configure.ac: Check for clock_gettime, and add -lrt to
4079 BENCH_LIBS if needed.
4081 2010-09-20 Niels Möller <nisse@lysator.liu.se>
4083 * configure.ac: Less quoting when invoking $CC, to allow CC="gcc
4086 * x86/camellia-crypt-internal.asm (ROUND): Adapted to new key
4087 convention, moving key xor to the end.
4089 * camellia-set-encrypt-key.c (CAMELLIA_F_HALF_INV): Deleted macro.
4090 (camellia_set_encrypt_key): Deleted the CAMELLIA_F_HALF_INV
4091 operations intended for moving the key xor into the middle of the
4094 * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Moved addition of
4095 key to the end, to use a 64-bit xor operation.
4097 * x86_64/camellia-crypt-internal.asm: New file.
4099 * x86_64/machine.m4 (LREG, HREG, XREG): New macros.
4101 2010-09-17 Niels Möller <nisse@lysator.liu.se>
4103 * configure.ac: Support shared libraries (dlls) with mingw32.
4104 Contributed by David Hoyt.
4106 2010-07-25 Niels Möller <nisse@lysator.liu.se>
4108 * configure.ac: Changed version number to nettle-2.2.
4110 * Released nettle-2.1.
4112 * configure.ac: Use camellia-crypt-internal.asm, if available.
4113 Bumped soname to libnettle.so.4, and reset LIBNETTLE_MINOR to
4116 * x86/machine.m4 (LREG, HREG): Moved macros here, from...
4117 * x86/aes.m4: ...here.
4119 * x86/camellia-crypt-internal.asm: New file.
4121 * nettle.texinfo: Updated and expanded section on DSA.
4122 Document aes_invert_key, and camellia. Added missing functions
4123 rsa_sha512_verify and rsa_sha512_verify_digest.
4125 * camellia.h (struct camellia_ctx): Eliminate the two unused
4126 subkeys, and renumber the remaining ones.
4127 * camellia-crypt-internal.c (_camellia_crypt): Updated for
4129 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Likewise.
4130 * camellia-set-decrypt-key.c (camellia_invert_key): Likewise.
4132 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Inline
4133 the expansion of camellia_setup128 and camellia_setup256, keeping
4134 the unexpanded key in scalar variables.
4135 (camellia_setup128): Deleted.
4136 (camellia_setup256): Deleted.
4138 2010-07-24 Niels Möller <nisse@lysator.liu.se>
4140 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Reduced
4141 code size, no complete loop unroll. Use one loop for each phase of
4142 the post-processing.
4144 * testsuite/camellia-test.c: New tests for camellia_invert_key.
4145 * testsuite/aes-test.c: New tests for aes_invert_key.
4147 * aes.h (aes_invert_key): Declare it.
4149 * aes-set-decrypt-key.c (aes_invert_key): New function, key
4150 inversion code extracted from aes_set_decrypt_key.
4151 (aes_set_decrypt_key): Use aes_invert_key.
4153 * camellia-set-encrypt-key.c (camellia_setup128): Generate
4154 unmodified subkeys according to the spec. Moved clever combination
4155 of subkeys to camellia_set_encrypt_key.
4156 (camellia_setup256): Likewise.
4157 (camellia_set_encrypt_key): Moved subkey post-processing code
4158 here, and reduce code duplication between 128-bit keys and larger
4161 * camellia.c: Deleted file, split into several new files...
4162 * camellia-table.c (_camellia_table): New file with the constant
4164 * camellia-set-encrypt-key.c: New file.
4165 (camellia_setup128): Generate unmodified subkeys according to the
4166 spec. Moved clever combination of subkeys to camellia_set_encrypt_key.
4167 (camellia_setup256): Likewise.
4169 * camellia-set-decrypt-key.c: New file.
4170 (camellia_invert_key): Key inversion function.
4171 (camellia_set_decrypt_key): New key setup function.
4172 * camellia-internal.h: New file.
4173 * camellia-crypt.c (camellia_crypt): New file, new wrapper
4174 function passing the sbox table to _camellia_crypt.
4175 * camellia-crypt-internal.c (_camellia_crypt): New file, with main
4176 encrypt/decrypt function.
4177 * Makefile.in (nettle_SOURCES): Updated list of camellia source files.
4178 (DISTFILES): Added camellia-internal.h.
4180 2010-07-20 Niels Möller <nisse@lysator.liu.se>
4182 * camellia-meta.c: Use _NETTLE_CIPHER_SEP_SET_KEY.
4184 * camellia.h (struct camellia_ctx): Replaced flag camellia128 by
4185 expanded key length nkeys.
4187 * camellia.c (camellia_set_encrypt_key): Renamed, from...
4188 (camellia_set_key): ... old name.
4189 (camellia_invert_key): New function.
4190 (camellia_set_decrypt_key): New function, using
4191 camellia_invert_key.
4192 (camellia_crypt): Renamed, from...
4193 (camellia_encrypt): ... old name.
4194 (camellia_decrypt): Deleted, no longer needed. camellia_crypt used
4195 for both encryption and decryption.
4197 * nettle-meta.h (_NETTLE_CIPHER_SEP_SET_KEY): New macro.
4199 * dsa-keygen.c: Removed unnecessary include of memxor.h.
4201 * camellia.c: Rewrote to use 64-bit type for subkeys and use
4202 64-bit operations throughout. Performance on x86_32, when compiled
4203 with gcc-4.4.4, is reduced by roughly 15%, this should be fixed
4206 * camellia.h (struct camellia_ctx): Use type uint64_t for subkeys.
4208 2010-07-07 Niels Möller <nisse@lysator.liu.se>
4210 * aes.h (aes_encrypt, aes_decrypt): Declare ctx argument as const.
4211 Also updated implementation.
4212 * blowfish.h (blowfish_encrypt, blowfish_decrypt): Likewise.
4213 * cast128.h (cast128_encrypt, cast128_decrypt): Likewise.
4214 * serpent.h (serpent_encrypt, serpent_decrypt): Likewise.
4215 * twofish.h (twofish_encrypt, twofish_decrypt): Likewise.
4217 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
4220 * examples/nettle-benchmark.c: Added camellia ciphers.
4222 * Makefile.in (nettle_SOURCES): Added camellia.c and
4224 (HEADERS): Added camellia.h.
4226 * nettle-meta.h (nettle_camellia128): Declare.
4227 (nettle_camellia192): Likewise.
4228 (nettle_camellia256): Likewise.
4230 * camellia-meta.c: New file.
4232 * camellia.h: Rewrote interface to match nettle conventions.
4234 * camellia.c: Converted to nettle conventions.
4235 (camellia_encrypt128, camellia_encrypt256): Unified to new
4237 (camellia_encrypt): ...New function, with a loop doing 6
4238 regular rounds, one FL round and one FLINV round per iteration,
4239 with iteration count depending on the key size.
4241 (camellia_decrypt128, camellia_decrypt256): Similarly unified
4243 (camellia_decrypt): ...New function, analogous to
4246 2010-07-06 Niels Möller <nisse@lysator.liu.se>
4248 * camellia.c, camellia.h: New files, copied from
4249 http://info.isl.ntt.co.jp/crypt/eng/camellia/dl/camellia-LGPL-1.2.0.tar.gz.
4251 * testsuite/camellia-test.c: New file.
4253 2010-07-05 Niels Möller <nisse@lysator.liu.se>
4255 * nettle.texinfo: Document new conventions for weak key and des
4256 parity checks. Document des_check_parity.
4258 * testsuite/des-test.c (test_weak): Don't check the deleted status
4261 * des-compat.c (des_key_sched): Rewrote error checking logic for
4262 the case of non-zero des_check_key.
4264 * des3.c (des3_set_key): Changed weak key detection logic.
4265 Complete key setup also for weak keys, and don't set the status
4268 * des.c (des_set_key): New iteration logic, to keep key pointer
4269 unchanged. Moved weak key check to the end, and don't set the
4271 (des_encrypt): Ignore status attribute.
4272 (des_decrypt): Likewise.
4274 * des.h (enum des_error): Deleted.
4275 (struct des_ctx): Deleted status attribute.
4276 (struct des3_ctx): Likewise.
4278 * blowfish.c (initial_ctx): Deleted status value.
4279 (blowfish_encrypt): Ignore status attribute.
4280 (blowfish_decrypt): Likewise.
4281 (blowfish_set_key): Return result from weak key check, without
4282 setting the status attribute.
4284 * blowfish.h (enum blowfish_error): Deleted.
4285 (struct blowfish_ctx): Deleted status attribute.
4287 * Makefile.in (des_headers): Deleted parity.h.
4289 2010-06-30 Niels Möller <nisse@lysator.liu.se>
4291 * testsuite/des-test.c (test_des): New function.
4292 (test_weak): New function.
4293 (test_main): Use test_des and test_weak. Added tests for all the
4294 weak keys. Added some tests with invalid (to be ignored) parity
4297 * des.c (parity_16): New smaller parity table.
4298 (des_check_parity): New function.
4299 (des_fix_parity): Use parity_16.
4300 (des_weak_p): New weak-key detection. Ignores parity bits, and
4302 (des_set_key): Deleted parity checking code. Replaced old weak-key
4303 detection code by a call to des_weak_p.
4305 2010-06-04 Niels Möller <nisse@lysator.liu.se>
4307 * testsuite/testutils.c (test_dsa_key): Updated for new name
4308 DSA_SHA1_MIN_P_BITS.
4310 * dsa-keygen.c (dsa_generate_keypair): Use DSA_SHA1_MIN_P_BITS and
4311 DSA_SHA256_MIN_P_BITS.
4313 * dsa.h (DSA_MIN_P_BITS, DSA_Q_OCTETS, DSA_Q_BITS): Renamed to...
4314 (DSA_SHA1_MIN_P_BITS, DSA_SHA1_Q_OCTETS, DSA_SHA1_Q_BITS): New
4317 * sexp2dsa.c (dsa_keypair_from_sexp_alist): New argument q_bits.
4318 Renamed parameter limit to p_max_bits.
4319 (dsa_sha1_keypair_from_sexp): Renamed, was dsa_keypair_from_sexp.
4320 Updated to call dsa_keypair_from_sexp_alist with the new argument.
4321 (dsa_sha256_keypair_from_sexp): New function.
4322 (dsa_signature_from_sexp): New argument q_bits.
4324 * der2dsa.c (dsa_params_from_der_iterator): Enforce 160-bit limit
4325 on q. Renamed parameter limit to p_max_bits.
4326 (dsa_openssl_private_key_from_der_iterator): Enforce 160-bit limit
4327 on q and x. Renamed parameter limit to p_max_bits.
4329 2010-06-03 Niels Möller <nisse@lysator.liu.se>
4331 * testsuite/dsa-test.c (test_main): Added test for dsa-sha256.
4333 2010-06-02 Niels Möller <nisse@lysator.liu.se>
4335 * testsuite/dsa-test.c (test_main): Provide expected value of the
4338 * testsuite/testutils.c (test_dsa160): Added argument for expected
4340 (test_dsa256): Likewise.
4342 2010-06-01 Niels Möller <nisse@lysator.liu.se>
4344 * testsuite/rsa-keygen-test.c (test_main): Updated expected
4347 * examples/random-prime.c (main): Updated for nettle_random_prime
4349 * testsuite/random-prime-test.c (test_main): Likewise.
4351 * rsa-keygen.c (bignum_random_prime): Deleted function.
4352 (rsa_generate_keypair): Use new nettle_random_prime. Generate
4353 secret factors p and q with the two most significant bits set.
4355 * dsa-keygen.c (dsa_generate_keypair): Updated for changes in
4356 nettle_random_prime and _nettle_generate_pocklington_prime. Invoke
4359 * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4360 argument top_bits_set, to optionally generate primes with the two
4361 most significant bits set. Reordered argument list.
4362 (nettle_random_prime): Likewise, added top_bits_set argument.
4363 Invoke progress callback when a prime is generated.
4365 2010-05-26 Niels Möller <nisse@lysator.liu.se>
4367 * dsa-keygen.c (dsa_generate_keypair): Use
4368 _nettle_generate_pocklington_prime. Deleted old key generation
4371 * bignum-random-prime.c (_nettle_generate_pocklington_prime): Also
4372 return the used r. Updated caller.
4374 * examples/random-prime.c (main): Allow sizes down to 3 bits.
4376 * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4377 function. Rely on mpz_probab_prime_p (for lack of a trial division
4378 function) for trial division.
4379 (nettle_random_prime): Rewritten. Uses the prime table for the
4380 smallest sizes, then trial division using a new set of tables, and
4381 then Maurer's algorithm, calling the new
4382 _nettle_generate_pocklington_prime for the final search.
4384 2010-05-25 Niels Möller <nisse@lysator.liu.se>
4386 * testsuite/dsa-test.c (test_main): Updated for dsa testing
4389 * testsuite/dsa-keygen-test.c (test_main): Test dsa256.
4391 * testsuite/testutils.h (struct nettle_mac): New struct, currently
4394 * testsuite/testutils.c (test_mac): New function (currently not
4396 (test_dsa): Replaced by two new functions...
4397 (test_dsa160): New function.
4398 (test_dsa256): New function.
4399 (test_dsa_key): New argument q_size.
4400 (DSA_VERIFY): Generalized.
4402 * dsa-keygen.c (dsa_generate_keypair): Rewritten, now generating
4403 primes using Pocklington's theorem. Takes both p_size and q_size
4406 2010-05-20 Niels Möller <nisse@lysator.liu.se>
4408 * bignum-random-prime.c (miller_rabin_pocklington): Fixed broken
4409 logic when Miller-rabin succeeds early.
4411 2010-04-09 Niels Möller <nisse@lysator.liu.se>
4413 * bignum-next-prime.c: Include stdlib.h, needed for alloca on
4417 * examples/Makefile.in (SOURCES): Added random-prime.c.
4419 * examples/random-prime.c: New program.
4421 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Moved
4422 knuth-lfib-test.c, cbc-test.c, ctr-test.c, hmac-test.c here, from
4424 (TS_HOGWEED_SOURCES): Added random-prime-test.c.
4426 * testsuite/random-prime-test.c: New test case.
4428 * examples/next-prime.c (main): With no command line arguments.
4429 exit after dislaying usage message.
4431 * examples/io.c (simple_random): Free buffer when done.
4433 * configure.ac: Changed message, say CC is the recommended
4434 way to configure the ABI.
4436 * bignum-random.c: Deleted test of HAVE_LIBGMP.
4437 * bignum.c: Likewise.
4438 * sexp2bignum.c: Likewise.
4440 * Makefile.in (hogweed_SOURCES): Added bignum-random-prime.c.
4442 * bignum-random-prime.c (nettle_random_prime): New file, new
4445 2010-03-31 Niels Möller <nisse@lysator.liu.se>
4447 * examples/nettle-benchmark.c (main): Benchmark sha224.
4449 2010-03-30 Niels Möller <nisse@lysator.liu.se>
4451 * testsuite/testutils.c (DSA_VERIFY): Updated for dsa_sha1_verify
4453 (test_dsa): Check return value from dsa_sha1_sign.
4455 * Makefile.in (hogweed_SOURCES): Added dsa-sha1-sign.c,
4456 dsa-sha1-verify.c, dsa-sha256-sign.c, and dsa-sha256-verify.c.
4458 * dsa.h: Updated and added dsa declarations.
4460 * dsa-sha256-verify.c (dsa_sha256_verify_digest): New file, new
4462 (dsa_sha256_verify): New function.
4463 * dsa-sha256-sign.c (dsa_sha256_sign_digest): New file, new
4465 (dsa_sha256_sign): New function.
4467 * dsa-sha1-verify.c (dsa_sha1_verify_digest): New file. Moved and
4468 renamed function, from dsa_verify_digest, rewrote to use
4470 (dsa_sha1_verify): Analogous change, renamed from dsa_verify.
4471 * dsa-sha1-sign.c (dsa_sha1_sign_digest): New file. Moved and
4472 renamed function, from dsa_sign_digest, rewrote to use _dsa_sign,
4473 and added return value.
4474 (dsa_sha1_sign): Analogous change, renamed from dsa_sign.
4476 * dsa-verify.c (_dsa_verify): New general verification function,
4478 * dsa-sign.c (_dsa_sign): New general signing function, for any
4479 hash. Returns success code, like the rsa signture functions.
4481 2010-03-29 Niels Möller <nisse@lysator.liu.se>
4483 * configure.ac (ABI): Attempt to use a better, ABI-dependant,
4484 default value for libdir.
4486 * x86/md5-compress.asm: Fixed function name in epilogue.
4488 * asm.m4 (EPILOGUE): Use . to refer to current address.
4490 * configure.ac (ABI): Detect which ABI the compiler is using.
4491 On x86_64, also check for __arch64__.
4493 2010-03-28 Niels Möller <nisse@lysator.liu.se>
4495 * configure.ac (asm_path): For x86_64, check if compiler is
4496 generating 32-bit code.
4498 2010-03-27 Niels Möller <nisse@lysator.liu.se>
4500 * testsuite/hmac-test.c (test_main): Rewrote rest of tests to use
4501 HMAC_TEST, and added more tests from Daniel Kahn Gillmor and from
4504 * Makefile.in (nettle_SOURCES): Added hmac-sha224.c and
4507 * hmac.h: Added declarations of hmac-sha224 and hmac-sha384.
4509 * hmac-sha224.c: New file.
4511 2010-03-26 Niels Möller <nisse@lysator.liu.se>
4513 * testsuite/hmac-test.c (HMAC_TEST): New macro.
4514 (test_main): Use HMAC_TEST for the md5 and sha1 tests, and add
4515 test vectors from Daniel Kahn Gillmor.
4517 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha224-test.c.
4519 * Makefile.in (nettle_SOURCES): Added sha224-meta.c and
4521 (DISTFILES): Added nettle-write.h.
4523 * sha.h: Added declarations for sha224. Some are aliases for the
4524 corresponding sha256 definition.
4526 * sha256.c (sha256_digest): Use _nettle_write_be32.
4527 (sha224_init): New function.
4528 (sha224_digest): New function.
4530 * sha1.c (sha1_digest): Use _nettle_write_be32.
4532 * nettle-internal.h (NETTLE_MAX_HASH_BLOCK_SIZE)
4533 (NETTLE_MAX_HASH_DIGEST_SIZE): Increased, to take sha512 into
4536 * nettle-write.h: New file.
4538 * write-be32.c (_nettle_write_be32): New file, new function.
4540 * sha224-meta.c: New file.
4542 2010-03-25 Niels Möller <nisse@lysator.liu.se>
4544 * hmac-sha384.c: New file.
4546 * testsuite/sha224-test.c: New file.
4548 * testsuite/md4-test.c (test_main): More test vectors, provided by
4549 Daniel Kahn Gillmor.
4550 * testsuite/md5-test.c (test_main): Likewise.
4551 * testsuite/sha1-test.c (test_main): Likewise.
4552 * testsuite/sha256-test.c (test_main): Likewise.
4553 * testsuite/sha384-test.c (test_main): Likewise.
4554 * testsuite/sha512-test.c (test_main): Likewise.
4556 * configure.ac: Bumped version numbers. Package version
4557 nettle-2.1, library versions libnettle.so.3.1, libhogweed.so.2.0.
4559 * examples/nettle-benchmark.c (main): Benchmark sha384.
4561 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha384-test.c.
4563 * testsuite/sha384-test.c: New file.
4565 * Makefile.in (nettle_SOURCES): Added sha384-meta.c.
4567 * sha384-meta.c: New file.
4569 * sha.h: Added declarations for sha384. Some are aliases for the
4570 corresponding sha512 definition.
4572 * sha512.c (sha512_write_digest): New function.
4573 (sha512_digest): Use it.
4574 (sha384_init): New function.
4575 (sha384_digest): New function.
4577 2010-03-24 Niels Möller <nisse@lysator.liu.se>
4579 * sha512.c: (sha512_digest): Simplified handling of any final
4580 partial word of the digest.
4582 * sha512.c: Reorganized to use _nettle_sha512_compress.
4584 * sha512-compress.c (_nettle_sha512_compress): Compression
4585 function extracted from sha512.c to a new file.
4587 * Makefile.in (nettle_SOURCES): Added sha256-compress.c and
4590 * sha256.c: Reorganized to use _nettle_sha256_compress.
4592 * sha256-compress.c (_nettle_sha256_compress): Compression
4593 function extracted from sha256.c to a new file.
4595 * examples/nettle-benchmark.c (main): Benchmark sha512.
4597 * rsa-keygen.c (rsa_generate_keypair): Ensure that bit size of e
4598 is less than bit size of n, and check for the unlikely case p = q.
4600 * rsa.h (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Reduced, to
4601 correspond to pkcs#1 encryption of single byte messagees.
4603 * pgp-encode.c (pgp_put_rsa_sha1_signature): Check return value
4605 * rsa-compat.c (R_SignFinal): Likewise.
4607 * rsa-md5-sign.c (rsa_md5_sign): Check and propagate return value
4608 from pkcs1_rsa_md5_encode.
4609 (rsa_md5_sign_digest): Check and propagate return value from
4610 pkcs1_rsa_md5_encode_digest.
4611 * rsa-md5-verify.c (rsa_md5_verify): Check return value from
4612 pkcs1_rsa_md5_encode.
4613 (rsa_md5_verify_digest): Check return value from
4614 pkcs1_rsa_md5_encode_digest.
4615 * rsa-sha1-sign.c: Analogous changes.
4616 * rsa-sha1-verify.c: Analogous changes.
4617 * rsa-sha256-sign.c: Analogous changes.
4618 * rsa-sha256-verify.c: Analogous changes.
4619 * rsa-sha512-sign.c: Analogous changes.
4620 * rsa-sha512-verify.c: Analogous changes.
4622 * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
4623 (pkcs1_rsa_md5_encode_digest): Added return value. Check and
4624 propagate return value from pkcs1_signature_prefix.
4625 * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
4626 (pkcs1_rsa_sha256_encode_digest): Likewise.
4627 * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
4628 (pkcs1_rsa_sha1_encode_digest): Likewise.
4629 * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
4630 (pkcs1_rsa_sha512_encode_digest): Likewise.
4632 * pkcs1.c (pkcs1_signature_prefix): Interface change, take both
4633 the total size and digest size as arguments, and return a status
4634 code to say if the size was large enough.
4636 * testsuite/Makefile.in: Added hogweed dependency for the test
4639 2010-03-23 Niels Möller <nisse@lysator.liu.se>
4641 * testsuite/rsa-test.c (test_main): Test signing with sha512.
4643 * testsuite/testutils.c (test_rsa_sha512): New function.
4645 * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-sha512.c,
4646 rsa-sha512-sign.c and rsa-sha512-verify.c.
4648 * rsa.h: Added prototypes for sha512-related functions.
4649 (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased.
4650 * pkcs1.h: Added prototypes for sha512-related functions.
4652 * rsa-sha512-verify.c: New file.
4653 * rsa-sha512-sign.c: New file.
4654 * pkcs1-rsa-sha512.c: New file.
4656 2010-03-22 Niels Möller <nisse@lysator.liu.se>
4658 * Makefile.in (nettle_SOURCES): Added hmac-sha512.c.
4660 * testsuite/hmac-test.c (test_main): Added test cases for
4663 * hmac.h: Declare functions sha512-related functions.
4664 * hmac-sha512.c (hmac_sha512_set_key): New file.
4666 Basic sha512 support.
4667 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha512-test.c.
4668 * testsuite/sha512-test.c: New file.
4670 * macros.h (READ_UINT64, WRITE_UINT64): New macros.
4672 * Makefile.in (nettle_SOURCES): Added sha512.c and sha512-meta.c.
4673 * sha.h: Added sha512-related declarations.
4674 * nettle-meta.h: Likewise.
4675 * sha512-meta.c: New file.
4676 * sha512.c: New file.
4678 2010-03-06 Niels Möller <nisse@lysator.liu.se>
4680 * Makefile.in (distdir): Include x86_64 assembler files.
4682 2010-01-20 Niels Möller <nisse@lysator.liu.se>
4684 * configure.ac: Check for mpz_powm_sec.
4686 2010-01-13 Niels Möller <nisse@lysator.liu.se>
4688 * Makefile.in ($(LIBHOGWEED_FORLINK)): Depend on
4689 $(LIBNETTLE_FORLINK).
4691 * configure.ac (LIBHOGWEED_LIBS): Added -lnettle -lgmp for the
4692 default case. Follows debian, and also makes dlopen of
4693 libhogweed.so work, without having to use RTLD_GLOBAL.
4694 (LIBHOGWEED_LINK): Added -L., to find our libnettle.so.
4696 2009-10-21 Niels Möller <nisse@lysator.liu.se>
4698 * tools/Makefile.in (pkcs1-conv$(EXEEXT)): Added dependency on
4701 2009-10-19 Niels Möller <nisse@lysator.liu.se>
4703 * tools/pkcs1-conv.c: Updated for dsa/der interface change.
4705 * der2dsa.c (dsa_public_key_from_der_iterators): Split into two
4707 (dsa_params_from_der_iterator): New function.
4708 (dsa_public_key_from_der_iterator): New function.
4709 (dsa_openssl_private_key_from_der_iterator): Renamed, was
4710 dsa_private_key_from_der_iterator.
4711 (dsa_openssl_private_key_from_der): Likewise.
4712 * dsa.h: Corresponding changees to prototypes and #defines.
4714 2009-10-12 Niels Möller <nisse@lysator.liu.se>
4716 * sexp-format.c: Removed conditioning on HAVE_LIBGMP.
4718 * tools/pkcs1-conv.c: Support for DSA keys, contributed by Magnus
4721 * Makefile.in (hogweed_SOURCES): Added dsa2sexp.c and der2dsa.c.
4723 * der2dsa.c: New file, contributed by Magnus Holmgren.
4724 * dsa2sexp.c: Likewise.
4725 * dsa.h: Added prototypes.
4727 * configure.ac (LIBHOGWEED_MINOR): Bumped libhogweed minor
4728 version, now it's 1.1.
4730 * testsuite/rsa2sexp-test.c (test_main): Updated testcase for
4733 2009-10-11 Niels Möller <nisse@lysator.liu.se>
4735 * rsa2sexp.c (rsa_keypair_to_sexp): Changed default algorithm name
4738 2009-09-20 Niels Möller <nisse@lysator.liu.se>
4740 * x86/sha1-compress.asm: Improved performance by 17% on AMD K7,
4741 by letting loopmix scramble the instruction order.
4743 2009-09-15 Niels Möller <nisse@lysator.liu.se>
4745 * x86/sha1-compress.asm: Cleanup, removing old cruft. Slight
4746 improvement to ROUND_F1_NOEXP. Slight reduction of
4749 2009-08-25 Niels Möller <nisse@lysator.liu.se>
4751 * x86/sha1-compress.asm: Eliminated tmp variable for f3 rounds.
4753 * examples/nettle-benchmark.c (bench_sha1_compress): New function,
4754 for precise benchmarking of the compression function.
4756 2009-06-08 Niels Möller <nisse@lysator.liu.se>
4758 * Released nettle-2.0.
4760 2009-06-04 Niels Möller <nisse@lysator.liu.se>
4762 * configure.ac: Set version to 2.0
4764 2009-05-30 Niels Möller <nisse@lysator.liu.se>
4766 * Makefile.in (.texinfo.info): Don't use a temporary output file
4767 $@T, trust makeinfo to remove output file on errors.
4769 2009-05-19 Niels Möller <nisse@lysator.liu.se>
4771 * nettle.texinfo: Changed license to public domain.
4773 2009-05-11 Niels Möller <nisse@lysator.liu.se>
4775 * nettle.texinfo: Fixes from Karl Berry. Added some more index
4778 2009-03-06 Niels Möller <nisse@lysator.liu.se>
4780 * x86_64/aes-encrypt-internal.asm: Reduced unrolling. Keep state
4782 * x86_64/aes-decrypt-internal.asm: Likewise.
4784 * x86_64/aes.m4 (MOVE_HREG): Deleted, no longer needed.
4785 (AES_STORE): Reduced offsets.
4786 (AES_ROUND): Use HREG directly, not MOVE_HREG.
4788 * x86_64/aes-decrypt-internal.asm: Rearrange register allocation.
4789 Put SA--SD in %eax--%edx, so the second byte can be accessed as
4790 %ah-%dh. TD is not needed, SD can be reused. Use the register that
4791 is saved for the outer loop counter, getting it off the stack.
4792 * x86_64/aes-encrypt-internal.asm: Likewise.
4794 * x86_64/aes.m4 (HREG, MOVE_HREG): New macros.
4795 (XREG): Fixed bug in handling of %r8 and %r9.
4796 (AES_ROUND): Use MOVE_HREG.
4798 2009-02-10 Niels Möller <nisse@lysator.liu.se>
4800 * base16-meta.c (base16_encode_update_wrapper): Mark ctx argument
4803 * testsuite/sexp-conv-test: Updated testcases for improved
4804 handling of comments.
4806 * tools/sexp-conv.c (sexp_convert_item): Use sexp_put_soft_newline
4807 to terminate comments, and modify indentation for the case that a
4808 list starts with a comment.
4810 * tools/output.c (sexp_output_init): Initialize soft_newline.
4811 (sexp_put_raw_char): Clear soft_newline.
4812 (sexp_put_newline): Check and reset soft_newline.
4813 (sexp_put_soft_newline): New function.
4815 * tools/output.h (struct sexp_output): Removed union with single
4816 element, and updated all users. New attribute soft_newline.
4818 2008-12-22 Niels Möller <nisse@lysator.liu.se>
4820 * Makefile.in ($(des_headers)): Create files in $(srcdir).
4822 2008-11-28 Niels Möller <nisse@lysator.liu.se>
4824 * testsuite/cxx-test.cxx: Include <cstdio>.
4826 2008-11-22 Niels Möller <nisse@lysator.liu.se>
4828 * yarrow256.c (yarrow256_fast_reseed): Set ctx->seeded = 1, so
4829 that it is set if and only if the aes context has been initialized
4830 with aes_set_encrypt_key.
4831 (yarrow256_seed): No need to set ctx->seeded here.
4832 (yarrow256_update): Likewise.
4834 2008-11-04 Niels Möller <nisse@lysator.liu.se>
4836 * examples/next-prime.c (main): Avoid using gmp_fprintf, to stay
4837 compatible with gmp-3.1.
4839 2008-11-01 Niels Möller <nisse@lysator.liu.se>
4841 * nettle.texinfo: Updated for 2.0. New section on linking.
4843 * nettle-types.h, nettle-meta.h: Moved all typedefs for function
4844 types to nettle-types.h. Use non-pointer types, so that the types
4845 can be used to declare functions. Updated all users.
4847 2008-10-31 Niels Möller <nisse@lysator.liu.se>
4849 * testsuite/yarrow-test.c (test_main): Updated for seed file
4852 * sha-example.c (display_hex): Use %02x, not %2x.
4854 2008-10-30 Niels Möller <nisse@lysator.liu.se>
4856 * tools/sexp-conv.c (main): Fixed file locking.
4858 2008-10-25 Niels Möller <nisse@lysator.liu.se>
4860 * configure.ac: Set version to 2.0rc1.
4862 * examples/Makefile.in (next-prime$(EXEEXT)): Added -lnettle to
4865 2008-10-24 Niels Möller <nisse@lysator.liu.se>
4867 * sha256.c (ROUND): Simplified macro.
4869 * yarrow256.c (yarrow256_fast_reseed): Renamed (was
4870 yarrow_fast_reseed) and made non-static. Don't generate seed file
4871 here, let the application use yarrow256_random instead.
4872 (yarrow256_slow_reseed): Renamed (was yarrow_slow_reseed) and made
4874 (yarrow256_force_reseed): Deleted function, use
4875 yarrow256_slow_reseed instead. For backwards compatibility,
4876 yarrow.h defines yarrow256_force_reseed as an alias for that
4879 * yarrow.h (struct yarrow256_ctx): Deleted seed_file buffer.
4881 2008-09-17 Niels Möller <nisse@lysator.liu.se>
4883 * x86/arcfour-crypt.asm: Improved loop logic, and unrolled
4884 loop twice. Gave a modest speedup.
4886 2008-09-15 Niels Möller <nisse@lysator.liu.se>
4888 * yarrow256.c (yarrow256_seed): Disallow length == 0.
4890 * base64-decode.c (decode_table): Added vertical tab (VT) and form
4891 feed (FF) as white space characters.
4893 * x86_64/aes-decrypt-internal.asm: New file.
4895 2008-09-13 Niels Möller <nisse@lysator.liu.se>
4897 * x86/aes-encrypt-internal.asm: Replaced pushl and popl in the
4898 loop with movl. Eliminated redundant movl.
4899 * x86/aes-decrypt-internal.asm: Likewise.
4901 * x86_64/aes.m4: New file.
4903 * x86/aes-encrypt-internal.asm: Updated for AES_FINAL_ROUND. Only
4904 three times through the substitution loop.
4905 * x86/aes-decrypt-internal.asm: Likewise.
4906 * x86_64/aes-encrypt-internal.asm: Likewise.
4908 * x86/aes.m4 (AES_FINAL_ROUND): Do the substitution on the least
4909 significant byte here.
4911 * x86/aes-encrypt-internal.asm: Updated use of AES_SUBST_BYTE. USe
4912 decl for outer loop.
4913 * x86/aes-decrypt-internal.asm: Likewise.
4915 * x86/aes.m4 (LREG, HREG): New macros.
4916 (AES_SUBST_BYTE): Take state registers as argument. Use LREG to
4917 get the corresponding byte register.
4918 (AES_ROUND): Use movzbl together with LREG and HREG.
4919 (AES_SUBST_BYTE): Likewise.
4921 2008-09-10 Niels Möller <nisse@lysator.liu.se>
4923 * x86_64/sha1-compress.asm: Avoid using registers %rbx and %rbp,
4924 which must be preserved.
4926 2008-09-08 Niels Möller <nisse@lysator.liu.se>
4928 * Makefile.in (stamp-h.in): Use $(AUTOHEADER).
4930 * x86_64/sha1-compress.asm: New x86_64 assembler, based on the x86
4933 * configure.ac (asm_path): Set up asm_path for x86_64.
4935 * x86_64/machine.m4: New file, new directory.
4937 2008-08-28 Niels Möller <nisse@lysator.liu.se>
4939 * examples/eratosthenes.c (main): Rewrote block-wise sieving to
4940 use less memory. New options -s and -v.
4942 2008-08-27 Niels Möller <nisse@lysator.liu.se>
4944 * testsuite/sexp-conv-test (print_raw, print_nl): Use printf.
4945 Updated testcases with comments; comments are now preserved.
4947 * tools/sexp-conv.c (sexp_convert_item): Keep comments in advanced
4949 (parse_options): New --lock option.
4950 (main): Optionally lock output file.
4952 * tools/parse.c (sexp_check_token): Removed check for "any" token.
4953 All callers specify the token they expect.
4954 (sexp_parse): Pass on comment tokens.
4956 * tools/output.c (sexp_put_data): Made non-static.
4958 * tools/input.c (sexp_get_comment): New function.
4959 (sexp_get_token): Use sexp_get_comment.
4961 * tools/misc.h (enum sexp_token): Start enumeration with zero, zero
4962 is no longer used to mean any type. New type SEXP_COMMENT.
4964 * configure.ac: Check for fcntl file locking.
4966 2008-08-26 Niels Möller <nisse@lysator.liu.se>
4968 * Makefile.in (tags-here): Put TAGS file in the source directory.
4969 * examples/Makefile.in (tags): Likewise.
4970 * testsuite/Makefile.in (tags): Likewise.
4971 * tools/Makefile.in (tags): Likewise.
4973 2008-02-29 Niels Möller <nisse@lysator.liu.se>
4975 * examples/Makefile.in (SOURCES): Added next-prime.c.
4977 2008-01-05 Niels Möller <nisse@lysator.liu.se>
4979 * examples/Makefile.in (TARGETS): Added eratosthenes and next-prime.
4980 (next-prime, eratosthenes): New rules.
4981 (nettle-benchmark): Don't rely on $@.
4983 * examples/eratosthenes.c (find_first_one): Optimized, using
4984 slightly larger table.
4985 (main): Use atol, rather than atoi.
4987 * testsuite/symbols-test: Check symbols also in libhogweed.
4989 * examples/next-prime.c: New file.
4990 Deleted code for detailed timing.
4992 * Makefile.in (hogweed_SOURCES): Added bignum-next-prime.c.
4993 (DISTFILES): Added prime-list.h.
4994 (hogweed_OBJS): Removed $(LIBOBJS).
4996 * bignum-next-prime.c (nettle_next_prime): Renamed function, for
4997 name space reasons. Was bignum_next_prime. Updated call in
4999 (primes): Use prime-list.h.
5000 (nettle_next_prime): Skip Fermat test. Use mpz_millerrabin
5001 directly, rather than mpz_probab_prime_p, when the former is
5004 * bignum.h (nettle_next_prime): New prototype.
5006 * rsa-keygen.c (bignum_next_prime): Deleted, moved to
5007 bignum-next-prime.c. Call with a larger prime limit, this improves
5008 the running time of lsh-keygen by roughly 25%.
5010 * prime-list.h: List of odd primes < 2^16.
5012 * configure.ac: Check for sizeof(long).
5014 2008-01-03 Niels Möller <nisse@lysator.liu.se>
5016 * examples/nettle-benchmark.c (main): Removed incorrect UNUSED
5019 * bignum-next-prime.c: Moved the bignum_next_prime function to a
5022 2007-09-08 Niels Möller <nisse@lysator.liu.se>
5024 * sparc64/aes-encrypt-internal.asm: The directory with the aes.m4
5025 include file was renamed from "sparc" to "sparc32". Updated include.
5026 * sparc64/aes-decrypt-internal.asm: Likewise.
5027 * sparc32/aes-encrypt-internal.asm: Likewise.
5028 * sparc32/aes-decrypt-internal.asm: Likewise.
5030 2007-09-07 Niels Möller <nisse@lysator.liu.se>
5032 * examples/read_rsa_key.c: Include stdlib.h.
5034 2007-06-02 Niels Möller <nisse@lysator.liu.se>
5036 * Makefile.in: Typo fixes to install targets, spotted by Magnus
5039 2007-05-14 Niels Möller <niels@s3.kth.se>
5041 * configure.ac: Fixed copy-and-paste errors in shared library
5044 * config.make.in (LIBNETTLE_SONAME, LIBHOGWEED_SONAME): Define.
5046 * Makefile.in (libnettle.so, libhogweed.so): Fixed rules.
5048 * Makefile.in: Split nettle library into two files, libnettle.a
5049 and libhogweed.a, and similarly for the shared libraries.
5051 * configure.ac: Bumped nettle so-versions to 3.0. Set hogweed
5052 so-versions to 1.0. New makefile conditionals IF_SHARED and
5053 IF_HOGWEED. Renamed WITH_PUBLIC_KEY to WITH_HOGWEED. Deleted
5054 SHLIBTARGET, SHLIBINSTALL, RSA_EXAMPLES and RSA_TOOLS.
5056 * config.make.in: Updated for hogweed split.
5058 * C source files: Don't use WITH_PUBLIC_KEY / WITH_HOGWEED, the
5059 Makefile sorts out which files should be compiled.
5061 * pgp.h: Include bignum.h, don't pretend to work without bignums.
5063 * pgp-encode.c (pgp_put_mpi, pgp_put_public_rsa_key)
5064 (pgp_put_rsa_sha1_signature): Define unconditionally. Removed the
5065 checking of HAVE_LIBGMP and WITH_PUBLIC_KEY.
5067 * examples/io.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5068 * examples/io.c (read_rsa_key): Deleted, moved to...
5069 * examples/read_rsa_key.c: New file, extracted from io.c.
5071 * examples/Makefile.in: Use IF_HOGWEED instead of RSA_EXAMPLES.
5072 Link appropriate programs with -lhogweed.
5073 (SOURCES): Added read_rsa_key.c.
5075 * tools/Makefile.in (pkcs1-conv): Use IF_HOGWEED, not @RSA_TOOLS@,
5076 for configuration. Link with -lhogweed.
5078 * testsuite/testutils.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5079 * testsuite/testutils.c: Likewise.
5081 * testsuite/Makefile.in (TS_NETTLE_SOURCES, TS_HOGWEED_SOURCES):
5082 Separate test cases using nettle and those also using hogweed.
5084 2007-04-05 Niels Möller <nisse@lysator.liu.se>
5086 * Moved in CVS tree. Also renamed directory sparc to sparc32.
5088 2007-02-24 Niels Möller <nisse@lysator.liu.se>
5090 * Makefile.in (clean-here): Remove .lib directory.
5091 (distclean-here): Remove machine.m4.
5093 2006-12-05 Niels Möller <nisse@lysator.liu.se>
5095 * configure.ac: AC_PREREQ 2.61, for AC_PROG_MKDIR_P.
5097 * config.make.in (datarootdir): New directory variable (for
5100 2006-11-28 Niels Möller <nisse@lysator.liu.se>
5102 * configure.ac: Bumped version to 1.16.
5104 * Released nettle-1.15.
5106 2006-11-27 Niels Möller <nisse@lysator.liu.se>
5108 * NEWS: New entry for nettle-1.15.
5110 * configure.ac (SHLIBMINOR): Bumped version. Library name is now
5113 * sha256.c: Changed copyright notice to use the LGPL.
5115 * Makefile.in (DISTFILES): Added COPYING.LIB.
5117 * COPYING.LIB: New file (previously only the plain GPL was
5118 included in the distribution).
5120 * nettle.texinfo: Updated vor nettle-1.15.
5122 * testsuite/rsa-test.c (test_main): Use test_rsa_sha256.
5123 * testsuite/testutils.c (test_rsa_sha256): New function.
5125 * testsuite/Makefile.in (DISTFILES): Replaces rfc1750.txt by
5128 * rsa.h (rsa_sha256_sign, rsa_sha256_verify)
5129 (rsa_sha256_sign_digest, rsa_sha256_verify_digest): New declarations.
5130 (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased to
5131 62 octets and 489 bits, respectively, for supporting sha256.
5133 * pkcs1.h (pkcs1_rsa_sha256_encode)
5134 (pkcs1_rsa_sha256_encode_digest): New declarations and name
5137 * Makefile.in (nettle_SOURCES): Added pkcs1-rsa-sha256.c,
5138 rsa-sha256-sign.c, rsa-sha256-verify.c.
5140 * pkcs1-rsa-sha256.c, rsa-sha256-sign.c, rsa-sha256-verify.c: New
5143 * COPYING, INSTALL, install-sh, texinfo.tex: Updated files, from
5146 2006-11-27 Niels Möller <niels@s3.kth.se>
5148 * tools/Makefile.in (install): Use MKDIR_P to create installation
5149 directory. Install only one file at a time.
5151 * Makefile.in (MKDIR_P): Use MKDIR_P for creating installation
5154 * configure.ac: Use AC_PROG_MKDIR_P.
5156 2006-11-24 Niels Möller <nisse@lysator.liu.se>
5158 * testsuite/yarrow-test.c (test_main): Use gold-bug.txt as input
5159 file, instead of rfc1750.txt.
5161 * testsuite/gold-bug.txt: New test input file for yarrow-test.
5162 The copyright on this short story by Edgar Allan Poe has expired.
5164 * testsuite/rfc1750.txt: Deleted file. Debian considers RFC:s
5165 non-free, and it was expired anyway. Replaced by gold-bug.txt.
5167 2006-11-24 Niels Möller <niels@s3.kth.se>
5169 * Almost all header files: Added C++ guards.
5171 * configure.ac: Test if the system has any C++ compiler.
5173 * config.make.in (CXX, CXXFLAGS, COMPILE_CXX, LINK_CXX): New variables.
5175 * testsuite/Makefile.in: New variables TS_C and TS_CXX. Setup for
5176 compiling the C++ file cxx-test.cxx.
5178 * testsuite/cxx-test.cxx: New testcase, trying to use nettle from
5181 2006-08-28 Niels Möller <niels@s3.kth.se>
5183 * index.html: Added section on language bindings.
5185 2006-06-10 Niels Möller <niels@s3.kth.se>
5187 * configure.ac: Darwin shared library support, from Grant
5190 2006-05-18 Niels Möller <nisse@lysator.liu.se>
5192 * src/nettle/x86/aes.asm: Deleted unused file.
5194 * aes-decrypt.c (_aes_decrypt_table): Deleted the indexing array,
5195 previously commented out.
5196 * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5198 * Makefile.in (.texinfo.info, .dvi.ps): Use more quotes with
5200 (install-here, install-shared, install-info, install-headers): Use
5201 plain mkdir, not $(INSTALL) -d.
5203 2006-05-16 Niels Möller <niels@s3.kth.se>
5204 Merged from the lsh experimental branch.
5206 2006-04-26 Niels Möller <nisse@lysator.liu.se>
5208 * examples/rsa-decrypt.c: Don't include "getopt.h", since it's not used.
5209 * examples/nettle-benchmark.c: Include "getopt.h".
5211 * examples/Makefile.in (GETOPT_OBJS): New variable.
5212 (rsa-keygen, rsa-encrypt, nettle-benchmark): Depend on and link
5213 with $(GETOPT_OBJS).
5215 * x86/aes-decrypt-internal.asm: Use ALIGN.
5216 * x86/aes-encrypt-internal.asm: Likewise.
5217 * x86/arcfour-crypt.asm: Likewise.
5218 * x86/md5-compress.asm: Likewise.
5219 * x86/sha1-compress.asm: Likewise.
5221 * config.m4.in (ASM_ALIGN_LOG): Substitute.
5222 * configure.ac (ASM_ALIGN_LOG): Check if .align directive is
5224 * asm.m4 (ALIGN): New macro. Takes a logarithmic argument, and
5225 expands to a .align directive.
5227 2006-04-21 Niels Möller <nisse@lysator.liu.se>
5229 * nettle.texinfo (Public-key algorithms): Say that the public key
5230 operations are undocumented, not unsupported. Reported by Jeronimo
5233 2006-04-08 Niels Möller <nisse@lysator.liu.se>
5235 * tools/pkcs1-conv.c (read_pem): Fixed c99-style declaration.
5236 Reported by Henrik Grubbström.
5238 2006-01-31 Niels Möller <niels@s3.kth.se>
5240 * examples/rsa-verify.c: Fixed typo in usage message.
5242 2005-12-05 Niels Möller <nisse@lysator.liu.se>
5244 * configure.ac: Bumped version to 1.15,
5246 * Released nettle-1.14.
5248 * NEWS: Updated for 1.14.
5250 * configure.ac (SHLIBMINOR): Increased minor number. Library
5251 version is now libnettle.so.2.5, soname still libnettle.so.2.
5253 2005-11-28 Niels Möller <nisse@lysator.liu.se>
5255 * config.make.in (INSTALL): Don't substitute INSTALL, INSTALL_DATA
5256 and friends here, to get a correct a relative filename for
5257 install-sh when used in tools/Makefile.
5259 * tools/Makefile.in (INSTALL): Substitute INSTALL, INSTALL_DATA
5261 * Makefile.in (INSTALL): Likewise.
5263 2005-11-27 Niels Möller <nisse@lysator.liu.se>
5265 * Makefile.in (.texinfo.pdf): New rule. Avoid dependency on
5266 intermediate .dvi and .ps files.
5268 * testsuite/Makefile.in (clean): Delete sha1-huge-test.
5270 * Makefile.in (install-info, install-headers): Don't use $< and
5271 $?; Solaris make doesn't support them in explicit rules.
5273 2005-11-26 Niels Möller <nisse@lysator.liu.se>
5275 * testsuite/Makefile.in: Include .test-rules.make, which contains
5276 the rules for all the test executables.
5277 (test-rules): New rule, to update this file.
5278 (DISTFILES): Added $(EXTRA_SOURCES).
5280 * testsuite/.test-rules.make: Automatically generated file for
5281 building the test programs.
5283 2005-11-25 Niels Möller <nisse@lysator.liu.se>
5285 * configure.ac: Disable assembler when compiling with rntcl.
5287 * tools/Makefile.in (pkcs1_conv_SOURCES): New variable.
5288 (pkcs1-conv): Link with getopt.o and getopt1.o.
5290 * Makefile.in (aesdata, desdata, shadata): Use explicit rules for
5293 * testsuite/Makefile.in: Use %-rules for building the -test
5294 executables, in addition to the suffix rules. Hopefully, this
5295 should make all of GNU make, BSD make and Solaris make happy.
5296 Use $(EXEEXT) and $(OBJEXT) more consistently.
5298 * examples/Makefile.in: Use explicit rules for all executable
5299 targets. Use $(EXEEXT) and $(OBJEXT) more consistently.
5301 2005-11-25 Niels Möller <niels@s3.kth.se>
5303 * testsuite/Makefile.in: Avoid using single-suffix rule to build
5306 2005-11-24 Niels Möller <niels@s3.kth.se>
5308 * Makefile.in (distdir): Use [ -f, not [ -e, since the latter
5309 is less portable, and not supported by Solaris /bin/sh.
5311 2005-11-23 Niels Möller <niels@s3.kth.se>
5313 * testsuite/Makefile.in (DISTFILES): Added teardown-env.
5314 * testsuite/teardown-env: New file. Delete files created by the
5317 2005-11-21 Niels Möller <nisse@lysator.liu.se>
5319 * testsuite/testutils.c (main): Fixed check for -v option. Spotted
5322 2005-11-21 Niels Möller <niels@s3.kth.se>
5324 * ctr.h (CTR_CTX, CTR_CRYPT): Fixed bugs, spotted by Goran K.
5326 2005-11-20 Niels Möller <nisse@lysator.liu.se>
5328 * Makefile.in (nettle_SOURCES): Added der2rsa.c.
5330 * testsuite/Makefile.in (TS_SH): Added pkcs1-conv-test.
5332 * tools/Makefile.in (TARGETS): Added @RSA_TOOLS@.
5333 (SOURCES): Added pkcs1-conv.c.
5334 (pkcs1-conv): New rule.
5336 * tools/pkcs1-conv.c: New program.
5338 * testsuite/pkcs1-conv-test: New file.
5340 * examples/rsa-verify-test: Use rsa-sign to create signature.
5342 * examples/io.c (read_file): Fixed spelling in error message.
5344 * rsa.h (rsa_public_key_from_der_iterator)
5345 (rsa_private_key_from_der_iterator, rsa_keypair_from_der): Declare
5348 * der2rsa.c: New file.
5350 * der-iterator.c (asn1_der_iterator_init): Initialize length and
5352 (asn1_der_iterator_next): Support for lengths >= 0x80.
5353 (asn1_der_decode_constructed_last, asn1_der_decode_bitstring)
5354 (asn1_der_decode_bitstring_last): New functions.
5355 (asn1_der_get_bignum): Check for non-mininal encodings.
5357 * configure.ac (RSA_TOOLS): New substituted variable. Includes
5358 pkcs1-conv, when public-key support is enabled.
5360 * bignum.h (nettle_asn1_der_get_bignum): Include nettle_-prefix in
5363 * asn1.h: Added name mangling defines, and a few new declarations.
5365 2005-11-13 Niels Möller <nisse@lysator.liu.se>
5367 * Makefile.in (nettle_SOURCES): Added der-iterator.c.
5368 (HEADERS): Added asn1.h.
5370 * bignum.h (asn1_der_get_bignum): Declare function.
5372 * der-iterator.c: New file.
5375 2005-11-07 Niels Möller <nisse@lysator.liu.se>
5377 * examples/nettle-benchmark.c: Check HAVE_UNISTD_H.
5379 * examples/Makefile.in (TARGETS): Use $(EXEEXT).
5380 * tools/Makefile.in (TARGETS, sexp-conv, nettle-lfib-stream): Likewise.
5382 * configure.ac: Use $host_cpu, not $host, when setting up the
5383 assembler path. Use $host_os, not uname, when setting up shared
5386 * Makefile.in (des.$(OBJEXT)): Use OBJEXT.
5388 * config.guess, config.sub: In the CVS tree, moved files to the
5389 lsh top-level directory.
5391 2005-10-23 Niels Möller <nisse@lysator.liu.se>
5393 * sparc64/arcfour-crypt.asm: New file, almost the same as
5394 sparc/arcfour-crypt.asm.
5396 * examples/nettle-benchmark.c (display): Use two decimal places.
5398 * sparc/arcfour-crypt.asm: Reorganized. Main loop unrolled four
5399 times. Uses aligned 32-bit write accesses at DST. Still uses 8-bit
5400 read accesses at SRC; could be improved int he case that SRC and
5401 DST have compatible alignment.
5403 2005-10-19 Niels Möller <niels@s3.kth.se>
5405 * testsuite/arcfour-test.c (test_main): New testcase with 512
5408 2005-10-19 Niels Möller <nisse@lysator.liu.se>
5410 * sparc/arcfour-crypt.asm: Fixed bug, spotted by Mikael Kalms. We
5411 must order the store at [CTX+I] before the load of [CTX+SI+SJ].
5413 2005-10-18 Niels Möller <nisse@lysator.liu.se>
5415 * sparc/arcfour-crypt.asm: Special unrolled code if SRC and DST
5416 have compatible alignment. Improves performance by 20%, but I'm
5417 not sure it's worth the extra complexity.
5419 * bignum.c (nettle_mpz_from_octets): Removed sign argument. If
5420 mpz_import is available, define nettle_mpz_from_octets as a macro
5422 (nettle_mpz_from_octets): Start by setting x to zero; callers no
5423 longer need to do that.
5424 (nettle_mpz_set_str_256_s): New logic for the handling of negative
5425 numbers. Convert in the same way as for positive numbers, and then
5426 subtract the appropriate power of two.
5428 2005-10-17 Niels Möller <nisse@lysator.liu.se>
5430 * bignum.c (nettle_mpz_from_octets): Improved loop. Removed the
5431 digit temporary (suggested by Torbjörn Granlund).
5433 * sparc/arcfour-crypt.asm: Improved instruction scheduling.
5435 * sparc/arcfour-crypt.asm: Bugfix, use lduh and stuh.
5437 * sparc/arcfour-crypt.asm: New file.
5439 * sparc64/aes.asm: Deleted unused file.
5441 * x86/arcfour-crypt.asm: Use ARCFOUR_I and ARCFOUR_J
5442 * asm.m4 (ARCFOUR): New struct.
5444 2005-10-17 Niels Möller <niels@s3.kth.se>
5446 * aes-internal.h (struct aes_table): Deleted idx and sparc_idx
5448 * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5449 * aes-decrypt.c (_aes_decrypt_table): Likewise.
5450 * asm.m4 (AES): Likewise
5452 2005-10-16 Niels Möller <nisse@lysator.liu.se>
5454 * tools/input.c (sexp_get_char): Use unsigned for the done flag.
5456 * sparc64/aes-encrypt-internal.asm: Include sparc/aes.m4.
5457 * sparc64/aes-decrypt-internal.asm: Likewise.
5459 * sparc64/machine.m4: Use .register pseudo op to say that we use
5460 %g2 and %g3 as scratch registers.
5462 * sparc/aes-encrypt-internal.asm: Explicitly include sparc/aes.m4.
5463 * sparc/aes-decrypt-internal.asm: Likewise.
5465 * sparc/aes.m4: New file. Moved aes-related macros here...
5466 * sparc/machine.m4: ... removed aes macros.
5468 * x86/aes-encrypt-internal.asm: Explicitly include x86/aes.m4.
5469 * x86/aes-decrypt-internal.asm: Likewise.
5471 * x86/aes.m4: New file. Moved aes-related macros here, from...
5472 * x86/machine.m4: ... removed aes macros.
5474 * sparc64/aes-encrypt-internal.asm: New file.
5475 * sparc64/aes-decrypt-internal.asm: New file.
5477 * sparc64/machine.m4: Include the same aes macros used for
5479 (BIAS): Define magic stack bias constant.
5481 * sparc/aes-encrypt-internal.asm, sparc/aes-decrypt-internal.asm:
5482 Reduced frame size to 104 bytes, since we no longer need wtxt and
5485 * sparc/aes.asm: Deleted old aes implementation.
5487 * sparc/aes-decrypt-internal.asm: New file.
5489 * sparc/machine.m4: Don't use m4 eval, instead rely on the
5490 assembler's arithmetic.
5492 * sparc/machine.m4 (AES_FINAL_ROUND): Better scheduling, by
5493 interleaving independent operations.
5495 * sparc/machine.m4 (TMP3): A third temporary register.
5496 (AES_FINAL_ROUND): Prepared for scheduling.
5498 * sparc/machine.m4 (AES_ROUND): Deleted unused argument T. Updated
5499 all calls in aes-encrypt-internal.asm.
5501 * sparc/machine.m4 (AES_ROUND): New loop invariants T0-T3, to
5502 avoid the additions of the AES_TABLEx constants in the inner loop.
5504 * sparc/machine.m4 (AES_ROUND): Better scheduling, by
5505 interleaving independent operations.
5507 * sparc/machine.m4 (AES_ROUND): Alternate between using TMP1 and
5508 TMP2, to prepare for scheduling.
5510 * sparc/aes-encrypt-internal.asm: Renamed Ti -> Xi.
5512 * sparc/aes-encrypt-internal.asm: Fixed bugs. Now passes the
5515 * sparc/machine.m4 (AES_ROUND, AES_FINAL_ROUND): Bugfixes. Put
5516 NOPs in the load dely slots.
5518 * sparc/aes-encrypt-internal.asm: Implemented. Not yet working,
5521 * sparc/machine.m4: Use TMP1 and TMP2, so we don't need to pass
5523 (AES_FINAL_ROUND): New macro.
5525 2005-10-15 Niels Möller <nisse@lysator.liu.se>
5527 * configure.ac (OBJDUMP): Substitute the program false if objdump
5530 * asm.m4 (PROLOGUE): Use TYPE_FUNCTION.
5532 * config.m4.in: Substitute ASM_TYPE_FUNCTION as TYPE_FUNCTION.
5534 * configure.ac (ASM_ELF_STYLE): Check for %function and #function,
5535 but not for @function.
5536 (ASM_TYPE_FUNCTION): New substituted variable.
5538 * configure.ac (ASM_ELF_STYLE): Fixed .type foo,@function statement
5539 used when checking for pseudo operations.
5541 * sparc/machine.m4 (AES_LOAD, AES_ROUND): Started writing new AES
5544 * sparc/aes-encrypt-internal.asm: New file.
5546 2005-10-14 Niels Möller <nisse@lysator.liu.se>
5548 * x86/aes-decrypt.asm, x86/aes-encrypt.asm: Deleted files.
5550 * x86/aes-decrypt-internal.asm: New file.
5552 * x86/machine.m4: Changed AES macros, to handle a table register.
5553 Also take more of the used registers as argument.
5555 * x86/aes-encrypt-internal.asm: Rewritten to match new interface,
5556 with the table pointer as an argument. Unlike the old code, this
5557 should really be position independent.
5559 * configure.ac: When looking for assembler files, link in
5560 aes-encrypt-internal.asm and aes-decrypt-internal.asm. Don't look
5561 for aes.asm, aes-encrypt.asm and aes-decrypt.asm.
5563 * configure.ac (OBJDUMP): Use AC_CHECK_TOOL to check for objdump.
5564 (ASM_MARK_NOEXEC_STACK): Use $OBJDUMP when examining the object file.
5566 * Makefile.in (nettle_SOURCES): Removed aes.c,
5567 aes-decrypt-table.c. Added aes-decrypt-internal.c and aes-encrypt-internal.c.
5569 * aes.c, aes-decrypt-table.c: Deleted files.
5571 * aes-decrypt.c (_aes_decrypt_table): Moved table here, and made
5574 * aes-internal.h (_aes_decrypt_table): Don't declare, it's no
5575 longer globally visible.
5577 * aes-decrypt-internal.c (_nettle_aes_decrypt): New AES decryption
5578 function, analogous to _nettle_aes_encrypt.
5580 2005-10-14 Niels Möller <niels@s3.kth.se>
5582 * aes-internal.h (AES_ROUND, AES_FINAL_ROUND): New macros.
5584 * aes-encrypt-internal.c (_nettle_aes_encrypt): New AES encryption
5585 function, avoiding the table-based indexing.
5587 * sha1-compress.c: Added debugging code.
5588 * md5-compress.c: Likewise.
5590 2005-10-13 Niels Möller <niels@s3.kth.se>
5592 * config.m4.in (ASM_MARK_NOEXEC_STACK): Use a diversion, to
5593 substitute the value of ASM_MARK_NOEXEC_STACK at the end of each
5596 * configure.ac (ASM_MARK_NOEXEC_STACK): Check if the C compiler
5597 generates a .note.GNU-stack section. If so, we should do the same
5598 in our assembler files.
5600 * sparc64/aes.asm: New file. Copy of sparc/aes.asm, with minor
5601 changes to the stack frame layout. Patch contributed by Henrik
5602 Grubbström. Not yet tested.
5604 * x86/md5-compress.asm: Skip copying of input to the stack, and
5605 don't allocate space for it.
5608 * testsuite/md5-test.c: Document intermediate values for first
5611 * configure.ac (asm_path): Check for sparc64, and use sparc64
5612 subdirectory. Link in md5-compress.asm, if it exists.
5614 2005-10-13 Niels Möller <nisse@lysator.liu.se>
5616 * x86/md5-compress.asm (REF): Fixed calculation of offset.
5618 2005-10-12 Niels Möller <nisse@lysator.liu.se>
5620 * x86/machine.m4 (OFFSET): Moved macro, used to be in...
5621 * x86/sha1-compress.asm (OFFSET): ... removed macro.
5623 * x86/md5-compress.asm: New file, with first attempt at md5
5624 assembler. Not yet working.
5626 2005-10-11 Niels Möller <nisse@lysator.liu.se>
5628 * Makefile.in (nettle_SOURCES): Added md5-compress.c.
5630 * md5.c: Reorganized to use _nettle_md5_compress, in analogy with
5633 * md5-compress.c (_nettle_md5_compress): New file and new function.
5635 2005-10-10 Niels Möller <niels@s3.kth.se>
5637 * testsuite/Makefile.in (EXTRA_SOURCES, EXTRA_TARGETS): New
5638 variables, for test cases that are not run by default.
5640 * testsuite/sha1-huge-test.c (test_main): New test case, with a
5641 very large sha1 input.
5643 * testsuite/testutils.c (test_hash_large): New function.
5645 * sha1.c (sha1_block): Deleted function; inlined where used.
5646 (SHA1_INCR): New macro for incrementing the block count.
5648 2005-10-06 Niels Möller <nisse@lysator.liu.se>
5650 * configure.ac: Bumped version to 1.14.
5652 * Released nettle-1.13.
5654 * configure.ac: Check for openssl/aes.h.
5656 * Makefile.in (distdir): Use a loop to pick up the contents of
5657 $(DISTFILES) from source and build directories. For some reason,
5658 $? failed to find stamp-h.in in the source directory.
5660 2005-10-05 Niels Möller <nisse@lysator.liu.se>
5662 * x86/aes-decrypt.asm: Use C_NAME(_nettle_aes_decrypt_table) when
5663 using the AES_SUBST_BYTE macro. Use PROLOGUE and EPILOGUE.
5664 * x86/sha1-compress.asm: Use PROLOGUE and EPILOGUE.
5665 * x86/arcfour-crypt.asm: Likewise.
5666 * x86/aes-encrypt.asm: Likewise.
5668 * config.m4.in (ELF_STYLE): Substitute configure's ASM_ELF_STYLE.
5670 * asm.m4 (PROLOGUE, EPILOGUE): New macros, checking the value of
5671 ELF_STYLE. So far, used and tested only for the x86 assembler
5672 files, and needed to make the assembler happy both with ELF
5673 (linux, solaris) and COFF (windows).
5675 * configure.ac (NM): Use AC_CHECK_TOOL to check for nm.
5676 (ASM_SYMBOL_PREFIX): Use $NM when examining the object file.
5677 (ASM_ELF_STYLE): New variable. Set to 'yes' if assembling a file
5678 with ELF-style .type and .size pseudo ops works.
5680 * Makefile.in (TARGETS, DISTFILES): Added nettle.pdf.
5681 (.texinfo.dvi, .dvi.ps, .ps.pdf): New targets, to build nettle.pdf.
5682 (DOCTARGETS): New variable with targets that shouldn't be deleted
5684 (maintainer-clean-here): New target. Deletes generated
5685 documentation files.
5687 * nettle.texinfo: Define AUTHOR with accents, when running in TeX
5688 mode, which doesn't handle latin-1 properly. Set UPDATED-FOR to
5689 1.13. Updated copyright years, and introduced a COPYRIGHT-YEARS
5690 symbol. Updated copyright section, to mention assembler
5692 (Cipher modes): Transformed the Cipher Block Chaining to a section
5693 Cipher modes, describing both CBC and the new CTR mode.
5695 * src/nettle/x86/aes_tables.asm: Deleted unused file.
5697 * x86/aes.asm: Deleted contents. This file is needed just to
5698 override aes.c, which isn't needed for the x86 implementation.
5700 * configure.ac (SHLIBMINOR): Increased minor number. Library
5701 version is now libnettle.so.2.4, soname still libnettle.so.2.
5703 * examples/nettle-benchmark.c (main): Reordered hash benchmarks.
5705 * x86/sha1-compress.asm (EXPAND): Use % 16 instead of & 15 to
5706 compute offsets mod 16, since m4 on FreeBSD 49.RELEASE and NetBSD
5707 doesn't implement & correctly in eval.
5709 2005-10-03 Niels Möller <nisse@lysator.liu.se>
5711 * x86/sha1-compress.asm (OFFSET): New macro.
5712 (F3): Eliminated a movl.
5713 (ROUND): New argument, for k. When using F3, it's TMP3, on the
5714 stack, otherwise, it is kept in TMP2, a register.
5716 2005-10-03 Niels Möller <niels@s3.kth.se>
5718 * examples/nettle-openssl.c: Use correct block sizes for openssl
5721 * examples/nettle-benchmark.c: Also display cycles per block.
5723 2005-10-02 Niels Möller <nisse@lysator.liu.se>
5725 * sha1-compress.c (_nettle_sha1_compress): Updated to new
5726 interface. Now responsible for byte conversion.
5728 * x86/sha1-compress.asm (_nettle_sha1_compress): Do byte order
5729 conversion, and store the input data on the stack. This leaves one
5730 more register free for other uses.
5732 * examples/nettle-benchmark.c: Now display cycles/byte, if the -f
5733 option is used to say what the clock frequency is.
5735 * sha1.c (sha1_block): Don't convert data from uint8_t to
5736 uint32_t, that's now the responsibility of _nettle_sha1_compress.
5738 * sha.h (_nettle_sha1_compress): Changed interface. Second
5739 argument is now a pointer to the input data in unaligned,
5742 2005-09-28 Niels Möller <niels@s3.kth.se>
5744 * sha1.c (sha1_final): Call sha1_block, don't call the compression
5745 function _nettle_sha1_compress directly.
5747 * nettle-internal.h (nettle_openssl_md5)
5748 (nettle_openssl_sha1): Declare.
5750 * examples/nettle-benchmark.c (main): Benchmark openssl md5 and
5753 * examples/nettle-openssl.c (nettle_openssl_md5)
5754 (nettle_openssl_sha1): Added glue for openssl hash functions.
5756 * nettle-internal.h (nettle_openssl_aes128, nettle_openssl_aes192)
5757 (nettle_openssl_aes256, nettle_openssl_arcfour128): Declare.
5759 * examples/nettle-benchmark.c: Check WITH_OPENSSL, not
5760 HAVE_LIBCRYPTO. Benchmark openssl's aes and arcfour code.
5762 * examples/nettle-openssl.c: Updated openssl des glue to use the
5763 new openssl des interface. Added glue for arcfour and aes.
5765 2005-09-27 Niels Möller <nisse@lysator.liu.se>
5767 * nettle.texinfo (RSA): Improved text about the RSA patent.
5768 Use @documentencoding ISO-8859-1.
5770 2005-09-07 Niels Möller <niels@s3.kth.se>
5772 * tools/sexp-conv.c (parse_options): New option --raw-hash, for
5773 compatibility with lsh-1.x. Equivalent to --hash.
5775 2005-09-06 Niels Möller <niels@s3.kth.se>
5777 * tools/sexp-conv.c (main): With --hash, output a newline after
5780 2005-07-02 Niels Möller <nisse@lysator.liu.se>
5782 * testsuite/Makefile.in (TS_SOURCES): Added ctr-test.c.
5784 * testsuite/testutils.c (test_cipher_ctr): New function.
5786 * testsuite/ctr-test.c: New file.
5788 * testsuite/cbc-test.c (test_main): Use static const for msg.
5790 * Makefile.in (nettle_SOURCES): Added ctr.c.
5791 (HEADERS): Added ctr.h.
5792 (HEADERS): Added nettle-types.h.
5793 (INSTALL_HEADERS): Install nettle-stdint.h.
5794 (distclean-here): Delete nettle-stdint.h, not nettle-types.h.
5796 * ctr.c (ctr_crypt): New file, new function.
5798 * memxor.c (memxor3): New function, suggested by Adam Langley.
5800 * nettle-internal.h (NETTLE_MAX_CIPHER_BLOCK_SIZE): New constant.
5802 * nettle.texinfo (Cipher functions): Fixed typo in prototype for
5803 arctwo_encrypt (noticed by Adam Langley).
5805 * nettle-meta.h: No longer needs to include cbc.h.
5807 * cbc.h (nettle_crypt_func): Moved typedef to nettle-types.h.
5808 (CBC_ENCRYPT, CBC_DECRYPT): Deleted older #if:ed out versions.
5810 * configure.ac (AX_CREATE_STDINT_H): Use the file name
5811 nettle-stdint.h, not nettle-types.h.
5813 * nettle-types.h: New file. Automatically generated declarations
5814 are now in nettle-stdint.h.
5816 2005-03-17 Niels Möller <niels@s3.kth.se>
5818 * config.guess: Support Solaris on x86_64. Fix by Henrik
5821 2005-01-03 Niels Möller <niels@s3.kth.se>
5823 * examples/io.h: Include RSA declarations only when public key
5824 algorithms are enabled. Problem reported by Meilof Veeningen
5827 2004-12-07 Niels Möller <nisse@lysator.liu.se>
5829 * Makefile.in: Install directories, using $(INSTALL) -d, only if
5830 they don't exist already.
5832 2004-12-05 Niels Möller <nisse@lysator.liu.se>
5834 * config.make.in (.PRECIOUS): Reverted earlier change. We need
5835 .PRECIOUS to stop GNU make from deleting object files for the test
5838 2004-12-02 Niels Möller <nisse@lysator.liu.se>
5840 * Makefile.in (.SUFFIXES): Moved from Makefile.in to...
5841 * config.make.in (.SUFFIXES): ... here. This helps compilation
5843 * testsuite/Makefile.in (.SUFFIXES): Deleted target.
5845 * config.make.in (.c): Disable default rule for BSD-make.
5847 * Makefile.in (all check install uninstall)
5848 (clean distclean mostlyclean maintainer-clean): Don't use the -C
5849 flag when invoking make, for compatibility with Solaris make.
5851 2004-12-02 Niels Möller <niels@s3.kth.se>
5853 * Makefile.in (aesdata, desdata): Commented out the explicit
5855 (shadata): Avoid using $< in non-pattern rule.
5857 2004-12-01 Niels Möller <nisse@lysator.liu.se>
5859 * config.make.in: Added a default target.
5861 2004-11-29 Niels Möller <nisse@lysator.liu.se>
5863 * testsuite/Makefile.in: Use .$(OBJEXT). Explicitly set .SUFFIXES.
5865 * Makefile.in: Use .$(OBJEXT).
5867 2004-11-28 Niels Möller <nisse@lysator.liu.se>
5869 * tools/Makefile.in (nettle-lfib-stream): Avoid using $< in
5872 * Makefile.in (distdir): Handle absolute $distdir.
5873 Avoid using the GNU extension $^.
5875 * examples/Makefile.in: Avoid using the GNU extension $^.
5876 * tools/Makefile.in: Likewise.
5877 * testsuite/Makefile.in: Likewise.
5879 2004-11-24 Niels Möller <niels@s3.kth.se>
5881 * configure.ac: Fixed typo, preventing the creation of dependency
5884 2004-11-23 Niels Möller <nisse@lysator.liu.se>
5886 * Makefile.in: Use DEP_INCLUDE.
5887 * tools/Makefile.in: Likewise.
5888 * testsuite/Makefile.in: Likewise.
5889 * examples/Makefile.in: Likewise.
5891 * configure.ac (dummy-dep-files): Generate only of dependency
5892 tracking is enabled.
5894 2004-11-18 Niels Möller <nisse@lysator.liu.se>
5896 * Makefile.in (clean-here): The clean target should not delete the
5897 dependency files. Moved to the distclean target.
5898 * examples/Makefile.in: Likewise.
5899 * testsuite/Makefile.in: Likewise.
5900 * tools/Makefile.in: Likewise.
5902 * configure.ac (ASM_SYMBOL_PREFIX): Fixed test.
5903 (dummy-dep-files): Added quotes to sed command.
5905 2004-11-17 Niels Möller <nisse@lysator.liu.se>
5907 * testsuite/symbols-test: Try plain nm if nm -g doesn't work.
5909 * x86/sha1-compress.asm: Use C_NAME for global symbols.
5910 * x86/aes-encrypt.asm: Likewise.
5911 * x86/aes-decrypt.asm: Likewise.
5912 * x86/arcfour-crypt.asm: Likewise.
5914 * Makefile.in (config.m4): New rule.
5916 * config.m4.in (C_NAME): New macro.
5918 * configure.ac (ASM_SYMBOL_PREFIX): Check if global symbols have a
5921 2004-11-16 Niels Möller <nisse@lysator.liu.se>
5923 * Deleted getopt.c, getopt.h and getopt1.c from the CVS tree. Link
5924 them from shared copies in lsh/misc instead.
5926 2004-11-14 Niels Möller <nisse@lysator.liu.se>
5928 * Makefile.in (DEP_FILES): Try include with only one macro
5929 argument to be expanted.
5931 * configure.ac (dummy-dep-files): Create dummy dependency files,
5932 so that they can be included by the makefiles.
5934 2004-11-13 Niels Möller <nisse@lysator.liu.se>
5936 * Makefile.in: Don't use -include, as it's GNU make specific.
5937 * examples/Makefile.in, tools/Makefile.in, testsuite/Makefile.in:
5940 * examples/nettle-openssl.c: Check WITH_OPENSSL, not HAVE_LIBCRYPTO.
5942 * configure.ac: Check for individual openssl headers blowfish.h,
5943 cast.h, des.h. Renamed symbol HAVE_LIBCRYPTO to WITH_OPENSSL. New
5944 configure option --disable-openssl.
5946 2004-11-04 Niels Möller <nisse@lysator.liu.se>
5948 * configure.ac: Bumped version to 1.13.
5950 * Released nettle-1.12.
5952 2004-11-04 Niels Möller <niels@s3.kth.se>
5954 * nettle.texinfo (UPDATED-FOR): Bumped to 1.12.
5956 2004-11-02 Niels Möller <nisse@lysator.liu.se>
5958 * nettle.texinfo (Cipher functions): Updated AES documentation,
5959 for aes_set_encrypt_key and aes_set_decrypt_key.
5960 (UPDATED-FOR): Set to 1.11. I think the manual should be updated
5961 with all user-visible changes.
5963 * aclocal.m4 (LSH_DEPENDENCY_TRACKING): Need extra quoting in case
5964 pattern. (This file really lives in the lsh tree, as
5965 lsh/acinclude.m4. For a complete ChangeLog, see lsh/Changelog).
5967 2004-10-26 Niels Möller <nisse@lysator.liu.se>
5969 * configure.ac: Bumped version to 1.12.
5971 * Released nettle-1.11.
5973 * Makefile.in (clean-here): Delete *.s files.
5974 (PRE_CPPFLAGS): Use this variable, not INCLUDES. Removed
5977 * x86/arcfour-crypt.asm: Use movzbl when extending %cl to 32 bits.
5979 2004-10-24 Niels Möller <nisse@lysator.liu.se>
5981 * x86/arcfour-crypt.asm: Reverted the latest two changes; update
5982 bost src and dst pointers in the loop, and use plain addb when
5983 updating j. These two previous changes slowed the code down on AMD
5986 2004-10-21 Niels Möller <nisse@lysator.liu.se>
5988 * Makefile.in (install-shared): Use $(INSTALL_PROGRAM).
5990 * configure.ac (SHLIBMINOR): Updated, shared library version is
5991 now libnettle.so.2.3, soname still libnettle.so.2.
5993 * Makefile.in (DISTFILES): Added asm.m4.
5995 2004-10-21 Niels Möller <niels@s3.kth.se>
5997 * examples/Makefile.in: Deleted all configure-related rules,
5998 except the one rebuilding this Makefile. One should run make at
5999 top level if other configure related files change.
6000 * tools/Makefile.in: Likewise.
6001 * testsuite/Makefile.in: Likewise.
6003 * configure.ac: Replaced AC_OUTPUT(list...) with an AC_OUTPUT
6004 without arguments, and AC_CONFIG_FILES listing the files.
6006 * Makefile.in: Changed the assembler rules as suffix rules.
6007 Rewrote the configure-related rules, mostly based on the example
6008 in the autoconf manual.
6010 2004-10-20 Niels Möller <nisse@lysator.liu.se>
6012 * examples/nettle-openssl.c (NCOMPAT): Disable openssl backwards
6015 * config.make.in: Insert $(PRE_CPPFLAGS) and $(PRE_LDFLAGS) before
6016 $(CPPFLAGS) and $(LDFLAGS). This mechanism replaces $(INCLUDES).
6018 * examples/Makefile.in (PRE_CPPFLAGS, PRE_LDFLAGS): Use these
6019 flags to get -I.. and -L.. early on the command line.
6020 * testsuite/Makefile.in: Likewise
6021 * tools/Makefile.in: Likewise.
6023 2004-10-20 Niels Möller <niels@s3.kth.se>
6025 * Makefile.in: In the assembler rules, there's no need to look in
6026 $(srcdir) for the input file.
6028 * x86/arcfour-crypt.asm: Reduced inner loop by one instruction, by
6029 precomputing the offset between src and dst.
6031 * tools/Makefile.in (.c.$(OBJEXT)): Removed redundant -I.. flag.
6033 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replaced addb ->
6034 addl + andl $0xff, improving speed on PPro by another 15%.
6036 2004-10-20 Niels Möller <nisse@lysator.liu.se>
6038 * tools/Makefile.in (install): Support DESTDIR.
6039 (uninstall): New target.
6041 * testsuite/Makefile.in (uninstall): New dummy target.
6043 * config.sub: Copied from automake-1.8.5.
6045 * examples/Makefile.in (SOURCES): Added rsa-sign.c and rsa-verify.c.
6046 (DISTFILES): Added getopt.h.
6047 (install uninstall): New dummy targets.
6049 * config.make.in (.PHONY): Added more targets.
6051 * Makefile.in (.texinfo.info, .texinfo.html): New targets. Added
6052 support for uninstall and DESTDIR. Various fixes to install and
6055 * examples/Makefile.in (INCLUDES): Added -I flags.
6056 (distdir): Use $^ to refer to the files.
6057 (distclean): New target.
6058 * testsuite/Makefile.in: Likewise.
6059 * tools/Makefile.in: Likewise.
6061 * Makefile.in (INCLUDES): Need -I flags for VPATH build.
6062 (clean distclean mostlyclean maintainer-clean): Clean
6063 subdirectories first.
6064 (DISTFILES): Added a bunch of files.
6065 (des_headers): Added desCore rules.
6066 (install-here): Split off target install-headers, which uses $^ to
6068 (distdir): Use $^ to refer to the files.
6071 * config.make.in (COMPILE): Add $(INCLUDE) to the line.
6073 2004-10-19 Niels Möller <nisse@lysator.liu.se>
6075 Stop using automake. Replaced each Makefile.am with a hand-written
6077 * configure.ac: New output variable CCPIC_MAYBE. New output file
6078 config.make. Replaced automake constructions.
6079 * .bootstrap: Don't run aclocal and automake.
6080 * config.make.in: New file, with shared Makefile variables and rules.
6082 2004-10-18 Niels Möller <nisse@lysator.liu.se>
6084 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replace incb ->
6085 incl + andl, to improve speed on PPro and PII. Suggested by
6088 2004-10-08 Niels Möller <niels@s3.kth.se>
6090 * examples/rsa-encrypt-test: Avoid reading and executing a file at
6092 * examples/setup-env: Likewise.
6094 2004-10-06 Niels Möller <niels@s3.kth.se>
6096 * testsuite/symbols-test: Ignore __i686.get_pc_thunk.bx and
6099 2004-10-05 Niels Möller <nisse@lysator.liu.se>
6101 * twofish.c (q_table): Use a const pointer array.
6103 * sexp2dsa.c (dsa_keypair_from_sexp_alist): Use a const pointer
6104 array for the keywords.
6105 (dsa_signature_from_sexp): Likewise.
6106 * sexp2rsa.c (rsa_keypair_from_sexp_alist): Likewise.
6107 (rsa_keypair_from_sexp): Likewise.
6109 * sexp.c (sexp_iterator_check_types): Use an argument of type
6110 "const uint8_t * const *" for the types list.
6111 (sexp_iterator_assoc): Likewise, for the keys list.
6113 * list-obj-sizes.awk: Fixes to handle multiple .data and .rodata
6114 sections. Also fixed to handle the last file correctly.
6116 2004-09-23 Niels Möller <nisse@lysator.liu.se>
6118 * configure.ac (SHLIBLINK, SHLIBLIBS): On cygwin, linking needs
6119 -Wl,--whole-archive $(OBJECTS) -Wl,--no-whole-archive $(LIBS).
6121 2004-09-22 Niels Möller <niels@s3.kth.se>
6123 * configure.ac: Setup SHLIBFORLINK and friends for cygwin.
6125 * list-obj-sizes.awk: Strip *_a-prefix from all file names.
6127 * Makefile.am (libnettle_a_SOURCES): List only .c files. Headers
6128 moved to noinst_HEADERS.
6129 (SHLIBOBJECTS): Substitute from libnettle_a_SOURCES, not
6130 am_libnettle_a_OBJECTS, since the latter includes
6131 libnettle_a-prefixes with some automake versions.
6132 (SHLIBSONAME): Check if this name is empty, which is the case on
6133 cygwin, before using it.
6135 2004-08-31 Niels Möller <nisse@lysator.liu.se>
6137 * configure.ac: New command line option --disable-pic. Use
6140 * Makefile.am (libnettle_a_CFLAGS): Added $(CCPIC), to attempt to
6141 build also the static library as position independent code.
6143 2004-08-24 Niels Möller <nisse@lysator.liu.se>
6145 * des-compat.c (des_cbc_cksum): Pad input with NUL's, if it's not
6146 an integral number of blocks.
6148 2004-08-24 Niels Möller <niels@s3.kth.se>
6150 * testsuite/arctwo-test.c, arctwo.h, arctwo.c
6151 (arctwo_set_key_ekb): Fixed typo; it should be "ekb", not "ebk".
6153 Integrated arctwo patch from Simon Josefsson.
6154 * testsuite/Makefile.am (noinst_PROGRAMS): Added arctwo-test.
6156 * Makefile.am (libnettleinclude_HEADERS): Added arctwo.h.
6157 (libnettle_a_SOURCES): Added arctwo.c, arctwo.h and arctwo-meta.c.
6159 * nettle-meta.h (nettle_arctwo40, nettle_arctwo64)
6160 (nettle_arctwo64, nettle_arctwo_gutmann128): Declare ciphers.
6162 * arctwo-meta.c, arctwo.c, arctwo.h, testsuite/arctwo-test.c: New
6165 * macros.h (LE_READ_UINT16, LE_WRITE_UINT16): New macros.
6167 2004-08-23 Niels Möller <nisse@lysator.liu.se>
6169 * testsuite/md5-test.c (test_main): Added collision, found in 2004.
6170 (test_main): Added second collision.
6172 2004-08-23 Niels Möller <niels@s3.kth.se>
6174 * testsuite/md5-test.c (test_main): Added first half of a
6175 collision test case.
6177 * des-compat.c (des_cbc_cksum): Changed input argument to be of
6178 type const uint8_t * (was const des_cblock *).
6180 * des-compat.h (const_des_cblock): New bogus type. Disabled use of
6181 const, for compatibility with openssl.
6183 2004-06-08 Niels Möller <niels@s3.kth.se>
6185 * aesdata.c: Renamed log and ilog to gf2_log and gf2_exp.
6187 2004-04-07 Niels Möller <nisse@lysator.liu.se>
6189 * aes-set-encrypt-key.c (log, ilog): Deleted unused tables.
6191 * aes-set-decrypt-key.c (gf2_log, gf2_exp, mult): Renamed tables,
6194 2004-03-20 Niels Möller <nisse@lysator.liu.se>
6196 * configure.ac: Use AC_CONFIG_AUX_DIR([.]).
6198 2004-03-18 Niels Möller <niels@s3.kth.se>
6200 * examples/io.c (read_file): Display a message if fopen fails.
6202 2004-03-05 Niels Möller <nisse@lysator.liu.se>
6204 * Released nettle-1.10.
6206 * configure.ac (SHLIBMINOR): Shared library version is now 2.2.
6208 2004-03-04 Niels Möller <nisse@lysator.liu.se>
6210 * testsuite/symbols-test: Pass -g flag to nm.
6212 2004-03-02 Niels Möller <nisse@lysator.liu.se>
6214 * configure.ac: Fixed EXEEXT workaround.
6216 2004-03-02 Niels Möller <niels@s3.kth.se>
6218 * configure.ac: Added workaround to get the correct $(EXEEXT)=''
6219 when compiling with rntcl.
6221 2004-03-02 Niels Möller <nisse@lysator.liu.se>
6223 * testsuite/Makefile.am (noinst_PROGRAMS): Put test program list
6224 here, to let automake add $(EXEEXT).
6226 * configure.ac (RSA_EXAMPLES): Append $(EXEEXT) to the filenames.
6228 2004-03-01 Niels Möller <nisse@lysator.liu.se>
6230 * examples/rsa-keygen.c, examples/rsa-encrypt.c,
6231 examples/rsa-decrypt.c: Include "getopt.h" instead of <unistd.h>.
6233 * examples/Makefile.am (rsa_encrypt_SOURCES, rsa_decrypt_SOURCES)
6234 (rsa_keygen_SOURCES): Added getopt.h, getopt.c and getopt1.c.
6236 * examples/getopt.h, examples/getopt.c, examples/getopt1.c: New
6239 * testsuite/des-compat-test.c: Don't include <unistd.h>.
6241 * testsuite/testutils.c (main): Don't use getopt. Then we don't
6242 need to include <unistd.h>.
6244 2004-03-01 Niels Möller <niels@s3.kth.se>
6246 * config.guess: Copied from automake-1.8.2. Hacked to recognize
6247 Windows_NT (and Windows_95 and Windows_98) running on "x86" and
6250 * install-sh: Removed from CVS repository. Let automake supply it.
6252 2004-02-26 Niels Möller <nisse@lysator.liu.se>
6254 * nettle-meta.h (nettle_crypt_func): Typedef moved to cbc.h.
6255 Include cbc.h instead.
6257 * des-compat.c: Reverted const change, now all the des_key_sched
6258 arguments are not const. This is also what openssl's interface
6260 (cbc_crypt_func): Deleted typedef, use nettle_crypt_func instead.
6262 * cbc.h (nettle_crypt_func): Moved typedef here.
6263 * cbc.c (cbc_encrypt, cbc_decrypt_internal, cbc_decrypt): Use it
6264 for typing the f argument. Reverted the const change, for
6265 compatibility with nettle_crypt_func.
6267 2004-02-25 Niels Möller <nisse@lysator.liu.se>
6269 * testsuite/des-compat-test.c: Use des_cblock for typing more of
6270 the variables. Use const. Got rid of most of the explicit casts.
6271 Disabled the input/output alignment tests.
6273 * des.c (des_encrypt, des_decrypt): Use a const context pointer.
6274 * des3.c (des3_encrypt, des3_decrypt): Likewise.
6276 * cbc.c (cbc_encrypt, cbc_decrypt): Use a _const_ void *ctx argument.
6278 * des-compat.c: Use const for all unchanged arguments.
6279 (des_key_sched): Use a copy of the key if we need to fix the
6282 * testsuite/des-compat-test.c (C_Block, Key_schedule): Deleted
6283 defines. Deleted some of the explicit casts.
6285 * des-compat.c (des_cbc_cksum): Dereference DST pointer.
6287 2004-02-25 Niels Möller <niels@s3.kth.se>
6289 * pgp.h: Include nettle-types.h.
6291 2004-02-24 Niels Möller <nisse@lysator.liu.se>
6293 * testsuite/symbols-test: Allow symbols starting with double
6294 underscores, like on darwin.
6296 2004-02-17 Niels Möller <niels@s3.kth.se>
6298 * Makefile.am: Protected %-rules used for building pure objects,
6299 and for assembler files, by automake conditionals. Needed for
6300 makes such as tru64's, which tries to understand %-patterns, but
6301 doesn't get it right.
6302 (SUFFIXES): Added .html.
6303 (.texinfo.html): Rewrote rule to use a traditional suffix target.
6305 * configure.ac (enable_assembler): Explicitly set
6306 enable_assembler=no, on architectures where we have no assembler
6308 (ENABLE_ASSEMBLER, ENABLE_SHARED): New automake conditionals.
6310 * testsuite/testutils.c (xalloc): xalloc(0) should work also on
6311 systems where malloc(0) returns NULL.
6313 2004-02-16 Niels Möller <niels@s3.kth.se>
6315 * Makefile.am (%.o: %.asm): Added comment about OSF1 make problem.
6317 2004-02-15 Niels Möller <nisse@lysator.liu.se>
6319 * testsuite/testutils.h: #include nettle-types.h instead of
6322 2004-02-12 Niels Möller <nisse@lysator.liu.se>
6324 * examples/rsa-encrypt-test: Use -r option when invoking
6325 rsa-encrypt. Needed for the test to work on systems with no
6328 2004-02-12 Niels Möller <niels@s3.kth.se>
6330 * configure.ac (CPPFLAGS, LDFLAGS): No spaces after -I and -L, as
6331 some C compilers, in particular True64 cc, don't like that.
6333 2004-02-08 Niels Möller <nisse@lysator.liu.se>
6335 * configure.ac: Bumped version number to 1.10.
6337 2004-02-07 Niels Möller <nisse@lysator.liu.se>
6339 * Released nettle-1.9.
6341 * configure.ac (SHLIBMINOR): Bumped, library version is now 2.1.
6343 * testsuite/sexp-format-test.c: Include bignum.h only if HAVE_LIBGMP.
6344 * testsuite/rsa-encrypt-test.c: Include rsa.h only if WITH_PUBLIC_KEY.
6345 * testsuite/pkcs1-test.c: Include pkcs1.h only if WITH_PUBLIC_KEY.
6347 * pgp-encode.c [!HAVE_LIBGMP]: Kludge around the pgp.h's
6348 dependency on gmp.h.
6349 (pgp_put_mpi): Condition on HAVE_LIBGMP.
6351 * pgp.h: Don't include bignum.h, to make it possible to compile
6352 the non-bignum parts of pgp-encode.c without bignum support. Needs
6353 to be fixed properly before the pgp interface is advertised.
6355 * tools/sexp-conv.c (xalloc): New function.
6358 * tools/output.c (sexp_put_digest): Use TMP_DECL instead of alloca.
6360 * testsuite/testutils.c (xalloc): New function. Made all other
6361 functions use xalloc instead of alloca.
6363 * examples/rsa-keygen.c (main): Use xalloc for allocation.
6364 * examples/rsa-encrypt.c (write_bignum): Likewise.
6365 * examples/rsa-decrypt.c (read_bignum): Likewise.
6366 * testsuite/yarrow-test.c (open_file): Likewise.
6367 * testsuite/rsa-encrypt-test.c (test_main): Likewise.
6368 * testsuite/bignum-test.c (test_bignum): Likewise.
6370 * examples/nettle-openssl.c: When calling des_key_sched and
6371 des_ecb_encrypt, cst arguments to (void *). Openssl's typedefs
6372 des_cblock and const_des_cblock are too broken.
6374 * examples/nettle-benchmark.c (xalloc): New function. Use instead
6375 of alloca, for better portability.
6377 * examples/io.c (xalloc): New function.
6379 * Makefile.am (nodist_libnettleinclude_HEADERS): nettle-types.h
6380 should not be distributed.
6382 2004-02-06 Niels Möller <niels@s3.kth.se>
6384 * x86/sha1-compress.asm: Rename round -> ROUND.
6386 * x86/sha1-compress.asm: Store the magic constants on stack.
6387 Accessing them via %esp should be a little faster than using large
6390 * Makefile.am (EXTRA_DIST, DISTCLEANFILES): Handle
6393 * configure.ac: Use assembler file sha1-compress.asm if available.
6395 * x86/sha1-compress.asm (EXPAND): Fixed the rotation part of the
6398 2004-02-06 Niels Möller <nisse@lysator.liu.se>
6400 * x86/sha1-compress.asm: Assembler implementation of
6401 sha1_compress. (Not yet working).
6403 * Makefile.am (libnettle_a_SOURCES): Added sha1-compress.c.
6405 * sha1.c (sha1_transform): Function renamed to sha1_compress, and
6407 * sha1-compress.c: ... New file.
6409 2004-02-05 Niels Möller <nisse@lysator.liu.se>
6411 * examples/rsa-encrypt.c (process_file): Copy the leftover to the
6412 start of the buffer, when preparing for the final processing.
6414 * examples/nettle-benchmark.c (bench_hash, time_hash): New functions.
6415 (main): Benchmark hash functions too.
6416 (BENCH_BLOCK): Increased 10K.
6417 (BENCH_INTERVAL): Decreased to 0.25s.
6419 * examples/nettle-benchmark.c (time_function): Loop around calling
6420 f, until 1s has elapsed. Returns seconds per call. Updated bench
6421 functions to not loop themselves.
6422 (display): Updated MB/s calculation.
6424 * testsuite/arcfour-test.c (test_main): Use test_cipher_stream.
6426 * testsuite/testutils.c (test_cipher_stream): New function, that
6427 tries dividing the input into varying size blocks before
6430 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Bug fix, half of
6431 the S array swap was forgotten.
6432 * arcfour.c (arcfour_stream): Likewise.
6433 * arcfour-crypt.c (arcfour_crypt): Likewise.
6435 2004-02-05 Niels Möller <niels@s3.kth.se>
6437 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Must store the new
6438 i, j at the end of the loop.
6440 * Makefile.am (EXTRA_DIST): Make sure x86 assembler files are
6442 (DISTCLEANFILES): And that the symlinks and .s files are deleted.
6444 * x86/aes-encrypt.asm, x86/aes-decrypt.asm, x86/arcfour-crypt.asm:
6445 Fixed debug information.
6447 * x86/arcfour-crypt.asm: New file. About three times faster than
6448 the optimized C code.
6450 * configure.ac: Use assembler file arcfour-crypt.asm if available.
6452 * arcfour.c (arcfour_crypt): Moved function too...
6453 * arcfour-crypt.c (arcfour_crypt): New file.
6455 * arcfour.c (arcfour_crypt): Optimization suggested by Jonas
6456 Walldén. Makes arcfour up to 50% faster on x86 and ppc, and
6457 probably on other architectures as well.
6459 2004-01-31 Niels Möller <nisse@lysator.liu.se>
6461 * configure.ac (AX_CREATE_STDINT_H): Also look for uint32_t and
6462 friends in sys/types.h.
6464 2004-01-11 Niels Möller <nisse@harpo.hack.org>
6466 * Makefile.am (libnettleinclude_HEADERS): Added bignum.h,
6467 memxor.h, pkcs1.h and rsa-compat.h.
6469 * configure.ac: Bumped version to 1.9.
6471 2004-01-10 Niels Möller <nisse@harpo.hack.org>
6473 * Released nettle-1.8.
6475 * examples/teardown-env: Delete more test files.
6477 * nettle.texinfo (Hash functions): Documented md2 and md4.
6479 * configure.ac (SHLIBMAJOR): Bumped to 2.
6481 2004-01-09 Niels Möller <nisse@harpo.hack.org>
6483 * examples/rsa-encrypt-test: New testcase.
6485 * examples/rsa-encrypt.c, examples/rsa-session.h: Expanded the
6486 comment describing the file format, and moved to rsa-session.h.
6488 * examples/rsa-decrypt.c (process_file): Finished this function.
6489 (main): Initialize x. Check the size of the session key after rsa
6492 * examples/io.c (write_string): Treat short item count as an error.
6494 2004-01-08 Niels Möller <niels@s3.kth.se>
6496 * index.html: Added instructions for CVS access.
6498 * dsa-keygen.c (dsa_nist_gen): Fixed declaration/statement order.
6500 * rsa-keygen.c (bignum_next_prime): Fixed off-by-one error when
6501 comparing input to the largest listed prime. General cleanup, as
6502 prime_limit > 0 always. Use TMP_DECL and TMP_ALLOC.
6504 * nettle-internal.h (TMP_DECL, TMP_ALLOC): New macros. When alloca
6505 is unavailable, they work by allocating a fix amount of stack and
6506 imposing a hard limit on what can be allocated. Updated all users
6509 2004-01-07 Niels Möller <nisse@harpo.hack.org>
6511 * nettle-types.h: New (generated) file, to be used instead of
6512 including <inttypes.h> directly. Updated all users of inttypes.h.
6514 * Makefile.am (DISTCLEANFILES, libnettleinclude_HEADERS): Added
6517 * configure.ac (AX_CREATE_STDINT_H): Create nettle-types.h.
6519 2003-11-16 Niels Möller <nisse@harpo.hack.org>
6521 * yarrow256.c (yarrow256_seed): Use const for the seed_file input.
6523 2003-11-12 Niels Möller <niels@s3.kth.se>
6525 * list-obj-sizes.awk: New function for decoding hex values, with a
6526 new function hex2int. Also implemented calculation of total
6527 storage, removed the dependence on the .comment section, and use
6528 the $FILTER environment variable as a regexp for restricting the
6529 object files that are considered.
6531 2003-09-21 Niels Möller <nisse@cuckoo.hack.org>
6533 * testsuite/rsa-encrypt-test.c (test_main): Don't use gmp_printf,
6534 as it seems it's only available with the newer gmp. Use
6535 mpz_out_str instead.
6537 2003-09-19 Niels Möller <niels@s3.kth.se>
6539 * examples/Makefile.am (EXTRA_DIST): Added rsa-session.h.
6541 * tools/nettle-lfib-stream.c: New tool, which outputs a sequence
6542 of pseudorandom (non-cryptographic) bytes, using Knuth's lagged
6543 fibonacci generator.
6545 * examples/rsa-decrypt.c: Fixes to get the file to compile. It
6548 * examples/Makefile.am (EXTRA_PROGRAMS): Added rsa-encrypt and
6551 * examples/io.c (write_file): New function.
6552 (write_string): Simplified error check, it's no real point in
6553 calling ferror unless we also call fflush.
6555 * examples/rsa-keygen.c (main): Check return value from
6558 * examples/rsa-decrypt.c, examples/rsa-encrypt.c,
6559 examples/rsa-session.h: New files, demonstrating rsa encryption
6562 * configure.ac (RSA_EXAMPLES): Added rsa-encrypt and rsa-decrypt.
6564 2003-09-01 Niels Möller <nisse@cuckoo.hack.org>
6566 * testsuite/testutils.c (print_hex): Use const.
6568 2003-08-30 Niels Möller <niels@s3.kth.se>
6570 * md2.c, md2.h: Added reference to RFC 1319.
6571 * md4.c, md4.h: Added reference to RFC 1320
6573 2003-08-26 Niels Möller <niels@s3.kth.se>
6575 * Makefile.am: Added md2 and md5 files. Deleted the print-path
6578 * configure.ac: Bumped version to 1.8.
6580 * testsuite/testutils.c (test_rsa_set_key_1): New function.
6581 * testsuite/rsa-test.c (test_main): Use it.
6583 * testsuite/dsa-keygen-test.c: Deleted definition of UNUSED, it's
6585 * testsuite/rsa-keygen-test.c: Likewise.
6587 * testsuite/Makefile.am (TS_PROGS): Added rsa-encrypt-test,
6588 md4-test, and md2-test.
6590 * testsuite/rsa-encrypt-test.c, testsuite/md4-test.c,
6591 testsuite/md2-test.c: New test cases.
6593 * nettle-meta.h: Declare nettle_md2 and nettle_md4.
6595 * md5.c: Reorderd functions, putting md5_final at the end.
6597 * md2.c, md2.h, md2-meta.c: New files, implemented md2.
6598 * md4.c, md4.h, md4-meta.c: New files, implemented md4.
6600 2003-08-17 Niels Möller <nisse@cuckoo.hack.org>
6602 * desCode.h (des_keymap, des_bigmap): Deleted extern declarations,
6603 they conficted with the static definition in des.c. Reported by
6606 * des.c (DesSmallFipsEncrypt, DesSmallFipsDecrypt): Moved
6607 definitions after the definition of the des_kemap array.
6609 2003-08-11 Niels Möller <nisse@cuckoo.hack.org>
6611 * rsa-encrypt.c (rsa_encrypt): Bugfix contributed by
6614 2003-06-10 Niels Möller <niels@s3.kth.se>
6616 * Makefile.am (EXTRA_DIST): Distribute sha-example.c.
6618 2003-06-05 Niels Möller <nisse@lysator.liu.se>
6620 * Makefile.am (DISTCLEANFILES): Delete .s files.
6622 2003-05-27 Niels Möller <nisse@cuckoo.hack.org>
6624 * testsuite/symbols-test: And allow symbols that start at the
6625 beginning of the line, as output by AIX nm.
6627 2003-05-26 Niels Möller <nisse@cuckoo.hack.org>
6629 * testsuite/symbols-test: Allow symbols to start with a dot.
6631 2003-05-14 Niels Möller <niels@s3.kth.se>
6633 * pgp.h (enum pgp_subpacket_tag): Copied values from RFC 2440.
6634 Renamed PGP_SUBPACKET_ISSUER to PGP_SUBPACKET_ISSUER_KEY_ID.
6636 2003-05-13 Niels Möller <nisse@cuckoo.hack.org>
6638 * pgp.h: Do proper namemangling for pgp_put_public_rsa_key and
6639 pgp_put_rsa_sha1_signature.
6641 * pgp-encode.c (pgp_put_mpi): Fixed nettle_mpz_get_str_256 call.
6643 2003-05-12 Niels Möller <nisse@cuckoo.hack.org>
6645 * rsa2openpgp.c (rsa_keypair_to_openpgp): Some bugfixes.
6647 * pgp.h (enum pgp_subpacket_tag): New enum. Definition is bogus
6648 and needs to be fixed.
6649 Added forward declarations of structs, and prototypes for
6650 pgp_put_public_rsa_key and pgp_put_rsa_sha1_signature.
6652 * pgp-encode.c (pgp_put_mpi): Take a const mpz_t argument. Gugfix,
6653 use nettle_mpz_get_str_256.
6654 (pgp_put_public_rsa_key, pgp_put_rsa_sha1_signature):
6655 Constification. Some bugfixes.
6657 * Use "config.h", not <config.h>.
6659 * Reordered includes in most or all .c-files. All should now
6662 2003-05-12 Niels Möller <niels@s3.kth.se>
6664 * configure.ac: Use LSH_FUNC_ALLOCA.
6666 2003-04-25 Niels Möller <niels@s3.kth.se>
6668 * Makefile.am (libnettle_a_SOURCES): Added hmac-sha256.c.
6670 * testsuite/hmac-test.c (test_main): Added tests for hmac-sha256,
6671 from draft-ietf-ipsec-ciph-sha-256-01.txt.
6673 * hmac-sha256.c (hmac_sha256_digest): New file.
6675 2003-04-22 Niels Möller <nisse@cuckoo.hack.org>
6677 * sha-example.c (display_hex): Simplified by using printf better.
6679 * nettle.texinfo (Example): Use @verbatiminclude to include the
6682 * sha-example.c: Example program, for inclusion in the manual.
6683 Fixed bugs reported by Mark Arking.
6685 2003-04-14 Niels Möller <niels@s3.kth.se>
6687 * x86/aes-encrypt.asm (nettle_aes_encrypt): Fixed references to
6688 _nettle_aes_encrypt_table.
6689 * x86/aes-decrypt.asm (nettle_aes_decrypt): Fixed references to
6690 _nettle_aes_decrypt_table.
6692 2003-04-12 Niels Möller <nisse@cuckoo.hack.org>
6694 * testsuite/Makefile.am (TS_SH): New test case symbols-test.
6695 (EXTRA_PROGRAMS): Added testutils, as a kludge to
6696 get automake to track dependencies for testutils.o.
6698 * x86/aes-encrypt.asm (nettle_aes_encrypt): Renamed function to
6699 use the nettle_ prefix.
6700 * x86/aes-decrypt.asm (nettle_aes_decrypt): Likewise.
6701 * sparc/aes.asm (_nettle_aes_crypt): Likewise.
6703 * examples/Makefile.am (EXTRA_PROGRAMS): Add "io", as a kludge to
6704 get automake to track dependencies for io.o.
6705 (LDADD): Added ../libnettle.a, for the dependency.
6707 * des-compat.c: Use names with the nettle_ prefix when using
6708 Nettle's des functions.
6710 * base16-meta.c (base16_encode_update): Need to undef before
6713 * New name mangling, to reduce the risk of link collisions. All
6714 functions (except memxor) now use a nettle_ or _nettle prefix when
6715 seen by the linker. For most functions, the header file that
6716 declares a function also use #define to provide a shorter more
6717 readable name without the prefix.
6719 2003-03-11 Niels Möller <nisse@cuckoo.hack.org>
6721 * Released nettle-1.7.
6723 * configure.ac: Bumped version to 1.7.
6725 * nettle.texinfo (DSA): New section.
6726 (RSA): Updated documentation.
6728 2003-03-02 Niels Möller <nisse@cuckoo.hack.org>
6730 * examples/nettle-benchmark.c (time_cipher): Don't use GNU C
6731 non-constant initializers.
6733 2003-02-23 Niels Moller <nisse@carduelis>
6735 * configure.ac: Use LSH_GCC_ATTRIBUTES.
6737 2003-02-19 Niels Möller <nisse@cuckoo.hack.org>
6739 * acinclude.m4: Deleted file from cvs, use a link to lsh's
6740 acinclude.m4 instead.
6742 2003-02-16 Niels Möller <nisse@cuckoo.hack.org>
6744 * Makefile.am (libnettleinclude_HEADERS): Added macros.h.
6746 * tools/Makefile.am (EXTRA_DIST): Added getopt.h.
6748 2003-02-14 Niels Möller <niels@s3.kth.se>
6750 * Makefile.am (print_path): Added target to print the used PATH,
6752 (print-path): Moved dependency to all-local.
6754 2003-02-11 Niels Möller <niels@s3.kth.se>
6756 * buffer.c (nettle_buffer_copy): Bug fix, it didn't return any
6759 2003-02-11 Niels Möller <nisse@cuckoo.hack.org>
6761 * testsuite/sexp-format-test.c (test_main): Added test for %( and
6764 * sexp-format.c (sexp_vformat): Handle %( and %).
6766 * realloc.c (nettle_xrealloc): Fixed out-of-memory check.
6768 * configure.ac (SHLIBMAJOR): Bumped version number to 1.
6770 * buffer.c (nettle_buffer_init_realloc): New function.
6771 * buffer-init.c (nettle_buffer_init): Use nettle_buffer_init_realloc.
6773 2003-02-10 Niels Möller <nisse@cuckoo.hack.org>
6775 * testsuite/sexp-format-test.c (test_main): New test with tokens
6776 in the format string.
6777 (test_main): Test space-searated literals too.
6779 * rsa2sexp.c (rsa_keypair_to_sexp): New argument ALGORITHM_NAME.
6780 * examples/rsa-keygen.c (main): Updated call to rsa_keypair_to_sexp.
6781 * testsuite/rsa2sexp-test.c (test_main): Likewise.
6783 * sexp-format.c (sexp_vformat): Allow whitespace in format string.
6785 * rsa2sexp.c (rsa_keypair_to_sexp): Use literals with sexp_format.
6787 * sexp-format.c (format_string): New function.
6788 (sexp_vformat): Implemented support for literals in the format
6791 2003-02-06 Niels Möller <nisse@lysator.liu.se>
6793 * testsuite/sexp-conv-test (print_raw, print_nl): New functions.
6794 The testfunctions use these instead of using echo directly.
6795 Use the test input '3:"\x' instead of '2:"\', to be friendlier to
6798 2003-02-05 Niels Möller <nisse@lysator.liu.se>
6800 * des-compat.h (des_set_key): Different name mangling, if this
6801 file is included, des_set_key should refer to a function that
6802 behaves like openssl's.
6804 * des-compat.c (des_key_sched, des_is_weak_key): Use the name
6805 nettle_des_set_key for referring to Nettle's function.
6807 * des.h (des_set_key): Name mangling, linker symbols should use a
6808 "nettle_" prefix, and this one collided with openssl. Perhaps all
6809 symbols should be mangled in a similar way, but that's for later.
6811 * configure.ac (LDFLAGS): --with-lib-path should add to LDFLAGS,
6814 2003-01-30 Niels Möller <nisse@cuckoo.hack.org>
6816 * tools/output.c (sexp_put_string): Fixed handling of escapable
6817 characters. The code generated random escape sequences for
6818 characters in the 0x10-0x1f range.
6820 * testsuite/sexp-conv-test: More tests for hex and base64 input
6823 2003-01-30 Niels Möller <niels@s3.kth.se>
6825 * sexp2bignum.c (nettle_mpz_set_sexp): Call sexp_iterator_next on
6826 success. That means the iterator argument can't be const.
6828 2003-01-29 Niels Möller <niels@s3.kth.se>
6830 * tools/Makefile.am (LDADD): Add libnettle.a, for the dependency.
6832 2003-01-27 Niels Möller <nisse@cuckoo.hack.org>
6834 * sexp2dsa.c (dsa_signature_from_sexp): New function.
6836 RSA renaming. Updated all callers.
6837 * rsa-sign.c (rsa_private_key_init, rsa_private_key_clear)
6838 (rsa_private_key_prepare): Renamed functions.
6839 * rsa.c (rsa_public_key_init, rsa_public_key_clear)
6840 (rsa_public_key_prepare): Renamed functions.
6842 2003-01-23 Niels Möller <nisse@cuckoo.hack.org>
6844 * Makefile.am (libnettle_a_SOURCES): Added new rsa and pkcs1
6845 files. Removed old rsa_md5.c and rsa_sha1.c.
6847 * testsuite/Makefile.am (TS_PROGS): Added pkcs1-test.
6849 * dsa-verify.c (dsa_verify_digest): New function.
6850 (dsa_verify): Most of the code moved to dsa_verify_digest, which
6852 * dsa-sign.c (dsa_sign_digest): New function.
6853 (dsa_sign): Most of the code moved to dsa_sign_digest, which is
6855 * dsa.c (_dsa_hash): Deleted function.
6857 * rsa_md5.c, rsa_sha1.c: Deleted files, contents spread over
6858 several files for signing and verification.
6859 * rsa-sign.c, rsa-sha1-verify.c, rsa-sha1-sign.c,
6860 rsa-md5-verify.c, rsa-md5-sign.c: New files.
6862 * rsa-sha1-verify.c (rsa_sha1_verify_digest): New function.
6863 * rsa-sha1-sign.c (rsa_sha1_sign_digest): New function.
6864 * rsa-md5-verify.c (rsa_md5_verify_digest): New function.
6865 * rsa-md5-sign.c (rsa_md5_sign_digest): New function.
6866 * rsa-verify.c (_rsa_verify): New file, new function.
6868 * rsa.c (_rsa_check_size): Renamed from rsa_check_size, and made
6869 non-static. Private key functions moved to rsa-sign.c.
6871 * pkcs1.c, pkcs1.h, pkcs1-rsa-md5.c, pkcs1-rsa-sha1.c: New files.
6872 (pkcs1_signature_prefix): New function.
6874 * testsuite/pkcs1-test.c: New test.
6876 2003-01-22 Niels Möller <niels@s3.kth.se>
6878 * examples/Makefile.am (nettle_benchmark_LDADD): Use
6881 * configure.ac (OPENSSL_LIBFLAGS): If libcrypto is found, add
6882 -lcrypto to OPENSSL_LIBFLAGS, not the plain LDFLAGS.
6884 2003-01-20 Niels Möller <nisse@cuckoo.hack.org>
6886 * testsuite/Makefile.am (CLEANFILES): Delete test.in, test1.out
6889 2003-01-17 Niels Möller <niels@s3.kth.se>
6891 * examples/Makefile.am (AM_CPPFLAGS): Use AM_CPPFLAGS instead of
6893 * testsuite/Makefile.am (AM_CPPFLAGS): Likewise.
6895 2003-01-16 Niels Möller <niels@s3.kth.se>
6897 * testsuite/Makefile.am (check): Can't use quotes around
6900 2003-01-14 Niels Möller <nisse@lysator.liu.se>
6902 * testsuite/Makefile.am (check): Don't use "run-tests" as a
6903 target, as it's confused with the file with the same name.
6905 * .bootstrap: Added missing #! /bin/sh.
6907 2003-01-12 Niels Möller <nisse@cuckoo.hack.org>
6909 * buffer.c (nettle_buffer_reset): New function.
6910 (nettle_buffer_copy): New function.
6912 * tools/input.c, tools/input.h, tools/output.c, tools/output.h,
6913 tools/parse.c, tools/parse.h, tools/misc.c, tools/misc.h: Moved
6914 parts ov sexp-conv.c to separate files
6916 * tools/sexp-conv.c (sexp_convert_list): Inlined into
6919 * tools/sexp-conv.c (struct sexp_input): Deleted string attribute.
6920 Changed all related functions to take a struct nettle_buffer *
6922 (struct sexp_compound_token): New struct.
6923 (sexp_compound_token_init, sexp_compound_token_clear): New
6925 (struct sexp_parser): Added a struct sexp_compound_token
6926 attribute, as a temporary measure.
6927 (sexp_parse): Take a struct sexp_compound_token * as argument.
6928 Updated all callers. Simplified handling of display types and
6931 * tools/sexp-conv.c (struct sexp_parser): Renamed struct (was
6932 struct sexp_parse_state). Added input pointer. Updated users to
6933 not pass around both parser and input.
6934 (sexp_check_token): handle token == 0.
6935 (sexp_parse): Simplified a little by calling sexp_check_token
6938 * tools/sexp-conv.c (sexp_convert_string): Deleted function.
6939 (sexp_skip_token): Likewise.
6941 * tools/sexp-conv.c (enum sexp_token): New constant SEXP_DISPLAY.
6942 Start constants from 1, to keep 0 free for special uses.
6943 (struct sexp_parse_state): New struct for keeping track of parser
6945 (sexp_parse_init): New function.
6946 (sexp_check_token): New function, replacing sexp_skip_token.
6947 (sexp_parse): New function.
6948 (sexp_convert_item): Simplified by using sexp_parse.
6949 (sexp_convert_list): Use sexp_parse.
6952 2003-01-08 Niels Möller <niels@s3.kth.se>
6954 * tools/sexp-conv.c (parse_options): Initialize prefer_hex.
6956 2003-01-07 Niels Möller <nisse@cuckoo.hack.org>
6958 * Makefile.am (des_headers): Refer to the desdata binary using
6961 2003-01-01 Niels Möller <nisse@cuckoo.hack.org>
6963 * testsuite/sexp-conv-test: New tests for hex and base64 literal
6966 * tools/sexp-conv.c (sexp_put_string): Print binary strings using
6967 either hex or base 64 (in advanced mode).
6968 (parse_options): Implemented -s hex, for output using hex rather
6971 2002-12-30 Niels Möller <nisse@cuckoo.hack.org>
6973 * testsuite/rsa2sexp-test.c: Don't include rsa.h (done by
6974 testutils.h, if enabled).
6975 * testsuite/sexp2rsa-test.c: Likewise.
6977 * rsa-decrypt.c: Make compilation conditional on WITH_PUBLIC_KEY.
6978 * rsa-encrypt.c: Likewise.
6979 * rsa-compat.c: Likewise.
6981 2002-12-04 Niels Möller <niels@s3.kth.se>
6983 * testsuite/Makefile.am (LDADD): Added path to ../libnettle.a,
6984 which is redundant except for the dependency.
6986 2002-12-04 Niels Möller <nisse@cuckoo.hack.org>
6988 * testsuite/sexp-format-test.c (test_main): Use %0s instead of %z.
6991 * sexp-format.c (format_length_string): Deleted function.
6992 (format_string): Deleted function.
6993 (sexp_vformat): New %t specifier, formatting an optional display
6994 type. Deleted %z specifier. Instead, introduced a new modifier "0"
6995 that can be used with %s, %l and %t, which says that the data is
6998 * rsa2sexp.c (rsa_keypair_to_sexp): Use %0s rather than %z, when
6999 formatting s-expressions.
7001 * buffer.c (nettle_buffer_grow): Fixed assertion.
7003 2002-11-22 Niels Möller <niels@s3.kth.se>
7005 * buffer.c: Include assert.h.
7007 2002-11-21 Niels Möller <nisse@cuckoo.hack.org>
7009 * testsuite/testutils.c (print_hex): Add line breaks.
7011 * Makefile.am (libnettleinclude_HEADERS): Added realloc.h.
7012 (libnettle_a_SOURCES): Added buffer-init.c and realloc.c.
7014 * sexp.c (sexp_iterator_exit_lists): New function, #if:ed out for
7017 * desdata.c: Include config.h, to get definition of UNUSED.
7018 * shadata.c: Likewise.
7020 * buffer.c (nettle_buffer_grow): New function, replacing
7022 (nettle_buffer_clear): Rewritten to use buffer->realloc.
7024 * buffer.h (struct nettle_buffer): Replaced the GROW function
7025 pointer with a nettle_realloc_func pointer and a
7027 (NETTLE_BUFFER_GROW): Deleted macro, use function instead.
7029 * buffer-init.c (nettle_buffer_init): Moved to a separate file.
7031 * realloc.c (nettle_realloc): New function.
7032 (nettle_xrealloc): New function.
7034 * realloc.h (nettle_realloc_func): New typedef.
7036 * configure.ac: Check for gcc:s __attribute__.
7038 2002-11-16 Niels Möller <nisse@cuckoo.hack.org>
7040 * sexp2dsa.c, sexp2rsa.c: (macro GET): Check sign of parsed
7043 * sexp2bignum.c (nettle_mpz_set_sexp): In the first check against
7044 limit, added some margin to allow for sign octets.
7046 2002-11-15 Niels Möller <nisse@cuckoo.hack.org>
7048 * testsuite/testutils.h (LDATA): Use sizeof instead of strlen. Now
7049 handles strings including NUL-characters. But works only with
7050 literals and character arrays, no char pointers.
7051 (LLENGTH): New macro, computing length the same way as LDATA.
7053 * testsuite/sexp-test.c (test_main): Test sexp_iterator_get_uint32.
7055 * testsuite/sexp-format-test.c (test_main): Check that %i and %b
7056 generate leading zeroes when needed. Check that %b handles
7059 * testsuite/rsa2sexp-test.c (test_main): Updated test, one leading
7060 zero is needed in the private key expression. In verbose mode,
7061 print the generated keys.
7063 * testsuite/sexp2rsa-test.c (test_main): Added a leading zero in
7064 the private key expression.
7066 * testsuite/bignum-test.c (test_bignum): Use
7067 nettle_mpz_init_set_str_256_s.
7068 (test_size): New function.
7069 (test_main): Test size computation and formatting of negative
7072 * sexp2bignum.c (nettle_mpz_set_sexp): Use
7073 nettle_mpz_set_str_256_s, to handle negative numbers correctly.
7075 * sexp-format.c (sexp_vformat): For %i, output a leading zero when
7076 needed to get a correct, positive, sign. For %b, use
7077 nettle_mpz_sizeinbase_256_s, to handle negative numbers properly.
7079 * bignum.c (nettle_mpz_sizeinbase_256_s): New function.
7080 (nettle_mpz_sizeinbase_256_u): New name, was
7081 nettle_mpz_sizeinbase_256. Updated all callers.
7082 (nettle_mpz_to_octets): New function.
7083 (nettle_mpz_get_str_256): Handle negative numbers.
7084 (nettle_mpz_from_octets): New function.
7085 (nettle_mpz_set_str_256_u): New name, was nettle_mpz_set_str_256.
7086 (nettle_mpz_init_set_str_256_u): New name, was
7087 nettle_mpz_init_set_str_256.
7088 (nettle_mpz_set_str_256_s): New function, handling negative two's
7090 (nettle_mpz_init_set_str_256_s): And an init variant.
7092 * sexp.c (sexp_iterator_get_uint32): New function.
7094 2002-11-10 Niels Möller <nisse@cuckoo.hack.org>
7096 * testsuite/sexp-conv-test: Use input files without any trailing
7097 newline character, in order to stress the end of file handling.
7099 * tools/sexp-conv.c (sexp_get_token_string): Fixed end of file
7101 (sexp_get_string): Fixed end of encoding/end of file handling.
7102 (parse_options): Check for negative width and complain.
7104 * tools/sexp-conv.c: Use supplied getopt.
7105 (werror): New function.
7106 (sexp_output_hash_init): New function.
7107 (sexp_put_char): Made base64 linebreaking configurable.
7108 Implemented hashing.
7109 (sexp_put_code_start, sexp_put_code_end): Don't output any
7111 (sexp_put_string): Output base64 delimiters.
7112 (sexp_put_digest): New function.
7113 (sexp_convert_item): Output transport delimiters.
7114 (sexp_convert_file): Deleted function, folded with main.
7115 (parse_options): New function.
7116 (main): Implemented --hash and --once, needed by lsh-authorize.
7118 * sexp.h (struct sexp_iterator): New field start.
7120 * sexp.c (sexp_iterator_subexpr): New function.
7121 (sexp_iterator_parse): Initialize ITERATOR->start.
7123 * sexp-format.c (sexp_vformat): Abort if format string contains
7124 unhandled characters.
7126 2002-11-08 Niels Möller <niels@s3.kth.se>
7128 * des-compat.c (des_ecb3_encrypt): Don't use struct initialization
7129 (c89 doesn't allow non-constant initializers). Reported by James
7131 (des_ede3_cbc_encrypt): Likewise.
7133 * examples/nettle-openssl.c: Moved from the top-level directory.
7134 Should *not* be included in the nettle library.
7136 2002-11-08 Niels Möller <nisse@cuckoo.hack.org>
7138 * testsuite/testutils.c (test_dsa_key): Bugfix for renamed DSA
7139 constant (noted by James Ralston).
7141 2002-11-07 Niels Möller <niels@s3.kth.se>
7143 * testsuite/run-tests: Copied new version rom lsh/src/testsuite.
7144 This version handles test scripts located in $srcdir.
7146 * examples/Makefile.am (AM_CFLAGS): We need -I$(top_srcdir).
7147 * tools/Makefile.am (AM_CFLAGS): Likewise.
7148 * testsuite/Makefile.am (AM_CFLAGS): Likewise.
7150 2002-11-07 Niels Möller <nisse@cuckoo.hack.org>
7152 * Makefile.am (SUBDIRS): Added tools.
7153 (libnettle_a_SOURCES): Added sexp-transport-format.c,
7154 sexp2bignum.c, sexp2dsa.c.
7156 * sexp2dsa.c (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp):
7157 New file, new functions.
7159 * rsa2sexp.c (rsa_keypair_to_sexp): %s -> %z renaming.
7161 * sexp-transport.c (sexp_transport_iterator_first): Fixed bug,
7162 length was mishandled.
7164 * sexp-transport-format.c (sexp_transport_format,
7165 sexp_transport_vformat): New file, new functions.
7167 * sexp-format.c (sexp_format): Return length of output. Allow
7168 buffer == NULL, and only compute the needed length in this case.
7169 Renamed %s to %z. New format specifiers %s, %i, and %l.
7170 (sexp_vformat): New function.
7171 (format_prefix): Rewrote to not use snprintf.
7173 * sexp2rsa.c (rsa_keypair_from_sexp): New limit argument. Use
7174 nettle_mpz_set_sexp.
7176 * dsa-keygen.c (dsa_generate_keypair): Added some newlines to
7177 progress display. Use DSA_P_MIN_BITS.
7179 * dsa.h (DSA_MIN_P_BITS): New constant (was DSA_MINIMUM_BITS).
7180 (DSA_Q_OCTETS, DSA_Q_BITS): New constants.
7181 (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp): New
7184 * configure.ac: Output tools/Makefile.
7186 * sexp2bignum.c (nettle_mpz_set_sexp): New file, and new function.
7187 Moved from sexp2rsa.c:get_value.
7189 * examples/io.c (read_rsa_key): New limit argument in
7190 call of rsa_keypair_from_sexp_alist.
7192 * examples/Makefile.am (noinst_PROGRAMS): Removed sexp-conv.
7194 * tools/sexp-conv.c: Moved file from examples directory.
7196 * testsuite/Makefile.am (TS_SH): New variable. Added
7199 * testsuite/testutils.h (LDUP): New macro.
7201 * testsuite/sexp2rsa-test.c (test_main): New limit argument in
7202 call of rsa_keypair_from_sexp_alist.
7204 * testsuite/sexp-test.c (test_main): Added test for lengths with
7205 more than one digit. Added tests for transport mode decoding.
7207 * testsuite/sexp-format-test.c (test_main): Added tests for %i and
7210 * testsuite/sexp-conv-test: Moved test from examples directory.
7211 Updated path to sexp-conv, now in ../tools/sexp-conv.
7213 2002-11-03 Niels Möller <nisse@cuckoo.hack.org>
7215 * sexp-format.c, sexp_format.c: Renamed sexp_format.c to
7217 * Makefile.am (libnettle_a_SOURCES): Renamed sexp_format.c to
7220 * examples/Makefile.am: Don't set CFLAGS or CPPFLAGS explicitly,
7221 let automake handle that.
7222 * testsuite/Makefile.am: Likewise.
7224 * sexp2rsa.c (rsa_keypair_from_sexp_alist): New function.
7225 (rsa_keypair_from_sexp): Use it.
7227 2002-11-01 Niels Möller <niels@s3.kth.se>
7229 * examples/Makefile.am (LDADD): Use -lnettle, instead of an
7230 explicit filename libnettle.a, so that we will use the shared
7231 library, if it exists.
7232 (AM_LDFLAGS): Added -L.., so we can find -lnettle.
7233 (run-tests): Set LD_LIBRARY_PATH to ../.lib, when running the
7235 * testsuite/Makefile.am: Similar changes.
7237 * Makefile.am (LIBOBJS): Put @LIBOBJS@ into the make variable
7239 (CLEANFILES): Delete libnettle.so.
7240 (clean-local): Delete the .lib linkfarm.
7241 ($(SHLIBFORLINK)): When building libnettle.so, create a link from
7242 .lib/$SHLIBSONAME. Needed at runtime, for the testsuite.
7244 2002-11-01 Niels Möller <nisse@lysator.liu.se>
7246 * configure.ac: Fixed definitions using SHLIBMAJOR and SHLIBMINOR.
7247 Also AC_SUBST SHLIBMAJOR and SHLIBMINOR. Reported by James
7250 2002-10-31 Niels Möller <niels@s3.kth.se>
7252 * examples/sexp-conv.c(sexp_put_list_start): Deleted function.
7253 (sexp_put_list_end): Likewise.
7254 (sexp_put_display_start): Likewise.
7255 (sexp_put_display_end): Likewise.
7256 (sexp_puts): Likewise.
7258 * examples/sexp-conv.c (sexp_get_quoted_string): Deleted function.
7259 Merged with sexp_get_String.
7260 (sexp_get_hex_string): Likewise.
7261 (sexp_get_base64_string): Likewise.
7262 (sexp_get_string): Do hex and base64 decoding.
7264 * examples/sexp-conv.c (enum sexp_char_type): New enum, for end
7265 markers in the input strem.
7266 (struct sexp_input): Deleted LEVEL attribute. Deleted all usage of
7268 (sexp_get_raw_char): Use INPUT->c and INPUT->ctype to store
7269 results. Deleted OUT argument.
7270 (sexp_get_char): Likewise. Also removed the
7271 INPUT->coding->decode_final call, for symmetry.
7272 (sexp_input_end_coding): Call INPUT->coding->decode_final.
7273 (sexp_next_char): New function.
7274 (sexp_push_char): New function.
7275 (sexp_get_token_char): Deleted function.
7276 (sexp_get_quoted_char): Simplified. Deleted output argument.
7277 (sexp_get_quoted_string): Simplified.
7278 (sexp_get_base64_string): Likewise.
7279 (sexp_get_token_string): Likewise.
7280 (sexp_get_string_length): Skip the character that terminates the
7282 (sexp_get_token): Cleared upp calling conventions. Always consume
7283 the final character of the token.
7284 (sexp_convert_list): Take responsibility for converting the start
7285 and end of the list.
7286 (sexp_convert_file): Call sexp_get_char first, to get the token
7288 (sexp_convert_item): Cleared up calling conventions. Should be
7289 called with INPUT->token being the first token of the expression,
7290 and returns with INPUT->token being the final token of the
7291 expression. Return value changed to void..
7293 * examples/sexp-conv-test: Added test for transport mode input.
7295 * examples/sexp-conv.c (sexp_get_char): Use the nettle_armor
7296 interface for decoding.
7297 (sexp_input_start_coding): New function.
7298 (sexp_input_end_coding): New function.
7299 (sexp_get_base64_string): Rewrote to use sexp_input_start_coding
7300 and sexp_input_end_coding.
7301 (sexp_get_token): Generate SEXP_TRANSPORT_START tokens.
7302 (sexp_convert_list): Lists are ended only by SEXP_LIST_END.
7303 (sexp_convert_item): Implemented transport mode, using
7304 sexp_input_start_coding and sexp_input_end_coding.
7306 2002-10-30 Niels Möller <nisse@cuckoo.hack.org>
7308 * Makefile.am: Added base16 files.
7310 * examples/sexp-conv-test: New tests for transport output.
7312 * examples/sexp-conv.c: Deleted hex functions, moved to Nettle's
7314 (struct sexp_output): Represent the current encoding as a
7315 nettle_armor pointer and a state struct.
7316 (sexp_output_init): Deleted MODE argument. Now passed to functions
7318 (sexp_get_char): Updated to new base64 conventions.
7319 (sexp_get_base64_string): Likewise.
7320 (sexp_put_raw_char): New function.
7321 (sexp_put_newline): Use sexp_put_raw_char.
7322 (sexp_put_char): Use nettle_armor interface for encoding data.
7323 Use OUTPUT->coding_indent for line breaking, so the INDENT
7324 argument was deleted.
7325 (sexp_put_code_start): New function, replacing sexp_put_base64_start.
7326 (sexp_put_code_end): New function, replacing sexp_put_base64_end.
7327 (sexp_put_data): Deleted argument INDENT.
7328 (sexp_puts): Likewise.
7329 (sexp_put_length): Likewise.
7330 (sexp_put_list_start): Likewise.
7331 (sexp_put_list_end): Likewise.
7332 (sexp_put_display_start): Likewise.
7333 (sexp_put_display_end): Likewise.
7334 (sexp_put_string): Likewise. Also changed base64 handling.
7335 (sexp_convert_string): Deleted argument INDENT. New argument
7337 (sexp_convert_list): New argument MODE_OUT.
7338 (sexp_convert_file): Likewise.
7339 (sexp_convert_item): Likewise. Also handle output in transport
7341 (match_argument): Simple string comparison.
7342 (main): Adapted to above changes.
7344 * testsuite/testutils.c (test_armor): Allocate a larger buffer
7345 CHECK, to make decode_update happy. Updated to new base64
7348 * testsuite/base64-test.c (test_main): Fixed overlap test to not
7349 change the base64 before decoding. Updated to new base64
7352 * testsuite/Makefile.am (TS_PROGS): Added base16-test.
7354 * testsuite/base16-test.c: New test.
7356 * sexp-transport.c (sexp_transport_iterator_first): Updated to new
7357 conventions for base64_decode_update and base64_decode_final.
7359 * nettle-meta.h: Updated ascii armor declarations. New declaration
7362 * base64-decode.c (base64_decode_single): Return -1 on error.
7363 Also keep track of the number of padding characters ('=') seen.
7364 (base64_decode_update): New argument dst_length. Return -1 on error.
7365 (base64_decode_status): Renamed function...
7366 (base64_decode_final): ... to this.
7368 * base64.h (struct base64_decode_ctx): Deleted STATUS attribute.
7369 Added PADDING attribute.
7371 * base16.h, base16-encode.c, base16-decode.c, base16-meta.c: New
7374 2002-10-28 Niels Möller <nisse@cuckoo.hack.org>
7376 * examples/sexp-conv.c (struct hex_decode_ctx): New hex decoding
7378 (sexp_get_raw_char): New function.
7379 (sexp_get_char): Use sexp_get_raw_char.
7381 2002-10-26 Niels Möller <nisse@cuckoo.hack.org>
7383 * examples/sexp-conv.c (sexp_put_length): Bugfix, don't output any
7385 (main): Implemented -s option.
7387 * examples/sexp-conv-test: Test for echo -n vs echo '\c'. Added a
7388 few tests for canonical output.
7390 2002-10-25 Niels Möller <niels@s3.kth.se>
7392 * examples/sexp-conv.c (struct sexp_input): Deleted the mode from
7393 the state, that should be passed as argument to relevant
7394 functions. Instead, introduces enum sexp_coding, to say if base64
7395 coding is in effect.
7396 (struct sexp_output): Added coding attribute.
7397 (sexp_put_char): Use output->coding.
7398 (sexp_put_base64_start): Likewise.
7399 (sexp_put_base64_end): Likewise.
7401 * base64-decode.c (base64_decode_single): Simplified, got rid of
7404 2002-10-25 Niels Möller <nisse@cuckoo.hack.org>
7406 * examples/sexp-conv.c (sexp_put_newline): Return void, die on
7408 (sexp_put_char, sexp_put_data, sexp_puts, sexp_put_length,
7409 sexp_put_base64_start, sexp_put_base64_end, sexp_put_string,
7410 sexp_put_list_start, sexp_put_list_end, sexp_put_display_start,
7411 sexp_put_display_end, sexp_convert_string, sexp_convert_list,
7412 sexp_skip_token): Likewise.
7413 (sexp_convert_item): Die on error.
7415 2002-10-24 Niels Möller <nisse@cuckoo.hack.org>
7417 * examples/sexp-conv-test: Doesn't need echo -n anymore.
7419 * examples/sexp-conv.c (die): New function.
7420 (struct sexp_input): Deleted field ITEM.
7421 (sexp_get_char): Die on failure, never return -1.
7422 (sexp_get_quoted_char): Likewise.
7423 (sexp_get_quoted_string): Die on failure, no returned value.
7424 (sexp_get_base64_string): Likewise.
7425 (sexp_get_token_string): Likewise.
7426 (sexp_get_string): Likewise.
7427 (sexp_get_string_length): Likewise.
7428 (sexp_get_token): Likewise.
7429 (sexp_convert_string): Adapted to sexp_get_token.
7430 (sexp_convert_list): Likewise.
7431 (sexp_convert_file): New function.
7432 (main): Use sexp_convert_file.
7434 2002-10-23 Niels Möller <nisse@cuckoo.hack.org>
7436 * examples/Makefile.am (TS_PROGS): Added sexp-conv-test.
7438 * examples/sexp-conv.c (sexp_input_init): Initialize input->string
7440 (sexp_get_char): Fixed non-transport case.
7441 (sexp_get_quoted_char): Fixed default case.
7442 (sexp_get_token): Loop over sexp_get_char (needed for handling of
7443 white space). Don't modify input->level. Fixed the code that skips
7445 (sexp_put_char): Fixed off-by-one bug in assertion.
7446 (sexp_put_string): Fixed escape handling for output of quoted
7448 (sexp_convert_list): Prettier output, hanging indent after the
7450 (sexp_skip_token): New function.
7451 (sexp_convert_item): Use sexp_skip_token to skip the end of a
7454 2002-10-22 Niels Möller <nisse@cuckoo.hack.org>
7456 * examples/sexp-conv-test: New test program.
7458 * examples/Makefile.am (noinst_PROGRAMS): Added sexp-conv.
7460 * examples/sexp-conv.c (sexp_convert_list): New function.
7461 (sexp_convert_item): New function.
7462 (main): New function. Compiles and runs now, but doesn't work.
7464 * base64-decode.c (base64_decode_single): New function.
7465 (base64_decode_update): Use base64_decode_single.
7467 * examples/sexp-conv.c: Added output functions.
7469 2002-10-21 Pontus Sköld <pont@soua.net>
7471 * base64-encode.c (base64_encode_raw): Fixed null statement
7472 amongst variable declarations, broke compilation for non C99
7475 2002-10-21 Niels Möller <nisse@lysator.liu.se>
7477 * examples/sexp-conv.c: New sexp conversion program.
7479 2002-10-21 Niels Möller <niels@s3.kth.se>
7481 * Makefile.am (libnettle_a_SOURCES): Added
7482 sexp-format-transport.c.
7484 * sexp-transport.c (sexp_transport_iterator_first): New file and
7486 * sexp.h (sexp_transport_iterator_first): Added protoype.
7488 * sexp.c (sexp_iterator_next): Abort if iterator type is boogus.
7490 2002-10-19 Niels Möller <nisse@cuckoo.hack.org>
7492 * testsuite/testutils.c (test_armor): Updated to new armor
7495 * testsuite/base64-test.c (test_main): Test BASE64_ENCODE_LENGTH
7496 and BASE64_DECODE_LENGTH. Updated test of base64_encode_raw (used
7497 to be base64_encode).
7499 * base64.h (BASE64_ENCODE_LENGTH, BASE64_DECODE_LENGTH): Fixed and
7502 * base64-meta.c (base64_encode_length, base64_decode_length): New
7503 functions, corresponding to the macros with the same name.
7505 * Makefile.am (libnettle_a_SOURCES): base64.c replaced by
7506 base64-encode.c and base64-decode.c.
7508 * pgp-encode.c (pgp_armor): Use new base64 conventions.
7510 * nettle-meta.h: Updated nettle_armor definitions.
7512 * base64.h: Major reorganization.
7514 * base64.c: Deleted file, contents moved to base64-encode.c or
7517 * base64-encode.c: New file. New supporting both encode-at-once
7518 and streamed operation.
7520 * base64-decode.c: New file.
7522 2002-10-09 Niels Möller <nisse@cuckoo.hack.org>
7524 * testsuite/Makefile.am (TS_PROGS): Added dsa-keygen-test.
7526 * dsa-keygen.c: Call the progress callback only if it's non-NULL.
7528 * Makefile.am (libnettle_a_SOURCES): Added bignum-random.c and
7531 * testsuite/testutils.c (test_dsa_key): New function to sanity
7532 check a dsa keypair.
7534 * testsuite/dsa-test.c (test_main): Call dsa_test_key.
7536 * testsuite/dsa-keygen-test.c: New test case.
7538 * dsa.h (DSA_MINIMUM_BITS): New constant.
7540 * bignum.h (nettle_mpz_random, nettle_mpz_random_size): Added
7543 * dsa-keygen.c: New file.
7545 * bignum-random.c: New file.
7546 (nettle_mpz_random): New function, moved from...
7547 * dsa-sign.c (nettle_mpz_random): ... here. Also changed argument
7548 ordering and updated callers.
7550 * bignum-random.c: (nettle_mpz_random_size): New function, renamed
7551 and moved here from...
7552 * rsa-keygen.c (bignum_random_size): ... here. Updated all
7555 * testsuite/testutils.c (test_dsa): Needs both public and private
7558 * testsuite/dsa-test.c (test_main): Updated to changes of the
7561 * testsuite/Makefile.am (TS_PROGS): Added dsa-test.
7563 * rsa-decrypt.c (rsa_decrypt): Constification.
7564 * rsa-encrypt.c (rsa_encrypt): Likewise.
7565 * rsa.c (rsa_compute_root): Likewise.
7566 * rsa_md5.c (rsa_md5_sign): Likewise.
7567 (rsa_md5_verify): Likewise.
7568 * rsa_sha1.c (rsa_sha1_sign): Likewise.
7569 (rsa_sha1_verify): Likewise.
7571 * dsa-verify.c (dsa_verify): Use const for the public key
7574 * dsa-sign.c (dsa_sign): Needs the public key as argument, in
7575 addition to the private key. Use const.
7577 * dsa.h (struct dsa_private_key): Don't include the public
7579 * dsa.c (dsa_private_key_init, dsa_private_key_clear): Updated to
7580 new struct dsa_private_key.
7582 * dsa-sign.c (dsa_sign): Bugfix, added missing mpz_init call.
7584 * Makefile.am (libnettle_a_SOURCES): Added dsa files.
7585 (libnettleinclude_HEADERS): Added dsa.h.
7587 * testsuite/testutils.c (test_dsa): New function.
7589 * testsuite/dsa-test.c: New test.
7591 * dsa.h, dsa.c, dsa-sign.c, dsa-verify.c: New files.
7593 * nettle-meta.h: Moved the nettle_random_func and
7594 nettle_progress_func typedefs here...
7595 * rsa.h: ... from here.
7597 2002-10-07 Niels Möller <nisse@cuckoo.hack.org>
7599 * sexp.h (enum sexp_type): Deleted SEXP_START.
7601 * sexp.c (sexp_iterator_parse): New function, similar to the old
7602 sexp_iterator_next, but independent of the previous value of the
7604 (sexp_iterator_first): Use sexp_iterator_parse.
7605 (sexp_iterator_next): Likewise.
7606 (sexp_iterator_enter_list): Use sexp_iterator_parse. SEXP_START
7608 (sexp_iterator_exit_list): Likewise.
7610 2002-10-06 Niels Möller <nisse@cuckoo.hack.org>
7612 * sexp2rsa.c (get_value): No need to call sexp_iterator_next
7615 * sexp.c (sexp_iterator_assoc): Advance the iterator to the
7616 element after a matching tag, before recording it.
7617 * testsuite/sexp-test.c (test_main): Updated test.
7619 * testsuite/sexp-test.c (test_main): No need to call
7620 sexp_iterator_next after sexp_iterator_exit_list.
7622 * sexp2rsa.c (rsa_keypair_from_sexp): No need to call
7623 sexp_iterator_next anymore.
7625 * sexp.c (sexp_iterator_next): Updated to new sexp_iterator_exit_list.
7626 (sexp_iterator_exit_list): Return with iterator pointing to the
7627 element after the list.
7628 (sexp_iterator_check_type): Call sexp_iterator_next before
7630 (sexp_iterator_check_types): Likewise.
7631 (sexp_iterator_assoc): Rearranged calls of sexp_iterator_next.
7633 * sexp.c (sexp_iterator_enter_list): Call sexp_iterator_next to
7634 get to the first element of the list. Updated callers.
7636 * base64.c (base64_encode_group): New function, used by openpgp
7639 * Makefile.am: Added openpgp files.
7641 * sexp2rsa.c (rsa_keypair_from_sexp): Use sexp_iterator_first.
7642 * testsuite/sexp-test.c (test_main): Likewise.
7644 * sexp.c (sexp_iterator_init): Made this function static.
7645 (sexp_iterator_first): New, friendlier, initialization function.
7647 * pgp-encode.c: New file. Functions for writing openpgp data
7650 * pgp.h: New file, with pgp related declarations.
7652 * rsa2openpgp.c (rsa_keypair_to_openpgp): New file, new function.
7654 2002-10-04 Niels Möller <niels@s3.kth.se>
7656 * examples/rsa-keygen.c: Use malloc, instead of asprintf.
7658 2002-10-03 Niels Möller <nisse@cuckoo.hack.org>
7660 * Released nettle-1.6.
7662 * NEWS: Note the aes api change.
7664 * examples/Makefile.am (EXTRA_DIST): Distribute setup-env and
7667 2002-10-02 Niels Möller <nisse@cuckoo.hack.org>
7669 * examples/rsa-keygen.c (main): Comment on the lax security of the
7672 * index.html: Added link to mailing list.
7674 2002-10-02 Niels Möller <niels@s3.kth.se>
7676 * Makefile.am: Fixed assembler rules, and shared libraries.
7678 * configure.ac: Fixed the enable-shared option.
7680 2002-10-01 Niels Möller <nisse@cuckoo.hack.org>
7682 * configure.ac: New option --enable-shared, and a first attempt at
7683 building a shared library (*without* using libtool).
7685 * Makefile.am: A first attempt at rules for building a shared
7688 2002-10-01 Niels Möller <niels@s3.kth.se>
7690 * examples/run-tests (test_program): Use basename.
7692 * examples/teardown-env: Delete some more files.
7694 * examples/run-tests (test_program): Strip directory part of
7697 * examples/Makefile.am (TS_PROGS): New variable. Run tests.
7699 * examples/io.c (read_file): Bug fix, used to overwrite pointer.
7701 * examples/rsa-keygen.c (main): Bug fix, private key wasn't
7704 * testsuite/Makefile.am: Some cleanup of make check.
7706 * examples/setup-env, examples/teardown-env: Test environment scripts.
7707 * examples/rsa-verify-test, examples/rsa-sign-test: New test cases.
7709 * examples/run-tests: New file (copied from lsh testsuite).
7711 * examples/Makefile.am: Use EXTRA_PROGRAMS and @RSA_EXAMPLES@.
7713 * examples/rsa-sign.c: No need to include config.h. Use werror
7715 * examples/rsa-verify.c: Likewise.
7716 * examples/rsa-keygen.c: Likewise.
7718 * examples/io.h: Forward declare struct rsa_public_key and struct
7719 rsa_private_key, to avoid dependences on config.h.
7721 * configure.ac (RSA_EXAMPLES): New substituted variable,
7722 controlling which example programs to build.
7724 * examples/rsa-verify.c: New example program.
7726 * examples/rsa-keygen.c: Use functions from io.c.
7727 * examples/rsa-sign.c: Likewise.
7729 * examples/Makefile.am (noinst_PROGRAMS): Added rsa-verify.
7730 (LDADD): Added io.o.
7732 * configure.ac: New define WITH_PUBLIC_KEY, and new configure flag
7733 --disable-public-key. Updated rsa-files to check for that, rather
7734 than for HAVE_LIBGMP.
7736 * examples/io.c, examples/io.c: New files. Miscellaneous functions
7737 used by the example programs.
7739 * base64.h (BASE64_DECODE_LENGTH): Comment fix.
7741 2002-09-30 Niels Möller <nisse@cuckoo.hack.org>
7743 * sexp2rsa.c (rsa_keypair_from_sexp): Bugfix: Call
7744 rsa_prepare_public_key and rsa_prepare_private_key.
7746 * examples/Makefile.am (noinst_PROGRAMS): Added rsa-sign.
7748 * examples/rsa-sign.c: New example program.
7750 * testsuite/base64-test.c (test_main): Test encoding and decoding
7753 * base64.c (base64_encode): Encode from the end of the data
7754 towards the start, in order to support overlapping areas.
7755 (base64_encode): Broke out some common code from the switch..
7757 2002-09-30 Niels Möller <niels@s3.kth.se>
7759 * sexp_format.c (sexp_format): Don't mix code and declarations.
7761 2002-09-29 Niels Möller <nisse@cuckoo.hack.org>
7763 * testsuite/Makefile.am (TS_PROGS): Added buffer-test
7764 sexp-format-test rsa2sexp-test sexp2rsa-test.
7767 * testsuite/sexp-test.c (test_main): Updated calls to
7768 sexp_iterator_assoc.
7770 * testsuite/testutils.h (MEMEQH): New macro.
7772 * testsuite/sexp2rsa-test.c: New test.
7773 * testsuite/sexp-format-test.c: New test.
7774 * testsuite/rsa2sexp-test.c: New test.
7775 * testsuite/buffer-test.c: New test.
7777 * testsuite/testutils.c (test_rsa_key): Copied this function
7779 testsuite/rsa-keygen-test.c: ... here.
7781 * examples/rsa-keygen.c: New file.
7783 * Makefile.am: Added new source files and headers buffer.h,
7784 buffer.c, sexp_format.c, sexp2rsa.c, rsa2sexp.c.
7786 * rsa.h (rsa_keypair_to_sexp, rsa_keypair_from_sexp): New
7789 * rsa2sexp.c, sexp2rsa.c: New files.
7791 * sexp.c (sexp_iterator_assoc): Don't enter the list, associate
7792 keys within the current list. Still exit the list when done.
7793 (sexp_iterator_assoc): Represent keys as plain NUL-terminated
7795 (sexp_iterator_check_type, sexp_iterator_check_types): New
7798 * sexp_format.c: New file, implementing an sexp canonical syntax
7801 * buffer.c, buffer.h: New files, implementing a bare-bones string
7804 * bignum.c (nettle_mpz_sizeinbase_256): New function.
7806 2002-09-28 Niels Möller <nisse@cuckoo.hack.org>
7808 * sexp.c (sexp_iterator_assoc): Return 0 for missing or duplicate
7809 keys. Now passes all the tests.
7811 * sexp.c (sexp_iterator_simple): Bugfixes. Check earlier that
7812 length doesn't grow too large.
7813 (sexp_iterator_next): Skip the current list only if type is
7814 SEXP_LIST. Handle ')'.
7815 (sexp_iterator_enter_list): Set type to SEXP_START.
7816 (sexp_iterator_exit_list): Likewise. Don't skip the ')' here.
7817 (sexp_iterator_assoc): Bug fix.
7819 * testsuite/sexp-test.c (test_main): Reordered sexp_iterator_assoc
7822 * nettle.texinfo (Randomness): Documented that yarrow256_init can
7823 be called with a zero number of sources.
7825 * testsuite/testutils.h (ASSERT): New macro.
7827 * testsuite/sexp-test.c: Test sexp parser.
7829 * Makefile.am (SUBDIRS): Added sexp files.
7831 * sexp.c, sexp.h: New files, implementing an sexp-parser.
7833 2002-08-27 Niels Möller <niels@s3.kth.se>
7835 * Makefile.am (DISTCLEANFILES): make distclean should delete the
7836 assembler-related symlinks.
7838 2002-08-26 Niels Möller <nisse@cuckoo.hack.org>
7840 * Makefile.am (%.o: %.asm): Create an empty (and unused)
7841 dependency file, to make the make/automake dependency tracking
7844 2002-07-18 Niels Möller <niels@s3.kth.se>
7846 * examples/nettle-benchmark.c (main): Try openssl's ciphers as
7849 * Makefile.am (libnettle_a_SOURCES): Added nettle-openssl.c.
7851 * nettle-openssl.c: New file.
7853 * nettle-internal.h: Declare openssl glue ciphers.
7855 * des-compat.h: Extra name-mangling, to avoid collisions in case a
7856 program links with both nettle and libcrypto (the nettle-benchmark
7859 * configure.ac: Don't use -ggdb3 with gcc-2.96.
7860 Check for openssl's libcrypto (for benchmarking).
7862 2002-05-16 Niels Möller <nisse@cuckoo.hack.org>
7864 * sparc/aes.asm: Deleted registers i and t3.
7865 (_aes_crypt): Moved some registers around. We now use input
7866 registers only for arguments, local registers for loop invariants,
7867 output registers for temporaries and loop variables, and no global
7870 * sparc/aes.asm (AES_FINAL_ROUND): New macro.
7871 (_aes_crypt): Use AES_FINAL_ROUND for the first word of the final
7873 (_aes_crypt): And for the rest of the final round.
7874 (AES_FINAL_ROUND): Don't update dst, just access it offseted by i.
7875 (_aes_crypt): Add 16 to dst at the end of the final round.
7876 (AES_ROUND): Use ldub, not ld + and, to get the third byte
7878 (AES_ROUND): Use ldub, not lduh + and, to get the second
7880 (AES_ROUND): Reordered instructions, so that we can save one
7882 (AES_ROUND): Eliminated use of t3.
7883 (AES_FINAL_ROUND): Eliminated ands.
7884 (AES_FINAL_ROUND): Reordered, so that we can save one register.
7885 (AES_FINAL_ROUND): Eliminated t3.
7886 (AES_LOAD): New macro.
7887 (_aes_crypt): Unrolled source loop.
7888 (_aes_crypt): Use AES_LOAD macro.
7889 (_aes_crypt): Deleted cruft from the old source loop.
7890 (AES_LOAD): Eliminated t3.
7892 2002-05-15 Niels Möller <nisse@cuckoo.hack.org>
7894 * sparc/aes.asm (AES_ROUND): New macro.
7895 (_aes_crypt): Use AES_ROUND for first word of the
7897 (_aes_crypt): And for the rest of the round function.
7899 * sparc/aes.asm (_aes_crypt): Deleted a bunch of additions,
7900 after accessing IDX1.
7902 * aes-internal.h (struct aes_table): sparc_idx[0] should now
7903 contain index values shifted by the size of a word, and with 2
7904 added. This saves some additions in the sparc assembler code.
7905 Updates aes-encrypt-table.c and aes-decrypt-table.c.
7907 * sparc/aes.asm (_aes_crypt): Unrolled final loop, preparing for
7909 (_aes_crypt): Eliminated i from forst copy of the loop. Some
7911 (_aes_crypt): And from second copy.
7912 (_aes_crypt): And from third.
7913 (_aes_crypt): And fourth.
7914 (_aes_crypt): Eliminated updates of i from the loop.
7915 (_aes_crypt): Access IDX1 and IDX3 through the T pointer, saving
7918 * aes-internal.h (struct aes_table): Renamed the shift_idx field
7919 to sparc_idx, as it will be tweaked to improve the sparc code.
7920 Also reduced its size to [2][4].
7921 (IDX_FACTOR): Deleted constant.
7922 * aes-encrypt-table.c (_aes_encrypt_table): Adapted initializer of
7924 * aes-decrypt-table.c (_aes_decrypt_table): Likewise.
7925 * asm.m4: Deleted AES_SIDX2, to match struct aes_table.
7927 * sparc/aes.asm (_aes_crypt): Unrolled the inner loop, preparing
7928 for optimizations suggested by Marcus Comstedt.
7929 (_aes_crypt): Eliminated i from the first copy of the inner loop.
7930 (_aes_crypt): And from the second copy.
7931 (_aes_crypt): And from the third copy.
7932 (_aes_crypt): And from the fourth copy.
7933 (_aes_crypt): Renamed .Linner_loop to .Lround_loop.
7934 (_aes_crypt): Eliminated the loop variable i from the unrolled
7936 (_aes_crypt): Deleted moves of constants into t2.
7938 2002-05-15 Niels Möller <niels@s3.kth.se>
7940 * x86/aes-encrypt.asm (aes_encrypt): Use AES_SUBST_BYTE.
7941 * x86/aes-decrypt.asm (aes_decrypt): Likewise.
7942 (aes_decrypt): Use AES_STORE.
7943 (aes_decrypt): Deleted first xchgl instruction into, permuting the
7944 AES_ROUND calls instead.
7945 (aes_decrypt): Likewise for the final round.
7946 (aes_decrypt): Got rid if the xchgl instruction after the final
7947 round, folding it into the final round.
7949 * x86/machine.m4: Renamed AES_LAST_ROUND to AES_FINAL_ROUND.
7952 * x86/aes-decrypt.asm (aes_decrypt): Use the AES_LOAD macro.
7953 (aes_decrypt): Start using AES_ROUND.
7954 (aes_decrypt): Use AES_LAST_ROUND.
7956 * x86/aes-decrypt.asm (aes_decrypt): Moved function to a separate
7958 * x86/aes.asm: ... from here.
7960 * x86/aes.asm (aes_decrypt): Use _aes_decrypt_table instead of
7961 itbl1-4. Commented out the inclusion of aes_tables.asm.
7962 (aes_decrypt): Use _aes_decrypt_table instead of isbox.
7965 * x86/aes-decrypt.asm: New file, empty at the start.
7967 * Makefile.am (libnettle_a_SOURCES): Added aes-decrypt-table.c.
7969 * aes-decrypt.c (_aes_decrypt_table): Moved from this file...
7970 * aes-decrypt-table.c (_aes_decrypt_table): ... to a new file.
7972 * testsuite/aes-test.out: New file, with the output of
7973 testsuite/aes-test, when aes.c has been compiled with debugging
7974 printouts of intermediate state.
7976 2002-05-15 Niels Möller <nisse@cuckoo.hack.org>
7978 * sparc/aes.asm: (_aes_crypt): Restore %fp at end of function, to
7979 make %fp available for other uses.
7981 * sparc/aes.asm: The frame setup was broken. Tried to fix it.
7982 Reverted to revision 1.70 + minor changes from the head revision.
7984 * x86/aes-encrypt.asm (aes_encrypt): Use test instead of cmpl $0,.
7986 * x86/machine.m4 (AES_SUBST_BYTE): New macro.
7988 * sparc/aes.asm: wtxt needs no register of it's own, as its
7989 pointed to by %sp. %g5 moved to %l0, the register previously
7990 allocated for wtxt, so that we stay clean of the reserved %g
7993 2002-05-14 Niels Möller <nisse@cuckoo.hack.org>
7995 * sparc/aes.asm: Avoid using %g6 and %g7, as they are reserved for
7996 operating sytem use. Use %i5 and %o7 instead. Also moved %g4 to %g1.
7997 (_aes_crypt): Allocate only 32 bytes local storage on the stack.
7998 Calculate wtxt and tmp using offsets from %sp, not %fp.
8000 2002-05-14 Niels Möller <niels@s3.kth.se>
8002 * x86/aes-encrypt.asm (aes_encrypt): Replaced first quarter of the
8003 round function with an invocation of AES_ROUND.
8004 (aes_encrypt): Similarly for the second column.
8005 (aes_encrypt): Similarly for the rest of the round function.
8007 * x86/machine.m4 (AES_ROUND): New macro.
8009 * x86/aes-encrypt.asm (aes_encrypt): Use AES_LOAD macro.
8011 * x86/machine.m4 (AES_LOAD): New macro.
8013 * x86/aes-encrypt.asm (aes_encrypt): Use AES_STORE.
8015 * x86/machine.m4 (AES_STORE): New macro.
8017 * x86/aes-encrypt.asm (aes_encrypt): Use the AES_LAST_ROUND macro
8018 for the first column of the final round.
8019 (aes_encrypt): Similarly for the second column.
8020 (aes_encrypt): Similarly for the third and fourth column.
8022 (aes_encrypt): Deleted xchgl instruction in final round, by
8023 reordering the second and fourth round.
8025 * x86/machine.m4 (AES_LAST_ROUND): New macro.
8027 * x86/aes-encrypt.asm (aes_encrypt): Move code here...
8028 * x86/aes.asm: ...from here.
8030 * x86/aes.asm: Use addl and subl, not add and sub. Replaced
8031 references to dtbl1-4 with references to _aes_encrypt_table.
8033 * configure.ac (asm_path): Enable x86 assembler.
8035 * x86/aes.asm (aes_decrypt): Adapted to the current interface.
8036 Notably, the order of the subkeys was reversed. Single block
8037 encrypt/decrypt works now.
8038 (aes_encrypt, aes_decrypt): Added an outer loop, so that we can
8039 encrypt more than one block at a time.
8041 2002-05-07 Niels Möller <niels@s3.kth.se>
8043 * configure.ac: Generate config.m4.
8045 * x86/aes.asm: Use C for comments, include the tables using
8046 include_src, and commented out the key setup functions.
8047 Fixed the processing of the first handling of the round function.
8048 Now, encryption of a single block works! Multiple blocks, and
8049 decryption, is still broken.
8051 * x86/machine.m4: New file (empty).
8053 * x86/aes-encrypt.asm: New file, empty for now.
8055 * Makefile.am (%.asm): Added asm.m4, machine.m4 and config.m4 to
8056 the m4 command line.
8057 (libnettle_a_SOURCES): Added aes-encrypt-table.c.
8059 * sparc/aes.asm: No need to include asm.m4, that is taken care of
8062 * config.m4.in: New file, configuration for asm.m4.
8064 * asm.m4 (C, include_src): New macros.
8066 * aes-encrypt-table.c: New file, table moved out from
8069 2002-05-06 Niels Möller <niels@s3.kth.se>
8071 * configure.ac (CFLAGS): Don't enable -Waggregate-return.
8073 2002-05-05 Niels Möller <nisse@lysator.liu.se>
8075 * configure.ac: Pass no arguments to AM_INIT_AUTOMAKE.
8077 2002-05-05 Niels Möller <nisse@cuckoo.hack.org>
8079 * configure.ac: Update for automake-1.6.
8081 * configure.ac: Renamed file, used to be configure.in.
8083 2002-03-20 Niels Möller <nisse@cuckoo.hack.org>
8085 * testsuite/run-tests (test_program): Added missing single quote.
8087 2002-03-20 Niels Möller <nisse@lysator.liu.se>
8089 * testsuite/run-tests (test_program): Test the exit status of the
8092 2002-03-19 Pontus Sköld <pont@it.uu.se>
8094 * testsuite/run-tests: Removed /bin/bashisms to use with /bin/sh.
8096 2002-03-18 Niels Möller <nisse@cuckoo.hack.org>
8098 * rsa-keygen.c (rsa_generate_keypair): Output a newline after a
8099 non-empty line of 'e':s (bad e was chosen, try again).
8101 2002-03-16 Niels Möller <nisse@cuckoo.hack.org>
8103 * configure.in (asm_path): AC_CONFIG_LINKS adds $srcdir
8106 2002-03-14 Niels Möller <nisse@cuckoo.hack.org>
8108 * sparc/aes.asm, x86/aes.asm: Added copyright notice.
8110 * Makefile.am (libnettle_a_SOURCES): Added aes-internal.h.
8111 (EXTRA_DIST): Added assembler files.
8113 * configure.in (asm_path): Use $srcdir when looking for the files.
8114 * configure.in (asm_path): For now, disable x86 assembler code.
8115 Bumped version to 1.6.
8117 2002-02-25 Niels Möller <nisse@cuckoo.hack.org>
8119 * sparc/aes.asm (_aes_crypt): Moved increment of src into the
8120 source_loop. Also fixed stop condition, the loop was run 5 times,
8121 not 4, as it should.
8122 (_aes_crypt): Use src directly when accessing the source data,
8124 (_aes_crypt): Renamed variables in source_loop.
8125 (_aes_crypt): Changed stop condition in source_loop to not depend
8126 on i. Finally reduced the source_loop to 16 instructions. Also
8127 increased the alignment of the code to 16.
8128 (_aes_crypt): In final_loop, use preshifted indices.
8129 (_aes_crypt): In final_loop, construct the result in t0. Use t0-t3
8130 for intermediate values.
8131 (_aes_crypt): In final_loop, use the register idx.
8132 (_aes_crypt): In final_loop, keep i multiplied by 4. Use key to
8133 get to the current roundkey.
8134 (_aes_crypt): In final_loop, use i for indexing.
8135 (_aes_crypt): Update dst in the output loop. This yields a delay
8136 slot that isn't filled yet.
8137 (_aes_crypt): Decrement round when looping, saving yet some
8139 (_aes_crypt): Reformatted code as blocks of four instructions
8141 (_aes_crypt): Copy the addresses of the indexing tables into
8142 registers at the start. No more need for the idx register.
8143 (_aes_crypt): Deleted idx register.
8144 (_aes_crypt): Some peep hole optimizations, duplicating some
8145 instructions to fill nop:s, and put branch instructions on even
8148 2002-02-22 Niels Möller <nisse@cuckoo.hack.org>
8150 * sparc/aes.asm (_aes_crypt): Moved some more additions out of the
8151 inner loop, using additional registers.
8152 (_aes_crypt): Deleted one more addition from the inner loop, by
8153 using the subkey pointer.
8155 2002-02-19 Niels Möller <nisse@cuckoo.hack.org>
8157 * configure.in (asm_path): Renamed "path" to "asm_path". Also look
8160 2002-02-16 Niels Möller <nisse@cuckoo.hack.org>
8162 * sparc/aes.asm: Use that IDX2(j) == j ^ 2
8164 * Makefile.am (libnettle_a_SOURCES): Reordered aes-decrypt.c and
8165 aes-encrypt.c. For some strange reason it makes the benchmark go
8168 * sparc/aes.asm (_aes_crypt): Use double-buffering, and no
8169 separate loop for adding the round key.
8170 (round): Keep round index muliplied by 16, so it can be used
8171 directly for indexing the subkeys.
8172 (_aes_crypt): In the final loop, use ctx+round to access the
8173 subkeys, no need for an extra register.
8175 2002-02-15 Niels Möller <nisse@cuckoo.hack.org>
8177 * sparc/aes.asm (_aes_crypt): Renaming variables, allocating
8178 locals starting from %l0.
8179 (_aes_crypt): Consistently use %l4, aka i, as the variable for the
8181 (_aes_crypt): Moved reading of ctx->nrounds out of the loop.
8182 (_aes_crypt): In final_loop, deleted a redundant mov, and use i as
8184 (_aes_crypt): Started renumbering registers in the inner loop. The
8185 computation for the table[j] sub-expression should be kept in
8187 (_aes_crypt): Renamed more variables in the inner loop. Now the
8188 primary variables are t0, t1, t2, t3.
8190 * sparc/aes.asm (_aes_crypt): Swapped register %i0 and %o5, %i1
8191 and %o0, %i2 and %o4, %i3 and %o3, %i4 and %o2.
8192 (_aes_crypt): wtxt was stored in both %l1 and %l2 for the entire
8193 function. Freed %l2 for other uses.
8194 (_aes_crypt): Likewise for tmp, freeing register %o1.
8196 * sparc/machine.m4: New file, for sparc-specific macros.
8198 * sparc/aes.asm (_aes_crypt): Hacked the source_loop, to get rid
8199 of yet another redundant loop variable, and one instruction.
8200 (_aes_crypt): Strength reduce loop variable in the
8201 inner loop, getting rid of one register.
8202 (_aes_crypt): Use pre-shifted indices (aes_table.idx_shift), to
8203 avoid some shifts in the inner loop.
8204 (_aes_crypt): Don't check for nrounds==0 at the start of the loop.
8206 * asm.m4: Define and use structure-defining macros.
8208 * Makefile.am (%.asm): Use a GNU pattern rule, to make %.o depend
8209 on both %.asm and asm.m4.
8211 * aes-internal.h (struct aes_table): New subtable idx_shift.
8212 Updated tables in aes_encrypt.c and aes_decrypt.c.
8214 * asm.m4: Use eval to compute values.
8216 * sparc/aes.asm (_aes_crypt): Deleted commented out old version of
8219 * asm.m4: Added constants for individual rows of the aes table.
8221 * aes.c (IDX0, IDX1, IDX2, IDX3): New macros, encapsualting the
8222 structure of the idx table.
8224 * asm.m4: Define various aes struct offsets.
8226 * testsuite/cbc-test.c (test_cbc_bulk): Use aes_set_encrypt_key
8227 and aes_set_decrypt_key.
8229 * sparc/aes.asm (_aes_crypt): Use symbolic names for the fucntion
8232 2002-02-14 Niels Möller <nisse@cuckoo.hack.org>
8234 * sparc/aes.asm: Copied gcc assembler code for _aes_crypt.
8236 * aesdata.c: New program for generating AES-related tables.
8238 * testsuite/testutils.c (print_hex): New function (moved from
8241 * testsuite/rsa-keygen-test.c (progress): Declare the ctx argument
8244 * testsuite/cbc-test.c (test_cbc_bulk): New function, testing CBC
8247 * yarrow256.c: Replaced uses of aes_set_key with
8248 aes_set_encrypt_key.
8250 * nettle-meta.h (_NETTLE_CIPHER_SEP): New macro, useful for
8251 algorithms with separate encyption and decryption key setup.
8253 * aes-internal.h (struct aes_table): New structure, including all
8254 constant tables needed by the unified encryption or decryption
8255 function _aes_crypt.
8257 * aes.c (_aes_crypt): New function, which unifies encryption and
8260 AES key setup now uses two separate functions for setting
8261 encryption and decryption keys. Applications that don't do
8262 decryption need no inverted subkeys and no code to generate them.
8263 Similarly, the tables (about 4K each for encryption and
8264 decryption), are put into separate files.
8266 * aes.h (struct aes_ctx): Deleted space for inverse subkeys. For
8267 decryption, the inverse subkeys replace the normal subkeys, and
8268 they are stored _in the order they are used_.
8270 * aes-set-key.c (aes_set_key): Deleted file, code moved...
8271 * aes-set-decrypt-key.c, aes-set-encrypt-key.c: New files,
8272 separated normal and inverse key setup.
8274 * aes-tables.c: Deleted, tables moved elsewhere...
8275 * aes-encrypt.c, aes-decrypt.c: New files; moved encryption and
8276 decryption funktions, and needed tables, into separate files.
8278 2002-02-13 Niels Möller <nisse@cuckoo.hack.org>
8280 * aes.c (aes_encrypt): Don't unroll the innerloop.
8281 (aes_encrypt): Don't unroll the loop for the final round.
8282 (aes_decrypt): Likewise, no loop unrolling.
8284 * aes-set-key.c (aes_set_key): Reversed the order of the inverted
8285 subkeys. They are now stored in the same order as they are used.
8287 * aes-tables.c (itable): New bigger table, generated by aesdata.c.
8289 * aes.c (aes_decrypt): Rewrote to use the bigger tables.
8291 2002-02-12 Niels Möller <nisse@cuckoo.hack.org>
8293 * aes.c (aes_encrypt): Interleave computation and output in the
8296 * aes-internal.h (AES_SMALL): New macro.
8298 * aes.c (aes_encrypt): Optionally use smaller rotating inner loop.
8300 * aes-tables.c (dtbl): Replaced with table generated by aesdata.
8302 * aes.c (aes_encrypt): Rewrite, now uses larger tables in order to
8305 * sparc/aes.asm (aes_encrypt): Strength reduced on j, getting rid
8306 of one register and one instruction in the inner loop.
8308 * sparc/aes.asm (idx, aes_encrypt): Multiplied tabled values by 4,
8309 making it possible to get rid of some shifts in the inner loop.
8311 * configure.in: Fixed spelling of --enable-assembler. Commented
8314 * asm.m4: New file. For now, only doing changequote and changecom.
8316 * sparc/aes.asm (aes_encrypt): Added comments.
8317 (aes_encrypt): Cut off redundant instruction per block, also
8318 saving one redundant register pointing to idx.
8319 (idx_row): New macro. Include asm.m4.
8321 2002-02-11 Niels Möller <nisse@cuckoo.hack.org>
8323 * sparc/aes.asm (key_addition_8to32): Cleaned up.
8324 Deleted gcc-generated debugging information.
8326 * sparc/aes.asm (key_addition32): First attempt at optimization.
8329 * sparc/aes.asm (key_addition32): Unrolled loop, gained 4%
8330 speed, payed four instructions compared to gcc
8333 * Makefile.am (.asm.o): New rule for assembling via m4.
8334 (libnettle_a_SOURCES): Added new rsa and aes files.
8336 * configure.in: New command line option --enable-assembler.
8337 Selects assembler code depending on the host system.
8339 * rsa-decrypt.c, rsa-encrypt.c: New files for rsa pkcs#1
8342 * aes-set-key.c, aes-tables.c: New files, split off from aes.c.
8343 Tables are now not static, but use a _aes_ prefix on their names.
8345 * aes-internal.h: New file.
8347 * cast128-meta.c (_NETTLE_CIPHER_FIX): Use _NETTLE_CIPHER_FIX.
8349 * cbc.c (cbc_decrypt_internal): New function, doing the real CBC
8350 procesing and requiring that src != dst.
8351 (cbc_decrypt): Use cbc_decrypt_internal. If src == dst, use a
8352 buffer of limited size to copy the ciphertext.
8354 * nettle-internal.c (nettle_blowfish128): Fixed definition, with
8357 * nettle-meta.h (_NETTLE_CIPHER_FIX): New macro, suitable for
8358 ciphers with a fixed key size.
8360 * examples/nettle-benchmark.c (display): New function for
8361 displaying the results, including MB/s figures.
8363 * sparc/aes.asm: New file. Not yet tuned in any way (it's just the
8364 code generated by gcc).
8366 2002-02-11 Niels Möller <nisse@lysator.liu.se>
8368 * x86/aes.asm, x86/aes_tables.asm: New assembler implementation by
8371 2002-02-06 Niels Möller <nisse@cuckoo.hack.org>
8373 Applied patch from Dan Egnor improving the base64 code.
8374 * base64.h (BASE64_ENCODE_LENGTH): New macro.
8375 (struct base64_ctx): New context struct, for decoding.
8376 (BASE64_DECODE_LENGTH): New macro.
8377 * base64.c (base64_decode_init): New function.
8378 (base64_decode_update): New function, replacing base64_decode.
8379 Takes a struct base64_ctx argument.
8380 * nettle-meta.h: Updated nettle_armor, and related typedefs and
8382 * testsuite/testutils.c (test_armor): Updated.
8383 * configure.in: Use AC_PREREQ(2.50).
8385 2002-02-01 Niels Möller <nisse@cuckoo.hack.org>
8387 * Released nettle-1.5.
8389 2002-01-31 Niels Möller <nisse@cuckoo.hack.org>
8391 * acinclude.m4: Commented out gmp-related macros, they're probably
8394 2002-01-31 Niels Möller <nisse@lysator.liu.se>
8396 * configure.in: Added command line options --with-lib-path and
8397 --with-include-path. Use the RPATH-macros to get correct flags for
8398 linking the test programs with gmp.
8400 * acinclude.m4: New file.
8402 2002-01-31 Niels Möller <nisse@cuckoo.hack.org>
8404 * nettle.texinfo (Randomness): New subsection on Yarrow.
8406 2002-01-30 Niels Möller <nisse@cuckoo.hack.org>
8408 * nettle.texinfo (Randomness): New chapter.
8409 Spell checking and ispell configuration.
8411 * md5.c: Added reference to RFC 1321.
8413 2002-01-24 Niels Möller <nisse@cuckoo.hack.org>
8415 * nettle.texinfo (Public-key algorithms): Minor fixes.
8417 2002-01-22 Niels Möller <nisse@cuckoo.hack.org>
8419 * nettle.texinfo (Nettle soup): New chapter.
8420 (Hash functions): New subsection on struct nettle_hash.
8421 (Hash functions): New subsection on struct nettle_cipher.
8422 (Keyed hash functions): New section, describing MAC:s and HMAC.
8423 (Public-key algorithms): New chapter.
8425 * testsuite/testutils.c (test_armor): New function.
8427 * testsuite/base64-test.c: New testcase.
8429 * testsuite/Makefile.am (TS_PROGS): Added base64-test.
8431 * nettle-meta.h (struct nettle_armor): New struct.
8433 * configure.in: Bumped version to 1.5.
8435 * Makefile.am (libnettle_a_SOURCES): Added base64 files, and some
8436 missing header files.
8438 * base64.c, base64.h, base64-meta.c: New files, hacked by Dan
8441 2002-01-16 Niels Möller <nisse@cuckoo.hack.org>
8443 * testsuite/yarrow-test.c: Deleted ran_array code, use
8444 knuth-lfib.h instead.
8446 * testsuite/testutils.c (test_rsa_md5, test_rsa_sha1): Moved
8448 * testsuite/rsa-test.c: ...from here.
8450 * testsuite/rsa-keygen-test.c: New file.
8452 * testsuite/knuth-lfib-test.c: New file.
8454 * Makefile.am (libnettle_a_SOURCES): Added knuth-lfib.c and
8457 * rsa-keygen.c: New file.
8459 * rsa.h (RSA_MINIMUM_N_OCTETS): New constant.
8460 (RSA_MINIMUM_N_BITS): New constant.
8461 (nettle_random_func, nettle_progress_func): New typedefs. Perhaps
8462 they don't really belong in this file.
8463 (rsa_generate_keypair): Added progress-callback argument.
8465 * macros.h (READ_UINT24, WRITE_UINT24, READ_UINT16, WRITE_UINT16):
8468 * knuth-lfib.c, knuth-lfib.h: New files, implementing a
8469 non-cryptographic prng.
8471 2002-01-15 Niels Möller <nisse@cuckoo.hack.org>
8473 * hmac-sha1.c: New file.
8475 2002-01-14 Niels Möller <nisse@cuckoo.hack.org>
8477 * configure.in: Bumped version to 1.1.
8479 * testsuite/hmac-test.c (test_main): Added hmac-sha1 test cases.
8481 * rsa.c (rsa_init_private_key, rsa_clear_private_key): Handle d.
8483 * rsa.h (struct rsa_private_key): Reintroduced d attribute, to be
8484 used only for key generation output.
8485 (rsa_generate_keypair): Wrote a prototype.
8487 * Makefile.am (libnettle_a_SOURCES): Added hmac-sha1.c and
8490 * des.c: Use static const for all tables.
8491 (des_set_key): Use a new const * variable for the parity
8492 procesing, for constness reasons.
8494 * list-obj-sizes.awk: New file.
8496 * nettle-internal.c, nettle-internal.h: New files.
8498 * testsuite/Makefile.am (TS_PROGS): Added hmac-test. Deleted old
8501 * testsuite/testutils.h (LDATA): Moved this macro here,...
8502 * testsuite/rsa-test.c: ... from here.
8504 * testsuite/hmac-test.c: New file.
8506 * hmac.h: General cleanup. Added declarations of hmac-md5,
8507 hmac-sha1 and hmac-sha256.
8509 * hmac.c: Bug fixes.
8511 * hmac-md5.c: First working version.
8513 * Makefile.am (libnettle_a_SOURCES): Added hmac.c and hmac-md5.c.
8514 (libnettleinclude_HEADERS): Added hmac.h.
8516 * testsuite/rsa-test.c: Also test a 777-bit key.
8518 * rsa.c (rsa_check_size): Changed argument to an mpz_t. Updated
8520 (rsa_prepare_private_key): Compute the size of the key by
8521 computing n = p * q.
8523 * rsa-compat.c: Adapted to new private key struct.
8524 * rsa_md5.c: Likesize.
8525 * rsa_sha1.c: Likesize.
8527 * rsa.c (rsa_check_size): New function, for computing and checking
8528 the size of the modulo in octets.
8529 (rsa_prepare_public_key): Usa rsa_check_size.
8530 (rsa_init_private_key): Removed code handling n, e and d.
8531 (rsa_clear_private_key): Likewise.
8532 (rsa_compute_root): Always use CRT.
8534 * rsa.h (struct rsa_private_key): Deleted public key and d from
8535 the struct, as they are not needed. Added size attribute.
8537 2002-01-12 Niels Möller <nisse@cuckoo.hack.org>
8539 * Makefile.am: Added *-meta files.
8541 * rsa.c (rsa_init_public_key): New function.
8542 (rsa_clear_public_key): Likewise.
8543 (rsa_init_private_key): Likewise.
8544 (rsa_clear_private_key): Likewise.
8546 * aes-meta.c: New file.
8547 * arcfour-meta.c: New file.
8548 * cast128-meta.c: New file.
8549 * serpent-meta.c: New file.
8550 * twofish-meta.c: New file.
8552 * examples/nettle-benchmark.c: Use the interface in nettle-meta.h.
8554 2002-01-11 Niels Möller <nisse@cuckoo.hack.org>
8556 Don't use m4 for generating test programs, it's way overkill. Use
8557 the C preprocessor instead.
8558 * testsuite/*-test.c: New file.
8560 * hmac.c, hmac.h, hmac-md5.c: New files.
8562 Defined structures describing the algoriths. Useful for code that
8563 wants to treat an algorithm as a black box.
8564 * nettle-meta.h, md5-meta.c, sha1-meta.c, sha256-meta.c: New
8567 2002-01-09 Niels Möller <nisse@cuckoo.hack.org>
8569 * rsa-compat.c: Updated for new md5 and rsa conventions.
8571 * rsa_md5.c: Represent a signature as an mpz_t, not a string.
8572 Updated calls of md5 functions.
8573 * rsa_sha1.c: Likewise.
8575 * rsa.c (rsa_prepare_public_key): Renamed function, was
8576 rsa_init_public_key.
8577 (rsa_prepare_private_key): Renamed function, was
8578 rsa_init_private_key.
8580 * nettle.texinfo (Hash functions): Update for the changed
8581 interface without *_final. Document sha256.
8583 * testsuite/md5-test.m4, testsuite/sha1-test.m4,
8584 testsuite/sha256-test.m4, testsuite/yarrow-test.c: Updated for new
8585 hash function interface.
8587 * yarrow256.c: Removed calls of sha256_final and and some calls of
8590 * md5-compat.c (MD5Final): Call only md5_digest.
8592 * md5.c (md5_digest): Call md5_final and md5_init.
8593 (md5_final): Declared static.
8594 sha1.c, sha256.c: Analogous changes.
8596 * bignum.c (nettle_mpz_get_str_256): Declare the input argument
8599 2001-12-14 Niels Möller <nisse@cuckoo.hack.org>
8601 * Makefile.am (EXTRA_DIST): Added $(des_headers). Changed
8602 dependencies for $(des_headers) to depend only on the source file
8603 desdata.c, not on the executable.
8605 2001-12-12 Niels Möller <nisse@cuckoo.hack.org>
8607 * testsuite/yarrow-test.c (main): Updated testcase to match fixed
8608 generator. Send verbose output to stdout, not stderr.
8610 * yarrow256.c (yarrow_slow_reseed): Bug fix, update the fast pool
8611 with the digest of the slow pool.
8612 (yarrow256_init): Initialize seed_file and counter to zero, to
8615 2001-12-07 Niels Möller <nisse@cuckoo.hack.org>
8617 * bignum.c (nettle_mpz_get_str_256): Fixed handling of leading
8620 2001-12-05 Niels Möller <nisse@cuckoo.hack.org>
8622 * testsuite/yarrow-test.c (main): Updated test to match the fixed
8623 key event estimator.
8625 * yarrow_key_event.c (yarrow_key_event_estimate): Fixed handling
8628 * nettle.texinfo (Copyright): Say that under certain
8629 circumstances, Nettle can be used as if under the LGPL.
8631 * README: Added a paragraph on copyright.
8633 2001-11-15 Niels Möller <nisse@cuckoo.hack.org>
8635 * yarrow256.c (yarrow256_force_reseed): New function.
8637 2001-11-14 Niels Möller <nisse@ehand.com>
8639 * testsuite/yarrow-test.c (main): Use yarrow256_is_seeded.
8641 * yarrow256.c (yarrow256_needed_sources): New function.
8642 (yarrow256_is_seeded): New function.
8643 (yarrow256_update): Use yarrow256_needed_sources.
8645 2001-11-14 Niels Möller <nisse@cuckoo.hack.org>
8647 * testsuite/yarrow-test.out: Updated, to match the seed-file aware
8650 * testsuite/yarrow-test.c: Updated expected_output. Check the seed
8651 file contents at the end.
8653 * yarrow256.c (yarrow256_seed): New function.
8654 (yarrow_fast_reseed): Create new seed file contents.
8656 2001-11-13 Niels Möller <nisse@cuckoo.hack.org>
8658 * yarrow.h: Deleted yarrow160 declarations.
8660 2001-11-02 Niels Möller <nisse@ehand.com>
8662 * yarrow256.c (yarrow256_init): Fixed order of code and
8665 2001-10-30 Niels Möller <nisse@ehand.com>
8667 * rsa-compat.h: Added real prototypes and declarations.
8669 * Makefile.am (libnettle_a_SOURCES): Added rsa-compat.h and
8672 * rsa-compat.c: New file, implementing RSA ref signature and
8673 verification functions.
8675 * configure.in: Check for libgmp. Deleted tests for SIZEOF_INT and
8678 * rsa_sha1.c: New file, PKCS#1 rsa-sha1 signatures.
8679 * rsa_md5.c: New file, PKCS#1 rsa-md5 signatures.
8681 * rsa.c: New file with general rsa functions.
8683 * Makefile.am (libnettle_a_SOURCES): Added rsa and bignum files.
8685 * bignum.c, bignum.h: New file, with base256 functions missing in
8688 * testsuite/Makefile.am: Added bignum-test.
8690 * testsuite/run-tests (test_program): Check the exit code more
8691 carefully, and treat 77 as skip. This convention was borrowed from
8694 * testsuite/macros.m4: New macro SKIP which exits with code 77.
8696 * testsuite/bignum-test.m4: New file.
8698 2001-10-15 Niels Möller <nisse@ehand.com>
8700 * testsuite/Makefile.am (EXTRA_DIST): Include rfc1750.txt in the
8703 2001-10-14 Niels Möller <nisse@cuckoo.hack.org>
8705 * testsuite/des-test.m4: Added testcase taken from applied
8708 * testsuite/yarrow-test.c: Use sha256 instead of sha1 for checking
8709 input and output. Updated the expected values.
8711 * yarrow256.c (YARROW_RESEED_ITERATIONS): New constant.
8712 (yarrow_iterate): New function.
8713 (yarrow_fast_reseed): Call yarrow_iterate.
8715 * testsuite/yarrow-test.c: Added verbose flag, disabled by
8718 2001-10-12 Niels Möller <nisse@ehand.com>
8720 * examples/nettle-benchmark.c: Added more ciphers.
8722 * Makefile.am (SUBDIRS): Added the examples subdir.
8724 * configure.in: Output examples/Makefile.
8726 2001-10-12 Niels Möller <nisse@cuckoo.hack.org>
8728 * examples/nettle-benchmark.c: New benchmarking program.
8730 2001-10-10 Niels Möller <nisse@ehand.com>
8732 * testsuite/yarrow-test.c: Open rfc1750.txt. Hash input and
8733 output, and compare to expected values.
8735 * testsuite/Makefile.am (CFLAGS): Don't disable optimization.
8736 (run-tests): Set srcdir in the environment when running run-tests.
8738 * testsuite/rfc1750.txt: Added this rfc as test input for yarrow.
8740 * yarrow_key_event.c (yarrow_key_event_estimate): Check if
8742 (yarrow_key_event_init): Initialize previous to zero.
8744 * yarrow256.c: Added debug some output.
8746 * testsuite/yarrow-test.c (main): Better output of entropy
8747 estimates at the end.
8749 2001-10-09 Niels Möller <nisse@ehand.com>
8751 * testsuite/Makefile.am (TS_PROGS): Added yarrow-test.
8753 * testsuite/yarrow-test.c: New file.
8755 * yarrow256.c (yarrow256_init): Initialize the sources.
8756 (yarrow256_random): Fixed loop condition.
8758 * yarrow.h (YARROW_KEY_EVENT_BUFFER): New constant.
8760 * yarrow_key_event.c: New file.
8762 * Makefile.am (libnettle_a_SOURCES): Added yarrow_key_event.c.
8764 2001-10-08 Niels Möller <nisse@cuckoo.hack.org>
8766 * yarrow.h (struct yarrow_key_event_ctx): New struct.
8768 * yarrow256.c (yarrow_fast_reseed): Generate two block of output
8769 using the old key and feed into the pool.
8771 * yarrow.h (struct yarrow256_ctx): Deleted buffer, index and
8774 * yarrow256.c (yarrow_fast_reseed): New function.
8775 (yarrow_slow_reseed): New function.
8776 (yarrow256_update): Check seed/reseed thresholds.
8777 (yarrow_gate): New function, extracted from
8778 yarrow_generate_block_with_gate which was deleted.
8779 (yarrow_generate_block_with_gate): Deleted function.
8780 (yarrow256_random): Don't buffer any output, instead gate after
8782 (YARROW_GATE_THRESHOLD): Deleted constant.
8784 2001-10-07 Niels Möller <nisse@cuckoo.hack.org>
8786 * Makefile.am: Added yarrow files.
8788 * yarrow256.c: New file, implementing Yarrow. Work in progress.
8790 * sha256.c: New file, implementing sha256.
8792 * testsuite/Makefile.am (CFLAGS): Added sha256-test.
8794 * testsuite/sha256-test.m4: New testcases for sha256.
8796 * shadata.c: New file, for generating sha256 constants.
8798 * sha.h: Renamed sha1.h to sha.h, and added declarations for
8801 2001-10-05 Niels Möller <nisse@ehand.com>
8803 * testsuite/aes-test.m4: Added a comment with NIST test vectors.
8805 2001-10-04 Niels Möller <nisse@ehand.com>
8807 * rsa.h, rsa-compat.h, yarrow.h: New files.
8809 2001-09-25 Niels Möller <nisse@cuckoo.hack.org>
8811 * Released version 1.0.
8813 2001-09-25 Niels Möller <nisse@ehand.com>
8815 * sha1.c: Include stdlib.h, for abort.
8817 * md5.c: Include string.h, for memcpy.
8819 * testsuite/Makefile.am (M4_FILES): New variable. Explicitly list
8820 those C source files that should be generated by m4.
8822 * configure.in: Changed package name from "libnettle" to "nettle".
8824 * Makefile.am (EXTRA_DIST): Added .bootstrap.
8826 * AUTHORS: Added a reference to the manual.
8828 2001-09-25 Niels Möller <nisse@lysator.liu.se>
8830 * des-compat.c (des_cbc_cksum): Bug fix, local variable was
8831 declared in the middle of a block.
8833 2001-09-19 Niels Möller <nisse@cuckoo.hack.org>
8835 * nettle.texinfo (Compatibility functions): New section,
8836 mentioning md5-compat.h and des-compat.h.
8838 2001-09-18 Niels Möller <nisse@ehand.com>
8840 * index.html: New file.
8842 2001-09-16 Niels Möller <nisse@cuckoo.hack.org>
8844 * nettle.texinfo: Added description of des3. Minor fixes.
8846 * testsuite/des-compat-test.c (cbc_data): Shorten to 32 bytes (4
8847 blocks), the last block of zeroes wasn't used anyway.
8849 * des-compat.c (des_compat_des3_decrypt): Decrypt in the right
8851 (des_ncbc_encrypt): Bug fixed.
8852 (des_cbc_encrypt): Rewritten as a wrapper around des_ncbc_encrypt.
8854 2001-09-14 Niels Möller <nisse@ehand.com>
8856 * testsuite/des-compat-test.c: New file, copied from libdes
8857 (freeswan). All implemented functions but des_cbc_cksum seems to
8860 * testsuite/Makefile.am (TS_PROGS): Added des-compat-test.
8862 * des-compat.c: Added libdes typedef:s. Had to remove all use of
8863 const in the process.
8864 (des_check_key): New global variable, checked by des_set_key.
8866 * des.c (des_set_key): Go on and expand the key even if it is
8869 * des-compat.c (des_cbc_cksum): Implemented.
8870 (des_key_sched): Fixed return values.
8872 2001-09-11 Niels Möller <nisse@cuckoo.hack.org>
8874 * Makefile.am: Added des-compat.c and des-compat.h
8876 * des-compat.c: Bugfixes, more functions implemented.
8878 * des-compat.h: Define DES_ENCRYPT and DES_DECRYPT. Bugfixes.
8880 2001-09-10 Niels Möller <nisse@ehand.com>
8882 * nettle.texinfo (Copyright): Added copyright information for
8884 (Miscellaneous functions): Started writing documentation on the CBC
8886 (Cipher Block Chaining): This section more or less complete now.
8888 2001-09-09 Niels Möller <nisse@cuckoo.hack.org>
8890 * testsuite/cbc-test.m4: Record intermediate values in a comment.
8891 * testsuite/des3-test.m4: Likewise.
8893 * testsuite/aes-test.m4: Added test case that appeared broken in
8896 * cbc.c (cbc_encrypt): Bug fix, encrypt block *after* XOR:ing the
8899 * Makefile.am (libnettleinclude_HEADERS): Added cbc.h. Deleted
8901 (libnettle_a_SOURCES): Added des3.c.
8903 * testsuite/Makefile.am (TS_PROGS): Added des3-test and cbc-test.
8905 * testsuite/cbc-test.m4: New testcase.
8907 * testsuite/des3-test.m4: New testcase.
8909 * cbc.h (CBC_CTX): New macro.
8910 (CBC_ENCRYPT): New macro.
8911 (CBC_DECRYPT): New macro.
8913 * des.c (des_fix_parity): New function.
8915 * des3.c: New file, implementing triple des.
8917 2001-09-06 Niels Möller <nisse@cuckoo.hack.org>
8919 * cbc.c, cbc.h: New files, for general CBC encryption.
8921 * des-compat.h: Added some prototypes.
8923 2001-09-05 Niels Möller <nisse@ehand.com>
8925 * testsuite/Makefile.am (TS_PROGS): Added md5-compat-test.
8927 * README: Copied introduction from the manual.
8929 * configure.in: Bumped version to 1.0.
8931 * Makefile.am (libnettleinclude_HEADERS): Added missing includes.
8932 (libnettle_a_SOURCES): Added md5-compat.c and md5-compat.h.
8934 * md5-compat.c, md5-compat.h: New files, implementing an RFC
8935 1321-style interface.
8937 2001-09-02 Niels Möller <nisse@cuckoo.hack.org>
8939 * twofish.c (twofish_decrypt): Fixed for();-bug in the block-loop.
8940 Spotted by Jean-Pierre.
8941 (twofish_encrypt): Likewise.
8943 2001-07-03 Niels Möller <nisse@ehand.com>
8945 * testsuite/testutils.c: Include string.h.
8947 * twofish.c: Include string.h.
8949 2001-06-17 Niels Möller <nisse@lysator.liu.se>
8951 * Makefile.am (des_headers): Dont use $(srcdir)/-prefixes as that
8952 seems to break with GNU make 3.79.1.
8954 * testsuite/testutils.c, testsuite/testutils.h: Use <inttypes.h>,
8958 2001-06-17 Niels Möller <nisse@cuckoo.hack.org>
8960 * Use <inttypes.h>, not <stdint.h>.
8962 * blowfish.h (BLOWFISH_MAX_KEY_SIZE): Fixed, should be 56.
8964 * Fixed copyright notices.
8966 * Makefile.am (libnettle_a_SOURCES): Added desinfo.h and
8968 (info_TEXINFOS): Added manual.
8969 (EXTRA_DIST): Added nettle.html.
8970 (%.html): Added rule for building nettle.html.
8972 * nettle.texinfo: New manual.
8974 * configure.in: Bumped version to 0.2.
8976 * testsuite/Makefile.am (TS_PROGS): Added cast128 test.
8980 * testsuite/serpent-test.m4: Added a few rudimentary tests
8981 extracted from the serpent package.
8983 * twofish.c: Adapted to nettle. Made constant tables const.
8984 Deleted bytes_to_word and word_to_bytes; use LE_READ_UINT32 and
8985 LE_WRITE_UINT32 instead.
8986 (twofish_selftest): Deleted. Moved the tests to the external
8988 (twofish_set_key): Don't silently truncate too large keys.
8990 * sha1.c (sha1_update): Use unsigned for length.
8992 * serpent.c (serpent_set_key): Read the key backwards. Fixed
8993 padding (but there are no test vectors for key_size not a multiple
8995 (serpent_encrypt): Read and write data in the strange order used
8996 by the reference implementation.
8997 (serpent_decrypt): Likewise.
8999 * macros.h (FOR_BLOCKS): New macro, taken from lsh.
9001 * blowfish.h (struct blowfish_ctx): Use a two-dimensional array
9004 * blowfish.c (initial_ctx): Arrange constants into a struct, to
9006 (F): Deleted all but one definitions of the F function/macro.
9007 Added a context argument, and use that to find the subkeys.
9008 (R): Added context argument, and use that to find the subkeys.
9009 (blowfish_set_key): Some simplification.
9011 (encrypt): Deleted code for non-standard number of rounds. Deleted
9012 a bunch of local variables. Using the context pointer for
9013 everything should consume less registers.
9014 (decrypt): Likewise.
9016 * Makefile.am (libnettle_a_SOURCES): Added twofish.
9018 2001-06-16 Niels Möller <nisse@cuckoo.hack.org>
9020 * testsuite/blowfish-test.m4: Fixed test.
9022 * Added twofish implementation.
9024 * blowfish.h (struct blowfish_ctx): Use the correct size for the p
9027 2001-06-15 Niels Möller <nisse@ehand.com>
9029 * testsuite/blowfish-test.m4: Fixed testcase, use correct key
9032 * Makefile.am (libnettle_a_SOURCES): Added blowfish files.
9033 ($(des_headers)): Strip directory part when passing file name to
9036 * testsuite/blowfish-test.m4: Added one test, from GNUPG.
9038 * Created blowfish.c and blowfish.h (from GNUPG via LSH). Needs
9041 * aes.h: Fixed copyright notice to not mention GNU MP. XXX: Review
9042 all nettle copyrights.
9044 * testsuite/Makefile.am (TS_PROGS): Added tests for twofish and
9047 2001-06-13 Niels Möller <nisse@ehand.com>
9049 * Makefile.am (libnettle_a_SOURCES): Added serpent files.
9051 2001-06-12 Niels Möller <nisse@cuckoo.hack.org>
9053 * des.c (des_encrypt, des_decrypt): Assert that the key setup was
9056 * testsuite/Makefile.am (TS_PROGS): Added tests for des and sha1.
9058 * testsuite/sha1-test.m4: New file.
9060 * testsuite/des-test.m4: New file.
9064 * Added desCore files.
9066 * Makefile.am: Added desCore and sha1.
9068 2001-04-17 Niels Möller <nisse@cuckoo.hack.org>
9070 * install-sh: Copied the standard install script.
9072 * testsuite/Makefile.am (CFLAGS): Disable optimization. Add
9073 $(top_srcdir) to the include path.
9074 (EXTRA_DIST): Added testutils.h, testutils.c and run-tests.
9075 (run-tests): Fixed path to run-tests.
9077 * Makefile.am (EXTRA_DIST): Added memxor.h.
9078 (libnettleinclude_HEADERS): Install headers in
9079 $(libnettleincludedir).
9081 2001-04-13 Niels Möller <nisse@cuckoo.hack.org>