1 2014-08-19 Niels Möller <nisse@lysator.liu.se>
3 * examples/ecc-benchmark.c (bench_curve): Support benchmarking of
4 curve25519, for now handled as a special case.
5 (curves): Added nettle_curve25519.
6 (bench_dup_eh, bench_add_eh, bench_add_ehh, bench_mul_g_eh): New
9 2014-08-18 Niels Möller <nisse@lysator.liu.se>
11 * testsuite/curve25519-dh-test.c (test_a): Use curve25519_mul.
12 (test_main): Use little-endian inputs for test_a.
13 (curve25519_sqrt, curve_25519): Deleted static helper functions,
16 * curve25519-mul.c (curve25519_mul): New file and function.
17 * curve25519.h (curve25519_mul): Declare it.
18 * Makefile.in (hogweed_SOURCES): Added curve25519-mul.c.
20 * curve25519-mul-g.c (curve25519_mul_g): Renamed file and
21 function, updated callers.
22 * curve25519-base.c (curve25519_base): ... old names.
23 * Makefile.in (hogweed_SOURCES): Updated for rename.
25 * eccdata.c (output_curve): Compute constants needed for
27 * ecc-25519.c (ecc_modp_powm_2kp1, ecc_25519_sqrt): New functions.
28 * ecc-internal.h (ecc_25519_sqrt): Declare it.
30 2014-08-06 Niels Möller <nisse@lysator.liu.se>
32 * testsuite/curve25519-dh-test.c (test_g): Use curve25519_base.
33 (test_main): Use little-endian inputs for test_g.
35 * curve25519-base.c (curve25519_base): New file, new function.
36 Analogous to NaCl's crypto_scalarmult_base.
37 * curve25519.h: New file.
38 * Makefile.in (hogweed_SOURCES): Added curve25519-base.c.
39 (HEADERS): Added curve25519.h.
41 * gmp-glue.c (mpn_set_base256_le, mpn_get_base256_le): New functions.
42 * gmp-glue.h: Declare them.
44 2014-08-02 Niels Möller <nisse@lysator.liu.se>
46 * testsuite/curve25519-dh-test.c (curve25519_sqrt): Fixed memory
47 leak, a mpz_clear call was missing.
49 * ecc-internal.h (ECC_MUL_A_EH_WBITS): Set to 4, to enable
50 window-based scalar multiplication.
52 * ecc-mul-a-eh.c (table_init) [ECC_MUL_A_EH_WBITS > 0]: Fixed
53 initialization of TABLE(1).
55 2014-07-29 Niels Möller <nisse@lysator.liu.se>
57 * ecc-internal.h (ECC_MUL_A_EH_WBITS): New constant.
58 (ECC_A_TO_EH_ITCH, ECC_MUL_A_EH_ITCH): New macros.
59 * ecc-a-to-eh.c (ecc_a_to_eh, ecc_a_to_eh_itch): New file, new
61 * ecc-mul-a-eh.c: New file.
62 (ecc_mul_a_eh): New function. The case [ECC_MUL_A_EH_WBITS > 0]
64 (ecc_mul_a_eh_itch): New function.
65 * ecc.h: Declare new functions.
66 * Makefile.in (hogweed_SOURCES): Added ecc-a-to-eh.c and
69 * testsuite/curve25519-dh-test.c (curve25519_sqrt): New function.
70 (curve_25519): Use ecc_mul_a_eh.
71 (test_a): New function.
72 (test_main): Test construction of shared secret, using scalar
73 multiplication with points other than the fix generator.
75 2014-07-26 Niels Möller <nisse@lysator.liu.se>
77 * ecc-add-ehh.c (ecc_add_ehh): Reduce scratch need.
78 * ecc-internal.h (ECC_ADD_EHH_ITCH): Reduced to 7*size.
80 2014-07-23 Niels Möller <nisse@lysator.liu.se>
82 * testsuite/curve25519-dh-test.c: New test case, based on
83 draft-josefsson-tls-curve25519-05 test vectors.
84 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added curve25519-dh-test.c.
86 2014-07-18 Niels Möller <nisse@lysator.liu.se>
88 * ecc-mul-g-eh.c (ecc_mul_g_eh, ecc_mul_g_eh_itch): New file and
90 * ecc.h (ecc_mul_g_eh_itch): Declare new functions.
91 * ecc-internal.h (ECC_MUL_G_EH_ITCH): New macro.
92 * Makefile.in (hogweed_SOURCES): Added ecc-mul-g-eh.c.
94 2014-07-17 Niels Möller <nisse@lysator.liu.se>
96 * ecc-add-eh.c (ecc_add_eh): Reduce scratch need.
97 * ecc-internal.h (ECC_ADD_EH_ITCH): Reduced to 6*size.
99 * testsuite/curve25519-dup-test.c (test_main): Free allocated
102 2014-07-15 Niels Möller <nisse@lysator.liu.se>
104 * ecc-add-eh.c (ecc_add_eh, ecc_add_eh_itch): New file, new
106 * ecc.h: Declare new functions.
107 * ecc-internal.h (ECC_ADD_EH_ITCH): New macro.
108 * Makefile.in (hogweed_SOURCES): Added ecc-add-eh.c.
109 * testsuite/curve25519-add-test.c (test_main): Test ecc_add_eh.
110 Additional test for g2+g2. Free allocated storage.
112 2014-07-14 Niels Möller <nisse@lysator.liu.se>
114 * testsuite/curve25519-add-test.c: New test case.
115 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
116 curve25519-add-test.c.
118 * ecc-add-ehh.c (ecc_add_ehh, ecc_add_ehh_itch): New file, new
120 * ecc.h (ecc_add_ehh, ecc_add_ehh_itch): Declare them.
121 * ecc-internal.h (ECC_ADD_EHH_ITCH): New macro.
122 * Makefile.in (hogweed_SOURCES): Added ecc-add-ehh.c.
124 * ecc-25519.c (nettle_curve25519): Use ecc_d instead of ecc_b.
126 * eccdata.c: For curve25519, output the Edwards curve constant,
127 ecc_d = (121665/121666) mod p.
129 * testsuite/curve25519-dup-test.c (test_main): Add test for 4g.
130 Delete some left-over debug output.
132 2014-07-11 Niels Möller <nisse@lysator.liu.se>
134 * misc/ecc-formulas.tex: Some ECC notes.
136 * testsuite/curve25519-dup-test.c: New testcase.
137 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
138 curve25519-dup-test.c.
140 * testsuite/testutils.c (test_ecc_point): Made non-static.
141 * testsuite/testutils.h (struct ecc_ref_point): Moved here, from
143 (test_ecc_point): Declare it.
145 * ecc-dup-eh.c (ecc_dup_eh, ecc_dup_eh_itch): New file, new functions.
146 * ecc-eh-to-a.c (ecc_eh_to_a, ecc_eh_to_a_itch): New file, new
148 * ecc.h: Declare new functions.
149 * ecc-internal.h (ECC_EH_TO_A_ITCH, ECC_DUP_EH_ITCH): New macros.
150 * Makefile.in (hogweed_SOURCES): Added ecc-dup-eh.c and
153 * ecc-internal.h (struct ecc_curve): New constant edwards_root.
154 * ecc-192.c (nettle_secp_192r1): Updated accordingly, additional
156 * ecc-224.c (nettle_secp_224r1): Likewise.
157 * ecc-256.c (nettle_secp_256r1): Likewise.
158 * ecc-384.c (nettle_secp_384r1): Likewise.
159 * ecc-521.c (nettle_secp_521r1): Likewise.
160 * ecc-25519.c (nettle_curve25519): Initialize new constant.
162 * eccdata.c (ecc_curve_init): For curve 25519, use correct
163 constant for edwards coordinate transform, and output the constant
166 2014-07-06 Niels Möller <nisse@lysator.liu.se>
168 * eccdata.c: Use separate is_zero flag to represent the neutral
170 (output_point, output_point_redc): Unified to a single function,
171 with a use_redc flag argument. Also support conversion to Edwards
173 (ecc_curve_init_str): New argument for Edwards curve conversion
176 2014-07-04 Niels Möller <nisse@lysator.liu.se>
178 * ecc-25519.c: New file.
179 (ecc_25519_modp): New function.
180 (nettle_curve25519): New curve.
182 * ecc-curve.h (nettle_curve25519): Declare it.
184 * Makefile.in (hogweed_SOURCES): Added ecc-25519.c.
185 (ecc-25519.h): New generated file. Add as explicit dependency for
188 * testsuite/ecc-mod-test.c (test_curve): New function, extracted
189 from test_main. Tolerate NULL modq function pointer.
190 (test_main): Use test_curve, iterate over supported curves, and
191 also test curve_25519 for the new modp function.
193 2014-07-02 Niels Möller <nisse@lysator.liu.se>
195 * eccdata.c (ecc_dup): Use mpz_submul_ui, now available in
197 (ecc_type): New enum, for Weierstrass and Montgomery curves
198 (ecc_curve): New field type.
199 (ecc_dup): Support montgomery curves.
201 (ecc_curve_init_str): New argument, for the curve type.
202 (ecc_curve_init): Pass curve type to all ecc_curve_init_str calls.
203 Recognize curve25519, for bit_size 255.
204 (output_modulo): Deleted assert, which isn't true for curve25519.
206 2014-06-30 Niels Möller <nisse@lysator.liu.se>
208 * camellia-absorb.c: Include <limits.h>, needed for correct use of
209 HAVE_NATIVE_64_BIT. Reported and debugged by Magnus Holmgren.
210 Fixes debian build failure on s390x.
212 2014-06-26 Niels Möller <nisse@lysator.liu.se>
215 * configure.ac (IF_NOT_SHARED): New substituted variable.
216 * hogweed.pc.in: Use @LIBS@, instead of hardcoding -lgmp. When
217 shared libraries are disabled, move needed libraries from
218 Requires.private: to Requires: and from Libs.private: to Libs:.
220 From Nikos Mavrogiannopoulos.
221 * examples/hogweed-benchmark.c (bench_alg): Tolerate alg->init
223 (bench_openssl_ecdsa_init): Return NULL if
224 EC_KEY_new_by_curve_name fails, indicating the curve is not
227 2014-06-25 Niels Möller <nisse@lysator.liu.se>
229 Support for building with mini-gmp instead of the real GMP. Loosely
230 based on work by Nikos Mavrogiannopoulos.
231 * configure.ac: New command line option --enable-mini-gmp. Also
232 disable all libgmp-related checks when enabled.
233 (NETTLE_USE_MINI_GMP): New substituted variable.
234 (LIBHOGWEED_LIBS): Use $(LIBS) instead of -lgmp.
235 (IF_MINI_GMP): New Makefile conditional.
236 (GMP_NUMB_BITS): Alternative test for the mini-gmp case.
237 Substituted also in bignum.h.
238 (HAVE_MPZ_POWM_SEC): Drop this unused check.
240 * bignum.h: Renamed, to...
241 * bignum.h.in: New name.
242 (NETTLE_USE_MINI_GMP): Substituted by configure.
243 (GMP_NUMB_BITS): Substituted by configure, for the mini-gmp case.
245 * Makefile.in (OPT_HOGWEED_SOURCES): New variable, value
246 conditional on @IF_MINI_GMP@.
247 (hogweed_SOURCES): Add $(OPT_HOGWEED_SOURCES).
248 (PRE_CPPFLAGS): Add -I$(srcdir).
249 (HEADERS): Delete bignum.h.
250 (INSTALL_HEADERS): Add bignum.h. Also add mini-gmp.h, if mini-gmp
252 (DISTFILES): Added bignum.h.in.
253 (bignum.h): New target.
254 (distclean-here): Delete bignum.h.
256 * examples/ecc-benchmark.c (modinv_gcd) [NETTLE_USE_MINI_GMP]:
257 Disable this benchmark.
258 (mpn_random) [NETTLE_USE_MINI_GMP]: Provide a simple implementation.
260 * testsuite/ecc-mod-test.c [NETTLE_USE_MINI_GMP]: Skip test, it
261 depends on gmp_randstate_t.
262 * testsuite/ecc-modinv-test.c [NETTLE_USE_MINI_GMP]: Likewise.
263 * testsuite/ecc-mul-a-test.c [NETTLE_USE_MINI_GMP]: Likewise.
264 * testsuite/ecc-mul-g-test.c [NETTLE_USE_MINI_GMP]: Likewise.
265 * testsuite/ecc-redc-test.c [NETTLE_USE_MINI_GMP]: Likewise.
267 Various preparations for mini-gmp support.
268 * testsuite/bignum-test.c: Use WITH_HOGWEED instead of HAVE_LIBGMP
269 for preprocessor conditionals.
270 * testsuite/testutils.h: Likewise.
271 * testsuite/sexp-format-test.c: Likewise.
273 * testsuite/ecdsa-keygen-test.c (test_main): Use printf,
274 mpz_out_str and write_mpn instead of gmp_fprintf.
275 * testsuite/ecdsa-sign-test.c (test_ecdsa): Likewise.
276 * testsuite/ecdsa-verify-test.c (test_ecdsa): Likewise.
278 * dsa.h: Include bignum.h instead of gmp.h.
279 * ecc-internal.h: Likewise.
281 * gmp-glue.h: Likewise.
285 * testsuite/testutils.c (die): Use plain vfprintf, not
287 (write_mpn): New function.
288 (test_ecc_point): Use it, replacing gmp_fprintf.
289 * testsuite/testutils.h (write_mpn): Declare it.
291 * der-iterator.c: Deleted HAVE_LIBGMP conditionals.
293 2014-06-07 Niels Möller <nisse@lysator.liu.se>
295 * Released nettle-3.0
297 2014-06-04 Niels Möller <nisse@lysator.liu.se>
299 * NEWS: List des-compat.h as a candidate for removal in the next
302 * testsuite/des-compat-test.c (test_main): Fixed out of bounds
303 memory read, reported by Nikos Mavrogiannopoulos.
305 * nettle-write.h: Include <stddef.h>, fixing compilation on
308 * aclocal.m4 (ac_stdint): Fixed "unsinged" typo, spotted by Andy
311 2014-06-01 Niels Möller <nisse@lysator.liu.se>
313 * x86_64/gcm-hash8.asm: Pass correct argument count to W64_EXIT.
314 * x86_64/camellia-crypt-internal.asm: Pass correct argument count
315 to W64_ENTRY and W64_EXIT.
317 * x86_64/machine.m4 [W64_ABI]: Fix for the case of 6 function
318 arguments. Also push %rdi unconditionally, and use aligned
319 accesses for save and restore %xmm registers (movdqa).
321 2014-05-31 Niels Möller <nisse@lysator.liu.se>
323 * configure.ac: Check for COFF type directives.
324 (ASM_COFF_STYLE): New substituted variable.
325 * config.m4.in: Set COFF_STYLE from configure.
326 * asm.m4 (PROLOGUE): Use COFF type directive, if enabled by
327 configure. Fixes problem with windows dll linking.
329 * asm.m4: Deleted unused offsets for struct aes_ctx.
331 2014-05-28 Niels Möller <nisse@lysator.liu.se>
333 * testsuite/nettle-pbkdf2-test: Delete carriage return characters
336 * configure.ac (LIBHOGWEED_LIBS): Be explicit and link
337 libhogweed.so with libnettle.so, not -lnettle.
338 (LIBHOGWEED_LINK): Drop -L. flag, no longer needed, and previously
339 not at the correct position in the link command line.
341 2014-05-27 Niels Möller <nisse@lysator.liu.se>
343 * examples/ecc-benchmark.c: If mpn_sec_powm is available,
344 benchmark it, for modinv.
345 (bench_modinv_powm): New function.
346 (bench_curve): Use it.
348 2014-05-22 Niels Möller <nisse@lysator.liu.se>
351 * Makefile.in ($(des_headers)): Use the EXEEXT_FOR_BUILD.
353 2014-05-15 Niels Möller <nisse@lysator.liu.se>
355 * NEWS: Updated with library version numbers.
357 * configure.ac (dummy-dep-files): Use simpler and more portable
358 sed expression. Problem reported by Peter Eriksson.
359 (LIBHOGWEED_MAJOR): Bumped shared library version to 3.0.
360 (LIBHOGWEED_MINOR): Reset to zero. Also increased the package
361 version number to 3.0.
363 * getopt.c: Don't use gettext.
365 2014-05-14 Niels Möller <nisse@lysator.liu.se>
367 * testsuite/nettle-pbkdf2-test: Avoid the bash construction
370 * getopt.c: Copied from glibc tree, tag glibc-2.19.
371 * getopt.h: Likewise.
372 * getopt1.c: Likewise.
373 * getopt_int.h: New file, also copied from glibc.
374 * Makefile.in (DISTFILES): Added getopt_int.h.
376 2014-05-09 Niels Möller <nisse@lysator.liu.se>
378 * mini-gmp.c: Updated, use version from gmp-6.0.0.
379 * mini-gmp.h: Likewise.
381 * testsuite/Makefile.in (all): Drop dependency on $(TARGETS), to
382 delay building of test programs until make check.
384 2014-05-08 Niels Möller <nisse@lysator.liu.se>
386 * nettle.texinfo (nettle_aead abstraction): Document nettle_aead.
388 * Makefile.in (nettle_SOURCES): Added nettle-meta-aeads.c.
389 * nettle-meta.h (nettle_aeads): Declare array.
390 * nettle-meta-aeads.c (nettle_aeads): New file, new array.
391 * testsuite/meta-aead-test.c: New test case.
392 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
395 * aclocal.m4 (GMP_PROG_CC_FOR_BUILD): If CC_FOR_BUILD is gcc, add
396 -O option. This makes eccdata twice as fast.
398 2014-05-06 Niels Möller <nisse@lysator.liu.se>
400 * nettle.texinfo: Document SHA3 and ChaCha-Poly1305 as
403 2014-05-05 Niels Möller <nisse@lysator.liu.se>
405 * nettle.texinfo (POLY1305): Document poly1305-aes.
406 (Authenticated encryption): Move AEAD algorithms to their own
408 (RSA, DSA, ECDSA): Change some subsections to subsubsections.
409 (ChaCha-Poly1305): Document ChaCha-Poly1305.
411 2014-05-04 Niels Möller <nisse@lysator.liu.se>
413 * nettle.texinfo (DSA): Document new DSA interface.
414 (Salsa20): Update salsa20 docs.
415 (ChaCha): Document ChaCha.
417 2014-05-03 Niels Möller <nisse@lysator.liu.se>
419 * configure.ac: Check for SIZEOF_SIZE_T.
420 * ccm.c (ccm_set_nonce): Skip code for 64-bit encoding when size_t
423 * nettle.texinfo (CCM): Document new ccm macros and constants.
424 Describe ccm restrictions.
426 * ccm.h (CCM_DIGEST_SIZE): New constant.
428 2014-04-30 Niels Möller <nisse@lysator.liu.se>
430 * ccm.c (CCM_IV_MAX_SIZE, CCM_IV_MIN_SIZE): Deleted, replaced by
431 public constants CCM_MIN_NONCE_SIZE and CCM_MAX_NONCE_SIZE.
432 (ccm_build_iv): Updated for above rename.
433 (CCM_L_MAX_SIZE): Deleted, no longer used.
435 * ccm.h (CCM_MIN_NONCE_SIZE, CCM_MAX_NONCE_SIZE): New constants.
436 (CCM_MAX_MSG_SIZE): New macro.
438 2014-04-27 Niels Möller <nisse@lysator.liu.se>
440 * nettle.texinfo (Cipher modes): Subsection on AEAD constructions.
441 (GCM): Update GCM documentation, including functions for
442 gcm_aes128, gcm_camellia128, ...
444 2014-04-26 Niels Möller <nisse@lysator.liu.se>
446 * nettle.texinfo: Update for introduction of nettle_cipher_func.
447 (GCM): Document GCM_DIGEST_SIZE.
448 (UMAC): Document new UMAC constants.
449 (Keyed hash functions): Make HMAC and UMAC their own info nodes.
452 * umac.h (UMAC_MIN_NONCE_SIZE, UMAC_MAX_NONCE_SIZE): New
455 2014-04-25 Niels Möller <nisse@lysator.liu.se>
457 * All hash-related files: Renamed all _DATA_SIZE constants to
458 _BLOCK_SIZE, for consistency. Old names kept for backwards
461 * nettle.texinfo (CCM): Documentation for CCM mode, contributed by
464 * testsuite/ccm-test.c (test_cipher_ccm): And tests.
466 * ccm.c (ccm_decrypt_message): Change length argument, should now
467 be clear text (dst) length.
468 * ccm-aes128.c (ccm_aes128_decrypt_message): Likewise.
469 * ccm-aes192.c (ccm_aes192_decrypt_message): Likewise.
470 * ccm-aes256.c (ccm_aes256_decrypt_message): Likewise.
471 * ccm.h: Updated prototypes.
473 2014-04-22 Niels Möller <nisse@lysator.liu.se>
475 * nettle.texinfo (Recommended hash functions): Document additional
478 * sha2.h (sha512_224_ctx, sha512_256_ctx): New aliases for the
479 sha512_ctx struct tag.
481 2014-04-17 Niels Möller <nisse@lysator.liu.se>
483 * examples/Makefile.in (SOURCES): Deleted next-prime.c (forgotten
484 in 2014-04-13 change).
486 2014-04-16 Niels Möller <nisse@lysator.liu.se>
488 * testsuite/ccm-test.c (test_cipher_ccm): Deleted check for NULL
491 * sha3-224.c (sha3_224_init): Pass pointer to context struct, not
492 pointer to first element, to memset.
493 * sha3-256.c (sha3_256_init): Likewise.
494 * sha3-384.c (sha3_384_init): Likewise.
495 * sha3-512.c (sha3_512_init): Likewise.
497 * examples/eratosthenes.c (vector_alloc): Use sizeof(*vector)
498 instead of explicit type in malloc call.
499 (vector_init): Make constant explicitly unsigned long.
501 * tools/input.c (sexp_get_quoted_char): Deleted useless for loop.
503 2014-04-13 Niels Möller <nisse@lysator.liu.se>
505 * rsa-compat.c: Deleted file.
506 * rsa-compat.h: Deleted file.
507 * Makefile.in (hogweed_SOURCES): Deleted rsa-compat.c.
508 (HEADERS): Deleted rsa-compat.h.
510 * examples/next-prime.c: Deleted file.
511 * bignum-next-prime.c (nettle_next_prime): Deleted file and
513 * prime-list.h: Deleted file.
514 * bignum.h (nettle_next_prime): Deleted prototype.
515 * Makefile.in (hogweed_SOURCES): Deleted bignum-next-prime.c.
516 (DISTFILES): Deleted prime-list.h.
517 * examples/Makefile.in (HOGWEED_TARGETS): Deleted next-prime, and
518 corresponding make target.
520 2014-04-12 Niels Möller <nisse@lysator.liu.se>
522 * nettle.texinfo (Copyright): Updated licensing info.
525 * Makefile.in (DISTFILES): Distribute new COPYING* files.
527 * COPYING.LESSERv3: New file.
528 * COPYINGv3: New file.
529 * COPYING.LIB: Deleted.
530 * COPYINGv2: New name for GPL version 2 file.
531 * COPYING: Old name, deleted.
533 * Update license headers for LGPL3+ and GPL2+ dual licensing.
535 2014-04-11 Niels Möller <nisse@lysator.liu.se>
537 * testsuite/testutils.c (test_aead): Use aead->digest_size.
539 * configure.ac: Skip GMP tests if public key support is disabled.
541 * eax.c (block16_xor): Fixed bug effecting 32-bit platforms.
543 * Makefile.in (DISTFILES): Deleted memxor.c, already included via
545 * tools/Makefile.in (SOURCES): Add nettle-pbkdf2.c.
547 2014-04-10 Niels Möller <nisse@lysator.liu.se>
549 From Nikos Mavrogiannopoulos:
550 * examples/hogweed-benchmark.c (bench_openssl_ecdsa_init): Support
551 for secp192r1 and secp256r1.
552 (alg_list): Add them.
554 2014-04-09 Niels Möller <nisse@lysator.liu.se>
556 * examples/nettle-benchmark.c (main): Benchmark sha512_224 and
559 * testsuite/sha512-224-test.c: New file.
560 * testsuite/sha512-256-test.c: New file.
561 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new files.
563 * nettle-meta.h (nettle_sha512_224, nettle_sha512_256): Declare.
564 * sha512-224-meta.c (nettle_sha512_224): New file, new nettle_hash.
565 * sha512-256-meta.c (nettle_sha512_256): New file, new nettle_hash.
567 * sha2.h (SHA512_224_DIGEST_SIZE, SHA512_224_DATA_SIZE)
568 (SHA512_256_DIGEST_SIZE, SHA512_256_DATA_SIZE): New constants.
570 * sha512.c (sha512_256_digest): Typo fix, call sha512_256_init.
572 * testsuite/testutils.c (test_hash): Removed redundant init call.
573 Tests that digest implies init.
575 2014-03-28 Niels Möller <nisse@lysator.liu.se>
577 * testsuite/dsa-keygen-test.c (test_main): Explicitly use
578 dsa_compat_generate_keypair.
579 (test_main): Test dsa_generate_params and dsa_generate_keypair
580 with a large q; p_bits = 1024, q_bits = 768.
582 * testsuite/testutils.h: Undo dsa-compat.h name mangling.
584 * dsa-keygen.c (dsa_generate_keypair): New interface, generating
585 only a keypair, and no new parameters.
586 * dsa-compat-keygen.c (dsa_compat_generate_keypair): New file.
587 Moved old key generation function here. Use dsa_generate_keypair.
589 2014-03-27 Niels Möller <nisse@lysator.liu.se>
591 * dsa-compat.c (dsa_public_key_init, dsa_public_key_clear)
592 (dsa_private_key_init, dsa_private_key_clear): : Move deprecated
593 DSA functions to a separate file...
594 * dsa.c: ...from here.
595 * dsa-compat.h: New file, declaring deprecated DSA interface.
596 Include in corresponding C files.
597 * Makefile.in (hogweed_SOURCES): Add dsa-compat.c.
598 (HEADERS): Add dsa-compat.h.
600 * dsa-gen-params.c (dsa_generate_params): New file and function,
601 extracted from DSA key generation.
602 * dsa-keygen.c (dsa_generate_keypair): Use dsa_generate_params.
604 2014-03-26 Niels Möller <nisse@lysator.liu.se>
606 * der2dsa.c (dsa_params_from_der_iterator): Converted to new DSA
607 interface. Allow q_size == 0, meaning any q < p is allowed.
608 Additional validity checks.
609 (dsa_public_key_from_der_iterator): Converted to new DSA
610 interface. Also check that the public value is in the correct
612 (dsa_openssl_private_key_from_der_iterator): Converted
613 to new DSA interface. Additional validity checks.
614 (dsa_openssl_private_key_from_der): Converted to new DSA
616 * tools/pkcs1-conv.c (convert_dsa_private_key): Update to use
617 struct dsa_params, and adapt to the der decoding changes.
618 (convert_public_key): Likewise.
620 * examples/hogweed-benchmark.c: Update dsa benchmarking to use new
623 * dsa.c (dsa_params_init, dsa_params_clear): New functions.
624 (dsa_public_key_init): Use dsa_params_init.
625 (dsa_public_key_clear): Use dsa_params_clear.
627 * sexp2dsa.c (dsa_keypair_from_sexp_alist): Converted to new DSA
628 interface. Allow q_size == 0, meaning any q < p is allowed.
629 Additional validity checks.
630 (dsa_sha1_keypair_from_sexp, dsa_sha256_keypair_from_sexp):
631 Converted to new DSA interface.
633 * dsa2sexp.c (dsa_keypair_to_sexp): Converted to new DSA
635 * tools/pkcs1-conv.c: Updated uses of dsa_keypair_to_sexp.
637 * dsa.h (struct dsa_params): New struct.
639 * dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
641 * dsa-verify.c (dsa_verify): Likewise.
642 * dsa-sha1-verify.c (dsa_sha1_verify_digest, dsa_sha1_verify): Use
643 dsa_verify, cast the struct dsa_public_key * input to a struct
645 * dsa-sha256-verify.c (dsa_sha256_verify_digest)
646 (dsa_sha256_verify): Likewise.
647 * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise
648 use dsa_sign, with a cast from struct dsa_public_key * to struct
650 * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
653 * testsuite/testutils.c (test_dsa_verify): Use struct dsa_params.
654 (test_dsa_key): Likewise.
655 * testsuite/dsa-test.c (test_main): Adapt to test_dsa_key and
656 test_dsa_verify changes.
657 * testsuite/dsa-keygen-test.c (test_main): Adapt to
660 * testsuite/testutils.c (test_dsa_sign): #if out, currently
663 2014-03-23 Niels Möller <nisse@lysator.liu.se>
668 * ccm-aes128.c: New file.
669 * ccm-aes192.c: New file.
670 * ccm-aes256.c: New file.
671 * Makefile.in (nettle_SOURCES): Added ccm source files.
672 (HEADERS): Added ccm.h.
673 * testsuite/ccm-test.c: New file.
674 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added ccm-test.c.
676 2014-03-20 Niels Möller <nisse@lysator.liu.se>
678 From Joachim Strömbergson:
679 * sha512.c (K): Indentation fix.
680 (sha512_224_init, sha512_224_digest, sha512_256_init)
681 (sha512_256_digest): New functions.
682 * sha2.h: Add prototypes.
683 (sha512_224_update, sha512_256_update): New aliases for
686 2014-03-18 Niels Möller <nisse@lysator.liu.se>
688 * examples/nettle-benchmark.c (main): Add benchmarking of arcfour,
689 salsa20 and chacha, via time_aead.
691 * nettle-internal.c (nettle_arcfour128): Define, as a struct
692 nettle_aead (with NULL set_nonce, update, and digest methods).
693 * examples/nettle-openssl.c (nettle_openssl_arcfour128): Likewise.
694 * nettle-internal.h (nettle_arcfour128)
695 (nettle_openssl_arcfour128): Declare.
697 * nettle-types.h (nettle_cipher_func): New typedef, similar to
698 nettle_crypt_func, but with a const context, intended for block
700 * nettle-meta.h (struct nettle_cipher): Use the nettle_cipher_func
702 * Many other files affected: aes*-meta.c, camellia*-meta.c,
703 cast128-meta.c, serpent-meta.c, twofish-meta.c, cbc.[ch],
704 ctr.[ch], ctr.[ch], des-compat.c, eax.[ch], gcm*.[ch],
705 nettle-internal.*, testsuite/aes-test.c,
706 examples/nettle-benchmark.c, examples/nettle-openssl.c.
708 2014-03-16 Niels Möller <nisse@lysator.liu.se>
710 * chacha-set-key.c: Include string.h.
712 * arcfour-meta.c: Deleted file.
713 * nettle-meta.h (nettle_arcfour128): Deleted declaration.
714 * nettle-meta-ciphers.c (nettle_ciphers): Deleted
715 nettle_arcfour128 from list.
716 * Makefile.in (nettle_SOURCES): Deleted arcfour-meta.c.
717 * examples/nettle-openssl.c (nettle_openssl_arcfour128): Deleted.
718 * testsuite/meta-cipher-test.c: Adjust test for removal of
721 2014-03-15 Niels Möller <nisse@lysator.liu.se>
723 * examples/nettle-benchmark.c (struct bench_aead_info): New
725 (bench_aead_crypt, bench_aead_update, init_nonce, time_aead): New
726 functions, for benchmarking aead algorithms.
727 (time_gcm, time_eax): Deleted functions.
728 (main): Use time_aead to benchmark gcm, eax and chacha-poly1305.
730 * salsa20.h (SALSA20_NONCE_SIZE): Renamed constant, old name
731 SALSA20_IV_SIZE kept as an alias.
732 (salsa20_set_nonce): Update prototype for the 2014-01-20 rename.
734 * Makefile.in (.asm.s): Add dependencies.
735 (.s.o, .s.po): Empty any dependency .d file.
737 2014-03-04 Niels Möller <nisse@lysator.liu.se>
739 * testsuite/chacha-test.c (test_main): Additional test cases, for
742 * Makefile.in (nettle_SOURCES): Deleted chacha128-set-key.c and
745 * chacha.h (CHACHA256_KEY_SIZE): Deleted.
746 (chacha_set_key): Updated prototype.
747 * chacha256-set-key.c (chacha256_set_key): Deleted file and
748 function, moved to...
749 * chacha-set-key.c (chacha_set_key): Do 256-bit keys only. Deleted
750 length argument. Updated all callers.
752 * chacha128-set-key.c (chacha128_set_key): Deleted file and
753 function. Support for 128-bit chacha keys may be reintroduced
754 later, if really needed.
755 * chacha.h: Deleted chacha128-related declarations.
756 * chacha-set-key.c (chacha_set_key): Drop support for 128-bit
758 * testsuite/chacha-test.c (test_main): #if:ed out all tests with
761 2014-02-16 Niels Möller <nisse@lysator.liu.se>
763 * gcm.h: Declarations for gcm-camellia256.
764 * gcm-camellia256.c: New file.
765 * gcm-camellia256-meta.c: New file.
766 * nettle-meta.h (nettle_gcm_camellia256): Declare.
767 * Makefile.in (nettle_SOURCES): Added gcm-camellia256.c and
768 gcm-camellia256-meta.c.
769 * testsuite/gcm-test.c (test_main): Test cases for
770 nettle_gcm_camellia256.
772 * gcm.h: Include camellia.h. Declarations for gcm-camellia128.
773 * gcm-camellia128.c: New file.
774 * gcm-camellia128-meta.c: New file.
775 * nettle-meta.h (nettle_gcm_camellia128): Declare.
776 * Makefile.in (nettle_SOURCES): Added gcm-camellia128.c and
777 gcm-camellia128-meta.c.
778 * testsuite/gcm-test.c (test_main): Test cases for
779 nettle_gcm_camellia128. From Nikos Mavrogiannopoulos.
781 2014-02-13 Niels Möller <nisse@lysator.liu.se>
783 * Makefile.in (nettle_SOURCES): Added eax-aes128.c
785 * examples/nettle-benchmark.c: Include eax.h.
786 * nettle-meta.h (nettle_eax_aes128): Declare, moved from
788 * eax.h: Declare eax_aes128_ctx and related functions. Moved from
790 (EAX_IV_SIZE): New constant.
791 * eax-aes128-meta.c (nettle_eax_aes128): Moved definition to new
793 * eax-aes128.c (eax_aes128_set_key, eax_aes128_set_nonce)
794 (eax_aes128_update, eax_aes128_encrypt, eax_aes128_decrypt)
795 (eax_aes128_digest): Moved functions to a new file.
796 * nettle-internal.c: ... from old location.
797 * nettle-internal.h: Moved eax declarations elsewhere.
799 * tools/nettle-pbkdf2.c (main): Added missing deallocation.
801 2014-02-12 Niels Möller <nisse@lysator.liu.se>
803 * chacha-poly1305.h: New file.
804 * chacha-poly1305.c: New file.
805 * chacha-poly1305-meta.c (nettle_chacha_poly1305): New file, new
807 * nettle-meta.h (nettle_chacha_poly1305): Declare.
809 * Makefile.in (nettle_SOURCES): Added chacha-poly1305.c and
810 chacha-poly1305-meta.c.
811 (HEADERS): Added chacha-poly1305.h.
813 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
814 chacha-poly1305-test.c.
815 * testsuite/chacha-poly1305-test.c: New file.
817 * nettle-meta.h (struct nettle_aead): New generalized version
819 (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256)
820 (nettle_eax_aes128): Declare, moved from nettle-internal.h.
821 * nettle-internal.h (struct nettle_aead): Deleted struct, moved to
822 nettle-meta.h. Deleted declarations of unused instances.
823 (_NETTLE_AEAD): Deleted macro.
824 * nettle-internal.c (nettle_eax_aes128): Updated for new
826 (nettle_gcm_aes128, nettle_gcm_aes192, nettle_gcm_aes256):
827 Deleted, moved to new files.
828 * gcm-aes128-meta.c (nettle_gcm_aes128): Moved to new file,
829 updated for new nettle_aead struct.
830 * gcm-aes192-meta.c (nettle_gcm_aes192): Likewise.
831 * gcm-aes256-meta.c (nettle_gcm_aes256): Likewise.
832 * testsuite/testutils.c (test_aead): Take alternative set_nonce
833 function as argument, and use it when nonce size differs from
835 * testsuite/testutils.h (test_aead): Updated prototype.
836 * testsuite/gcm-test.c (nettle_gcm_unified_aes128): Updated for
837 new nettle_aead struct.
838 (test_main): Pass additional argument to test_aead.
839 * testsuite/eax-test.c (test_main): Pass additional NULL argument
842 * eax.h (EAX_DIGEST_SIZE): New constant.
843 * gcm.h (GCM_DIGEST_SIZE): Likewise.
845 2014-02-10 Niels Möller <nisse@lysator.liu.se>
847 * chacha-set-nonce.c (chacha_set_nonce): Renamed file and
848 function, updated callers and Makefile.in.
849 * chacha-set-iv.c (chacha_set_iv): ... from old names.
851 2014-02-08 Niels Möller <nisse@lysator.liu.se>
853 * testsuite/chacha-test.c (test_chacha): For 20 rounds, use
854 chacha_crypt, and test varying the message length.
855 (test_main): Add second key stream block, for all testcases with
858 * chacha-crypt.c (chacha_crypt): Fixed block counter update.
860 2014-02-07 Niels Möller <nisse@lysator.liu.se>
862 * nettle.texinfo (ASCII encoding): Document that
863 base16_encode_update and base64_encode_update now uses dst_length
866 * testsuite/base64-test.c (test_main): Updated
867 base64_decode_update test case.
869 * sexp-transport.c (sexp_transport_iterator_first): For
870 base64_decode_update, omit initialization of coded_length.
871 * examples/base64dec.c (main): Likewise.
872 * examples/base16dec.c (main): Likewise, for base16_decode_update.
874 * base64-decode.c (base64_decode_update): Use *dst_length for
875 output only. Don't require callers to pass a sane value.
876 * base16-decode.c (base16_decode_update): Likewise.
878 2014-02-06 Niels Möller <nisse@lysator.liu.se>
880 * NEWS: List _set_key incompatibilities.
882 * nettle-meta.h (_NETTLE_CIPHER_SEP, _NETTLE_CIPHER_SEP_SET_KEY)
883 (_NETTLE_CIPHER_FIX, _NETTLE_CIPHER): Deleted unused macros.
885 * nettle-internal.c (nettle_blowfish128): Deleted only use of
888 * blowfish.c (blowfish128_set_key): New function.
889 * blowfish.h (BLOWFISH128_KEY_SIZE): New constant.
891 * cast128-meta.c (nettle_cast128): Deleted only use of
894 * examples/nettle-benchmark.c (time_cipher): Fixed memset calls.
896 2014-01-30 Niels Möller <nisse@lysator.liu.se>
898 * Makefile.in (nettle_SOURCES): Arrange in alphabetic order.
900 * nettle.texinfo: Updated, document size_t for length arguments.
901 Document new AES and Camellia interfaces.
903 * ecc-size.c (ecc_bit_size): New function.
904 * ecc.h (ecc_bit_size): Declare it.
906 2014-01-29 Niels Möller <nisse@lysator.liu.se>
908 * nettle-types.h (typedef nettle_set_key_func): Deleted length
911 * arctwo.c (arctwo40_set_key, arctwo64_set_key)
912 (arctwo128_set_key, arctwo128_set_key_gutmann): New functions.
913 * arctwo.h: Declare them.
914 * arctwo-meta.c (ARCTWO): New macro.
915 (nettle_arctwo40, nettle_arctwo64, nettle_arctwo128)
916 (nettle_arctwo_gutmann128): Use new _set_key functions.
918 * arcfour.h (ARCFOUR128_KEY_SIZE): New constant.
919 * arcfour.c (arcfour128_set_key): New function.
920 * arcfour-meta.c (nettle_arcfour128): Use arcfour128_set_key and
923 * cast128.c (cast5_set_key): Renamed, was cast128_set_key.
924 (cast128_set_key): New definition, with fixed key size.
925 * cast128.h (CAST128_MIN_KEY_SIZE, CAST128_MAX_KEY_SIZE): Renamed
927 (CAST5_MIN_KEY_SIZE, CAST5_MAX_KEY_SIZE): ... new names.
929 * eax.h (EAX_SET_KEY): Deleted length argument.
931 * aes128-meta.c: Deleted _set_key wrappers.
932 * aes192-meta.c: Likewise.
933 * aes256-meta.c: Likewise.
934 * camellia128-meta.c: Likewise.
935 * camellia192-meta.c: Likewise.
936 * camellia256-meta.c: Likewise.
938 * gcm-aes128.c (gcm_aes128_set_key): Deleted length argument.
939 * gcm-aes192.c (gcm_aes192_set_key): Likewise.
940 * gcm-aes256.c (gcm_aes256_set_key): Likewise.
941 * gcm.h: Updated prototypes.
943 * serpent-set-key.c (serpent128_set_key, serpent192_set_key)
944 (serpent256_set_key): New functions.
945 * serpent.h: Declare new functions.
946 (SERPENT128_KEY_SIZE, SERPENT192_KEY_SIZE)
947 (SERPENT256_KEY_SIZE): New constants.
948 * serpent-meta.c (SERPENT): New macro.
949 (nettle_serpent128, nettle_serpent192, nettle_serpent256): Use new
952 * twofish-set-key.c (twofish128_set_key, twofish192_set_key)
953 (twofish256_set_key): New functions.
954 * twofish.h: Declare new functions.
955 (TWOFISH128_KEY_SIZE, TWOFISH192_KEY_SIZE)
956 (TWOFISH256_KEY_SIZE): New constants.
957 * twofish-meta.c (TWOFISH): New macro.
958 (nettle_twofish128, nettle_twofish192, nettle_twofish256): Use new
961 * nettle-internal.h (struct nettle_aead): Use
962 nettle_hash_update_func for the set_iv function pointer.
964 * nettle-internal.c (des_set_key_hack, des3_set_key_hack): Deleted
966 (chacha_set_key_hack): Deleted length argument. Use
968 (salsa20_set_key_hack): Deleted length argument. Use
970 (nettle_unified_aes128, nettle_unified_aes192)
971 (nettle_unified_aes256): Deleted, moved to test program.
972 (eax_aes128_set_key): Deleted length argument. Use EAX_SET_KEY.
974 * examples/nettle-benchmark.c: Updated for _set_key changes.
975 * examples/nettle-openssl.c: Likewise.
976 * testsuite/testutils.c: Likewise.
977 * testsuite/gcm-test.c: Likewise.
979 * testsuite/aes-test.c (UNIFIED_AES): New macro. Moved glue for
980 testing the old aes interface (struct aes_ctx) here.
982 * testsuite/arcfour-test.c (test_arcfour): New function, for key
986 * testsuite/blowfish-test.c (test_blowfish): New function.
987 (test_main): Use it. Also deleted old #if:ed out code.
989 * testsuite/cast128-test.c (test_cast5): New function.
990 (test_main): Use it, for 40-bit and 80-bit tests.
992 * testsuite/serpent-test.c (test_serpent): New function.
995 2014-01-27 Niels Möller <nisse@lysator.liu.se>
997 * eax.h (struct eax_key, struct eax_ctx): Use union
998 nettle_block16, for alignment.
999 * eax.c: Updated everything to use nettle_block16.
1000 (block16_xor): New function.
1002 * examples/nettle-benchmark.c (time_eax): New function.
1005 * x86_64/chacha-core-internal.asm: Use pshufhw + pshuflw for the
1008 * configure.ac (asm_replace_list): Added chacha-core-internal.asm.
1009 * x86_64/chacha-core-internal.asm: New file.
1011 * examples/nettle-benchmark.c (main): Add benchmarking of chacha.
1012 * nettle-internal.c (nettle_chacha): New const struct, for the
1015 Chacha implementation, based on contribution by Joachim
1017 * chacha.h: New file.
1018 * chacha256-set-key.c (chacha256_set_key): New file and function.
1019 * chacha128-set-key.c (chacha128_set_key): New file and function.
1020 * chacha-set-key.c (chacha_set_key): New file and function.
1021 * chacha-set-iv.c (chacha_set_iv): New file and function.
1022 * chacha-core-internal.c (_chacha_core): New file and function.
1023 * chacha-crypt.c (chacha_crypt): New file and function.
1024 * Makefile.in (nettle_SOURCES): Added chacha files.
1025 (HEADERS): Added chacha.h.
1026 * testsuite/chacha-test.c: New file.
1027 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added chacha-test.c.
1029 2014-01-26 Niels Möller <nisse@lysator.liu.se>
1031 * nettle-internal.h (_NETTLE_AEAD_FIX): Renamed to...
1032 (_NETTLE_AEAD): ... new name, and deleted old definition. Also use
1033 _set_nonce instead of _set_iv.
1034 * nettle-internal.c (nettle_gcm_aes128, nettle_gcm_aes192)
1035 (nettle_gcm_aes256): Define in terms of new interface.
1036 (nettle_eax_aes128): Updated for _NETTLE_AEAD changes.
1038 * testsuite/gcm-test.c (test_gcm_hash): Likewise use struct
1040 (test_main): Added a testcase using the old interface based on
1043 * examples/nettle-benchmark.c (time_gcm): Update to use new struct
1044 gcm_aes128_ctx. Also use name "gcm-aes128" in output.
1046 * gcm.h: New interface for gcm_aes128, gcm_aes192, gcm_aes256,
1047 using the new AES interface.
1048 (GCM_CTX): Reorder fields, putting the cipher context
1051 * Makefile.in (nettle_SOURCES): Added gcm-aes128.c, gcm-aes192.c,
1054 * gcm-aes128.c: New file.
1055 * gcm-aes192.c: New file
1056 * gcm-aes256.c: New file.
1058 2014-01-25 Niels Möller <nisse@lysator.liu.se>
1060 * gcm.h (GCM_SET_KEY): Deleted length argument.
1061 * gcm-aes.c (gcm_aes_set_key): Use aes_set_encrypt_key and
1062 gcm_set_key, can no longer use GCM_SET_KEY macro.
1064 2014-01-23 Niels Möller <nisse@lysator.liu.se>
1066 * testsuite/gcm-test.c (test_main): Use the correct
1067 nettle_gcm_aes128/192/256 object.
1069 2014-01-21 Niels Möller <nisse@lysator.liu.se>
1071 Merged camellia-reorg changes (starting at 2013-10-07).
1073 2013-10-10 Niels Möller <nisse@lysator.liu.se>
1075 * Makefile.in (nettle_SOURCES): Updated list of camellia files.
1077 * testsuite/camellia-test.c (test_invert): Updated for new
1080 * camellia.h: Reorganized camellia interface, with distinct
1081 context structs and functions for camellia128 and camellia256.
1083 * camellia-meta.c: Deleted file.
1084 * camellia256-meta.c: New file.
1085 * camellia192-meta.c: New file.
1086 * camellia128-meta.c: New file.
1088 * camellia-set-decrypt-key.c: Deleted file, code moved to:
1089 * camellia128-set-decrypt-key.c: New file.
1090 (camellia128_invert_key, camellia128_set_decrypt_key): New
1092 * camellia256-set-decrypt-key.c: New file.
1093 (camellia256_invert_key, camellia256_set_decrypt_key)
1094 (camellia192_set_decrypt_key): New functions.
1095 * camellia-invert-key.c (_camellia_invert_key): New file and
1098 * camellia-set-encrypt-key.c: Deleted file, code moved to:
1099 * camellia128-set-encrypt-key.c: New file.
1100 (camellia128_set_encrypt_key): New function.
1101 * camellia256-set-encrypt-key.c: New file.
1102 (_camellia256_set_encrypt_key, camellia256_set_encrypt_key)
1103 (camellia192_set_encrypt_key): New functions.
1104 * camellia-absorb.c (_camellia_absorb): New file and function.
1105 * camellia-internal.h: Moved key schedule macros here.
1107 * camellia-crypt.c: Deleted file, code moved to:
1108 * camellia128-crypt.c (camellia128_crypt): New file and function.
1109 * camellia256-crypt.c (camellia256_crypt): New file and function.
1111 2013-10-07 Niels Möller <nisse@lysator.liu.se>
1113 * configure.ac: Delete check for ALIGNOF_UINT64_T, no longer
1115 * config.m4.in: Likewise delete ALIGNOF_UINT64_T.
1117 * camellia-crypt.c (camellia_crypt): Updated call to
1119 * camellia-internal.h (_camellia_crypt): Updated prototype.
1120 * camellia-crypt-internal.c (_camellia_crypt): Take separate
1121 arguments for rounds and subkey array.
1122 * x86_64/camellia-crypt-internal.asm: Likewise. Also corrected
1124 * x86/camellia-crypt-internal.asm: Likewise.
1126 2014-01-20 Niels Möller <nisse@lysator.liu.se>
1128 * poly1305-internal.c (poly1305_digest): Use union nettle_block16
1130 * poly1305-aes.c (poly1305_aes_digest): Update for poly1305_digest
1133 Merged poly1305 changes (starting at 2013-11-08).
1134 * x86_64/poly1305-internal.asm: Update to new interface.
1135 poly1305_digest much simplified.
1137 * poly1305.h (struct poly1305_ctx): Moved block and index
1139 (struct poly1305_aes_ctx): ... to here.
1140 * asm.m4: Delete also from the assembly definition of struct
1143 * poly1305-internal.c (poly1305_digest): Don't do final padding
1144 here, leave that to caller. Add digest to the provided nonce s,
1145 and deleted length and dst arguments. Also reset h0-h4 to zero
1147 (_poly1305_block): Renamed, from...
1148 (poly1305_block): ...old name.
1150 * poly1305-aes.c (poly1305_aes_update): New function.
1151 (poly1305_aes_digest): Update for poly1305_digest changes, do
1154 * poly1305.c (poly1305_update): Deleted file and function. Moved
1156 * Makefile.in (nettle_SOURCES): Deleted poly1305.c.
1158 2014-01-17 Niels Möller <nisse@lysator.liu.se>
1160 * poly1305-internal.c (poly1305_block): Additional argument with
1162 (poly1305_block_internal): Deleted function, code moved into the
1164 (poly1305_digest): Simplified padding code, call poly1305_block
1166 * poly1305.h (poly1305_block): Update prototype.
1167 * poly1305.c (poly1305_update): Call poly1305_block with high bit 1.
1168 * x86_64/poly1305-internal.asm (poly1305_block): Handle new
1171 * poly1305.h (struct poly1305_ctx): Moved nonce field from here...
1172 (struct poly1305_aes_ctx): ... to here.
1173 * poly1305-aes.c (poly1305_aes_set_nonce, poly1305_aes_digest):
1175 * poly1305.c (poly1305_set_nonce): Deleted function.
1176 * asm.m4: Delete nonce also from the assembly definition of struct
1179 2014-01-16 Niels Möller <nisse@lysator.liu.se>
1181 * poly1305-aes.c: Include poly1305.h. Rewrite functions without
1182 using the POLY1305_* macros.
1184 * Makefile.in (HEADERS): Deleted poly1305-aes.h.
1186 * poly1305.h (POLY1305_CTX, POLY1305_SET_KEY, POLY1305_SET_NONCE)
1187 (POLY1305_DIGEST): Deleted macros. Only implemented variant is
1189 (POLY1305_DIGEST_SIZE, POLY1305_BLOCK_SIZE, POLY1305_KEY_SIZE):
1191 (POLY1305_AES_KEY_SIZE, POLY1305_AES_DIGEST_SIZE): Moved here,
1192 from poly1305-aes.h.
1193 (struct poly1305_aes_ctx): Likewise.
1194 (poly1305_aes_set_key, poly1305_aes_set_nonce)
1195 (poly1305_aes_update, poly1305_aes_digest): Likewise.
1196 * poly1305-aes.h: Deleted file, declarations moved to poly1305.h.
1199 * poly1305-internal.c (s2, s3, s4): Fixed macros.
1201 * poly1305-aes.h (struct poly1305_aes_ctx): Replace struct aes_ctx
1202 by struct aes128_ctx.
1203 * poly1305-aes.c (poly1305_aes_set_key, poly1305_aes_digest):
1204 Update to use aes128_* functions.
1205 * poly1305.h (POLY1305_SET_KEY): Drop key size argument when
1208 2013-12-19 Niels Möller <nisse@lysator.liu.se>
1210 * poly1305-aes.h (poly1305_aes_update): Define as an alias for
1211 poly1305_update, using preprocessor and a type cast.
1213 * poly1305-aes.c (poly1305_aes_update): Deleted function.
1215 * poly1305.h (poly1305_update): Declare.
1216 (_POLY1305_BLOCK, POLY1305_UPDATE): Deleted macros.
1218 * poly1305.c (poly1305_update): New function.
1220 2013-11-21 Niels Möller <nisse@lysator.liu.se>
1222 * x86_64/poly1305-internal.asm: New file. Almost a factor of two
1225 * configure.ac (asm_replace_list): Added poly1305-internal.asm.
1227 * asm.m4: Define struct offsets for 64-bit poly1305_ctx.
1229 * poly1305.h (POLY1305_DIGEST): Pass the encrypted nonce as an
1230 additional argument to poly1305_digest.
1231 (struct poly1305_ctx): Introduce unions, to support either 26-bit
1232 or 64-bit implementation.
1234 * poly1305-internal.c (poly1305_digest): Added s argument.
1236 * poly1305.c (poly1305_set_s): Deleted function.
1238 2013-11-12 Niels Möller <nisse@lysator.liu.se>
1240 * poly1305-internal.c: New file, for poly1305 functions depending
1241 on the internal mod (2^130 - 5) representation.
1242 (poly1305_block_internal): New helper function.
1243 (poly1305_block, poly1305_digest): Use it.
1245 2013-11-08 Nikos Mavrogiannopoulos <nmav@gnutls.org>
1247 * poly1305.h: New file.
1248 * poly1305.c: New file.
1249 * poly1305-aes.h: New file.
1250 * poly1305-aes.c: New file.
1251 * Makefile.in (nettle_SOURCES): Added poly1305-aes.c and poly1305.c.
1252 (HEADERS): Added poly1305-aes.h and poly1305.h.
1254 * testsuite/poly1305-test.c: New file.
1255 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added poly1305-test.c.
1257 * examples/nettle-benchmark.c (time_poly1305_aes): New function.
1258 (main): Benchmark poly1305.
1260 2014-01-20 Niels Möller <nisse@lysator.liu.se>
1262 * Makefile.in (nettle_SOURCES): Added salsa20-set-nonce.c,
1263 salsa20-128-set-key.c, and salsa20-256-set-key.c.
1265 * salsa20.h: Declare new functions.
1266 (SALSA20_128_KEY_SIZE, SALSA20_256_KEY_SIZE): New constants.
1267 (salsa20_set_iv): Define as an alias for salsa20_set_nonce.
1269 * salsa20-set-key.c (salsa20_set_key): Use salsa20_128_set_key and
1270 salsa20_256_set_key.
1271 (salsa20_set_iv): Renamed and moved...
1272 * salsa20-set-nonce.c (salsa20_set_nonce): ... new file, new name.
1274 * salsa20-256-set-key.c (salsa20_256_set_key): New file and
1276 * salsa20-128-set-key.c (salsa20_128_set_key): New file and
1279 2014-01-13 Niels Möller <nisse@lysator.liu.se>
1281 * nettle-types.h (union nettle_block16): New type, replacing union
1283 * gcm.h (union gcm_block): Deleted. Replaced by nettle_block16.
1284 * gcm.c: Replaced all use of gcm_block by nettle_block16.
1286 2014-01-04 Niels Möller <nisse@lysator.liu.se>
1288 * config.guess: Updated to 2014-01-01 version, from
1289 git://git.sv.gnu.org/config.git.
1290 * config.sub: Likewise.
1292 * testsuite/memxor-test.c [HAVE_VALGRIND_MEMCHECK_H] (test_mark):
1294 (test_memxor, test_memxor3): Use test_mark to tell valgrind the
1295 start and end of src and destination areas.
1297 * configure.ac: Check for valgrind/memcheck.h.
1299 * testsuite/Makefile.in (VALGRIND): Added --partial-loads-ok=yes,
1300 needed for the way unaligned data is handled in, e.g., memxor.
1302 2014-01-03 Niels Möller <nisse@lysator.liu.se>
1304 * shadata.c (main): Zero-pad output values to 8 hex digits.
1305 * sha256.c (K): Updated table.
1307 2013-12-17 Niels Möller <nisse@lysator.liu.se>
1309 * configure.ac (ASM_RODATA): New substituted variable. Needed for
1310 portability to darwin.
1311 * config.m4.in: Define RODATA, using configure variable ASM_RODATA
1312 * x86_64/gcm-hash8.asm: Use RODATA macro.
1314 * bignum-random-prime.c (_nettle_generate_pocklington_prime): Use
1315 stronger variants of Pocklington's theorem, to allow p0 of size
1318 2013-12-15 Niels Möller <nisse@lysator.liu.se>
1320 * nettle-internal.h (NETTLE_MAX_BIGNUM_BITS)
1321 (NETTLE_MAX_BIGNUM_SIZE): Deleted arbitrary limits.
1323 2013-12-15 Nikos Mavrogiannopoulos <nmav@redhat.com>
1325 Introduced TMP_GMP_ALLOC macro for temporary allocations of
1326 potentially large data, e.g, sized as an RSA key.
1327 * gmp-glue.h (TMP_GMP_DECL, TMP_GMP_ALLOC, TMP_GMP_FREE): New
1329 * gmp-glue.c (gmp_alloc, gmp_free): New functions.
1330 * bignum-next-prime.c (nettle_next_prime): Use TMP_GMP_ALLOC.
1331 * bignum-random.c (nettle_mpz_random_size): Likewise.
1332 * pkcs1-decrypt.c (pkcs1_decrypt): Likewise.
1333 * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
1334 * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): Likewise.
1335 * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
1336 (pkcs1_rsa_sha512_encode_digest): Likewise.
1337 * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
1338 (pkcs1_rsa_sha256_encode_digest): Likewise.
1339 * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
1340 (pkcs1_rsa_sha1_encode_digest): Likewise.
1341 * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
1342 (pkcs1_rsa_md5_encode_digest): Likewise.
1344 2013-12-14 Niels Möller <nisse@lysator.liu.se>
1346 * x86_64/gcm-hash8.asm: Use .short rather than .hword, for
1347 compatibility with apple's assembler.
1349 2013-12-03 Niels Möller <nisse@lysator.liu.se>
1351 * x86_64/sha1-compress.asm: Reorganized, to get closer to the x86
1352 version. No difference in running time.
1354 * configure.ac (dummy-dep-files): Don't overwrite any existing
1357 * x86_64/md5-compress.asm: New file, similar to the x86 version.
1358 35% speedup on AMD, 15% speedup on Intel.
1360 2013-11-25 Niels Möller <nisse@lysator.liu.se>
1362 * testsuite/dsa-test.c (test_main): Additional tests from NIST
1365 * testsuite/testutils.c (test_dsa_sign, test_dsa_verify): New
1366 functions, supporting arbitrary digest size.
1368 * testsuite/testutils.h (ASSERT): Improved failure message.
1370 * dsa-verify.c (dsa_verify): Renamed, from _dsa_verify.
1371 * dsa-sign.c (dsa_sign): Renamed, from _dsa_sign.
1373 2013-11-24 Niels Möller <nisse@lysator.liu.se>
1375 * testsuite/dsa-keygen-test.c (test_main): Test generating a
1378 * dsa-verify.c (_dsa_verify): Use _dsa_hash.
1380 * dsa-sign.c (_dsa_sign): Use _dsa_hash. Fix memory leak in
1381 error case, spotted by Nikos.
1383 * dsa-keygen.c (dsa_generate_keypair): Allow q_bits == 224.
1385 * dsa-hash.c (_dsa_hash): New file and function. Allows digest
1386 sizes not matching the bitsize of q.
1387 * dsa.h (_dsa_hash): Declare it.
1388 * Makefile.in (hogweed_SOURCES): Added dsa-hash.c.
1390 2013-11-23 Niels Möller <nisse@lysator.liu.se>
1392 * configure.ac: Check also for openssl/ecdsa.h.
1394 2013-10-05 Niels Möller <nisse@lysator.liu.se>
1396 * Makefile.in (nettle_SOURCES): Added eax.c.
1397 (HEADERS): Added eax.h.
1399 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added eax-test.c.
1401 * testsuite/eax-test.c: New file.
1403 * nettle-internal.c (nettle_eax_aes128): New aead algorithm.
1404 (eax_aes128_set_key, eax_aes128_set_nonce, eax_aes128_update)
1405 (eax_aes128_encrypt, eax_aes128_decrypt, eax_aes128_digest): New
1411 * aes.h: Fixed typo in name mangling for new aes functions.
1413 2013-09-28 Niels Möller <nisse@lysator.liu.se>
1415 * Merge aes-reorg branch. Changes below,
1416 dated 2013-05-17 - 2013-08-13.
1418 2013-08-13 Niels Möller <nisse@lysator.liu.se>
1420 * yarrow.h (struct yarrow256_ctx): Use aes256_ctx, not aes_ctx.
1421 * yarrow256.c: Adapted to use new aes256 interface.
1423 2013-08-07 Niels Möller <nisse@lysator.liu.se>
1425 * umac.h (_UMAC_STATE): Use struct aes128_ctx, not aes_ctx.
1426 * umac-set-key.c (umac_kdf, _umac_set_key): Use aes128 interface.
1427 * umac32.c (umac32_digest): Likewise.
1428 * umac64.c (umac64_digest): Likewise.
1429 * umac96.c (umac96_digest): Likewise.
1430 * umac128.c (umac128_digest): Likewise.
1432 2013-06-25 Niels Möller <nisse@lysator.liu.se>
1434 * aes-meta.c: Deleted file.
1436 Analogous changes for new aes192 and aes256 interface.
1438 * aes.h (struct aes128_ctx): New aes128 declarations.
1439 * aes-decrypt.c (aes128_decrypt): New function.
1440 * aes-encrypt.c (aes128_encrypt): New function.
1441 * aes128-meta.c: New file.
1442 * aes128-set-encrypt-key.c (aes128_set_encrypt_key): New file and
1444 * aes128-set-decrypt-key.c (aes128_set_decrypt_key)
1445 (aes128_invert_key): New file and functions.
1446 * Makefile.in (nettle_SOURCES): Added aes128-set-encrypt-key.c,
1447 aes128-set-decrypt-key.c and aes128-meta.c.
1449 * nettle-internal.c (nettle_unified_aes128): For testing the old
1451 * testsuite/aes-test.c (test_cipher2): New function.
1452 (test_main): Test both nettle_aes128 and nettle_unified_aes128.
1454 2013-05-22 Niels Möller <nisse@lysator.liu.se>
1456 * Makefile.in (nettle_SOURCES): Added aes-invert-internal.c and
1457 aes-set-key-internal.c.
1459 * aes.h (AES128_KEY_SIZE, _AES128_ROUNDS): New constants.
1460 Similarly also for aes192 and aes256.
1462 * aes-internal.h: Declare new functions.
1464 * aes-set-key-internal.c (_aes_set_key): New file and funxtion
1465 extracted from aes_set_encrypt_key.
1466 * aes-set-encrypt-key.c (aes_set_encrypt_key): Use _aes_set_key.
1468 * aes-invert-internal.c (_aes_invert): New file and function,
1469 extracted from aes_invert_key.
1470 * aes-set-decrypt-key.c (aes_invert_key): Use _aes_invert.
1472 * arm/v6/aes-encrypt-internal.asm: Adapted to new interface.
1473 Unfortunately, 4% slowdown on Cortex-A9, for unknown reason.
1474 * arm/v6/aes-decrypt-internal.asm: Likewise.
1475 * arm/aes-encrypt-internal.asm: Adapted to new interface.
1476 * arm/aes-decrypt-internal.asm: Likewise.
1478 2013-05-21 Niels Möller <nisse@lysator.liu.se>
1480 * sparc32/aes-encrypt-internal.asm: Adapted to new interface.
1481 * sparc32/aes-decrypt-internal.asm: Likewise.
1482 * sparc64/aes-encrypt-internal.asm: Likewise.
1483 * sparc64/aes-decrypt-internal.asm: Likewise.
1485 * x86/aes-encrypt-internal.asm: Adapted to new interface.
1486 * x86/aes-decrypt-internal.asm: Likewise.
1488 2013-05-20 Niels Möller <nisse@lysator.liu.se>
1490 * x86_64/aes-encrypt-internal.asm: Adapted to new interface.
1491 * x86_64/aes-decrypt-internal.asm: Likewise.
1493 2013-05-17 Niels Möller <nisse@lysator.liu.se>
1495 * aes.h (struct aes_ctx): Renamed nrounds to rounds, and moved
1496 first in the structure.
1497 * aes-set-encrypt-key.c (aes_set_encrypt_key): Updated for renaming.
1498 * aes-set-decrypt-key.c (aes_invert_key): Likewise.
1500 * aes-encrypt-internal.c (_nettle_aes_encrypt): Take rounds and
1501 subkeys as separate arguments, not a struct aes_ctx *. Updated
1503 * aes-decrypt-internal.c (_nettle_aes_decrypt): Likewise.
1504 * aes-internal.h: Updated prototypes.
1506 * Start of aes-reorg changes.
1508 2013-09-28 Niels Möller <nisse@lysator.liu.se>
1510 * md4.h (struct md4_ctx): Use single uint64_t variable for block
1512 * md4.c: Use new block count variable.
1513 * md5.c, md5.h (struct md5_ctx): Likewise.
1514 * ripemd160.c, ripemd160.h (struct ripemd160_ctx): Likewise.
1515 * sha1.c, sha1.h (struct sha1_ctx): Likewise.
1516 * sha256.c, sha2.h (struct sha256_ctx): Likewise.
1518 * testsuite/testutils.c (test_hash_large): Added simple progress
1521 * macros.h (MD_PAD): Use size argument, don't depend on
1522 sizeof of the count field(s).
1524 2013-09-22 Niels Möller <nisse@lysator.liu.se>
1526 * x86_64/gcm-hash8.asm: New file.
1527 * x86_64/gcm-gf-mul-8.asm: Deleted.
1529 * configure.ac (asm_nettle_optional_list): Look for gcm-hash8.asm,
1530 not gcm-gf-mul-8.asm.
1531 * gcm.c [HAVE_NATIVE_gcm_hash8]: Make use of (optional) assembly
1534 2013-09-21 Niels Möller <nisse@lysator.liu.se>
1536 * Makefile.in (des.po): Add same dependencies as for des.o.
1537 Reported by Vincent Torri.
1539 2013-09-20 Niels Möller <nisse@lysator.liu.se>
1541 * testsuite/gcm-test.c: Added tests with associated data of
1544 * testsuite/testutils.c (tstring_alloc): Add NUL-termination.
1546 2013-09-18 Niels Möller <nisse@lysator.liu.se>
1548 * Makefile.in: New stampfiles, libnettle.stamp and
1549 libhogweed.stamp, updated when both static and shared libraries
1550 are rebuilt. Used as link dependencies in subdirectories.
1551 * examples/Makefile.in: Make executable targets depend on
1552 ../libnettle.stamp and libhogweed.stamp, not directly on the
1553 static library files.
1554 * testsuite/Makefile.in: Likewise.
1555 * tools/Makefile.in: Likewise.
1557 2013-09-09 Niels Möller <nisse@lysator.liu.se>
1559 * gcm.c [HAVE_NATIVE_gcm_gf_mul_8]: Make use of (optional)
1560 assembly implementation.
1562 * configure.ac: Support optional assembly files for both nettle
1563 and hogweed. Replaced OPT_ASM_SOURCES with OPT_ASM_NETTLE_SOURCES,
1564 OPT_ASM_HOGWEED_SOURCES, and asm_optional_list with
1565 asm_nettle_optional_list and asm_hogweed_optional_list.
1566 (asm_nettle_optional_list): Added gcm-gf-mul-8.asm.
1568 2013-06-25 Niels Möller <nisse@lysator.liu.se>
1570 * testsuite/gcm-test.c: Deleted redundant include of aes.h.
1572 * testsuite/testutils.c (test_aead): Allow digest size smaller
1573 than the block size.
1575 * tools/nettle-pbkdf2.c: New command line tool.
1576 * tools/Makefile.in (TARGETS): Added nettle-pbkdf2.
1577 (nettle-pbkdf2$(EXEEXT)): New target.
1578 * testsuite/nettle-pbkdf2-test: New test case.
1579 * testsuite/Makefile.in (TS_SH): Added nettle-pbkdf2-test.
1581 * tools/nettle-hash.c (digest_file): Use stack allocation for the
1582 small hex output buffer.
1584 * examples/io.c (MIN): Deleted unused macro.
1586 2013-05-21 Niels Möller <nisse@lysator.liu.se>
1588 From nettle-2.7-fixes branch:
1589 * Makefile.in (distdir): Distribute files in arm/v6 subdirectory.
1591 2013-05-20 Niels Möller <nisse@lysator.liu.se>
1593 * arm/v6/sha1-compress.asm: Moved into v6 directory, since it uses
1594 the v6 instruction uadd8, sel and rev.
1595 * arm/v6/sha256-compress.asm: Likewise.
1597 * nettle-types.h: Include <stddef.h>, for size_t.
1599 2013-05-17 Niels Möller <nisse@lysator.liu.se>
1601 * macros.h (ROTL32, ROTL64): Avoid undefined behaviour for zero
1602 rotation count. Unfortunately makes CAST128 a bit slower with
1605 * ecc-j-to-a.c (ecc_j_to_a): Fixed ecc_modp_mul call, to avoid
1606 invalid overlap of arguments to mpn_mul_n. Problem tracked down by
1609 2013-05-16 Niels Möller <nisse@lysator.liu.se>
1611 * arm/aes-encrypt-internal.asm: New file, for pre-v6 processors.
1612 * arm/aes-decrypt-internal.asm: New file, likewise.
1614 * arm/aes.m4 (AES_FINAL_ROUND_V5): Variant without using uxtb.
1615 (AES_FINAL_ROUND_V6): New name, updated callers.
1616 (AES_FINAL_ROUND): ... old name. Also eliminated one uxtb
1618 (AES_ENCRYPT_ROUND, AES_DECRYPT): Moved macros to the
1621 * arm/v6/aes-encrypt-internal.asm: Use ALIGN macro. Use 16-byte
1622 alignment for loops.
1623 * arm/v6/aes-decrypt-internal.asm: Likewise. Also added a nop
1624 which mysteriously improves benchmark performance on Cortex-A9.
1626 2013-05-15 Niels Möller <nisse@lysator.liu.se>
1628 * configure.ac (asm_path): Handle armv6 and armv7 differently from
1629 older ARMs. Add the arm/v6 directory to asm_path when appropriate.
1631 * arm/v6/aes-encrypt-internal.asm: Moved into v6 directory. Uses
1632 the uxtb instruction which is not available for older ARMs.
1633 * arm/v6/aes-decrypt-internal.asm: Likewise.
1635 2013-05-03 Niels Möller <nisse@lysator.liu.se>
1637 * cast128.c: Adapt to new struct cast128_ctx.
1638 (cast128_set_key): Rewrite, eliminating lots of conditions and
1639 some false warnings.
1641 * cast128.h (struct cast128_ctx): Separate the small 5-bit
1642 rotation subkeys and the larger 32-bit masking subkeys.
1644 2013-05-02 Niels Möller <nisse@lysator.liu.se>
1646 * testsuite/testutils.c (mpz_combit): Renamed. Define only if not
1647 provided GMP. Updated all uses.
1648 (mpz_togglebit): ... old name.
1650 * sexp-format.c (sexp_vformat): Use type mpz_srcptr rather
1651 than the old MP_INT *.
1653 2013-04-26 Niels Möller <nisse@lysator.liu.se>
1655 * Many files: Use size_t rather than unsigned for data sizes.
1656 * x86_64/aes-encrypt-internal.asm: Accept 64-bit length.
1657 * x86_64/aes-decrypt-internal.asm: Likewise.
1659 2013-04-25 Niels Möller <nisse@lysator.liu.se>
1661 * configure.ac: Changed version number, to 2.8.
1662 (LIBNETTLE_MAJOR): Bumped major number, following
1663 nettle_memxor ABI break.
1664 (LIBNETTLE_MINOR): Reset to zero.
1666 * examples/hogweed-benchmark.c: Add benchmarking of OpenSSL's RSA
1668 (all functions): Deleted unneeded casts.
1670 2013-04-24 Niels Möller <nisse@lysator.liu.se>
1672 * nettle.texinfo (Miscellaneous functions): Updated memxor
1673 prototype. Document memxor3.
1675 * salsa20-crypt.c (salsa20_crypt): Deleted cast of memxor
1676 argument, no longer needed.
1677 * salsa20r12-crypt.c (salsa20r12_crypt): Likewise.
1678 * sha3.c (sha3_absorb): Likewise.
1680 * memxor.h: Updated prototypes. Drop include of nettle-types.h.
1682 * memxor.c: Include nettle-types.h, for uintptr_t. Replace all
1683 internal uses of uint8_t by plain char.
1684 (memxor): Use void * rather than uint8_t * for
1686 (memxor3): Likewise.
1688 * x86_64/memxor.asm: Added nettle_ prefix to symbols.
1689 * arm/memxor.asm: Likewise.
1691 * testsuite/symbols-test: Don't allow memxor functions without
1694 * memxor.h (memxor3): Added name mangling to add "nettle_" prefix
1695 to memxor and memxor3 symbols.
1697 * Makefile.in (nettle_OBJS): Deleted $(LIBOBJS), and also deleted
1698 LIBOBJS substitution.
1699 (nettle_SOURCES): Added memxor.c, to include it in the library
1702 * configure.ac: Deleted AC_REPLACE_FUNCS for memxor.
1704 * Released nettle-2.7.
1706 2013-04-23 Niels Möller <nisse@lysator.liu.se>
1708 From Martin Storsjö:
1709 * x86_64/sha256-compress.asm: Add forgotten W64_EXIT.
1710 * x86_64/sha512-compress.asm: Likewise.
1711 * x86_64/salsa20-crypt.asm (Lpartial): Don't return via W64_EXIT
1712 within this subfunction.
1713 * x86_64/machine.m4 (W64_ENTRY): Use movdqu instead of movdqa for
1714 saving xmm registers, since the stack is not guaranteed to be
1715 16-byte aligned on win64. Take pushed xmm registers into account
1716 when reading the fifth parameter from the stack.
1718 * Makefile.in: Consistently use EXEEXT_FOR_BUILD.
1720 2013-04-21 Niels Möller <nisse@lysator.liu.se>
1722 * Makefile.in (DISTFILES): Added mini-gmp.c and mini-gmp.h.
1723 (distdir): Use find, for identifying assembly files to copy.
1725 2013-04-18 Niels Möller <nisse@lysator.liu.se>
1727 * configure.ac: Recognize cpu type "arm*", not just "armv7*'.
1729 * arm/aes-encrypt-internal.asm: Updated include of aes.m4.
1730 * arm/aes-decrypt-internal.asm: Likewise.
1732 * Makefile.in (distdir): Updated for ARM reorganization.
1734 * configure.ac (asm_path): Generalized, can now be a list of
1735 directories. On ARM, check for neon instructions, and add arm/neon
1736 if appropriate. New command line options
1737 --enable-arm-neon/--disable-arm-neon, for overriding the default.
1739 arm/neon: New subdirectory, for assembly files making use of neon
1742 arm: Renamed directory, from...
1745 * aclocal.m4 (NETTLE_CHECK_ARM_NEON): New macro.
1747 * nettle.texinfo (Keyed hash functions): Document UMAC.
1749 * umac.h (UMAC32_DIGEST_SIZE, UMAC64_DIGEST_SIZE)
1750 (UMAC96_DIGEST_SIZE, UMAC128_DIGEST_SIZE): New constants.
1751 (UMAC_DATA_SIZE): New name, for consistency with hash functions.
1753 (UMAC_BLOCK_SIZE): ... old name.
1755 2013-04-17 Niels Möller <nisse@lysator.liu.se>
1757 * examples/nettle-benchmark.c (main): Benchmark salsa20r12.
1759 * nettle-internal.c (nettle_salsa20r12): Cipher struct for
1761 * nettle-internal.h (nettle_salsa20): Declare it.
1763 * Makefile.in (eccdata): Depend on mini-gmp files. Drop -lgmp.
1765 * eccdata.c: Use mini-gmp, to avoid gmp dependency and associated
1766 configure tests for the *build* system. Replaced mpz_submul_ui by
1767 mpz_mul_ui + mpz_sub, and gmp_printf and gmp_fprintf by calls to
1770 * mini-gmp.h, mini-gmp.c: New files, copied from gmp-5.1.1.
1772 2013-04-16 Niels Möller <nisse@lysator.liu.se>
1774 * umac-set-key.c (BE_SWAP32_N): Fixed dummy definition used for
1777 * Makefile.in (TARGETS): Deleted eccdata, it should be build only
1778 when public key support is enabled.
1779 (clean-here): Exlicitly list it here.
1781 * asm.m4 (m4_log2): New macro, similar to the one in gmp.
1782 (ALIGN): Changed to take alignment in bytes. Updated all callers,
1783 currently used only in x86 and x86_64 files.
1785 * umac.h (umac32_ctx, umac64_ctx, umac96_ctx, umac128_ctx): Make
1786 block count an uint64_t. Reorder some elements to put short values
1788 * umac-l2.c (_umac_l2, _umac_l2_final): Make count argument an uint64_t.
1789 (_umac_l2): Deleted redundant memcpy.
1790 (_umac_l2, _umac_l2_final): Store input buffer at end of the
1791 poly64/poly128 state. Deleted l1_out from corresponding context
1792 structs, and updated all callers.
1794 * configure.ac: Changed version number to 2.7.
1795 (LIBNETTLE_MINOR): Bumped library version, to 4.6.
1796 (LIBHOGWEED_MINOR): And to 2.4.
1798 * Makefile.in (distdir): Include files from armv7 subdirectory.
1800 * x86_64/umac-nh-n.asm: New file, 3.5 time speedup.
1802 * umac32.c (umac32_digest): Fix nonce caching.
1803 * umac64.c (umac64_digest): Likewise.
1805 * testsuite/umac-test.c (test_incr): New function.
1806 (test_main): Test nonce increment.
1808 * misc/umac/umac.py: UMAC reference implementation.
1809 * misc/umac/rijndael.py: AES implementation used by umac.py.
1810 * misc/umac/mkvectors: Script to generate UMAC test vectors.
1811 * misc/umac/vectors.out: Generated test vectors.
1813 * umac32.c (umac32_digest): Fix nonce increment, use INCREMENT
1815 * umac64.c (umac64_digest): Likewise.
1816 * umac96.c (umac96_digest): Likewise.
1817 * umac128.c (umac128_digest): Likewise.
1819 * macros.h (INCREMENT): Allow size == 1.
1821 2013-04-15 Niels Möller <nisse@lysator.liu.se>
1823 * x86_64/umac-nh.asm: New file. 4.4 time speedup.
1825 * armv7/umac-nh-n.asm: New file. 2.0-2.3 time speedup.
1827 * testsuite/umac-test.c (test_align): Fixed memory leak.
1829 2013-04-12 Niels Möller <nisse@lysator.liu.se>
1831 * armv7/umac-nh.asm: New file. 2.4 time speedup.
1833 * armv7/machine.m4 (D0REG, D1REG): New macros.
1835 * configure.ac (asm_replace_list): Added umac-nh.asm and
1838 * testsuite/umac-test.c: Test different alignments for the
1841 2013-04-11 Niels Möller <nisse@lysator.liu.se>
1843 * umac-nh-n.c (_umac_nh_n): Rewrote as a single pass over the
1846 * examples/nettle-benchmark.c (time_umac): New function.
1849 * umac-set-key.c (_umac_set_key): Drop byteswapping of l3_key2, it
1850 can be xored directly to the pad in native byteorder.
1851 * umac-l3.c (_umac_l3): Drop key_2 argument, let caller do that
1852 xor. Updated all callers.
1853 * umac32.c (umac32_digest): Adapt to l3 changes.
1854 * umac64.c (umac64_digest): Likewise.
1855 * umac96.c (umac96_digest): Likewise.
1856 * umac128.c (umac128_digest): Likewise.
1858 Initial implementation of umac.
1860 * umac-nh.c: New file.
1861 * umac-nh-n.c: New file.
1862 * umac-poly64.c: New file.
1863 * umac-poly128.c: New file.
1864 * umac-l2.c: New file.
1865 * umac-l3.c: New file.
1866 * Makefile.in (nettle_SOURCES): Added umac source files.
1867 (HEADERS): Added umac.h.
1868 * testsuite/umac-test.c: New file.
1869 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added umac-test.c.
1871 * ecc-mul-a.c (ecc_mul_a): Avoid using mp_bitcnt_t, for
1872 compatibility with older GMP versions.
1873 * ecc-mul-g.c (ecc_mul_g): Likewise.
1874 * eccdata.c (ecc_mul_binary): Likewise.
1875 * sec-modinv.c (sec_modinv): Likewise.
1877 * x86_64/sha3-permute.asm: Go via memory for moves between general
1878 registers and xmm registers.
1880 2013-04-06 Niels Möller <nisse@lysator.liu.se>
1882 From Edgar E. Iglesias:
1883 * sha3.c (_sha3_update): Fix condition for when the block buffer
1886 2013-04-04 Niels Möller <nisse@lysator.liu.se>
1888 * ecc-point.c (ecc_point_get): Allow NULL x or y, ignore
1889 corresponding coordinate.
1891 * nettle.texinfo (Elliptic curves): Document high-level ECDSA
1894 From Martin Storsjö. Fallback functions for older GMP releases.
1895 * gmp-glue.c (mpn_copyd, mpn_copyi, mpn_zero): New functions.
1896 * gmp-glue.h: Declare them.
1897 (mpn_sqr): Fallback macro.
1899 * gmp-glue.h (cnd_add_n, cnd_sub_n): Moved here, define in terms
1900 of mpn_cnd_add_n and mpn_sub_n if available, otherwise in terms of
1901 mpn_addmul_1 and mpn_submul_1. This seems to be an improvement for
1902 subtraction, but more questionable for addition.
1904 * ecc-internal.h: Include gmp-glue.h. Deleted corresponding
1905 include in all files using ecc-internal.h.
1906 (cnd_add_n, cnd_sub_n): Moved from here.
1908 2013-04-03 Niels Möller <nisse@lysator.liu.se>
1910 * ecc-point-mul-g.c (ecc_point_mul_g): New file and function.
1911 * ecc-point-mul.c (ecc_point_mul): New file and function.
1912 * ecc.h: Updated declarations and name mangling.
1913 * Makefile.in (hogweed_SOURCES): Added ecc-point-mul.c and
1916 * testsuite/salsa20-test.c (test_main): Tests for salsa20r12,
1917 contributed by Nikos Mavrogiannopoulos.
1919 2013-03-26 Niels Möller <nisse@lysator.liu.se>
1921 * armv7/salsa20-core-internal.asm: New file. 45% speedup.
1923 2013-03-25 Niels Möller <nisse@lysator.liu.se>
1925 From Martin Storsjö:
1926 * examples/timing.c: New file, extracted from nettle-benchmark.c.
1927 * examples/timing.h: New file.
1928 * examples/Makefile.in (SOURCES): Added timing.c.
1929 (DISTFILES): Added timing.h.
1930 (BENCH_OBJS, ECC_BENCH_OBJS, HOGWEED_BENCH_OBJS): Added timing.o.
1931 * examples/nettle-benchmark.c: Use timing.h.
1932 * examples/hogweed-benchmark.c: Likewise.
1933 * examples/ecc-benchmark.c: Likewise.
1935 From Nikos Mavrogiannopoulos:
1936 * salsa20r12-crypt.c (salsa20r12_crypt): New file and function.
1937 * salsa20.h (salsa20r12_crypt): Declare.
1938 * Makefile.in (nettle_SOURCES): Added salsa20r12-crypt.c.
1940 From Martin Storsjö:
1941 * examples/hogweed-benchmark.c: Include local headers.
1942 * testsuite/ecdsa-keygen-test.c: Likewise.
1943 * x86_64/sha3-permute.asm: Workaround for Apple's assembler; write
1944 movq instructions as movd.
1946 * Makefile.in (hogweed_PURE_OBJS): Don't include OPT_ASM_SOURCES
1949 2013-03-15 Niels Möller <nisse@lysator.liu.se>
1951 * armv7/sha3-permute.asm: New file. 4.5 time speedup.
1953 * armv7/machine.m4 (QREG): New macro.
1955 2013-03-14 Niels Möller <nisse@lysator.liu.se>
1957 * configure.ac (asm_replace_list): Added sha3-permute.asm,
1958 revering 2012-12-30 change. 34% speedup on intel i5, from 2190
1959 cycles for the C implementation down to 1630.
1961 * armv7/sha512-compress.asm: Optimized. Keep expanded data in
1962 registers, exploit parallelism. Another 70% speedup.
1964 * testsuite/sha512-test.c (test_main): Additional test vectors,
1965 including some longer than 128 bytes.
1967 2013-03-13 Niels Möller <nisse@lysator.liu.se>
1969 * armv7/sha512-compress.asm: New file, using neon instructions.
1972 * configure.ac (asm_replace_list): Added sha512-compress.asm.
1973 * x86_64/machine.m4 (OFFSET64): New macro.
1974 * x86_64/sha512-compress.asm: New file, 20% speedup.
1976 * sha512-compress.c (ROUND): Eliminated a temporary, analogous to
1977 sha256 change below.
1979 * x86_64/sha256-compress.asm: New file, 16% speedup (benchmarked
1982 2013-03-11 Niels Möller <nisse@lysator.liu.se>
1984 * armv7/sha256-compress.asm: New file, 25% speedup.
1986 * configure.ac (asm_replace_list): Added sha256-compress.asm.
1988 * sha256-compress.c (ROUND): Eliminated a temporary.
1990 * armv7/sha1-compress.asm: New file, 9% speedup.
1992 * testsuite/testutils.c (test_hash): Test different alignments for
1995 2013-03-08 Niels Möller <nisse@lysator.liu.se>
1997 * armv7/aes-decrypt-internal.asm: New file, 15% speedup.
1998 * armv7/aes-encrypt-internal.asm: New file, 25% speedup.
1999 * armv7/aes.m4: New file.
2001 2013-03-07 Niels Möller <nisse@lysator.liu.se>
2003 * gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros.
2005 * Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata)
2006 (eccdata): Arrange for compiling these programs for running on the
2007 build system, also when cross compiling everything else.
2009 * config.make.in (CC_FOR_BUILD, EXEEXT_FOR_BUILD): New variables.
2011 * configure.ac: Use GMP_PROG_CC_FOR_BUILD and
2012 GMP_PROG_EXEEXT_FOR_BUILD.
2014 * aclocal.m4 (GMP_PROG_CC_FOR_BUILD, GMP_PROG_CC_FOR_BUILD_WORKS)
2015 (GMP_PROG_EXEEXT_FOR_BUILD): New macros, based on GMP's.
2017 * aesdata.c: Deleted includes of config.h and nettle-types.h. Use
2018 unsigned char and unsigned long instead of stdint.h types.
2020 * desdata.c: Deleted includes of config.h and desCode.h.
2021 (main): Return 1 on invalid argument. Don't use ROR macro. Use
2022 unsigned long instead of uint32_t, and make it work if unsigned
2023 long is larger than 32 bits.
2025 * gcmdata.c: Deleted include of config.h and use UNUSED macro.
2026 * shadata.c: Likewise.
2028 * twofishdata.c: Deleted include of nettle-types.h. Use unsigned
2029 char instead of stdint.h types.
2031 * x86_64/ecc-521-modp.asm: New file. 2.4 time speedup.
2033 2013-03-06 Niels Möller <nisse@lysator.liu.se>
2035 * x86_64/ecc-384-modp.asm: New file, 3 time speedup.
2036 * x86_64/ecc-256-redc.asm: New file, 2.5 time speedup.
2037 * x86_64/ecc-224-modp.asm: New file, 5 time speedup over C
2040 2013-03-05 Niels Möller <nisse@lysator.liu.se>
2042 * configure.ac (asm_optional_list): Added ecc-521-modp.asm.
2043 * ecc-521.c: Check HAVE_NATIVE_ecc_521_modp, and use native
2044 version if available.
2045 * armv7/ecc-521-modp.asm: New file, 2 time speedup over C version.
2047 2013-03-04 Niels Möller <nisse@lysator.liu.se>
2049 * configure.ac (asm_optional_list): Added ecc-384-modp.asm. Deleted
2050 bogus reference to $asm_search_list.
2051 * ecc-384.c: Check HAVE_NATIVE_ecc_384_modp, and use native
2052 version if available.
2053 * armv7/ecc-384-modp.asm: New file, 3 time speedup over C version.
2055 2013-03-03 Niels Möller <nisse@lysator.liu.se>
2057 * ecc-256.c: Fixed definition of USE_REDC.
2059 2013-03-01 Niels Möller <nisse@lysator.liu.se>
2061 * ecc-256.c: Check HAVE_NATIVE_ecc_256_redc, and use native
2062 version if available.
2063 * armv7/ecc-256-redc.asm: New file, 4 time speedup over C version.
2065 * testsuite/ecc-redc-test.c: Increased test count.
2067 * ecc-224.c: Check HAVE_NATIVE_ecc_224_modp, and use native
2068 version if available.
2069 * armv7/ecc-224-modp.asm: New file, 4.5 time speedup over C
2072 * configure.ac (asm_optional_list): Added ecc-224-modp.asm.
2073 (OPT_ASM_SOURCES): Fixed assignment.
2075 2013-02-28 Niels Möller <nisse@lysator.liu.se>
2077 * x86_64/ecc-192-modp.asm: Reorganized to reduce number of
2078 additions. Use setc instruction.
2080 * examples/Makefile.in: Let $(HOGWEED_TARGETS) depend on
2083 * armv7/ecc-192-modp.asm: New file. 2.5 time speedup over C
2086 2013-02-27 Niels Möller <nisse@lysator.liu.se>
2088 * ecc-192.c: Check HAVE_NATIVE_ecc_192_modp, and use native
2089 version if available.
2090 (ecc_192_modp): Fixed carry handling bug in 32-bit version.
2092 * x86_64/ecc-192-modp.asm: New file. 3.8 times speedup over C
2095 * configure.ac (OPT_ASM_SOURCES): New substituted variable.
2096 (asm_replace_list, asm_optional_list): New variables. For files in
2097 asm_optional_list, also add them to OPT_ASM_SOURCES and define
2098 appropriate HAVE_NATIVE_* symbols found.
2100 * Makefile.in (OPT_ASM_SOURCES): New variable. Used for setting
2101 hogweed_OBJS and hogweed_PURE_OBJS.
2103 * testsuite/ecc-mod-test.c: Increased test count.
2105 * ecc-384.c (ecc_384_modp): Fixed typo which broke carry handling
2106 in the 64-bit version.
2108 * examples/ecc-benchmark.c (bench_add_jjj): Typo fix, benchmark
2111 * gmp-glue.h: Check if GMP provides mpz_limbs_read (expected in
2113 * gmp-glue.c: Use GMP's mpz_limbs_read and friends if available.
2114 Renamed all functions for consistency with GMP. Updated all
2117 2013-02-20 Niels Möller <nisse@lysator.liu.se>
2119 * examples/Makefile.in (HOGWEED_TARGETS): Added
2120 hogweed-benchmark$(EXEEXT).
2121 (SOURCES): Added hogweed-benchmark.c.
2122 (hogweed-benchmark$(EXEEXT)): New target.
2124 * examples/hogweed-benchmark.c: New file.
2126 * ecdsa-keygen.c (ecdsa_generate_keypair): New file and function.
2127 * Makefile.in (hogweed_SOURCES): Added ecdsa-keygen.c.
2128 * testsuite/ecdsa-keygen-test.c: New testcase.
2129 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2130 ecdsa-keygen-test.c.
2132 * nettle-internal.h (TMP_ALLOC): Added missing parentheses.
2134 2013-02-18 Niels Möller <nisse@lysator.liu.se>
2136 * testsuite/ecdsa-verify-test.c: New testcase.
2137 * testsuite/ecdsa-sign-test.c: New testcase.
2138 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2139 ecdsa-sign-test.c and ecdsa-verify-test.c.
2140 * testsuite/testutils.h: Include ecdsa.h.
2141 (SHEX): Deleted const cast.
2143 * ecc-point.c: New file, struct ecc_point abstraction.
2144 * ecc-scalar.c: New file, struct ecc_scalar abstraction.
2145 * ecc-random.c (ecc_modq_random, ecc_scalar_random): New file, new
2147 * ecc-hash.c (ecc_hash): New file and function.
2148 * ecc-ecdsa-sign.c: New file, low-level signing interface.
2149 * ecc-ecdsa-verify.c: New file, low-level ecdsa verify.
2150 * ecdsa-sign.c: (ecdsa_sign): New file and function.
2151 * ecdsa-verify.c (ecdsa_verify): New file and function.
2152 * ecdsa.h: New header file.
2153 * ecc.h: Declare ecc_point and ecc_scalar functions.
2154 * ecc-internal.h: Added declarations.
2155 * Makefile.in (hogweed_SOURCES): Added new source files.
2156 (HEADERS): Added ecdsa.h.
2158 * gmp-glue.c (_mpz_set_mpn): New convenience function.
2159 (_mpn_set_base256): New function.
2160 (_gmp_alloc_limbs): New function.
2161 (_gmp_free_limbs): New function.
2162 * gmp-glue.h: Corresponding declarations. Include nettle-stdinh.h.
2164 * examples/Makefile.in (HOGWEED_TARGETS): Renamed, was
2165 RSA_TARGETS. Added ecc-benchmark$(EXEEXT).
2166 (SOURCES): Added ecc-benchmark.c.
2167 (ecc-benchmark$(EXEEXT)): New target.
2169 * examples/ecc-benchmark.c: New file, benchmarking ecc primitives.
2171 2013-02-15 Niels Möller <nisse@lysator.liu.se>
2173 Integrate ecc_mul_a.
2174 * ecc-a-to-j.c: New file.
2175 * ecc-add-jjj.c: New file.
2176 * ecc-mul-a.c: New file.
2177 * Makefile.in (hogweed_SOURCES): Added new files.
2178 * testsuite/ecc-mul-a-test.c: New file.
2179 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2182 * testsuite/testutils.c: Removed redundant includes.
2183 (die): New function.
2185 Integrate ecc_mul_g.
2187 * ecc-j-to-a.c: New file.
2188 * ecc-size.c: New file.
2189 * ecc-add-jja.c: New file.
2190 * ecc-dup-jj.c: New file.
2191 * ecc-mul-g.c: New file.
2192 * sec-tabselect.c: New file.
2193 * Makefile.in (hogweed_SOURCES): Added new files.
2194 (HEADERS): Added ecc.h
2195 * testsuite/ecc-mul-g-test.c: New file.
2196 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
2198 * testsuite/testutils.c (xalloc_limbs): New function.
2199 (test_mpn): New function.
2200 (test_ecc_point): New function.
2201 (test_ecc_mul_a): New function.
2202 (test_ecc_mul_j): New function.
2203 * testsuite/testutils.h: Corresponding declarations.
2205 Integrate ECC internals.
2206 * ecc-curve.h: New file.
2207 * ecc-internal.h: New file.
2208 * cnd-copy.c: New file.
2209 * ecc-192.c: New file.
2210 * ecc-224.c: New file.
2211 * ecc-256.c: New file.
2212 * ecc-384.c: New file.
2213 * ecc-521.c: New file.
2214 * ecc-generic-modp.c: New file.
2215 * ecc-generic-modq.c: New file.
2216 * ecc-generic-redc.c: New file.
2217 * ecc-mod.c: New file.
2218 * ecc-modp.c: New file.
2219 * ecc-modq.c: New file.
2220 * sec-add-1.c: New file.
2221 * sec-modinv.c: New file.
2222 * sec-sub-1.c: New file.
2223 * Makefile.in (hogweed_SOURCES): Added new files.
2224 (HEADERS): Added ecc-curve.h.
2225 (DISTFILES): Added ecc-internal.h.
2226 * testsuite/ecc-mod-test.c: New file.
2227 * testsuite/ecc-modinv-test.c: New file.
2228 * testsuite/ecc-redc-test.c: New file.
2229 * testsuite/testutils.c (ecc_curves): New constant array.
2230 * testsuite/testutils.h: Include ecc-related headers. Declare
2232 * testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added ecc-mod-test.c
2233 ecc-modinv-test.c ecc-redc-test.c.
2235 * gmp-glue.c: New file, mpn <-> mpz conversions.
2236 * gmp-glue.h: New file.
2237 * Makefile.in: Added to hogweed_SOURCES and DISTFILES, respectively.
2239 * eccdata.c: New program, for generating ECC-related tables.
2240 * Makefile.in (ecc-192.h, ecc-224.h, ecc-256.h, ecc-384.h)
2241 (ecc-512.h): New generated files.
2243 2013-02-19 Niels Möller <nisse@lysator.liu.se>
2245 * armv7/memxor.asm (memxor): Software pipelining for the aligned
2246 case. Runs at 6 cycles (0.5 cycles per byte). Delayed push of
2247 registers until we know how many registers we need.
2248 (memxor3): Use 3-way unrolling also for aligned memxor3.
2249 Runs at 8 cycles (0.67 cycles per byte)
2251 2013-02-14 Niels Möller <nisse@lysator.liu.se>
2253 * configure.ac: Find GMP's GMP_NUMB_BITS. Substitute in Makefile.
2254 * config.make.in (GMP_NUMB_BITS): New variable.
2256 * examples/rsa-keygen.c (uint_arg): New function.
2257 (main): New options -s and -e, to specify key size and public
2258 exponent. Increased default key size to 2048.
2260 2013-02-12 Niels Möller <nisse@lysator.liu.se>
2262 * armv7/memxor.asm (memxor): Optimized aligned case, using 3-way
2265 2013-02-06 Niels Möller <nisse@lysator.liu.se>
2267 * armv7/memxor.asm (memxor, memxor3): Optimized aligned case, now
2268 runs at 0.75 cycles/byte.
2270 * armv7/README: New file.
2271 * armv7/machine.m4: New (empty) file.
2272 * armv7/memxor.asm: Initial assembly implementation.
2274 * config.m4.in: Substitute ASM_TYPE_PROGBITS as TYPE_PROGBITS.
2276 * config.make.in: Added .s to the suffix list.
2278 * Makefile.in (.asm.s): Use a separate make target for .asm
2279 preprocessing. Include asm.d, which the corresponding
2282 * configure.ac (asm_file_list): Collect assembly files into this
2284 (asm.d): Make config.status write dependencies for .s files into
2286 (ASM_ALIGN_LOG): Set to "no" when appropriate.
2287 (ASM_TYPE_FUNCTION): Default to "@function".
2288 (ASM_TYPE_PROGBITS): New substituted variable, set in the same way
2289 as ASM_TYPE_FUNCTION.
2290 (ASM_MARK_NOEXEC_STACK): Use TYPE_PROGBITS.
2291 (asm_path): Set up asm_path for armv7.
2293 * asm.m4: Use changecom to disable m4 quoting. Use divert to
2296 2013-02-05 Niels Möller <nisse@lysator.liu.se>
2298 * testsuite/rsa-keygen-test.c (test_main): Updated expected
2299 signatures, after the nettle_mpz_random change below.
2300 * testsuite/dsa-test.c (test_main): Likewise. Also fixed the
2301 dsa256 test to actually use the expected signature.
2303 2013-01-31 Niels Möller <nisse@lysator.liu.se>
2305 * bignum-random.c (nettle_mpz_random): Increased number of extra
2306 bits to 64, following FIPS 186-3.
2308 2013-01-16 Niels Möller <nisse@lysator.liu.se>
2310 * Released nettle-2.6.
2312 2013-01-12 Niels Möller <nisse@lysator.liu.se>
2314 * configure.ac: Use AC_LANG_SOURCE.
2316 2013-01-02 Niels Möller <nisse@lysator.liu.se>
2318 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.5.
2319 (LIBHOGWEED_MINOR): And to 2.3.
2321 * examples/Makefile.in: Explicit rules for building objects in
2323 * tools/Makefile.in: Likewise.
2324 * testsuite/Makefile.in: Likewise.
2326 2013-01-01 Niels Möller <nisse@lysator.liu.se>
2328 * nettle.texinfo (Recommended hash functions): Document additional
2331 * examples/nettle-benchmark.c (main): Benchmark additional sha3
2334 2012-12-30 Niels Möller <nisse@lysator.liu.se>
2336 * sha3-224.c, sha3-224-meta.c: New files.
2337 * sha3-384.c, sha3-384-meta.c: New files.
2338 * sha3-512.c, sha3-512-meta.c: New files.
2339 * sha3.h: Prototypes for sha3 with sizes 224, 384 and 512.
2340 * nettle-meta.h: Declare nettle_sha3_224, nettle_sha3_384 and
2342 * Makefile.in (nettle_SOURCES): Added new sha3 files.
2344 * testsuite/sha3-224-test.c: New file.
2345 * testsuite/sha3-384-test.c: New file.
2346 * testsuite/sha3-512-test.c: New file.
2347 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added new sha3 test files.
2349 * configure.ac: Disabled use of sha3-permute.asm.
2351 2012-12-20 Niels Möller <nisse@lysator.liu.se>
2354 * testsuite/des-compat-test.c (pt): Use proper prototype, use
2356 * testsuite/testutils.c (test_dsa_key): Deleted spurious
2359 2012-12-15 Niels Möller <nisse@lysator.liu.se>
2361 Based on a patch from Alon Bar-Lev:
2362 * Makefile.in (LIBTARGETS, SHLIBTARGET): Define as empty if static
2363 or shared libraries, respectively, are disabled.
2364 (TARGETS): Deleted @IF_SHARED@ conditional, now in the definition
2368 * configure.ac: Check for ar program. New option --disable-static.
2369 * config.make.in (AR): Use configured value.
2371 2012-12-13 Niels Möller <nisse@lysator.liu.se>
2373 * x86_64/sha3-permute.asm: Rewrote, to keep all state in
2374 registers. 2400 cycles on x86_64, only slightly faster than the
2377 2012-12-09 Niels Möller <nisse@lysator.liu.se>
2379 * sha3-permute.c (sha3_permute): Rewrote to do permutation in
2380 place. 80% speedup on x86_64, 2500 cycles.
2382 2012-12-04 Niels Möller <nisse@lysator.liu.se>
2384 * ctr.c (ctr_crypt): Fix bug reported by Tim Kosse. Don't
2385 increment the counter when length is zero (was broken for the
2388 * testsuite/ctr-test.c (test_main): Added test with zero-length
2390 * testsuite/testutils.c (test_cipher_ctr): Check the ctr value
2391 after encrypt and decrypt.
2393 2012-12-03 Niels Möller <nisse@lysator.liu.se>
2395 * sha3-permute.c (sha3_permute): Optimized, to reduce number of
2396 passes over the data. 20% speedup on x86_64, 4700 cycles.
2398 * configure.ac: Added sha3-permute.asm.
2400 * x86_64/sha3-permute.asm: New file. 30% speedup over current C
2403 * nettle.texinfo (Hash functions): Split into several sections,
2404 separating recommended hash functions and legacy hash functions.
2407 2012-12-02 Niels Möller <nisse@lysator.liu.se>
2409 Split sha.h into new files sha1.h and sha2.h. Replaced all
2410 internal usage of sha.h in all files.
2411 * sha.h: Kept for compatibility, just includes both new files.
2414 * Makefile.in (HEADERS): Added sha1.h and sha2.h.
2416 2012-11-28 Niels Möller <nisse@lysator.liu.se>
2418 From Fredrik Thulin:
2419 * testsuite/pbkdf2-test.c (test_main): Add PBKDF2-HMAC-SHA512 test
2422 2012-11-15 Niels Möller <nisse@lysator.liu.se>
2424 * sha3-permute.c (sha3_permute): Use ULL suffix on round
2425 constants. Avoid passing shift count 0 to ROTL64.
2427 * sha3.c (sha3_absorb): Fixed big-endian code. Need macros.h.
2429 * macros.h (LE_READ_UINT64): New macro.
2431 2012-11-13 Niels Möller <nisse@lysator.liu.se>
2433 * sha3-permute.c (sha3_permute): Micro optimizations. Partial
2434 unrolling. Use lookup table for the permutation. On an x86_64,
2435 execution time reduced from appr. 13000 cycles to appr. 6000.
2437 * examples/nettle-benchmark.c (TIME_CYCLES): New macro.
2438 (bench_sha1_compress, bench_salsa20_core): Use it.
2439 (bench_sha3_permute): New function.
2440 (main): Call bench_sha3_permute.
2442 2012-11-12 Niels Möller <nisse@lysator.liu.se>
2444 * examples/nettle-benchmark.c (main): Benchmark sha3_256.
2446 * sha3-permute.c: New file. Permutation function for sha3, aka
2448 * sha3.h: New header file.
2449 * sha3.c: New file, absorption and padding for sha3.
2450 * sha3-256.c: New file.
2451 * sha3-256-meta.c: New file.
2452 * nettle-meta.h (nettle_sha3_256): Declare.
2453 * Makefile.in (nettle_SOURCES): Added sha3 files.
2454 (HEADERS): Added sha3.h.
2455 * testsuite/sha3.awk: New file. Script to extract test vectors.
2456 * testsuite/sha3-256-test.c: New file.
2457 * testsuite/sha3-permute-test.c: New file.
2458 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2459 sha3-permute-test.c and sha3-256-test.c.
2460 (DISTFILES): Added sha3.awk.
2461 * testsuite/.test-rules.make: Added sha3 targets.
2463 * macros.h (LE_WRITE_UINT64): New macro.
2464 * write-le64.c (_nettle_write_le64): New file and function.
2465 * nettle-write.h (_nettle_write_le64): Declare. Also deleted
2466 declaration of non-existent _nettle_write_be64.
2467 * Makefile.in (nettle_SOURCES): Added write-le64.c.
2469 * macros.h (ROTL64): New macro, moved from...
2470 * sha512-compress.c (ROTL64): ... old location, deleted.
2472 * serpent-internal.h [HAVE_NATIVE_64_BIT] (DROTL32): Renamed from...
2473 (ROTL64): ... old name.
2474 (DRSHIFT32): Renamed from ...
2475 (RSHIFT64): ... old name.
2476 * serpent-encrypt.c (LINEAR_TRANSFORMATION64): Updated for above
2478 * serpent-decrypt.c (LINEAR_TRANSFORMATION64_INVERSE): Likewise.
2480 2012-11-11 Niels Möller <nisse@lysator.liu.se>
2482 From Nikos Mavrogiannopoulos:
2483 * nettle.texinfo (Hash functions): Added documentation for
2485 * examples/nettle-benchmark.c (main): Benchmark gosthash94.
2487 2012-11-10 Niels Möller <nisse@lysator.liu.se>
2489 * nettle.texinfo (nettle_hashes, nettle_ciphers): Use deftypevr,
2490 not deftypevrx. Spotted by Nikos Mavrogiannopoulos.
2492 2012-11-08 Niels Möller <nisse@lysator.liu.se>
2494 Gost hash function, ported from Aleksey Kravchenko's rhash library
2495 by Nikos Mavrogiannopoulos.
2496 * gosthash94.c: New file.
2497 * gosthash94.h: New file.
2498 * gosthash94-meta.c: New file.
2499 * nettle-meta.h (nettle_gosthash94): Declare.
2500 * Makefile.in (nettle_SOURCES): Added gosthash94.c and
2502 (HEADERS): Added gosthash94.h.
2503 * testsuite/gosthash94-test.c: New file.
2504 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
2507 2012-10-29 Niels Möller <nisse@lysator.liu.se>
2509 From Martin Storsjö:
2510 * configure.ac (dummy-dep-files): Avoid non-posix \|-operator in
2513 2012-10-29 Niels Möller <nisse@lysator.liu.se>
2515 * x86_64/salsa20-core-internal.asm: New file.
2516 * configure.ac: Added salsa20-core-internal.asm.
2517 * examples/nettle-benchmark.c (bench_salsa20_core): New function.
2519 2012-10-27 Niels Möller <nisse@lysator.liu.se>
2521 * testsuite/Makefile.in (TS_SOURCES, CXX_SOURCES): Include sources
2523 (TS_CXX): Moved @IF_CXX@ conditional here.
2524 (DISTFILES): Use $(SOURCES), which now includes all C source
2525 files. testutils.c was lost in a the 2012-09-20 change.
2527 * x86_64/salsa20-crypt.asm: Include x86_64/salsa20.m4.
2528 Make all exits go via .Lend and W64_EXIT.
2530 * x86_64/salsa20.m4: New file, extracted from
2531 x86_64/salsa20-crypt.asm.
2533 2012-10-26 Niels Möller <nisse@lysator.liu.se>
2535 * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LIBS): Add $(CFLAGS) on
2536 the link command line. Reported by Dennis Clarke.
2538 2012-10-03 Niels Möller <nisse@lysator.liu.se>
2540 From: Nikos Mavrogiannopoulos:
2541 * testsuite/testutils.c (test_hash): On failure, print the
2542 expected and returned hash values.
2544 2012-09-23 Niels Möller <nisse@lysator.liu.se>
2546 * Makefile.in (nettle_SOURCES): Added salsa20-core-internal.c.
2548 * salsa20-core-internal.c (_salsa20_core): New file and function,
2549 extracted from salsa20_crypt.
2550 * salsa20.h (_salsa20_core): Declare it.
2551 * salsa20-crypt.c (salsa20_crypt): Use _salsa20_core.
2553 2012-09-21 Niels Möller <nisse@lysator.liu.se>
2555 * pbkdf2.c (pbkdf2): assert that iterations > 0. Reorganized
2558 * nettle.texinfo (Cipher functions): Stress that the salsa20 hash
2559 function is not suitable as a general hash function.
2561 2012-09-20 Simon Josefsson <simon@josefsson.org>
2563 * pbkdf2-hmac-sha1.c, pbkdf2-hmac-sha256.c: New files.
2564 * pbkdf2.h (pbkdf2_hmac_sha1, pbkdf2_hmac_sha256): New prototypes.
2565 * Makefile.in (nettle_SOURCES): Add pbkdf2-hmac-sha1.c and
2566 pbkdf2-hmac-sha256.c.
2567 * nettle.texinfo (Key derivation functions): Improve.
2568 * testsuite/pbkdf2-test.c (test_main): Test new functions.
2570 2012-09-20 Niels Möller <nisse@lysator.liu.se>
2572 * pbkdf2.c (pbkdf2): Reordered arguments, for consistency.
2573 * pbkdf2.h (PBKDF2): Analogous reordering.
2574 * testsuite/pbkdf2-test.c: Adapted to new argument order. Also use
2576 * nettle.texinfo (Key derivation functions): Updated documented
2579 * testsuite/Makefile.in (VALGRIND): New variable, to make valgrind
2582 * configure.ac: New substitution IF_CXX, replacing CXX_TESTS.
2583 (dummy-dep-files): Handle .cxx files.
2585 * testsuite/Makefile.in: Use IF_CXX. Include dependency file for
2588 2012-09-19 Niels Möller <nisse@lysator.liu.se>
2591 * examples/rsa-encrypt.c (main): Added missing mpz_clear.
2592 * examples/rsa-keygen.c (main): Added missing deallocation.
2594 * testsuite/meta-hash-test.c (test_main): Validate
2595 NETTLE_MAX_HASH_DIGEST_SIZE.
2597 * pbkdf2.h (PBKDF2): New macro.
2598 * testsuite/pbkdf2-test.c: Use it.
2600 2012-09-12 Simon Josefsson <simon@josefsson.org>
2602 * NEWS: Mention addition of PBKDF2.
2603 * pbkdf2.c (pbkdf2): New file and function.
2604 * pbkdf2.h: Declare it.
2605 * Makefile.in (nettle_SOURCES): Add pbkdf2.c.
2606 (HEADERS): Add pbkdf2.h.
2607 * nettle.texinfo (Key derivation functions): New section.
2608 * testsuite/pbkdf2-test.c: New test case.
2609 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Add pbkdf2-test.c.
2610 * testsuite/.test-rules.make (pbkdf2-test): New target.
2612 2012-09-16 Niels Möller <nisse@lysator.liu.se>
2614 * testsuite/: Overhaul of testsuite, affecting almost all files.
2615 + Use struct tstring for allocated strings, and deallocate before
2617 + Changed most test functions to take struct tstring as arguments.
2618 + Made all test_main return on success.
2620 * testsuite/testutils.h (struct tstring): New struct type.
2621 (H2, HL, MEMEQH, SUCCESS): Deleted macros.
2622 (SHEX, SDATA): New macros.
2623 (H): Redefined to track storage.
2625 * testsuite/testutils.c (tstring_alloc): New function.
2626 (tstring_clear): New function.
2627 (tstring_data): New function.
2628 (tstring_hex): New function.
2629 (tstring_print_hex): New function.
2630 (decode_hex_length): Made static.
2631 (decode_hex): Made static. No return value, abort on error.
2632 (main): Expect test_main to return, and call tstring_clear before
2634 (test_dsa_key): Added missing mpz_clear.
2635 (test_mac): Deleted unused function.
2637 * testsuite/rsa2sexp-test.c (test_main): Added missing
2638 nettle_buffer_clear.
2640 * testsuite/yarrow-test.c (open_file): Don't leak filename.
2641 (test_main): fclose input file properly.
2643 * testsuite/sexp-format-test.c (test_main): Added missing calls to
2644 nettle_buffer_clear and mpz_clear.
2646 * testsuite/serpent-test.c (tstring_hex_reverse): New function,
2648 (decode_hex_reverse): ... deleted function.
2649 (RHEX): New macro, replacing...
2650 (RH, RHL): ... deleted macros.
2652 * testsuite/rsa2sexp-test.c (test_main): Added missing
2653 nettle_buffer_clear.
2655 * testsuite/random-prime-test.c (test_main): Added missing
2658 * realloc.c (nettle_realloc): Only call libc realloc if length >
2659 0, otherwise call free. Fixes a small memory leak.
2660 (nettle_xrealloc): Likewise.
2662 * run-tests (test_program): Don't quote $EMULATOR; allow it to
2663 expand to program and arguments (e.g., valgrind).
2665 * tools/pkcs1-conv.c (convert_public_key): Added missing calls to
2666 dsa_public_key_clear and rsa_public_key_clear.
2667 (main): Added missing nettle_buffer_clear.
2669 2012-09-10 Niels Möller <nisse@lysator.liu.se>
2671 * examples/eratosthenes.c (main): Explicitly deallocate storage
2674 * examples/io.c (read_file): Explicitly treat an empty file as an
2675 error. Rearrange loop, check for short fread return value.
2677 * desdata.c: Don't declare printf, include <stdio.h> instead. Also
2678 deleted casts of printf return value.
2681 * examples/nettle-benchmark.c (die): Use PRINTF_STYLE attribute.
2682 * pgp-encode.c (pgp_put_rsa_sha1_signature): Deleted unused variable.
2683 * rsa2openpgp.c (rsa_keypair_to_openpgp): Likewise.
2684 * examples/base16enc.c (main): Deleted useless allocations.
2686 2012-09-07 Niels Möller <nisse@lysator.liu.se>
2688 * examples/nettle-benchmark.c (die): Add NORETURN attribute. Patch
2690 * tools/misc.h (die, werror): Use PRINTF_STYLE and NORETURN macros
2691 for attributes. Patch from Tim Rühsen.
2693 * examples/io.h (werror): Use PRINTF_STYLE macro.
2695 2012-08-22 Niels Möller <nisse@lysator.liu.se>
2697 From Sam Thursfield <sam.thursfield@codethink.co.uk>:
2698 * configure.ac: Make documentation optional, to avoid requiring
2699 TeX. New option --disable-documentation, and Makefile substitution
2701 * Makefile.in: Use IF_DOCUMENTATION.
2703 2012-07-12 Niels Möller <nisse@lysator.liu.se>
2705 * asm.m4 (ALIGN): Use << operator rather than **, with m4 eval.
2706 The latter is not supported by BSD m4.
2708 2012-07-07 Niels Möller <nisse@lysator.liu.se>
2710 Copyright headers: Updated FSF address. Patch from David Woodhouse.
2712 * examples/Makefile.in (BENCH_LIBS): Added -lm, needed for the
2713 ldexp function. Reported by Anthony G. Basile.
2715 * configure.ac: Changed version number to 2.6.
2717 * Released nettle-2.5.
2719 2012-07-05 Niels Möller <nisse@lysator.liu.se>
2721 * x86_64/salsa20-crypt.asm (salsa20_crypt): Write the 64-bit movq
2722 instructions as "movd", since that makes the osx assembler
2723 happier. Assembles to the same machine code on gnu/linux.
2725 2012-07-03 Niels Möller <nisse@lysator.liu.se>
2727 * aclocal.m4 (LSH_FUNC_ALLOCA): In the config.h boilerplate,
2728 include malloc.h if it exists, also when compiling with gcc.
2729 Needed for cross-compiling with --host=i586-mingw32msvc.
2731 * examples/base16dec.c: Don't #include files using <nettle/...>,
2732 we don't want to pick up installed versions. On windows, include
2733 <fcntl.h>, needed for _setmode.
2734 * examples/base16enc.c: Likewise.
2735 * examples/base64dec.c: Likewise.
2736 * examples/base64enc.c: Likewise
2738 * nettle.texinfo (Cipher functions): Document Salsa20.
2740 2012-06-25 Niels Möller <nisse@lysator.liu.se>
2742 * pkcs1.c (_pkcs1_signature_prefix): Renamed function, adding a
2743 leading underscore. Updated all callers.
2745 * bignum-next-prime.c (nettle_next_prime): Consistently use the
2746 type nettle_random_func * (rather then just nettle_random_func)
2747 when passing the function pointer as argument. Similar change for
2748 nettle_progress_func. Should have been done for the 2.0 release,
2749 but a few arguments were overlooked.
2750 * bignum-random-prime.c (_nettle_generate_pocklington_prime)
2751 (nettle_random_prime): Likewise.
2752 * bignum-random.c (nettle_mpz_random_size, nettle_mpz_random):
2754 * dsa-keygen.c (dsa_generate_keypair): Likewise.
2755 * dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise.
2756 * dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
2758 * dsa-sign.c (_dsa_sign): Likewise.
2759 * pkcs1-encrypt.c (pkcs1_encrypt): Likewise.
2760 * rsa-blind.c (_rsa_blind): Likewise.
2761 * rsa-decrypt-tr.c (rsa_decrypt_tr): Likewise.
2762 * rsa-encrypt.c (rsa_encrypt): Likewise.
2763 * rsa-keygen.c (rsa_generate_keypair): Likewise.
2764 * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): Likewise.
2766 * cbc.c (cbc_encrypt, cbc_decrypt): Similarly, use the type
2767 nettle_crypt_func * rather than just nettle_crypt_func.
2768 * ctr.c (ctr_crypt): Likewise.
2769 * gcm.c (gcm_set_key): Likewise.
2771 * testsuite/des-compat-test.c (test_main): Disable declarations of
2772 disabled functions and variables, to avoid warnings. No verbose
2773 output unless verbose flag is set.
2775 2012-06-09 Niels Möller <nisse@lysator.liu.se>
2777 * examples/Makefile.in (SOURCES): Added base16dec.c, forgotten
2780 General pkcs1 signatures, with a "DigestInfo" input. Suggested by
2781 Nikos Mavrogiannopoulos.
2782 * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-digest.c,
2783 rsa-pkcs1-sign.c, rsa-pkcs1-sign-tr.c, and rsa-pkcs1-verify.c.
2785 * pkcs1-rsa-digest.c (pkcs1_rsa_digest_encode): New file and
2787 * pkcs1.h: Declare it.
2789 * rsa-pkcs1-verify.c (rsa_pkcs1_verify): New file and function.
2790 * rsa-pkcs1-sign.c (rsa_pkcs1_sign): New file and function.
2791 * rsa-pkcs1-sign-tr.c (rsa_pkcs1_sign_tr): New file and function,
2792 contributed by Nikos Mavrogiannopoulos.
2793 * rsa.h: Declare new functions.
2795 * rsa.h (_rsa_blind, _rsa_unblind): Declare functions.
2796 * rsa-blind.c (_rsa_blind, _rsa_unblind): Functions moved to a
2797 separate file, renamed and made non-static. Moved from...
2798 * rsa-decrypt-tr.c: ... here.
2800 2012-06-03 Niels Möller <nisse@lysator.liu.se>
2802 * testsuite/pkcs1-test.c (test_main): Include leading zero in
2805 * pkcs1.c (pkcs1_signature_prefix): Return pointer to where the
2806 digest should be written. Let the size input be the key size in
2807 octets, rather then key size - 1.
2808 * pkcs1-rsa-*.c: Updated for above.
2809 * rsa-*-sign.c, rsa-*-verify.c: Pass key->size, not key->size - 1.
2811 2012-05-18 Niels Möller <nisse@lysator.liu.se>
2813 * pkcs1-encrypt.c (pkcs1_encrypt): New file and function.
2814 * rsa-encrypt.c (rsa_encrypt): Use pkcs1_encrypt.
2816 2012-05-09 Niels Möller <nisse@lysator.liu.se>
2818 * rsa-decrypt-tr.c (rsa_decrypt_tr): Added missing mpz_clear,
2819 spotted by Nikos Mavrogiannopoulos.
2821 2012-05-07 Niels Möller <nisse@lysator.liu.se>
2823 * nettle-types.h (_STDINT_HAVE_INT_FAST32_T): Define here, to
2824 force nettle-stdint.h to not try to define the int_fast*_t types.
2825 Avoids compilation problems with gnutls on SunOS-5.8, where the
2826 definitions here collide with gnulib's.
2828 2012-04-23 Niels Möller <nisse@lysator.liu.se>
2830 * nettle-internal.h (NETTLE_MAX_BIGNUM_SIZE): New constant. Based
2831 on NETTLE_MAX_BIGNUM_BITS, rounded upwards. Replaced all uses of
2832 NETTLE_MAX_BIGNUM_BITS.
2834 2012-04-19 Niels Möller <nisse@lysator.liu.se>
2836 * list-obj-sizes.awk: Use decimal rather than hexadecimal output.
2837 (hex2int): Use local variables.
2839 2012-04-18 Niels Möller <nisse@lysator.liu.se>
2841 * x86_64/salsa20-crypt.asm: New file.
2843 2012-04-17 Niels Möller <nisse@lysator.liu.se>
2845 * testsuite/salsa20-test.c (test_salsa20_stream): Check that
2846 salsa20_crypt doesn't write beyond the given destination area.
2847 (test_salsa20): Likewise.
2849 * salsa20-crypt.c: Renamed file, from...
2850 * salsa20.c: ... old name.
2852 * x86_64/machine.m4 (WREG): New macro.
2854 * salsa20.c (salsa20_hash): Deleted function, inlined into
2856 (salsa20_set_key, salsa20_set_iv): Moved, to...
2857 * salsa20-set-key.c: ...new file.
2859 2012-04-15 Niels Möller <nisse@lysator.liu.se>
2861 * testsuite/salsa20-test.c (test_salsa20_stream): New function.
2862 (test_main): Tests for encrypting more than one block at a time.
2864 2012-04-14 Niels Möller <nisse@lysator.liu.se>
2866 * examples/io.c (write_file): Use write_string.
2868 * examples/Makefile.in (base64enc): New targets. Also
2869 added missing io.o dependency to several other targets.
2870 (base64dec, base16enc, base16dec): Likewise.
2872 * examples/base64enc.c: New file, based on example code
2873 contributed by Jeronimo Pellegrini.
2874 * examples/base64dec.c: Likewise.
2875 * examples/base16enc.c: Likewise.
2876 * examples/base16dec.c: Likewise.
2878 * examples/rsa-encrypt.c (process_file): Reorganized fread loop.
2879 (usage): New function.
2880 (main): Implemented --help option.
2882 * examples/rsa-decrypt.c (process_file): Improved error message
2883 for too short input file.
2885 * aes-set-decrypt-key.c (gf2_log, gf2_exp): Deleted tables.
2886 (mult, inv_mix_column): Deleted functions.
2887 (mtable): New table.
2888 (MIX_COLUMN): New macro.
2889 (aes_invert_key): Use MIX_COLUMN and mtable.
2891 * aesdata.c (compute_mtable): New table, for the inv mix column
2892 operation in aes_invert_key.
2894 2012-04-13 Niels Möller <nisse@lysator.liu.se>
2896 * aes-set-encrypt-key.c (aes_set_encrypt_key): Use LE_READ_UINT32.
2897 Tabulate the needed "round constants".
2898 (xtime): Deleted function.
2900 * aes-internal.h (SUBBYTE): Cast to uint32_t. Use B0, ..., B3
2903 2012-04-09 Niels Möller <nisse@lysator.liu.se>
2905 Timing resistant RSA decryption, based on RSA blinding code
2906 contributed by Nikos Mavrogiannopoulos.
2907 * rsa-decrypt-tr.c (rsa_decrypt_tr): New function.
2908 (rsa_blind): Helper function.
2909 (rsa_unblind): Helper function.
2910 * rsa.h: Declare rsa_decrypt_tr. Some cleanups, no longer include
2911 nettle-meta.h, more consistent declarations of function pointer
2913 * testsuite/rsa-encrypt-test.c (test_main): Test rsa_decrypt_tr.
2914 Check for writes past the end of the message area.
2916 * Makefile.in (hogweed_SOURCES): Added pkcs1-decrypt.c.
2917 * rsa-decrypt.c (rsa_decrypt): Use pkcs1_decrypt.
2918 * pkcs1-decrypt.c (pkcs1_decrypt): New file and function,
2919 extracted from rsa_decrypt.
2921 2012-04-01 Niels Möller <nisse@lysator.liu.se>
2923 * salsa20.c (LE_SWAP32): Typo fix for big-endian case.
2924 (QROUND): New macro.
2925 (salsa20_hash): Use it.
2927 2012-03-31 Niels Möller <nisse@lysator.liu.se>
2929 * salsa20.c: (salsa20_set_iv): Deleted size argument, only one
2931 (U8TO32_LITTLE): Deleted macro. Use LE_READ_UINT32 instead, which
2932 avoids unaligned reads.
2933 (salsa20_set_key): Rearranged slightly, to avoid unnecessary
2934 byte-to-word conversions.
2936 (LE_SWAP32): Renamed macro from...
2937 (U32TO32_LITTLE): ... old name.
2938 (U32TO8_LITTLE): Deleted macro.
2939 (salsa20_wordtobyte): Renamed function to...
2940 (salsa20_hash): ... new name. Changed output argument from byte
2941 array to word array. Use memxor3, which brings a considerable
2944 * nettle-internal.c (salsa20_set_key_hack): Updated salsa20_set_iv
2946 * testsuite/salsa20-test.c (test_salsa20): Deleted iv_length
2947 argument, updated all calls.
2949 * salsa20.h (SALSA20_BLOCK_SIZE): New constant.
2950 (_SALSA20_INPUT_LENGTH): New constant.
2951 * salsa20.c: Use these constants.
2953 * salsa20.c (ROTL32): Deleted macro, use the one from macros.h
2954 instead, with reversed order of arguments.
2955 (ROTATE, XOR, PLUS, PLUSONE): Deleted macros, use ROTL32 and
2956 builtin operators directly.
2958 Unification of rotation macros.
2959 * macros.h (ROTL32): New macro, to replace (almost) all other
2962 * aes-set-encrypt-key.c: Include macros.h.
2963 (aes_set_encrypt_key): Use ROTL32.
2964 * aes-internal.h (ROTBYTE, ROTRBYTE): Deleted macros.
2966 * camellia-internal.h (ROL32): Deleted macro.
2967 (ROTL128): Renamed for consistency, from...
2968 (ROL128): ... old name.
2969 * camellia-crypt-internal.c: Updated for renamed rotation macros.
2970 * camellia-set-encrypt-key.c: Likewise.
2971 * cast128.c (ROL): Deleted macro.
2972 (F1, F2, F3): Updated to use ROTL32 (reversed order of arguments).
2973 Also added proper do { ... } while (0) wrappers.
2975 * ripemd160-compress.c (ROL32): Deleted macro.
2976 (R): Updated to use ROTL32 (reversed order of arguments).
2978 * serpent-internal.h (ROL32): Deleted macro.
2979 (ROTL64): Renamed (from ROL64) and reorderd arguments, for
2981 (RSHIFT64): Reordered arguments, for consistency.
2982 * serpent-decrypt.c: Updated for renamed rotation macros, with
2983 reversed argument order.
2984 * serpent-encrypt.c: Likewise.
2985 * serpent-set-key.c: Likewise.
2987 * sha1-compress.c (ROTL): Deleted macro, use ROTL32 instead.
2989 * sha256-compress.c (ROTR): Deleted macro. Replaced by ROTL32,
2990 with complemented shift count.
2991 (SHR): Deleted macro, use plain shift operator instead.
2993 * sha512-compress.c (ROTR): Deleted macro, replaced by...
2994 (ROTL64): ...new macro, with complemented shift count
2995 (SHR): Deleted macro, use plain shift operator instead.
2996 (S0, S1, s0, s1): Updated accordingly.
2998 2012-03-30 Niels Möller <nisse@lysator.liu.se>
3000 * nettle-internal.c (nettle_salsa20): Cipher struct for
3001 benchmarking only. Sets a fix zero IV, and ignores block size.
3002 * nettle-internal.h (nettle_salsa20): Declare it.
3004 * examples/nettle-benchmark.c (block_cipher_p): New function.
3005 (time_cipher): Use block_cipher_p.
3006 (main): Include salsa20 in benchmark.
3008 * Makefile.in (soname link): Fixed logic.
3009 (nettle_SOURCES): Removed nettle-internal.c, so that it's not
3010 part of the library...
3011 (internal_SOURCES): ...and put it here.
3012 * testsuite/Makefile.in (TEST_OBJS): Added ../nettle-internal.o.
3013 * examples/Makefile.in (BENCH_OBJS): New variable, to simplify the
3014 nettle-benchmark rule. Also link with ../nettle-internal.o.
3016 2012-03-29 Niels Möller <nisse@lysator.liu.se>
3018 Implementation of Salsa20, contributed by Simon Josefsson.
3019 * salsa20.h: New file.
3020 * salsa20.c: New file.
3021 * Makefile.in (nettle_SOURCES): Added salsa20.c
3022 (HEADERS): Added salsa20.h.
3023 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added salsa20-test.c.
3024 * testsuite/salsa20-test.c: New test case.
3026 * Makefile.in (soname links): Adding missing space before ].
3028 2012-03-23 Niels Möller <nisse@lysator.liu.se>
3030 * arcfour.h (arcfour_stream): Deleted obsolete prototype.
3032 2012-03-05 Niels Möller <nisse@lysator.liu.se>
3034 * configure.ac (enable_shared): Build shared libraries by default.
3036 2012-03-04 Niels Möller <nisse@lysator.liu.se>
3038 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.4.
3039 (LIBHOGWEED_MINOR): And to 2.2.
3041 2012-02-27 Niels Möller <nisse@lysator.liu.se>
3043 * list-obj-sizes.awk: Recognize elf64 objects.
3045 * Makefile.in (.texinfo.dvi): Pass -b option to texi2dvi.
3047 * Makefile.in (TARGETS): Added twofishdata.
3048 (SOURCES): Added twofishdata.c.
3049 (twofishdata): New rule.
3051 * twofish.c (q0, q1): Made const, and reformatted to match the
3052 twofishdata program.
3054 * twofishdata.c: Resurrected old file. Used to be called
3055 generate_q.c, when the twofish code was contributed back in 1999.
3057 * nettle.texinfo: Documentation for base16 and base64 encoding.
3058 Text contributed by Jeronimo Pellegrini
3059 <pellegrini@mpcnet.com.br>, back in April 2006.
3061 2012-02-18 Niels Möller <nisse@lysator.liu.se>
3063 * run-tests, getopt.c, getopt1.c, getopt.h: These files were moved
3064 to the top-level in the conversion to an independent git
3065 repository. They used to be symlinks to lsh files, from the
3066 subdirectories which use them.
3068 * Makefile.in: Build and distribute getopt files. Distribute
3070 * examples/Makefile.in: Adapt to getopt files and the run-tests
3071 script now located in the parent directory.
3072 * testsuite/Makefile.in: Likewise.
3073 * tools/Makefile.in: Likewise.
3075 * index.html: Converted to xhtml (from lsh repository, change
3076 dated 2012-02-03). Updated git instructions.
3078 * nettle.texinfo: Updated charset declaration.
3079 * misc/plan.html: Likewise.
3081 2012-01-17 Niels Möller <nisse@lysator.liu.se>
3083 * testsuite/Makefile.in (DISTFILES): Added setup-env.
3085 * examples/rsa-decrypt.c (main): Use _setmode rather than setmode,
3086 suggested by Eli Zaretskii. Affects windows builds only.
3087 * examples/rsa-encrypt.c: Likewise.
3089 * Makefile.in ($(LIBNETTLE_FORLINK)): Always create a .lib symlink
3090 to the library file. Use LN_S.
3091 ($(LIBHOGWEED_FORLINK)): Likewise.
3093 (install-shared-nettle): Use LN_S.
3094 (install-shared-hogweed): Likewise.
3096 * configure.ac: Use AC_PROG_LN_S.
3097 * config.make.in (LN_S): New substitution.
3099 * testsuite/setup-env: New file. Wine workaround. Can't get
3100 ../.lib into wine's dll search path, so create additional
3102 * testsuite/teardown-env: ...and delete them here. Also delete
3104 * examples/setup-env: Similar links setup here.
3105 * examples/teardown-env: ... and deleted.
3107 2012-01-07 Niels Möller <nisse@lysator.liu.se>
3109 * examples/Makefile.in (check): Add ../.lib to PATH, like in
3110 testsuite/Makefile. Needed for w*ndows. Reported by Eli Zaretskii.
3112 2011-11-25 Niels Möller <nisse@lysator.liu.se>
3114 From Martin Storsjö:
3115 * x86_64/machine.m4 (W64_ENTRY, W64_EXIT): New macros for
3117 * x86_64: Updated all assembly files to use them.
3119 * configure.ac (W64_ABI): New variable, set when compiling for
3120 W64 ABI (64-bit M$ windows).
3121 * config.m4.in (W64_ABI): Define, from configure substitution.
3123 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3125 From Martin Storsjö:
3126 * examples/Makefile.in (check): Pass $(EMULATOR) and $(EXEEXT) in
3127 the environment of run-tests.
3128 * examples/rsa-encrypt-test: Use $EXEEXT and $EMULATOR.
3129 * examples/rsa-sign-test: Likewise.
3130 * examples/rsa-verify-test: Likewise.
3131 * examples/setup-env: Likewise.
3133 * testsuite/Makefile.in (check): Pass $(EXEEXT) in the environment of
3135 * testsuite/pkcs1-conv-test: Use $EXEEXT and $EMULATOR. Ignore \r
3138 * examples/rsa-decrypt.c (main) [WIN32]: Set stdout/stdin to
3140 * examples/rsa-encrypt.c (main): Likewise.
3142 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3144 * configure.ac (HAVE_NATIVE_64_BIT): Workaround to get it set to 1
3147 * serpent-internal.h (ROL64): Use (uint64_t) 1 rather than 1L, for
3149 (RSHIFT64): Likewise. Also added a missing parenthesis.
3151 2011-11-24 Niels Möller <nisse@lysator.liu.se>
3153 From Martin Storsjö:
3154 * testsuite/symbols-test: Use $NM, falling back to nm if undefined.
3155 * testsuite/Makefile.in (check): Pass $(NM) in the environment of
3157 * config.make.in (NM): Set NM.
3159 * testsuite/sexp-conv-test: Use $EMULATOR when running test
3160 programs. Also ignore \r for output in the non-canonical output
3162 * testsuite/Makefile.in (check): Pass $(EMULATOR) in the
3163 environment of run-tests.
3164 * configure.ac (EMULATOR): New substituted variable. Set to wine
3165 or wine64 when cross compiling for windows, otherwise empty.
3166 * config.make.in (EMULATOR): Set from autoconf value.
3168 2011-11-20 Niels Möller <nisse@lysator.liu.se>
3170 * x86/camellia-crypt-internal.asm: Take ALIGNOF_UINT64_T into
3171 account when getting the offset for the subkeys. Differs between
3172 w32 and other systems. w32 problem identified by Martin Storsjö.
3174 * config.m4.in: Define ALIGNOF_UINT64_T (from configure).
3176 * configure.ac: Check alignment of uint64_t, and also use AC_SUBST
3177 for use in config.m4.in.
3179 2011-11-19 Niels Möller <nisse@lysator.liu.se>
3181 Cygwin/mingw32 improvements contributed by Martin Storsjö:
3182 * Makefile.in (IMPLICIT_TARGETS): New variable for DLL link
3184 (clean-here): Delete the DLL import libraries.
3186 * configure.ac: Setup installation of DLL files in $bindir.
3187 (IF_DLL, LIBNETTLE_FILE_SRC, LIBHOGWEED_FILE_SRC): New
3190 * config.make.in (LIBNETTLE_FILE_SRC): Substitute new autoconf
3192 (LIBHOGWEED_FILE_SRC): Likewise.
3194 * Makefile.in (install-dll-nettle, uninstall-dll-nettle): New
3195 target for installing the DLL file in $bindir.
3196 (install-shared-nettle): Conditionally
3197 depend on install-dll-nettle. Use LIBNETTLE_FILE_SRC.
3198 (uninstall-shared-nettle): Conditionally depend on
3200 (various hogweed targets): Analogous changes.
3202 * configure.ac: Unify shared lib setup for cygwin and mingw.
3204 2011-10-31 Niels Möller <nisse@lysator.liu.se>
3206 * configure.ac (LIBHOGWEED_LIBS): Typo fix for the darwin case.
3207 Spotted by Martin Storsjö.
3209 2011-10-25 Niels Möller <nisse@lysator.liu.se>
3211 * configure.ac (LIBHOGWEED_LIBS): cygwin fix, added
3212 libnettle.dll.a. Reported by Volker Zell.
3214 2011-10-18 Niels Möller <nisse@lysator.liu.se>
3216 * configure.ac: Improved setup för darwin shared libraries.
3217 Patch contributed by Ryan Schmidt.
3219 2011-10-03 Niels Möller <nisse@lysator.liu.se>
3221 * x86_64/memxor.asm: Implemented sse2-loop. Configured at compile
3222 time, and currently disabled.
3224 * testsuite/testutils.h (ASSERT): Write message to stderr.
3226 * testsuite/memxor-test.c: Use 16-byte alignment for "fully
3229 2011-09-03 Niels Möller <nisse@lysator.liu.se>
3231 * x86/camellia-crypt-internal.asm: Use "l"-suffix on instructions
3232 more consistently. Reportedly, freebsd and netbsd systems with
3233 clang are more picky about this.
3235 * configure.ac: Changed version number to 2.5.
3237 * Released nettle-2.4.
3239 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.3.
3241 * gcm-aes.c: Include config.h.
3242 * tools/nettle-lfib-stream.c: Likewise.
3244 * ripemd160-compress.c: Added missing include of config.h. Needed
3245 for correct operation on big-endian systems.
3247 2011-09-02 Niels Möller <nisse@amfibolit.hack.org>
3249 * configure.ac: Changed version number to 2.4.
3251 * Released nettle-2.3.
3253 2011-08-30 Niels Möller <nisse@lysator.liu.se>
3255 * testsuite/hmac-test.c: Added tests for hmac-ripemd160.
3257 * hmac.h: Declare hmac-ripemd160 related functions.
3259 * Makefile.in (nettle_SOURCES): Added hmac-ripemd160.c.
3261 2011-08-30 Niels Möller <nisse@amfibolit.hack.org>
3263 * nettle.texinfo (Hash functions): Document ripemd-160.
3265 * hmac-ripemd160.c: New file.
3267 * hmac.h: Declare hmac-ripemd160 functions.
3269 2011-08-29 Niels Möller <nisse@lysator.liu.se>
3271 * sha256.c (sha256_update): Updated MD_UPDATE call for new
3273 (sha256_write_digest): Use MD_PAD rather than MD_FINAL, and insert
3274 the length manually.
3275 * sha512.c: Analogous changes.
3277 * sha1.c (COMPRESS): New macro.
3278 (sha1_update): Updated MD_UPDATE call for new conventions.
3279 (sha1_digest): Use MD_PAD rather than MD_FINAL, and insert the
3282 * ripemd160.c (ripemd160_init): Use memcpy for initializing the
3284 (COMPRESS): New macro.
3285 (ripemd160_update): Use MD_UPDATE.
3286 (ripemd160_digest): Inline ripemd160_final processing. Use MD_PAD
3287 and _nettle_write_le32.
3288 (ripemd160_final): Deleted function.
3290 * ripemd160.h (struct ripemd160_ctx): Use a 64-bit block count.
3291 Renamed digest to state.
3293 * md5.c (md5_init): Use memcpy for initializing the state vector.
3294 (COMPRESS): New macro, wrapping _nettle_md5_compress.
3295 (md5_update): Use MD_UPDATE.
3296 (md5_digest): Inline md5_final processing. Use MD_PAD and
3298 (md5_final): Deleted.
3300 * md5.h (struct md5_ctx): Renamed some fields, for consistency.
3302 * md4.h (struct md4_ctx): Renamed some fields, for consistency.
3304 * md4.c (md4_init): Use memcpy for initializing the state vector.
3305 (md4_update): Use MD_UPDATE.
3306 (md4_digest): Inline md4_final processing, using MD_PAD. Use
3308 (md4_block): Renamed, to...
3309 (md4_compress): ... new name. Take ctx pinter as argument.
3310 (md4_final): Deleted function.
3312 * md2.c (md2_update): Use MD_UPDATE.
3314 * macros.h (MD_UPDATE): Added incr argument. Invoke compression
3315 function with ctx pointer as argument, rather than ctx->state.
3316 (MD_FINAL): Just pad, don't store length field. Renamed to MD_PAD.
3317 (MD_PAD): Analogous change of compression invocations.
3319 * sha512.c: (COMPRESS): New macro wrapping _nettle_sha512_compress.
3320 (sha512_update): Use MD_UPDATE.
3321 (sha512_final): Deleted function.
3322 (sha512_write_digest): Use MD_FINAL.
3324 * sha256.c (COMPRESS): New macro wrapping _nettle_sha256_compress.
3325 (SHA256_INCR): Deleted macro.
3326 (sha256_update): Use MD_UPDATE.
3327 (sha256_final): Deleted function.
3328 (sha256_write_digest): New function, replacing sha256_final, and
3330 (sha256_digest): Use sha256_write_digest.
3331 (sha224_digest): Likewise.
3333 * tools/nettle-hash.c (list_algorithms): Fixed typo in header.
3335 * sha1.c (SHA1_DATA_LENGTH): Deleted unused macro.
3336 (sha1_init): Use memcpy to initialize the state vector.
3337 (SHA1_INCR): Deleted macro.
3338 (sha1_update): Use MD_UPDATE macro, to reduce code duplication.
3339 (sha1_digest): Use MD_FINAL macro.
3340 (sha1_final): Deleted function.
3342 * sha.h (struct sha1_ctx): Renamed attribute digest to state.
3344 * macros.h (MD_UPDATE): New macro.
3345 (MD_FINAL): New macro.
3347 2011-08-28 Niels Möller <nisse@lysator.liu.se>
3349 * ripemd160.c (ripemd160_final): Use LE_WRITE_UINT32. Deleted byte
3350 swapping at the end, leaving it to ripemd160_digest.
3351 (ripemd160_digest): Use _nettle_write_le32.
3353 * Makefile.in (nettle_SOURCES): Added write-le32.c.
3355 * md5.c (md5_digest): Use _nettle_write_le32.
3357 * write-le32.c (_nettle_write_le32): New file and function.
3359 * ripemd160-compress.c (ROL32): Renamed macro (was "rol"). Deleted
3360 x86 version using inline assembly; at least gcc-4.4.5 recognizes
3361 shift-and-or expressions which are in fact rotations.
3362 (_nettle_ripemd160_compress): Use LE_READ_UINT32.
3364 * configure.ac (LIBNETTLE_MINOR): Bumped library version, to 4.2.
3366 * testsuite/meta-hash-test.c: Updated for the addition of
3369 * testsuite/.test-rules.make: Added rule for ripemd160-test.
3371 * examples/nettle-benchmark.c (main): Benchmark ripemd-160.
3373 2011-08-28 Niels Möller <nisse@lysator.liu.se>
3375 RIPEMD-160 hash function. Ported from libgcrypt by Andres Mejia.
3376 * testsuite/ripemd160-test.c: New file.
3377 * ripemd160.h: New file.
3378 * nettle-meta.h: Declare nettle_ripemd160.
3379 * ripemd160.c: New file, ported from libgcrypt.
3380 * ripemd160-compress.c: Likewise.
3381 * ripemd160-meta.c: New file.
3382 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3384 * nettle-meta-hashes.c (nettle_hashes): Added nettle_ripemd160.
3385 * Makefile.in (nettle_SOURCES): Added ripemd160.c,
3386 ripemd160-compress.c, and ripemd160-meta.c.
3387 (HEADERS): Added ripemd160.h.
3389 2011-08-10 Niels Möller <nisse@amfibolit.hack.org>
3391 * nettle.texinfo: Fixed mis-placed const in various prototypes.
3392 Spotted by Tatsuhiro Tsujikawa.
3394 2011-07-24 Niels Möller <nisse@lysator.liu.se>
3396 * Makefile.in (PKGCONFIG_FILES, pkgconfigdir): New variables.
3397 (DISTFILES): Added nettle.pc.in and hogweed.pc.in.
3398 (nettle.pc, hogweed.pc): New targets (invoking config.status).
3399 (install-pkgconfig, uninstall-pkgconfig): New targets.
3400 (install-here): Depend on install-pkgconfig.
3401 (uninstall-here): Depend on uninstall-pkgconfig.
3402 (distclean-here): Delete nettle.pc and hogweed.pc.
3404 2011-07-20 Niels Möller <nisse@lysator.liu.se>
3406 * configure.ac: Generate nettle.pc and hogweed.pc.
3408 * nettle.pc.in, hogweed.pc.in: New files.
3410 2011-07-17 Niels Möller <nisse@lysator.liu.se>
3412 * nettle-internal.h: Added missing extern declarations.
3414 2011-07-11 Niels Möller <nisse@lysator.liu.se>
3416 * configure.ac: Changed version number to 2.3.
3418 * Released nettle-2.2.
3420 * Makefile.in (DISTFILES): Distribute COPYING.LIB, not COPYING,
3422 2011-07-07 Niels Möller <nisse@lysator.liu.se>
3424 * tools/misc.h (werror): Removed incorrect noreturn attribute from
3427 * examples/io.c (read_file): Bug fix, in dependence of initial
3430 2011-07-01 Niels Möller <nisse@lysator.liu.se>
3432 * cbc.c (CBC_BUFFER_LIMIT): Reduced to 512 bytes.
3433 (cbc_decrypt): For in-place operation, use overlapping memxor3 and
3436 * ctr.c (ctr_crypt): Reorganized to call the encryption function
3437 with several blocks at a time. Handle the case of a single block
3440 * x86_64/memxor.asm: Added ALIGN for shifting loop. Deleted
3443 2011-06-30 Niels Möller <nisse@lysator.liu.se>
3445 * configure.ac: Link in serpent-decrypt.asm, if found.
3447 * x86_64/serpent-decrypt.asm: Added an SSE2 loop, doing four
3448 blocks at a time in parallel.
3450 * x86_64/serpent-encrypt.asm: Include serpent.m4. Deleted a
3453 * x86_64/serpent.m4: New file, with serpent-related macros.
3455 2011-06-29 Niels Möller <nisse@lysator.liu.se>
3457 * x86_64/serpent-decrypt.asm: Wrote main (32-bit) loop.
3458 (SBOX0I, SBOX1I, SBOX7I): Fixed bugs.
3460 * nettle.texinfo (Copyright): Updated for license change to
3461 LGPLv2+. Updated copyright info on serpent.
3463 * NEWS: Updated information for nettle-2.2.
3465 * x86_64/serpent-decrypt.asm: New file.
3467 * x86_64/serpent-encrypt.asm: Fixed .file pseudo op.
3469 * testsuite/testutils.c (test_cipher_ctr): Display more info on
3472 * examples/nettle-benchmark.c (bench_ctr): New function.
3473 (time_cipher): Also benchmark CTR mode.
3475 * configure.ac (LIBNETTLE_MINOR): Updated library version number
3477 (LIBHOGWEED_MINOR): And to 2.1.
3479 2011-06-22 Niels Möller <nisse@lysator.liu.se>
3481 * configure.ac: Use pwd -P when examining lib directories.
3482 Link in serpent-encrypt.asm, if found.
3484 2011-06-21 Niels Möller <nisse@lysator.liu.se>
3486 * serpent-decrypt.c (SBOX3_INVERSE): Eliminated temporaries.
3487 (SBOX4_INVERSE): Likewise.
3488 (SBOX5_INVERSE): Likewise.
3489 (SBOX6_INVERSE): Likewise.
3490 (SBOX7_INVERSE): Likewise.
3491 (All SBOX_INVERSE-macros): Deleted type argument, and updated users.
3493 2011-06-20 Niels Möller <nisse@lysator.liu.se>
3495 * serpent-decrypt.c: Renamed arguments in sbox macros.
3496 (SBOX0_INVERSE): Eliminated temporaries.
3497 (SBOX1_INVERSE): Likewise.
3498 (SBOX2_INVERSE): Likewise.
3500 * x86_64/serpent-encrypt.asm: Added an SSE2 loop, doing four
3501 blocks at a time in parallel.
3503 * testsuite/serpent-test.c (test_main): Added some more multiple
3506 2011-06-15 Niels Möller <nisse@lysator.liu.se>
3508 * configure.ac (libdir): On 64-bit Linux, we used to assume that
3509 libraries are installed according to the FHS. Since at least
3510 Fedora and Gentoo follow the FHS convention, while at least Debian
3511 doesn't, we have to try to figure out which convention is used.
3513 2011-06-14 Niels Möller <nisse@lysator.liu.se>
3515 * x86_64/serpent-encrypt.asm: Slight simplification of loop logic.
3517 * x86_64/serpent-encrypt.asm: New file.
3519 2011-06-12 Niels Möller <nisse@lysator.liu.se>
3521 * testsuite/serpent-test.c (test_main): Added tests with multiple
3524 * serpent-encrypt.c (SBOX6): Renamed arguments. Eliminated
3527 (All SBOX-macros): Deleted type argument, and updated users.
3529 * configure.ac: Display summary at the end of configure..
3530 (asm_path): Set only if enable_assember is yes.
3532 2011-06-10 Niels Möller <nisse@lysator.liu.se>
3534 * serpent-encrypt.c (SBOX5): Renamed arguments. Eliminated
3537 2011-06-09 Niels Möller <nisse@lysator.liu.se>
3539 * serpent-encrypt.c (SBOX4): Renamed arguments. Eliminated
3542 * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LINK): Cygwin fix, from
3545 2011-06-08 Niels Möller <nisse@lysator.liu.se>
3547 * examples/eratosthenes.c (find_first_one): Fixed c99-style
3548 declaration. Reported by Sebastian Reitenbach.
3549 (find_first_one): Declare the lookup table as static const, and
3550 use unsigned char rather than unsigned..
3552 2011-06-07 Niels Möller <nisse@lysator.liu.se>
3554 * serpent-encrypt.c (SBOX0): Renamed arguments. Eliminated
3560 2011-06-06 Niels Möller <nisse@lysator.liu.se>
3562 * Makefile.in (DISTFILES): Added serpent-internal.h.
3563 (nettle_SOURCES): Replaced serpent.c by serpent-set-key.c,
3564 serpent-encrypt.c, and serpent-decrypt.c.
3566 * serpent.c: Replaced by several new files.
3567 * serpent-set-key.c: New file.
3568 * serpent-encrypt.c: New file.
3569 * serpent-decrypt.c: New file.
3570 * serpent-internal.h: New file.
3572 * serpent.c [HAVE_NATIVE_64_BIT]: Process two blocks at a time in
3573 parallel. Measured speedup of 10%--25% (higher for encryption) on
3576 2011-06-01 Niels Möller <nisse@lysator.liu.se>
3578 * serpent.c (ROUNDS): Deleted macro.
3579 (serpent_block_t): Deleted array typedef.
3580 (KEYXOR): New macro, replacing BLOCK_XOR.
3581 (BLOCK_COPY, SBOX, SBOX_INVERSE): Deleted macros.
3582 (LINEAR_TRANSFORMATION): Use four separate arguments.
3583 (LINEAR_TRANSFORMATION_INVERSE): Likewise.
3584 (ROUND): Take separate arguments for all input and output words.
3585 (ROUND_INVERSE): Likewise.
3586 (ROUND_LAST, ROUND_FIRST_INVERSE): Deleted macros.
3587 (serpent_set_key): Moved loop termination test.
3588 (serpent_encrypt): Rewrote with unrolling of just eight rounds,
3589 and without serpent_block_t.
3590 (serpent_decrypt): Likewise.
3592 * serpent.c: Added do { ... } while (0) around block macros.
3593 (serpent_key_t): Deleted array typedef.
3594 (ROL32, ROR32): Renamed macros, were rol and ror.
3595 (KS_RECURRENCE, KS): New macros.
3596 (serpent_key_pad): Renamed, from...
3597 (serpent_key_prepare): ...old name.
3598 (serpent_subkeys_generate): Deleted function.
3599 (serpent_set_key): Rewrote the generation of subkeys. Reduced both
3600 temporary storage and code size (less unrolling)
3602 2011-05-31 Niels Möller <nisse@lysator.liu.se>
3604 * testsuite/serpent-test.c (test_main): Enabled test with short,
3607 * serpent.c (byte_swap_32): Deleted macro.
3608 (serpent_key_prepare): Use LE_READ_UINT32. Don't require aligned
3609 input, and support arbitrary key sizes.
3611 2011-05-30 Simon Josefsson <simon@josefsson.org>
3613 * serpent.c: Rewrite, based on libgcrypt code. License changed
3615 * serpent_sboxes.h: Removed.
3616 * Makefile.in: Drop serpent_sboxes.h.
3618 2011-05-31 Niels Möller <nisse@lysator.liu.se>
3620 * testsuite/serpent-test.c (test_main): Added some tests for
3621 padding of keys of length which is not a multiple of four bytes.
3623 2011-05-30 Simon Josefsson <simon@josefsson.org>
3625 * testsuite/serpent-test.c (test_main): Add test vectors from
3628 2011-05-21 Niels Möller <nisse@lysator.liu.se>
3630 * dsa-keygen.c (dsa_generate_keypair): Avoid double init of mpz
3631 variable. Spotted by Nikos Mavrogiannopoulos.
3633 2011-05-06 Niels Möller <nisse@lysator.liu.se>
3635 * configure.ac: Fix link flags for shared libraries on Solaris,
3636 which needs -h to set the soname. Patch contributed by Dagobert
3639 2011-05-06 Niels Möller <nisse@lysator.liu.se>
3641 * configure.ac: New configure option --enable-gcov.
3643 * arcfour.h (arcfour_stream): Deleted obsolete define.
3645 2011-04-27 Niels Möller <nisse@lysator.liu.se>
3647 * tools/nettle-hash.c (find_algorithm): Require exact match.
3649 2011-04-15 Niels Möller <nisse@lysator.liu.se>
3651 Reverted broken byte-order change from 2001-06-17:
3652 * serpent.c (serpent_set_key): Use correct byteorder.
3653 (serpent_encrypt): Likewise.
3654 (serpent_decrypt): Likewise.
3656 * testsuite/serpent-test.c (decode_hex_reverse): New function.
3657 (RH, RHL): New macros.
3658 (test_main): Byte reverse inputs and outputs for the testvectors
3659 taken from the serpent submission package. Enable test vectors
3660 from http://www.cs.technion.ac.il/~biham/Reports/Serpent/.
3662 2011-03-23 Niels Möller <nisse@lysator.liu.se>
3664 * tools/sexp-conv.c (xalloc): Deleted function, now it's in misc.c
3667 * configure.ac: Use LSH_FUNC_STRERROR.
3669 * tools/Makefile.in (TARGETS): Added nettle-hash, and related
3671 (SOURCES): Added nettle-hash.c.
3673 * tools/misc.c (xalloc): New function.
3675 * tools/pkcs1-conv.c (main): Made the OPT_* constants local, and
3676 fixed numerical values to start with non-ASCII 0x300.
3678 * tools/nettle-hash.c: New file.
3680 2011-03-23 Niels Möller <nisse@lysator.liu.se>
3682 Contributed by Daniel Kahn Gillmor:
3683 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
3684 meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.
3686 * testsuite/meta-hash-test.c: New file.
3687 * testsuite/meta-cipher-test.c: New file.
3688 * testsuite/meta-armor-test.c: New file.
3690 * nettle.texinfo: Document nettle_hashes and nettle_ciphers.
3692 * nettle-meta.h: Declare algorithm lists nettle_ciphers,
3693 nettle_hashes, nettle_armors.
3695 * Makefile.in (nettle_SOURCES): Added nettle-meta-hashes.c,
3696 nettle-meta-ciphers.c, and nettle-meta-armors.c.
3698 * nettle-meta-armors.c: New file.
3699 * nettle-meta-ciphers.c: New file.
3700 * nettle-meta-hashes.c: New file.
3702 2011-02-18 Niels Möller <nisse@lysator.liu.se>
3704 * arcfour.c (arcfour_stream): Deleted function. It's not very
3705 useful, and neither documented nor tested.
3707 2011-02-16 Niels Möller <nisse@lysator.liu.se>
3709 * cbc.h (CBC_ENCRYPT): Avoid using NULL; we don't ensure that it
3711 (CBC_DECRYPT): Likewise.
3713 * gcm-aes.c (gcm_aes_set_iv): Use GCM_SET_IV.
3714 (gcm_aes_set_key): Deleted cast.
3715 (gcm_aes_encrypt): Likewise.
3716 (gcm_aes_decrypt): Likewise.
3717 (gcm_aes_digest): Likewise.
3718 (gcm_aes_update): One less argument to GCM_UPDATE.
3720 * gcm.h (GCM_SET_KEY): Added cast to nettle_crypt_func *. Help
3721 compiler type checking despite this cast.
3722 (GCM_ENCRYPT): Likewise.
3723 (GCM_DECRYPT): Likewise.
3724 (GCM_DIGEST): Likewise.
3725 (GCM_SET_IV): New macro, for completeness.
3726 (GCM_UPDATE): Deleted unused argument encrypt.
3728 2011-02-14 Niels Möller <nisse@lysator.liu.se>
3730 * nettle.texinfo: Split node on cipher modes, and started on
3731 the GCM documentation.
3733 * testsuite/gcm-test.c (test_gcm_aes): Deleted function, replaced
3735 (test_main): Use test_aead.
3737 * testsuite/testutils.c (test_aead): New function, replacing
3738 test_gcm_aes and before that test_cipher_gcm.
3740 * nettle-internal.c (nettle_gcm_aes128): New const struct.
3741 (nettle_gcm_aes192): Likewise.
3742 (nettle_gcm_aes256): Likewise.
3744 * nettle-internal.h (struct nettle_aead): Tentative interface for
3745 authenticated encryption with associated data.
3747 * examples/nettle-benchmark.c (time_gcm): Renamed. Updated for
3748 gcm_aes_auth to gcm_aes_update renaming. Benchmark both encryption
3750 (time_gmac): ...old name.
3752 * nettle-internal.c (des_set_key_hack): Don't touch the bits
3753 parity, since thay are now ignored.
3754 (des3_set_key_hack): Likewise.
3756 * cast128-meta.c (nettle_cast128): Don't pass keysize.
3757 * nettle-meta.h (_NETTLE_CIPHER_FIX): Deleted keysize parameter
3758 derived from the appropriate constant instead.
3760 * testsuite/gcm-test.c (test_gcm_aes): Updated for gcm_aes_auth to
3761 gcm_aes_update renaming.
3763 2011-02-13 Niels Möller <nisse@lysator.liu.se>
3765 * gcm.h (GCM_UPDATE): Renamed, from...
3766 (GCM_AUTH): ...old name.
3768 * gcm-aes.c (gcm_aes_update): Renamed, from...
3769 (gcm_aes_auth): ...old name.
3771 * gcm.c (gcm_update): Renamed, and fixed an assert. From...
3772 (gcm_auth): ...old name.
3774 * gcm.h (GCM_TABLE_BITS): Increase table size to 8 bits,
3775 corresponding to 4 KByte of key-dependent tables.
3777 2011-02-10 Niels Möller <nisse@lysator.liu.se>
3779 * x86_64/memxor.asm: New file. Improves performance by 22% for the
3780 unaligned01 case and 35% for the unaligned12 case, benchmarked on
3783 * examples/nettle-benchmark.c (cgt_works_p): New function.
3784 (cgt_time_start): Likewise.
3785 (cgt_time_end): Likewise.
3786 (clock_time_start): Likewise.
3787 (clock_time_end): Likewise.
3788 (time_function): Read clock via function pointers time_start and
3789 time_end, so we can select method at runtime.
3790 (xalloc): Use die function.
3791 (main): Choose timing function. If available, try clock_gettime,
3792 and fall back to clock if it doesn't exist.
3794 * examples/nettle-benchmark.c (die): New function.
3795 (TIME_END, TIME_START): Check return value from clock_gettime.
3797 * gcm.h (union gcm_block): Use correct length for w array.
3799 * testsuite/gcm-test.c (test_main): Added the rest of the
3800 testcases from the spec.
3802 2011-02-09 Niels Möller <nisse@lysator.liu.se>
3804 * testsuite/gcm-test.c (test_main): Enabled testcases 5 and 6,
3805 with different IV lengths.
3807 * gcm-aes.c (gcm_aes_set_iv): Updated for gcm_set_iv change.
3809 * gcm.c (gcm_hash_sizes): New function.
3810 (gcm_set_iv): Added support for IVs of arbitrary size. Needed
3811 another argument, for the hash subkey.
3812 (gcm_digest): Use gcm_hash_sizes.
3814 * examples/nettle-benchmark.c (time_gmac): Use gcm_aes interface.
3816 * testsuite/gcm-test.c (test_gcm_aes): New function, replacing
3817 test_cipher_gcm and using the new gcm_aes interface.
3818 (test_main): Updated to use test_gcm_aes.
3819 * testsuite/testutils.c (test_cipher_gcm): Deleted function.
3821 * Makefile.in (nettle_SOURCES): Added gcm-aes.c.
3823 * gcm.c (gcm_set_key): Replaced context argument by a struct
3825 (gcm_hash): Replaced context argument by a struct gcm_key * and a
3826 pointer to the hashing state block.
3827 (gcm_auth): Added struct gcm_key * argument.
3828 (gcm_encrypt): Likewise.
3829 (gcm_decrypt): Likewise.
3830 (gcm_digest): Likewise.
3832 * gcm-aes.c: New file.
3833 (gcm_aes_set_key): New function.
3834 (gcm_aes_set_iv): Likewise.
3835 (gcm_aes_auth): Likewise.
3836 (gcm_aes_encrypt): Likewise.
3837 (gcm_aes_decrypt): Likewise.
3838 (gcm_aes_digest): Likewise.
3840 * gcm.h (struct gcm_key): Moved the key-dependent and
3841 message-independent state to its own struct.
3842 (struct gcm_ctx): ... and removed it here.
3843 (GCM_CTX): New macro.
3844 (GCM_SET_KEY): Likewise.
3845 (GCM_AUTH): Likewise.
3846 (GCM_ENCRYPT): Likewise.
3847 (GCM_DECRYPT): Likewise.
3848 (GCM_DIGEST): Likewise.
3849 (struct gcm_aes_ctx): New struct.
3851 2011-02-08 Niels Möller <nisse@lysator.liu.se>
3853 * gcm.h (struct gcm_ctx): The hash key is now always an array,
3854 named h, with array size depending on GCM_TABLE_BITS.
3855 * gcm.c (gcm_gf_shift): Added a separate result argument.
3856 (gcm_gf_mul): Compile bitwise version only when GCM_TABLE_BITS ==
3857 0. Simplified interface with just two arguments pointing to
3859 (gcm_gf_shift_4, gcm_gf_shift_8): Renamed table-based functions, from...
3860 (gcm_gf_shift_chunk): ... old name.
3861 (gcm_gf_mul): Renamed both table-based versions and made the
3862 argument types compatible with the bitwise gcm_gf_mul.
3863 (gcm_gf_mul_chunk): ... the old name.
3864 (gcm_set_key): Initialize the table using adds and shifts only.
3865 When GCM_TABLE_BITS > 0, this eliminates the only use of the
3866 bitwise multiplication.
3867 (gcm_hash): Simplified, now that we have the same interface for
3868 gcm_gf_mul, regardless of table size.
3870 * gcm.c (GHASH_POLYNOMIAL): Use unsigned long for this constant.
3871 (gcm_gf_shift_chunk): Fixed bugs for the big endian 64-bit case,
3872 e.g., sparc64. For both 4-bit and 8-bit tables.
3874 * gcm.c: Use the new union gcm_block for all gf operations.
3876 * gcm.h (union gcm_block): New union, used to enforce alignment.
3878 2011-02-07 Niels Möller <nisse@lysator.liu.se>
3880 * gcm.c (gcm_gf_shift_chunk) : Bug fix for little-endian 8-bit
3883 * gcm.c (gcm_gf_mul_chunk): Special case first and last iteration.
3884 (gcm_gf_add): New function, a special case of memxor. Use it for
3885 all memxor calls with word-aligned 16 byte blocks. Improves
3886 performance to 152 cycles/byte with no tables, 28 cycles per byte
3887 with 4-bit tables and 10.5 cycles per byte with 8-bit tables.
3889 Introduced 8-bit tables. If enabled, gives gmac performance of 19
3890 cycles per byte (still on intel x86_64).
3891 * gcm.c (gcm_gf_shift_chunk): New implementation for 8-bit tables.
3892 (gcm_gf_mul_chunk): Likewise.
3893 (gcm_set_key): Generate 8-bit tables.
3895 * Makefile.in (SOURCES): Added gcmdata.c.
3897 * gcm.h (GCM_TABLE_BITS): Set to 4.
3899 2011-02-06 Niels Möller <nisse@lysator.liu.se>
3901 * Makefile.in (TARGETS): Added gcmdata.
3902 (gcmdata): New rule.
3904 Introduced 4-bit tables. Gives gmac performance of 45 cycles per
3905 byte (still on intel x86_64).
3906 * gcm.c (gcm_gf_shift): Renamed. Tweaked little-endian masks.
3907 (gcm_rightshift): ... old name.
3908 (gcm_gf_mul): New argument for the output. Added length argument
3909 for one of the inputs (implicitly padding with zeros).
3910 (shift_table): New table (in 4-bit and 8-bit versions), generated
3912 (gcm_gf_shift_chunk): New function shifting 4 bits at
3914 (gcm_gf_mul_chunk): New function processing 4 bits at a time.
3915 (gcm_set_key): Generation of 4-bit key table.
3916 (gcm_hash): Use tables, when available.
3918 * gcmdata.c (main): New file.
3920 * gcm.c (gcm_rightshift): Moved the reduction of the shifted out
3922 (gcm_gf_mul): Updated for gcm_rightshift change. Improves gmac
3923 performance to 181 cycles/byte.
3925 * gcm.c (gcm_gf_mul): Rewrote. Still uses the bitwise algorithm from the
3926 specification, but with separate byte and bit loops. Improves gmac
3927 performance a bit further, to 227 cycles/byte.
3929 * gcm.c (gcm_rightshift): Complete rewrite, to use word rather
3930 than byte operations. Improves gmac performance from 830 cycles /
3931 byte to (still poor) 268 cycles per byte on intel x86_64.
3933 2011-02-05 Niels Möller <nisse@lysator.liu.se>
3935 * examples/nettle-benchmark.c (time_gmac): New function.
3936 (main): Call time_gmac.
3938 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added gcm-test.c.
3940 * testsuite/testutils.c (test_cipher_gcm): New function,
3941 contributed by Nikos Mavrogiannopoulos.
3943 * testsuite/gcm-test.c: New file, contributed by Nikos
3946 * Makefile.in (nettle_SOURCES): Added gcm.c.
3947 (HEADERS): Added gcm.h.
3949 * gcm.c: New file, contributed by Nikos Mavrogiannopoulos.
3950 * gcm.h: New file, contributed by Nikos Mavrogiannopoulos.
3952 * macros.h (INCREMENT): New macro, moved from ctr.c. Deleted third
3954 * ctr.c: Use INCREMENT macro from macros.h, deleted local version.
3956 2011-01-07 Niels Möller <nisse@lysator.liu.se>
3958 * testsuite/Makefile.in (check): Add ../.lib to PATH, since that's
3959 where w*ndows looks for dlls.
3961 * testsuite/testutils.c (test_cipher_stream): More debug output on
3964 2010-12-14 Niels Möller <nisse@lysator.liu.se>
3966 * nettle-types.h: Deleted some unnecessary parenthesis from
3968 (nettle_realloc_func): Moved typedef here...
3969 * realloc.h: ...from here.
3971 * buffer.c (nettle_buffer_init_realloc): Use an explicit pointer
3972 for realloc argument.
3974 2010-12-07 Niels Möller <nisse@lysator.liu.se>
3976 * nettle.texinfo (Copyright): Updated info on blowfish.
3978 2010-11-26 Niels Möller <nisse@lysator.liu.se>
3980 Reapplied optimizations (150% speedup on x86_32) and other fixes,
3981 relicensing them as LGPL.
3982 * blowfish.c (do_encrypt): Renamed, to...
3983 (encrypt): ...new name.
3984 (F): Added context argument. Shift input explicitly, instead of
3985 reading individual bytes via memory.
3986 (R): Added context argument.
3987 (encrypt): Deleted a bunch of local variables. Using the context
3988 pointer for everything should consume less registers.
3989 (decrypt): Likewise.
3990 (initial_ctx): Arrange constants into a struct, to simplify key
3992 (blowfish_set_key): Some simplification.
3994 2010-11-26 Simon Josefsson <simon@josefsson.org>
3996 * blowfish.c: New version ported from libgcrypt. License changed
3999 2010-11-25 Niels Möller <nisse@lysator.liu.se>
4001 * Makefile.in (install-shared-nettle): Use INSTALL_DATA, which
4002 clears the execute permission bits.
4003 (install-shared-hogweed): Likewise.
4005 2010-11-16 Niels Möller <nisse@lysator.liu.se>
4007 * configure.ac: Updated gmp url.
4009 2010-11-01 Niels Möller <nisse@lysator.liu.se>
4011 * tools/misc.c (werror): Don't call exit (copy&paste-error).
4013 2010-10-26 Niels Möller <nisse@lysator.liu.se>
4015 * examples/rsa-encrypt.c (main): No extra message for bad options.
4017 * examples/rsa-keygen.c (main): Added long options. Deleted -?,
4018 and fixed handling of bad options.
4020 * examples/next-prime.c (main): Deleted -?, and fixed handling of
4022 * examples/random-prime.c (main): Likewise.
4024 2010-10-22 Niels Möller <nisse@lysator.liu.se>
4026 * examples/nettle-benchmark.c (main): Added long options. Deleted -?,
4027 and fixed handling of bad options.
4029 * examples/eratosthenes.c (main): Added long options. Deleted -?,
4030 and fixed handling of bad options. Renamed -s to -q (long option
4033 * tools/pkcs1-conv.c (main): Deleted short alias -? for --help,
4034 and fixed handling of bad options.
4035 * tools/sexp-conv.c (parse_options): Likewise.
4037 2010-10-06 Niels Möller <nisse@lysator.liu.se>
4039 * memxor.c (memxor3): Optimized.
4040 (memxor3_common_alignment): New function.
4041 (memxor3_different_alignment_b): New function.
4042 (memxor3_different_alignment_ab): New function.
4043 (memxor3_different_alignment_all): New function.
4045 * examples/nettle-benchmark.c (time_function): Reorganized, to
4047 (time_memxor): Also benchmark memxor3.
4049 * x86_64/memxor.asm: New file.
4051 * examples/nettle-benchmark.c (overhead): New global variable.
4052 (time_function): Compensate for call overhead.
4053 (bench_nothing, time_overhead): New functions.
4054 (time_memxor): Tweaked src size, making it an integral number of
4056 (main): Call time_overhead.
4058 2010-10-01 Niels Möller <nisse@lysator.liu.se>
4060 * x86_64/camellia-crypt-internal.asm (ROUND): Reordered sbox
4063 * testsuite/memxor-test.c: Also test memxor3.
4065 2010-09-30 Niels Möller <nisse@lysator.liu.se>
4067 * configure.ac: Link in memxor.asm, if found.
4069 * testsuite/testutils.c (test_cipher_cbc): Print more info when
4072 * testsuite/memxor-test.c (test_xor): Added verbose printout.
4074 * examples/nettle-benchmark.c (time_memxor): Count size of
4075 unsigned long as "block size" for memxor.
4077 2010-09-24 Niels Möller <nisse@lysator.liu.se>
4079 * testsuite/.test-rules.make: Added rule for memxor-test.
4080 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added memxor-test.c
4081 * testsuite/memxor-test.c: New file.
4083 * memxor.c (memxor_common_alignment): New function.
4084 (memxor_different_alignment): New function.
4085 (memxor): Optimized to do word-operations rather than byte
4088 * configure.ac (HAVE_NATIVE_64_BIT): New config.h define.
4090 Partial revert of 2010-09-20 changes.
4091 * camellia-set-encrypt-key.c (camellia_set_encrypt_key):
4092 Reintroduce CAMELLIA_F_HALF_INV, for 32-bit machines.
4093 * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Two variants,
4094 differing in where addition of the key is done.
4095 * x86/camellia-crypt-internal.asm: Moved addition of key.
4097 2010-09-22 Niels Möller <nisse@lysator.liu.se>
4099 * examples/nettle-benchmark.c (BENCH_INTERVAL): Changed unit to
4101 (time_function): Use clock_gettime with CLOCK_PROCESS_CPUTIME_ID,
4102 if available. This gives better accuracy, at least on recent
4104 (BENCH_INTERVAL): Reduced to 0.1 s.
4105 (struct bench_memxor_info): New struct.
4106 (bench_memxor): New function.
4107 (time_memxor): New function.
4108 (main): Use time_memxor. Added optional argument used to limit the
4109 algorithms being benchmarked.
4110 (GET_CYCLE_COUNTER): Define also for x86_64.
4111 (time_memxor): Improved display.
4113 * examples/Makefile.in (nettle-benchmark): Link using
4114 $(BENCH_LIBS) rather than $(LIBS).
4116 * configure.ac: Check for clock_gettime, and add -lrt to
4117 BENCH_LIBS if needed.
4119 2010-09-20 Niels Möller <nisse@lysator.liu.se>
4121 * configure.ac: Less quoting when invoking $CC, to allow CC="gcc
4124 * x86/camellia-crypt-internal.asm (ROUND): Adapted to new key
4125 convention, moving key xor to the end.
4127 * camellia-set-encrypt-key.c (CAMELLIA_F_HALF_INV): Deleted macro.
4128 (camellia_set_encrypt_key): Deleted the CAMELLIA_F_HALF_INV
4129 operations intended for moving the key xor into the middle of the
4132 * camellia-crypt-internal.c (CAMELLIA_ROUNDSM): Moved addition of
4133 key to the end, to use a 64-bit xor operation.
4135 * x86_64/camellia-crypt-internal.asm: New file.
4137 * x86_64/machine.m4 (LREG, HREG, XREG): New macros.
4139 2010-09-17 Niels Möller <nisse@lysator.liu.se>
4141 * configure.ac: Support shared libraries (dlls) with mingw32.
4142 Contributed by David Hoyt.
4144 2010-07-25 Niels Möller <nisse@lysator.liu.se>
4146 * configure.ac: Changed version number to nettle-2.2.
4148 * Released nettle-2.1.
4150 * configure.ac: Use camellia-crypt-internal.asm, if available.
4151 Bumped soname to libnettle.so.4, and reset LIBNETTLE_MINOR to
4154 * x86/machine.m4 (LREG, HREG): Moved macros here, from...
4155 * x86/aes.m4: ...here.
4157 * x86/camellia-crypt-internal.asm: New file.
4159 * nettle.texinfo: Updated and expanded section on DSA.
4160 Document aes_invert_key, and camellia. Added missing functions
4161 rsa_sha512_verify and rsa_sha512_verify_digest.
4163 * camellia.h (struct camellia_ctx): Eliminate the two unused
4164 subkeys, and renumber the remaining ones.
4165 * camellia-crypt-internal.c (_camellia_crypt): Updated for
4167 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Likewise.
4168 * camellia-set-decrypt-key.c (camellia_invert_key): Likewise.
4170 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Inline
4171 the expansion of camellia_setup128 and camellia_setup256, keeping
4172 the unexpanded key in scalar variables.
4173 (camellia_setup128): Deleted.
4174 (camellia_setup256): Deleted.
4176 2010-07-24 Niels Möller <nisse@lysator.liu.se>
4178 * camellia-set-encrypt-key.c (camellia_set_encrypt_key): Reduced
4179 code size, no complete loop unroll. Use one loop for each phase of
4180 the post-processing.
4182 * testsuite/camellia-test.c: New tests for camellia_invert_key.
4183 * testsuite/aes-test.c: New tests for aes_invert_key.
4185 * aes.h (aes_invert_key): Declare it.
4187 * aes-set-decrypt-key.c (aes_invert_key): New function, key
4188 inversion code extracted from aes_set_decrypt_key.
4189 (aes_set_decrypt_key): Use aes_invert_key.
4191 * camellia-set-encrypt-key.c (camellia_setup128): Generate
4192 unmodified subkeys according to the spec. Moved clever combination
4193 of subkeys to camellia_set_encrypt_key.
4194 (camellia_setup256): Likewise.
4195 (camellia_set_encrypt_key): Moved subkey post-processing code
4196 here, and reduce code duplication between 128-bit keys and larger
4199 * camellia.c: Deleted file, split into several new files...
4200 * camellia-table.c (_camellia_table): New file with the constant
4202 * camellia-set-encrypt-key.c: New file.
4203 (camellia_setup128): Generate unmodified subkeys according to the
4204 spec. Moved clever combination of subkeys to camellia_set_encrypt_key.
4205 (camellia_setup256): Likewise.
4207 * camellia-set-decrypt-key.c: New file.
4208 (camellia_invert_key): Key inversion function.
4209 (camellia_set_decrypt_key): New key setup function.
4210 * camellia-internal.h: New file.
4211 * camellia-crypt.c (camellia_crypt): New file, new wrapper
4212 function passing the sbox table to _camellia_crypt.
4213 * camellia-crypt-internal.c (_camellia_crypt): New file, with main
4214 encrypt/decrypt function.
4215 * Makefile.in (nettle_SOURCES): Updated list of camellia source files.
4216 (DISTFILES): Added camellia-internal.h.
4218 2010-07-20 Niels Möller <nisse@lysator.liu.se>
4220 * camellia-meta.c: Use _NETTLE_CIPHER_SEP_SET_KEY.
4222 * camellia.h (struct camellia_ctx): Replaced flag camellia128 by
4223 expanded key length nkeys.
4225 * camellia.c (camellia_set_encrypt_key): Renamed, from...
4226 (camellia_set_key): ... old name.
4227 (camellia_invert_key): New function.
4228 (camellia_set_decrypt_key): New function, using
4229 camellia_invert_key.
4230 (camellia_crypt): Renamed, from...
4231 (camellia_encrypt): ... old name.
4232 (camellia_decrypt): Deleted, no longer needed. camellia_crypt used
4233 for both encryption and decryption.
4235 * nettle-meta.h (_NETTLE_CIPHER_SEP_SET_KEY): New macro.
4237 * dsa-keygen.c: Removed unnecessary include of memxor.h.
4239 * camellia.c: Rewrote to use 64-bit type for subkeys and use
4240 64-bit operations throughout. Performance on x86_32, when compiled
4241 with gcc-4.4.4, is reduced by roughly 15%, this should be fixed
4244 * camellia.h (struct camellia_ctx): Use type uint64_t for subkeys.
4246 2010-07-07 Niels Möller <nisse@lysator.liu.se>
4248 * aes.h (aes_encrypt, aes_decrypt): Declare ctx argument as const.
4249 Also updated implementation.
4250 * blowfish.h (blowfish_encrypt, blowfish_decrypt): Likewise.
4251 * cast128.h (cast128_encrypt, cast128_decrypt): Likewise.
4252 * serpent.h (serpent_encrypt, serpent_decrypt): Likewise.
4253 * twofish.h (twofish_encrypt, twofish_decrypt): Likewise.
4255 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
4258 * examples/nettle-benchmark.c: Added camellia ciphers.
4260 * Makefile.in (nettle_SOURCES): Added camellia.c and
4262 (HEADERS): Added camellia.h.
4264 * nettle-meta.h (nettle_camellia128): Declare.
4265 (nettle_camellia192): Likewise.
4266 (nettle_camellia256): Likewise.
4268 * camellia-meta.c: New file.
4270 * camellia.h: Rewrote interface to match nettle conventions.
4272 * camellia.c: Converted to nettle conventions.
4273 (camellia_encrypt128, camellia_encrypt256): Unified to new
4275 (camellia_encrypt): ...New function, with a loop doing 6
4276 regular rounds, one FL round and one FLINV round per iteration,
4277 with iteration count depending on the key size.
4279 (camellia_decrypt128, camellia_decrypt256): Similarly unified
4281 (camellia_decrypt): ...New function, analogous to
4284 2010-07-06 Niels Möller <nisse@lysator.liu.se>
4286 * camellia.c, camellia.h: New files, copied from
4287 http://info.isl.ntt.co.jp/crypt/eng/camellia/dl/camellia-LGPL-1.2.0.tar.gz.
4289 * testsuite/camellia-test.c: New file.
4291 2010-07-05 Niels Möller <nisse@lysator.liu.se>
4293 * nettle.texinfo: Document new conventions for weak key and des
4294 parity checks. Document des_check_parity.
4296 * testsuite/des-test.c (test_weak): Don't check the deleted status
4299 * des-compat.c (des_key_sched): Rewrote error checking logic for
4300 the case of non-zero des_check_key.
4302 * des3.c (des3_set_key): Changed weak key detection logic.
4303 Complete key setup also for weak keys, and don't set the status
4306 * des.c (des_set_key): New iteration logic, to keep key pointer
4307 unchanged. Moved weak key check to the end, and don't set the
4309 (des_encrypt): Ignore status attribute.
4310 (des_decrypt): Likewise.
4312 * des.h (enum des_error): Deleted.
4313 (struct des_ctx): Deleted status attribute.
4314 (struct des3_ctx): Likewise.
4316 * blowfish.c (initial_ctx): Deleted status value.
4317 (blowfish_encrypt): Ignore status attribute.
4318 (blowfish_decrypt): Likewise.
4319 (blowfish_set_key): Return result from weak key check, without
4320 setting the status attribute.
4322 * blowfish.h (enum blowfish_error): Deleted.
4323 (struct blowfish_ctx): Deleted status attribute.
4325 * Makefile.in (des_headers): Deleted parity.h.
4327 2010-06-30 Niels Möller <nisse@lysator.liu.se>
4329 * testsuite/des-test.c (test_des): New function.
4330 (test_weak): New function.
4331 (test_main): Use test_des and test_weak. Added tests for all the
4332 weak keys. Added some tests with invalid (to be ignored) parity
4335 * des.c (parity_16): New smaller parity table.
4336 (des_check_parity): New function.
4337 (des_fix_parity): Use parity_16.
4338 (des_weak_p): New weak-key detection. Ignores parity bits, and
4340 (des_set_key): Deleted parity checking code. Replaced old weak-key
4341 detection code by a call to des_weak_p.
4343 2010-06-04 Niels Möller <nisse@lysator.liu.se>
4345 * testsuite/testutils.c (test_dsa_key): Updated for new name
4346 DSA_SHA1_MIN_P_BITS.
4348 * dsa-keygen.c (dsa_generate_keypair): Use DSA_SHA1_MIN_P_BITS and
4349 DSA_SHA256_MIN_P_BITS.
4351 * dsa.h (DSA_MIN_P_BITS, DSA_Q_OCTETS, DSA_Q_BITS): Renamed to...
4352 (DSA_SHA1_MIN_P_BITS, DSA_SHA1_Q_OCTETS, DSA_SHA1_Q_BITS): New
4355 * sexp2dsa.c (dsa_keypair_from_sexp_alist): New argument q_bits.
4356 Renamed parameter limit to p_max_bits.
4357 (dsa_sha1_keypair_from_sexp): Renamed, was dsa_keypair_from_sexp.
4358 Updated to call dsa_keypair_from_sexp_alist with the new argument.
4359 (dsa_sha256_keypair_from_sexp): New function.
4360 (dsa_signature_from_sexp): New argument q_bits.
4362 * der2dsa.c (dsa_params_from_der_iterator): Enforce 160-bit limit
4363 on q. Renamed parameter limit to p_max_bits.
4364 (dsa_openssl_private_key_from_der_iterator): Enforce 160-bit limit
4365 on q and x. Renamed parameter limit to p_max_bits.
4367 2010-06-03 Niels Möller <nisse@lysator.liu.se>
4369 * testsuite/dsa-test.c (test_main): Added test for dsa-sha256.
4371 2010-06-02 Niels Möller <nisse@lysator.liu.se>
4373 * testsuite/dsa-test.c (test_main): Provide expected value of the
4376 * testsuite/testutils.c (test_dsa160): Added argument for expected
4378 (test_dsa256): Likewise.
4380 2010-06-01 Niels Möller <nisse@lysator.liu.se>
4382 * testsuite/rsa-keygen-test.c (test_main): Updated expected
4385 * examples/random-prime.c (main): Updated for nettle_random_prime
4387 * testsuite/random-prime-test.c (test_main): Likewise.
4389 * rsa-keygen.c (bignum_random_prime): Deleted function.
4390 (rsa_generate_keypair): Use new nettle_random_prime. Generate
4391 secret factors p and q with the two most significant bits set.
4393 * dsa-keygen.c (dsa_generate_keypair): Updated for changes in
4394 nettle_random_prime and _nettle_generate_pocklington_prime. Invoke
4397 * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4398 argument top_bits_set, to optionally generate primes with the two
4399 most significant bits set. Reordered argument list.
4400 (nettle_random_prime): Likewise, added top_bits_set argument.
4401 Invoke progress callback when a prime is generated.
4403 2010-05-26 Niels Möller <nisse@lysator.liu.se>
4405 * dsa-keygen.c (dsa_generate_keypair): Use
4406 _nettle_generate_pocklington_prime. Deleted old key generation
4409 * bignum-random-prime.c (_nettle_generate_pocklington_prime): Also
4410 return the used r. Updated caller.
4412 * examples/random-prime.c (main): Allow sizes down to 3 bits.
4414 * bignum-random-prime.c (_nettle_generate_pocklington_prime): New
4415 function. Rely on mpz_probab_prime_p (for lack of a trial division
4416 function) for trial division.
4417 (nettle_random_prime): Rewritten. Uses the prime table for the
4418 smallest sizes, then trial division using a new set of tables, and
4419 then Maurer's algorithm, calling the new
4420 _nettle_generate_pocklington_prime for the final search.
4422 2010-05-25 Niels Möller <nisse@lysator.liu.se>
4424 * testsuite/dsa-test.c (test_main): Updated for dsa testing
4427 * testsuite/dsa-keygen-test.c (test_main): Test dsa256.
4429 * testsuite/testutils.h (struct nettle_mac): New struct, currently
4432 * testsuite/testutils.c (test_mac): New function (currently not
4434 (test_dsa): Replaced by two new functions...
4435 (test_dsa160): New function.
4436 (test_dsa256): New function.
4437 (test_dsa_key): New argument q_size.
4438 (DSA_VERIFY): Generalized.
4440 * dsa-keygen.c (dsa_generate_keypair): Rewritten, now generating
4441 primes using Pocklington's theorem. Takes both p_size and q_size
4444 2010-05-20 Niels Möller <nisse@lysator.liu.se>
4446 * bignum-random-prime.c (miller_rabin_pocklington): Fixed broken
4447 logic when Miller-rabin succeeds early.
4449 2010-04-09 Niels Möller <nisse@lysator.liu.se>
4451 * bignum-next-prime.c: Include stdlib.h, needed for alloca on
4455 * examples/Makefile.in (SOURCES): Added random-prime.c.
4457 * examples/random-prime.c: New program.
4459 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Moved
4460 knuth-lfib-test.c, cbc-test.c, ctr-test.c, hmac-test.c here, from
4462 (TS_HOGWEED_SOURCES): Added random-prime-test.c.
4464 * testsuite/random-prime-test.c: New test case.
4466 * examples/next-prime.c (main): With no command line arguments.
4467 exit after dislaying usage message.
4469 * examples/io.c (simple_random): Free buffer when done.
4471 * configure.ac: Changed message, say CC is the recommended
4472 way to configure the ABI.
4474 * bignum-random.c: Deleted test of HAVE_LIBGMP.
4475 * bignum.c: Likewise.
4476 * sexp2bignum.c: Likewise.
4478 * Makefile.in (hogweed_SOURCES): Added bignum-random-prime.c.
4480 * bignum-random-prime.c (nettle_random_prime): New file, new
4483 2010-03-31 Niels Möller <nisse@lysator.liu.se>
4485 * examples/nettle-benchmark.c (main): Benchmark sha224.
4487 2010-03-30 Niels Möller <nisse@lysator.liu.se>
4489 * testsuite/testutils.c (DSA_VERIFY): Updated for dsa_sha1_verify
4491 (test_dsa): Check return value from dsa_sha1_sign.
4493 * Makefile.in (hogweed_SOURCES): Added dsa-sha1-sign.c,
4494 dsa-sha1-verify.c, dsa-sha256-sign.c, and dsa-sha256-verify.c.
4496 * dsa.h: Updated and added dsa declarations.
4498 * dsa-sha256-verify.c (dsa_sha256_verify_digest): New file, new
4500 (dsa_sha256_verify): New function.
4501 * dsa-sha256-sign.c (dsa_sha256_sign_digest): New file, new
4503 (dsa_sha256_sign): New function.
4505 * dsa-sha1-verify.c (dsa_sha1_verify_digest): New file. Moved and
4506 renamed function, from dsa_verify_digest, rewrote to use
4508 (dsa_sha1_verify): Analogous change, renamed from dsa_verify.
4509 * dsa-sha1-sign.c (dsa_sha1_sign_digest): New file. Moved and
4510 renamed function, from dsa_sign_digest, rewrote to use _dsa_sign,
4511 and added return value.
4512 (dsa_sha1_sign): Analogous change, renamed from dsa_sign.
4514 * dsa-verify.c (_dsa_verify): New general verification function,
4516 * dsa-sign.c (_dsa_sign): New general signing function, for any
4517 hash. Returns success code, like the rsa signture functions.
4519 2010-03-29 Niels Möller <nisse@lysator.liu.se>
4521 * configure.ac (ABI): Attempt to use a better, ABI-dependant,
4522 default value for libdir.
4524 * x86/md5-compress.asm: Fixed function name in epilogue.
4526 * asm.m4 (EPILOGUE): Use . to refer to current address.
4528 * configure.ac (ABI): Detect which ABI the compiler is using.
4529 On x86_64, also check for __arch64__.
4531 2010-03-28 Niels Möller <nisse@lysator.liu.se>
4533 * configure.ac (asm_path): For x86_64, check if compiler is
4534 generating 32-bit code.
4536 2010-03-27 Niels Möller <nisse@lysator.liu.se>
4538 * testsuite/hmac-test.c (test_main): Rewrote rest of tests to use
4539 HMAC_TEST, and added more tests from Daniel Kahn Gillmor and from
4542 * Makefile.in (nettle_SOURCES): Added hmac-sha224.c and
4545 * hmac.h: Added declarations of hmac-sha224 and hmac-sha384.
4547 * hmac-sha224.c: New file.
4549 2010-03-26 Niels Möller <nisse@lysator.liu.se>
4551 * testsuite/hmac-test.c (HMAC_TEST): New macro.
4552 (test_main): Use HMAC_TEST for the md5 and sha1 tests, and add
4553 test vectors from Daniel Kahn Gillmor.
4555 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha224-test.c.
4557 * Makefile.in (nettle_SOURCES): Added sha224-meta.c and
4559 (DISTFILES): Added nettle-write.h.
4561 * sha.h: Added declarations for sha224. Some are aliases for the
4562 corresponding sha256 definition.
4564 * sha256.c (sha256_digest): Use _nettle_write_be32.
4565 (sha224_init): New function.
4566 (sha224_digest): New function.
4568 * sha1.c (sha1_digest): Use _nettle_write_be32.
4570 * nettle-internal.h (NETTLE_MAX_HASH_BLOCK_SIZE)
4571 (NETTLE_MAX_HASH_DIGEST_SIZE): Increased, to take sha512 into
4574 * nettle-write.h: New file.
4576 * write-be32.c (_nettle_write_be32): New file, new function.
4578 * sha224-meta.c: New file.
4580 2010-03-25 Niels Möller <nisse@lysator.liu.se>
4582 * hmac-sha384.c: New file.
4584 * testsuite/sha224-test.c: New file.
4586 * testsuite/md4-test.c (test_main): More test vectors, provided by
4587 Daniel Kahn Gillmor.
4588 * testsuite/md5-test.c (test_main): Likewise.
4589 * testsuite/sha1-test.c (test_main): Likewise.
4590 * testsuite/sha256-test.c (test_main): Likewise.
4591 * testsuite/sha384-test.c (test_main): Likewise.
4592 * testsuite/sha512-test.c (test_main): Likewise.
4594 * configure.ac: Bumped version numbers. Package version
4595 nettle-2.1, library versions libnettle.so.3.1, libhogweed.so.2.0.
4597 * examples/nettle-benchmark.c (main): Benchmark sha384.
4599 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha384-test.c.
4601 * testsuite/sha384-test.c: New file.
4603 * Makefile.in (nettle_SOURCES): Added sha384-meta.c.
4605 * sha384-meta.c: New file.
4607 * sha.h: Added declarations for sha384. Some are aliases for the
4608 corresponding sha512 definition.
4610 * sha512.c (sha512_write_digest): New function.
4611 (sha512_digest): Use it.
4612 (sha384_init): New function.
4613 (sha384_digest): New function.
4615 2010-03-24 Niels Möller <nisse@lysator.liu.se>
4617 * sha512.c: (sha512_digest): Simplified handling of any final
4618 partial word of the digest.
4620 * sha512.c: Reorganized to use _nettle_sha512_compress.
4622 * sha512-compress.c (_nettle_sha512_compress): Compression
4623 function extracted from sha512.c to a new file.
4625 * Makefile.in (nettle_SOURCES): Added sha256-compress.c and
4628 * sha256.c: Reorganized to use _nettle_sha256_compress.
4630 * sha256-compress.c (_nettle_sha256_compress): Compression
4631 function extracted from sha256.c to a new file.
4633 * examples/nettle-benchmark.c (main): Benchmark sha512.
4635 * rsa-keygen.c (rsa_generate_keypair): Ensure that bit size of e
4636 is less than bit size of n, and check for the unlikely case p = q.
4638 * rsa.h (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Reduced, to
4639 correspond to pkcs#1 encryption of single byte messagees.
4641 * pgp-encode.c (pgp_put_rsa_sha1_signature): Check return value
4643 * rsa-compat.c (R_SignFinal): Likewise.
4645 * rsa-md5-sign.c (rsa_md5_sign): Check and propagate return value
4646 from pkcs1_rsa_md5_encode.
4647 (rsa_md5_sign_digest): Check and propagate return value from
4648 pkcs1_rsa_md5_encode_digest.
4649 * rsa-md5-verify.c (rsa_md5_verify): Check return value from
4650 pkcs1_rsa_md5_encode.
4651 (rsa_md5_verify_digest): Check return value from
4652 pkcs1_rsa_md5_encode_digest.
4653 * rsa-sha1-sign.c: Analogous changes.
4654 * rsa-sha1-verify.c: Analogous changes.
4655 * rsa-sha256-sign.c: Analogous changes.
4656 * rsa-sha256-verify.c: Analogous changes.
4657 * rsa-sha512-sign.c: Analogous changes.
4658 * rsa-sha512-verify.c: Analogous changes.
4660 * pkcs1-rsa-md5.c (pkcs1_rsa_md5_encode)
4661 (pkcs1_rsa_md5_encode_digest): Added return value. Check and
4662 propagate return value from pkcs1_signature_prefix.
4663 * pkcs1-rsa-sha256.c (pkcs1_rsa_sha256_encode)
4664 (pkcs1_rsa_sha256_encode_digest): Likewise.
4665 * pkcs1-rsa-sha1.c (pkcs1_rsa_sha1_encode)
4666 (pkcs1_rsa_sha1_encode_digest): Likewise.
4667 * pkcs1-rsa-sha512.c (pkcs1_rsa_sha512_encode)
4668 (pkcs1_rsa_sha512_encode_digest): Likewise.
4670 * pkcs1.c (pkcs1_signature_prefix): Interface change, take both
4671 the total size and digest size as arguments, and return a status
4672 code to say if the size was large enough.
4674 * testsuite/Makefile.in: Added hogweed dependency for the test
4677 2010-03-23 Niels Möller <nisse@lysator.liu.se>
4679 * testsuite/rsa-test.c (test_main): Test signing with sha512.
4681 * testsuite/testutils.c (test_rsa_sha512): New function.
4683 * Makefile.in (hogweed_SOURCES): Added pkcs1-rsa-sha512.c,
4684 rsa-sha512-sign.c and rsa-sha512-verify.c.
4686 * rsa.h: Added prototypes for sha512-related functions.
4687 (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased.
4688 * pkcs1.h: Added prototypes for sha512-related functions.
4690 * rsa-sha512-verify.c: New file.
4691 * rsa-sha512-sign.c: New file.
4692 * pkcs1-rsa-sha512.c: New file.
4694 2010-03-22 Niels Möller <nisse@lysator.liu.se>
4696 * Makefile.in (nettle_SOURCES): Added hmac-sha512.c.
4698 * testsuite/hmac-test.c (test_main): Added test cases for
4701 * hmac.h: Declare functions sha512-related functions.
4702 * hmac-sha512.c (hmac_sha512_set_key): New file.
4704 Basic sha512 support.
4705 * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added sha512-test.c.
4706 * testsuite/sha512-test.c: New file.
4708 * macros.h (READ_UINT64, WRITE_UINT64): New macros.
4710 * Makefile.in (nettle_SOURCES): Added sha512.c and sha512-meta.c.
4711 * sha.h: Added sha512-related declarations.
4712 * nettle-meta.h: Likewise.
4713 * sha512-meta.c: New file.
4714 * sha512.c: New file.
4716 2010-03-06 Niels Möller <nisse@lysator.liu.se>
4718 * Makefile.in (distdir): Include x86_64 assembler files.
4720 2010-01-20 Niels Möller <nisse@lysator.liu.se>
4722 * configure.ac: Check for mpz_powm_sec.
4724 2010-01-13 Niels Möller <nisse@lysator.liu.se>
4726 * Makefile.in ($(LIBHOGWEED_FORLINK)): Depend on
4727 $(LIBNETTLE_FORLINK).
4729 * configure.ac (LIBHOGWEED_LIBS): Added -lnettle -lgmp for the
4730 default case. Follows debian, and also makes dlopen of
4731 libhogweed.so work, without having to use RTLD_GLOBAL.
4732 (LIBHOGWEED_LINK): Added -L., to find our libnettle.so.
4734 2009-10-21 Niels Möller <nisse@lysator.liu.se>
4736 * tools/Makefile.in (pkcs1-conv$(EXEEXT)): Added dependency on
4739 2009-10-19 Niels Möller <nisse@lysator.liu.se>
4741 * tools/pkcs1-conv.c: Updated for dsa/der interface change.
4743 * der2dsa.c (dsa_public_key_from_der_iterators): Split into two
4745 (dsa_params_from_der_iterator): New function.
4746 (dsa_public_key_from_der_iterator): New function.
4747 (dsa_openssl_private_key_from_der_iterator): Renamed, was
4748 dsa_private_key_from_der_iterator.
4749 (dsa_openssl_private_key_from_der): Likewise.
4750 * dsa.h: Corresponding changees to prototypes and #defines.
4752 2009-10-12 Niels Möller <nisse@lysator.liu.se>
4754 * sexp-format.c: Removed conditioning on HAVE_LIBGMP.
4756 * tools/pkcs1-conv.c: Support for DSA keys, contributed by Magnus
4759 * Makefile.in (hogweed_SOURCES): Added dsa2sexp.c and der2dsa.c.
4761 * der2dsa.c: New file, contributed by Magnus Holmgren.
4762 * dsa2sexp.c: Likewise.
4763 * dsa.h: Added prototypes.
4765 * configure.ac (LIBHOGWEED_MINOR): Bumped libhogweed minor
4766 version, now it's 1.1.
4768 * testsuite/rsa2sexp-test.c (test_main): Updated testcase for
4771 2009-10-11 Niels Möller <nisse@lysator.liu.se>
4773 * rsa2sexp.c (rsa_keypair_to_sexp): Changed default algorithm name
4776 2009-09-20 Niels Möller <nisse@lysator.liu.se>
4778 * x86/sha1-compress.asm: Improved performance by 17% on AMD K7,
4779 by letting loopmix scramble the instruction order.
4781 2009-09-15 Niels Möller <nisse@lysator.liu.se>
4783 * x86/sha1-compress.asm: Cleanup, removing old cruft. Slight
4784 improvement to ROUND_F1_NOEXP. Slight reduction of
4787 2009-08-25 Niels Möller <nisse@lysator.liu.se>
4789 * x86/sha1-compress.asm: Eliminated tmp variable for f3 rounds.
4791 * examples/nettle-benchmark.c (bench_sha1_compress): New function,
4792 for precise benchmarking of the compression function.
4794 2009-06-08 Niels Möller <nisse@lysator.liu.se>
4796 * Released nettle-2.0.
4798 2009-06-04 Niels Möller <nisse@lysator.liu.se>
4800 * configure.ac: Set version to 2.0
4802 2009-05-30 Niels Möller <nisse@lysator.liu.se>
4804 * Makefile.in (.texinfo.info): Don't use a temporary output file
4805 $@T, trust makeinfo to remove output file on errors.
4807 2009-05-19 Niels Möller <nisse@lysator.liu.se>
4809 * nettle.texinfo: Changed license to public domain.
4811 2009-05-11 Niels Möller <nisse@lysator.liu.se>
4813 * nettle.texinfo: Fixes from Karl Berry. Added some more index
4816 2009-03-06 Niels Möller <nisse@lysator.liu.se>
4818 * x86_64/aes-encrypt-internal.asm: Reduced unrolling. Keep state
4820 * x86_64/aes-decrypt-internal.asm: Likewise.
4822 * x86_64/aes.m4 (MOVE_HREG): Deleted, no longer needed.
4823 (AES_STORE): Reduced offsets.
4824 (AES_ROUND): Use HREG directly, not MOVE_HREG.
4826 * x86_64/aes-decrypt-internal.asm: Rearrange register allocation.
4827 Put SA--SD in %eax--%edx, so the second byte can be accessed as
4828 %ah-%dh. TD is not needed, SD can be reused. Use the register that
4829 is saved for the outer loop counter, getting it off the stack.
4830 * x86_64/aes-encrypt-internal.asm: Likewise.
4832 * x86_64/aes.m4 (HREG, MOVE_HREG): New macros.
4833 (XREG): Fixed bug in handling of %r8 and %r9.
4834 (AES_ROUND): Use MOVE_HREG.
4836 2009-02-10 Niels Möller <nisse@lysator.liu.se>
4838 * base16-meta.c (base16_encode_update_wrapper): Mark ctx argument
4841 * testsuite/sexp-conv-test: Updated testcases for improved
4842 handling of comments.
4844 * tools/sexp-conv.c (sexp_convert_item): Use sexp_put_soft_newline
4845 to terminate comments, and modify indentation for the case that a
4846 list starts with a comment.
4848 * tools/output.c (sexp_output_init): Initialize soft_newline.
4849 (sexp_put_raw_char): Clear soft_newline.
4850 (sexp_put_newline): Check and reset soft_newline.
4851 (sexp_put_soft_newline): New function.
4853 * tools/output.h (struct sexp_output): Removed union with single
4854 element, and updated all users. New attribute soft_newline.
4856 2008-12-22 Niels Möller <nisse@lysator.liu.se>
4858 * Makefile.in ($(des_headers)): Create files in $(srcdir).
4860 2008-11-28 Niels Möller <nisse@lysator.liu.se>
4862 * testsuite/cxx-test.cxx: Include <cstdio>.
4864 2008-11-22 Niels Möller <nisse@lysator.liu.se>
4866 * yarrow256.c (yarrow256_fast_reseed): Set ctx->seeded = 1, so
4867 that it is set if and only if the aes context has been initialized
4868 with aes_set_encrypt_key.
4869 (yarrow256_seed): No need to set ctx->seeded here.
4870 (yarrow256_update): Likewise.
4872 2008-11-04 Niels Möller <nisse@lysator.liu.se>
4874 * examples/next-prime.c (main): Avoid using gmp_fprintf, to stay
4875 compatible with gmp-3.1.
4877 2008-11-01 Niels Möller <nisse@lysator.liu.se>
4879 * nettle.texinfo: Updated for 2.0. New section on linking.
4881 * nettle-types.h, nettle-meta.h: Moved all typedefs for function
4882 types to nettle-types.h. Use non-pointer types, so that the types
4883 can be used to declare functions. Updated all users.
4885 2008-10-31 Niels Möller <nisse@lysator.liu.se>
4887 * testsuite/yarrow-test.c (test_main): Updated for seed file
4890 * sha-example.c (display_hex): Use %02x, not %2x.
4892 2008-10-30 Niels Möller <nisse@lysator.liu.se>
4894 * tools/sexp-conv.c (main): Fixed file locking.
4896 2008-10-25 Niels Möller <nisse@lysator.liu.se>
4898 * configure.ac: Set version to 2.0rc1.
4900 * examples/Makefile.in (next-prime$(EXEEXT)): Added -lnettle to
4903 2008-10-24 Niels Möller <nisse@lysator.liu.se>
4905 * sha256.c (ROUND): Simplified macro.
4907 * yarrow256.c (yarrow256_fast_reseed): Renamed (was
4908 yarrow_fast_reseed) and made non-static. Don't generate seed file
4909 here, let the application use yarrow256_random instead.
4910 (yarrow256_slow_reseed): Renamed (was yarrow_slow_reseed) and made
4912 (yarrow256_force_reseed): Deleted function, use
4913 yarrow256_slow_reseed instead. For backwards compatibility,
4914 yarrow.h defines yarrow256_force_reseed as an alias for that
4917 * yarrow.h (struct yarrow256_ctx): Deleted seed_file buffer.
4919 2008-09-17 Niels Möller <nisse@lysator.liu.se>
4921 * x86/arcfour-crypt.asm: Improved loop logic, and unrolled
4922 loop twice. Gave a modest speedup.
4924 2008-09-15 Niels Möller <nisse@lysator.liu.se>
4926 * yarrow256.c (yarrow256_seed): Disallow length == 0.
4928 * base64-decode.c (decode_table): Added vertical tab (VT) and form
4929 feed (FF) as white space characters.
4931 * x86_64/aes-decrypt-internal.asm: New file.
4933 2008-09-13 Niels Möller <nisse@lysator.liu.se>
4935 * x86/aes-encrypt-internal.asm: Replaced pushl and popl in the
4936 loop with movl. Eliminated redundant movl.
4937 * x86/aes-decrypt-internal.asm: Likewise.
4939 * x86_64/aes.m4: New file.
4941 * x86/aes-encrypt-internal.asm: Updated for AES_FINAL_ROUND. Only
4942 three times through the substitution loop.
4943 * x86/aes-decrypt-internal.asm: Likewise.
4944 * x86_64/aes-encrypt-internal.asm: Likewise.
4946 * x86/aes.m4 (AES_FINAL_ROUND): Do the substitution on the least
4947 significant byte here.
4949 * x86/aes-encrypt-internal.asm: Updated use of AES_SUBST_BYTE. USe
4950 decl for outer loop.
4951 * x86/aes-decrypt-internal.asm: Likewise.
4953 * x86/aes.m4 (LREG, HREG): New macros.
4954 (AES_SUBST_BYTE): Take state registers as argument. Use LREG to
4955 get the corresponding byte register.
4956 (AES_ROUND): Use movzbl together with LREG and HREG.
4957 (AES_SUBST_BYTE): Likewise.
4959 2008-09-10 Niels Möller <nisse@lysator.liu.se>
4961 * x86_64/sha1-compress.asm: Avoid using registers %rbx and %rbp,
4962 which must be preserved.
4964 2008-09-08 Niels Möller <nisse@lysator.liu.se>
4966 * Makefile.in (stamp-h.in): Use $(AUTOHEADER).
4968 * x86_64/sha1-compress.asm: New x86_64 assembler, based on the x86
4971 * configure.ac (asm_path): Set up asm_path for x86_64.
4973 * x86_64/machine.m4: New file, new directory.
4975 2008-08-28 Niels Möller <nisse@lysator.liu.se>
4977 * examples/eratosthenes.c (main): Rewrote block-wise sieving to
4978 use less memory. New options -s and -v.
4980 2008-08-27 Niels Möller <nisse@lysator.liu.se>
4982 * testsuite/sexp-conv-test (print_raw, print_nl): Use printf.
4983 Updated testcases with comments; comments are now preserved.
4985 * tools/sexp-conv.c (sexp_convert_item): Keep comments in advanced
4987 (parse_options): New --lock option.
4988 (main): Optionally lock output file.
4990 * tools/parse.c (sexp_check_token): Removed check for "any" token.
4991 All callers specify the token they expect.
4992 (sexp_parse): Pass on comment tokens.
4994 * tools/output.c (sexp_put_data): Made non-static.
4996 * tools/input.c (sexp_get_comment): New function.
4997 (sexp_get_token): Use sexp_get_comment.
4999 * tools/misc.h (enum sexp_token): Start enumeration with zero, zero
5000 is no longer used to mean any type. New type SEXP_COMMENT.
5002 * configure.ac: Check for fcntl file locking.
5004 2008-08-26 Niels Möller <nisse@lysator.liu.se>
5006 * Makefile.in (tags-here): Put TAGS file in the source directory.
5007 * examples/Makefile.in (tags): Likewise.
5008 * testsuite/Makefile.in (tags): Likewise.
5009 * tools/Makefile.in (tags): Likewise.
5011 2008-02-29 Niels Möller <nisse@lysator.liu.se>
5013 * examples/Makefile.in (SOURCES): Added next-prime.c.
5015 2008-01-05 Niels Möller <nisse@lysator.liu.se>
5017 * examples/Makefile.in (TARGETS): Added eratosthenes and next-prime.
5018 (next-prime, eratosthenes): New rules.
5019 (nettle-benchmark): Don't rely on $@.
5021 * examples/eratosthenes.c (find_first_one): Optimized, using
5022 slightly larger table.
5023 (main): Use atol, rather than atoi.
5025 * testsuite/symbols-test: Check symbols also in libhogweed.
5027 * examples/next-prime.c: New file.
5028 Deleted code for detailed timing.
5030 * Makefile.in (hogweed_SOURCES): Added bignum-next-prime.c.
5031 (DISTFILES): Added prime-list.h.
5032 (hogweed_OBJS): Removed $(LIBOBJS).
5034 * bignum-next-prime.c (nettle_next_prime): Renamed function, for
5035 name space reasons. Was bignum_next_prime. Updated call in
5037 (primes): Use prime-list.h.
5038 (nettle_next_prime): Skip Fermat test. Use mpz_millerrabin
5039 directly, rather than mpz_probab_prime_p, when the former is
5042 * bignum.h (nettle_next_prime): New prototype.
5044 * rsa-keygen.c (bignum_next_prime): Deleted, moved to
5045 bignum-next-prime.c. Call with a larger prime limit, this improves
5046 the running time of lsh-keygen by roughly 25%.
5048 * prime-list.h: List of odd primes < 2^16.
5050 * configure.ac: Check for sizeof(long).
5052 2008-01-03 Niels Möller <nisse@lysator.liu.se>
5054 * examples/nettle-benchmark.c (main): Removed incorrect UNUSED
5057 * bignum-next-prime.c: Moved the bignum_next_prime function to a
5060 2007-09-08 Niels Möller <nisse@lysator.liu.se>
5062 * sparc64/aes-encrypt-internal.asm: The directory with the aes.m4
5063 include file was renamed from "sparc" to "sparc32". Updated include.
5064 * sparc64/aes-decrypt-internal.asm: Likewise.
5065 * sparc32/aes-encrypt-internal.asm: Likewise.
5066 * sparc32/aes-decrypt-internal.asm: Likewise.
5068 2007-09-07 Niels Möller <nisse@lysator.liu.se>
5070 * examples/read_rsa_key.c: Include stdlib.h.
5072 2007-06-02 Niels Möller <nisse@lysator.liu.se>
5074 * Makefile.in: Typo fixes to install targets, spotted by Magnus
5077 2007-05-14 Niels Möller <niels@s3.kth.se>
5079 * configure.ac: Fixed copy-and-paste errors in shared library
5082 * config.make.in (LIBNETTLE_SONAME, LIBHOGWEED_SONAME): Define.
5084 * Makefile.in (libnettle.so, libhogweed.so): Fixed rules.
5086 * Makefile.in: Split nettle library into two files, libnettle.a
5087 and libhogweed.a, and similarly for the shared libraries.
5089 * configure.ac: Bumped nettle so-versions to 3.0. Set hogweed
5090 so-versions to 1.0. New makefile conditionals IF_SHARED and
5091 IF_HOGWEED. Renamed WITH_PUBLIC_KEY to WITH_HOGWEED. Deleted
5092 SHLIBTARGET, SHLIBINSTALL, RSA_EXAMPLES and RSA_TOOLS.
5094 * config.make.in: Updated for hogweed split.
5096 * C source files: Don't use WITH_PUBLIC_KEY / WITH_HOGWEED, the
5097 Makefile sorts out which files should be compiled.
5099 * pgp.h: Include bignum.h, don't pretend to work without bignums.
5101 * pgp-encode.c (pgp_put_mpi, pgp_put_public_rsa_key)
5102 (pgp_put_rsa_sha1_signature): Define unconditionally. Removed the
5103 checking of HAVE_LIBGMP and WITH_PUBLIC_KEY.
5105 * examples/io.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5106 * examples/io.c (read_rsa_key): Deleted, moved to...
5107 * examples/read_rsa_key.c: New file, extracted from io.c.
5109 * examples/Makefile.in: Use IF_HOGWEED instead of RSA_EXAMPLES.
5110 Link appropriate programs with -lhogweed.
5111 (SOURCES): Added read_rsa_key.c.
5113 * tools/Makefile.in (pkcs1-conv): Use IF_HOGWEED, not @RSA_TOOLS@,
5114 for configuration. Link with -lhogweed.
5116 * testsuite/testutils.h: Use WITH_HOGWEED, not WITH_PUBLIC_KEY.
5117 * testsuite/testutils.c: Likewise.
5119 * testsuite/Makefile.in (TS_NETTLE_SOURCES, TS_HOGWEED_SOURCES):
5120 Separate test cases using nettle and those also using hogweed.
5122 2007-04-05 Niels Möller <nisse@lysator.liu.se>
5124 * Moved in CVS tree. Also renamed directory sparc to sparc32.
5126 2007-02-24 Niels Möller <nisse@lysator.liu.se>
5128 * Makefile.in (clean-here): Remove .lib directory.
5129 (distclean-here): Remove machine.m4.
5131 2006-12-05 Niels Möller <nisse@lysator.liu.se>
5133 * configure.ac: AC_PREREQ 2.61, for AC_PROG_MKDIR_P.
5135 * config.make.in (datarootdir): New directory variable (for
5138 2006-11-28 Niels Möller <nisse@lysator.liu.se>
5140 * configure.ac: Bumped version to 1.16.
5142 * Released nettle-1.15.
5144 2006-11-27 Niels Möller <nisse@lysator.liu.se>
5146 * NEWS: New entry for nettle-1.15.
5148 * configure.ac (SHLIBMINOR): Bumped version. Library name is now
5151 * sha256.c: Changed copyright notice to use the LGPL.
5153 * Makefile.in (DISTFILES): Added COPYING.LIB.
5155 * COPYING.LIB: New file (previously only the plain GPL was
5156 included in the distribution).
5158 * nettle.texinfo: Updated vor nettle-1.15.
5160 * testsuite/rsa-test.c (test_main): Use test_rsa_sha256.
5161 * testsuite/testutils.c (test_rsa_sha256): New function.
5163 * testsuite/Makefile.in (DISTFILES): Replaces rfc1750.txt by
5166 * rsa.h (rsa_sha256_sign, rsa_sha256_verify)
5167 (rsa_sha256_sign_digest, rsa_sha256_verify_digest): New declarations.
5168 (RSA_MINIMUM_N_OCTETS, RSA_MINIMUM_N_BITS): Increased to
5169 62 octets and 489 bits, respectively, for supporting sha256.
5171 * pkcs1.h (pkcs1_rsa_sha256_encode)
5172 (pkcs1_rsa_sha256_encode_digest): New declarations and name
5175 * Makefile.in (nettle_SOURCES): Added pkcs1-rsa-sha256.c,
5176 rsa-sha256-sign.c, rsa-sha256-verify.c.
5178 * pkcs1-rsa-sha256.c, rsa-sha256-sign.c, rsa-sha256-verify.c: New
5181 * COPYING, INSTALL, install-sh, texinfo.tex: Updated files, from
5184 2006-11-27 Niels Möller <niels@s3.kth.se>
5186 * tools/Makefile.in (install): Use MKDIR_P to create installation
5187 directory. Install only one file at a time.
5189 * Makefile.in (MKDIR_P): Use MKDIR_P for creating installation
5192 * configure.ac: Use AC_PROG_MKDIR_P.
5194 2006-11-24 Niels Möller <nisse@lysator.liu.se>
5196 * testsuite/yarrow-test.c (test_main): Use gold-bug.txt as input
5197 file, instead of rfc1750.txt.
5199 * testsuite/gold-bug.txt: New test input file for yarrow-test.
5200 The copyright on this short story by Edgar Allan Poe has expired.
5202 * testsuite/rfc1750.txt: Deleted file. Debian considers RFC:s
5203 non-free, and it was expired anyway. Replaced by gold-bug.txt.
5205 2006-11-24 Niels Möller <niels@s3.kth.se>
5207 * Almost all header files: Added C++ guards.
5209 * configure.ac: Test if the system has any C++ compiler.
5211 * config.make.in (CXX, CXXFLAGS, COMPILE_CXX, LINK_CXX): New variables.
5213 * testsuite/Makefile.in: New variables TS_C and TS_CXX. Setup for
5214 compiling the C++ file cxx-test.cxx.
5216 * testsuite/cxx-test.cxx: New testcase, trying to use nettle from
5219 2006-08-28 Niels Möller <niels@s3.kth.se>
5221 * index.html: Added section on language bindings.
5223 2006-06-10 Niels Möller <niels@s3.kth.se>
5225 * configure.ac: Darwin shared library support, from Grant
5228 2006-05-18 Niels Möller <nisse@lysator.liu.se>
5230 * src/nettle/x86/aes.asm: Deleted unused file.
5232 * aes-decrypt.c (_aes_decrypt_table): Deleted the indexing array,
5233 previously commented out.
5234 * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5236 * Makefile.in (.texinfo.info, .dvi.ps): Use more quotes with
5238 (install-here, install-shared, install-info, install-headers): Use
5239 plain mkdir, not $(INSTALL) -d.
5241 2006-05-16 Niels Möller <niels@s3.kth.se>
5242 Merged from the lsh experimental branch.
5244 2006-04-26 Niels Möller <nisse@lysator.liu.se>
5246 * examples/rsa-decrypt.c: Don't include "getopt.h", since it's not used.
5247 * examples/nettle-benchmark.c: Include "getopt.h".
5249 * examples/Makefile.in (GETOPT_OBJS): New variable.
5250 (rsa-keygen, rsa-encrypt, nettle-benchmark): Depend on and link
5251 with $(GETOPT_OBJS).
5253 * x86/aes-decrypt-internal.asm: Use ALIGN.
5254 * x86/aes-encrypt-internal.asm: Likewise.
5255 * x86/arcfour-crypt.asm: Likewise.
5256 * x86/md5-compress.asm: Likewise.
5257 * x86/sha1-compress.asm: Likewise.
5259 * config.m4.in (ASM_ALIGN_LOG): Substitute.
5260 * configure.ac (ASM_ALIGN_LOG): Check if .align directive is
5262 * asm.m4 (ALIGN): New macro. Takes a logarithmic argument, and
5263 expands to a .align directive.
5265 2006-04-21 Niels Möller <nisse@lysator.liu.se>
5267 * nettle.texinfo (Public-key algorithms): Say that the public key
5268 operations are undocumented, not unsupported. Reported by Jeronimo
5271 2006-04-08 Niels Möller <nisse@lysator.liu.se>
5273 * tools/pkcs1-conv.c (read_pem): Fixed c99-style declaration.
5274 Reported by Henrik Grubbström.
5276 2006-01-31 Niels Möller <niels@s3.kth.se>
5278 * examples/rsa-verify.c: Fixed typo in usage message.
5280 2005-12-05 Niels Möller <nisse@lysator.liu.se>
5282 * configure.ac: Bumped version to 1.15,
5284 * Released nettle-1.14.
5286 * NEWS: Updated for 1.14.
5288 * configure.ac (SHLIBMINOR): Increased minor number. Library
5289 version is now libnettle.so.2.5, soname still libnettle.so.2.
5291 2005-11-28 Niels Möller <nisse@lysator.liu.se>
5293 * config.make.in (INSTALL): Don't substitute INSTALL, INSTALL_DATA
5294 and friends here, to get a correct a relative filename for
5295 install-sh when used in tools/Makefile.
5297 * tools/Makefile.in (INSTALL): Substitute INSTALL, INSTALL_DATA
5299 * Makefile.in (INSTALL): Likewise.
5301 2005-11-27 Niels Möller <nisse@lysator.liu.se>
5303 * Makefile.in (.texinfo.pdf): New rule. Avoid dependency on
5304 intermediate .dvi and .ps files.
5306 * testsuite/Makefile.in (clean): Delete sha1-huge-test.
5308 * Makefile.in (install-info, install-headers): Don't use $< and
5309 $?; Solaris make doesn't support them in explicit rules.
5311 2005-11-26 Niels Möller <nisse@lysator.liu.se>
5313 * testsuite/Makefile.in: Include .test-rules.make, which contains
5314 the rules for all the test executables.
5315 (test-rules): New rule, to update this file.
5316 (DISTFILES): Added $(EXTRA_SOURCES).
5318 * testsuite/.test-rules.make: Automatically generated file for
5319 building the test programs.
5321 2005-11-25 Niels Möller <nisse@lysator.liu.se>
5323 * configure.ac: Disable assembler when compiling with rntcl.
5325 * tools/Makefile.in (pkcs1_conv_SOURCES): New variable.
5326 (pkcs1-conv): Link with getopt.o and getopt1.o.
5328 * Makefile.in (aesdata, desdata, shadata): Use explicit rules for
5331 * testsuite/Makefile.in: Use %-rules for building the -test
5332 executables, in addition to the suffix rules. Hopefully, this
5333 should make all of GNU make, BSD make and Solaris make happy.
5334 Use $(EXEEXT) and $(OBJEXT) more consistently.
5336 * examples/Makefile.in: Use explicit rules for all executable
5337 targets. Use $(EXEEXT) and $(OBJEXT) more consistently.
5339 2005-11-25 Niels Möller <niels@s3.kth.se>
5341 * testsuite/Makefile.in: Avoid using single-suffix rule to build
5344 2005-11-24 Niels Möller <niels@s3.kth.se>
5346 * Makefile.in (distdir): Use [ -f, not [ -e, since the latter
5347 is less portable, and not supported by Solaris /bin/sh.
5349 2005-11-23 Niels Möller <niels@s3.kth.se>
5351 * testsuite/Makefile.in (DISTFILES): Added teardown-env.
5352 * testsuite/teardown-env: New file. Delete files created by the
5355 2005-11-21 Niels Möller <nisse@lysator.liu.se>
5357 * testsuite/testutils.c (main): Fixed check for -v option. Spotted
5360 2005-11-21 Niels Möller <niels@s3.kth.se>
5362 * ctr.h (CTR_CTX, CTR_CRYPT): Fixed bugs, spotted by Goran K.
5364 2005-11-20 Niels Möller <nisse@lysator.liu.se>
5366 * Makefile.in (nettle_SOURCES): Added der2rsa.c.
5368 * testsuite/Makefile.in (TS_SH): Added pkcs1-conv-test.
5370 * tools/Makefile.in (TARGETS): Added @RSA_TOOLS@.
5371 (SOURCES): Added pkcs1-conv.c.
5372 (pkcs1-conv): New rule.
5374 * tools/pkcs1-conv.c: New program.
5376 * testsuite/pkcs1-conv-test: New file.
5378 * examples/rsa-verify-test: Use rsa-sign to create signature.
5380 * examples/io.c (read_file): Fixed spelling in error message.
5382 * rsa.h (rsa_public_key_from_der_iterator)
5383 (rsa_private_key_from_der_iterator, rsa_keypair_from_der): Declare
5386 * der2rsa.c: New file.
5388 * der-iterator.c (asn1_der_iterator_init): Initialize length and
5390 (asn1_der_iterator_next): Support for lengths >= 0x80.
5391 (asn1_der_decode_constructed_last, asn1_der_decode_bitstring)
5392 (asn1_der_decode_bitstring_last): New functions.
5393 (asn1_der_get_bignum): Check for non-mininal encodings.
5395 * configure.ac (RSA_TOOLS): New substituted variable. Includes
5396 pkcs1-conv, when public-key support is enabled.
5398 * bignum.h (nettle_asn1_der_get_bignum): Include nettle_-prefix in
5401 * asn1.h: Added name mangling defines, and a few new declarations.
5403 2005-11-13 Niels Möller <nisse@lysator.liu.se>
5405 * Makefile.in (nettle_SOURCES): Added der-iterator.c.
5406 (HEADERS): Added asn1.h.
5408 * bignum.h (asn1_der_get_bignum): Declare function.
5410 * der-iterator.c: New file.
5413 2005-11-07 Niels Möller <nisse@lysator.liu.se>
5415 * examples/nettle-benchmark.c: Check HAVE_UNISTD_H.
5417 * examples/Makefile.in (TARGETS): Use $(EXEEXT).
5418 * tools/Makefile.in (TARGETS, sexp-conv, nettle-lfib-stream): Likewise.
5420 * configure.ac: Use $host_cpu, not $host, when setting up the
5421 assembler path. Use $host_os, not uname, when setting up shared
5424 * Makefile.in (des.$(OBJEXT)): Use OBJEXT.
5426 * config.guess, config.sub: In the CVS tree, moved files to the
5427 lsh top-level directory.
5429 2005-10-23 Niels Möller <nisse@lysator.liu.se>
5431 * sparc64/arcfour-crypt.asm: New file, almost the same as
5432 sparc/arcfour-crypt.asm.
5434 * examples/nettle-benchmark.c (display): Use two decimal places.
5436 * sparc/arcfour-crypt.asm: Reorganized. Main loop unrolled four
5437 times. Uses aligned 32-bit write accesses at DST. Still uses 8-bit
5438 read accesses at SRC; could be improved int he case that SRC and
5439 DST have compatible alignment.
5441 2005-10-19 Niels Möller <niels@s3.kth.se>
5443 * testsuite/arcfour-test.c (test_main): New testcase with 512
5446 2005-10-19 Niels Möller <nisse@lysator.liu.se>
5448 * sparc/arcfour-crypt.asm: Fixed bug, spotted by Mikael Kalms. We
5449 must order the store at [CTX+I] before the load of [CTX+SI+SJ].
5451 2005-10-18 Niels Möller <nisse@lysator.liu.se>
5453 * sparc/arcfour-crypt.asm: Special unrolled code if SRC and DST
5454 have compatible alignment. Improves performance by 20%, but I'm
5455 not sure it's worth the extra complexity.
5457 * bignum.c (nettle_mpz_from_octets): Removed sign argument. If
5458 mpz_import is available, define nettle_mpz_from_octets as a macro
5460 (nettle_mpz_from_octets): Start by setting x to zero; callers no
5461 longer need to do that.
5462 (nettle_mpz_set_str_256_s): New logic for the handling of negative
5463 numbers. Convert in the same way as for positive numbers, and then
5464 subtract the appropriate power of two.
5466 2005-10-17 Niels Möller <nisse@lysator.liu.se>
5468 * bignum.c (nettle_mpz_from_octets): Improved loop. Removed the
5469 digit temporary (suggested by Torbjörn Granlund).
5471 * sparc/arcfour-crypt.asm: Improved instruction scheduling.
5473 * sparc/arcfour-crypt.asm: Bugfix, use lduh and stuh.
5475 * sparc/arcfour-crypt.asm: New file.
5477 * sparc64/aes.asm: Deleted unused file.
5479 * x86/arcfour-crypt.asm: Use ARCFOUR_I and ARCFOUR_J
5480 * asm.m4 (ARCFOUR): New struct.
5482 2005-10-17 Niels Möller <niels@s3.kth.se>
5484 * aes-internal.h (struct aes_table): Deleted idx and sparc_idx
5486 * aes-encrypt-table.c (_aes_encrypt_table): Likewise.
5487 * aes-decrypt.c (_aes_decrypt_table): Likewise.
5488 * asm.m4 (AES): Likewise
5490 2005-10-16 Niels Möller <nisse@lysator.liu.se>
5492 * tools/input.c (sexp_get_char): Use unsigned for the done flag.
5494 * sparc64/aes-encrypt-internal.asm: Include sparc/aes.m4.
5495 * sparc64/aes-decrypt-internal.asm: Likewise.
5497 * sparc64/machine.m4: Use .register pseudo op to say that we use
5498 %g2 and %g3 as scratch registers.
5500 * sparc/aes-encrypt-internal.asm: Explicitly include sparc/aes.m4.
5501 * sparc/aes-decrypt-internal.asm: Likewise.
5503 * sparc/aes.m4: New file. Moved aes-related macros here...
5504 * sparc/machine.m4: ... removed aes macros.
5506 * x86/aes-encrypt-internal.asm: Explicitly include x86/aes.m4.
5507 * x86/aes-decrypt-internal.asm: Likewise.
5509 * x86/aes.m4: New file. Moved aes-related macros here, from...
5510 * x86/machine.m4: ... removed aes macros.
5512 * sparc64/aes-encrypt-internal.asm: New file.
5513 * sparc64/aes-decrypt-internal.asm: New file.
5515 * sparc64/machine.m4: Include the same aes macros used for
5517 (BIAS): Define magic stack bias constant.
5519 * sparc/aes-encrypt-internal.asm, sparc/aes-decrypt-internal.asm:
5520 Reduced frame size to 104 bytes, since we no longer need wtxt and
5523 * sparc/aes.asm: Deleted old aes implementation.
5525 * sparc/aes-decrypt-internal.asm: New file.
5527 * sparc/machine.m4: Don't use m4 eval, instead rely on the
5528 assembler's arithmetic.
5530 * sparc/machine.m4 (AES_FINAL_ROUND): Better scheduling, by
5531 interleaving independent operations.
5533 * sparc/machine.m4 (TMP3): A third temporary register.
5534 (AES_FINAL_ROUND): Prepared for scheduling.
5536 * sparc/machine.m4 (AES_ROUND): Deleted unused argument T. Updated
5537 all calls in aes-encrypt-internal.asm.
5539 * sparc/machine.m4 (AES_ROUND): New loop invariants T0-T3, to
5540 avoid the additions of the AES_TABLEx constants in the inner loop.
5542 * sparc/machine.m4 (AES_ROUND): Better scheduling, by
5543 interleaving independent operations.
5545 * sparc/machine.m4 (AES_ROUND): Alternate between using TMP1 and
5546 TMP2, to prepare for scheduling.
5548 * sparc/aes-encrypt-internal.asm: Renamed Ti -> Xi.
5550 * sparc/aes-encrypt-internal.asm: Fixed bugs. Now passes the
5553 * sparc/machine.m4 (AES_ROUND, AES_FINAL_ROUND): Bugfixes. Put
5554 NOPs in the load dely slots.
5556 * sparc/aes-encrypt-internal.asm: Implemented. Not yet working,
5559 * sparc/machine.m4: Use TMP1 and TMP2, so we don't need to pass
5561 (AES_FINAL_ROUND): New macro.
5563 2005-10-15 Niels Möller <nisse@lysator.liu.se>
5565 * configure.ac (OBJDUMP): Substitute the program false if objdump
5568 * asm.m4 (PROLOGUE): Use TYPE_FUNCTION.
5570 * config.m4.in: Substitute ASM_TYPE_FUNCTION as TYPE_FUNCTION.
5572 * configure.ac (ASM_ELF_STYLE): Check for %function and #function,
5573 but not for @function.
5574 (ASM_TYPE_FUNCTION): New substituted variable.
5576 * configure.ac (ASM_ELF_STYLE): Fixed .type foo,@function statement
5577 used when checking for pseudo operations.
5579 * sparc/machine.m4 (AES_LOAD, AES_ROUND): Started writing new AES
5582 * sparc/aes-encrypt-internal.asm: New file.
5584 2005-10-14 Niels Möller <nisse@lysator.liu.se>
5586 * x86/aes-decrypt.asm, x86/aes-encrypt.asm: Deleted files.
5588 * x86/aes-decrypt-internal.asm: New file.
5590 * x86/machine.m4: Changed AES macros, to handle a table register.
5591 Also take more of the used registers as argument.
5593 * x86/aes-encrypt-internal.asm: Rewritten to match new interface,
5594 with the table pointer as an argument. Unlike the old code, this
5595 should really be position independent.
5597 * configure.ac: When looking for assembler files, link in
5598 aes-encrypt-internal.asm and aes-decrypt-internal.asm. Don't look
5599 for aes.asm, aes-encrypt.asm and aes-decrypt.asm.
5601 * configure.ac (OBJDUMP): Use AC_CHECK_TOOL to check for objdump.
5602 (ASM_MARK_NOEXEC_STACK): Use $OBJDUMP when examining the object file.
5604 * Makefile.in (nettle_SOURCES): Removed aes.c,
5605 aes-decrypt-table.c. Added aes-decrypt-internal.c and aes-encrypt-internal.c.
5607 * aes.c, aes-decrypt-table.c: Deleted files.
5609 * aes-decrypt.c (_aes_decrypt_table): Moved table here, and made
5612 * aes-internal.h (_aes_decrypt_table): Don't declare, it's no
5613 longer globally visible.
5615 * aes-decrypt-internal.c (_nettle_aes_decrypt): New AES decryption
5616 function, analogous to _nettle_aes_encrypt.
5618 2005-10-14 Niels Möller <niels@s3.kth.se>
5620 * aes-internal.h (AES_ROUND, AES_FINAL_ROUND): New macros.
5622 * aes-encrypt-internal.c (_nettle_aes_encrypt): New AES encryption
5623 function, avoiding the table-based indexing.
5625 * sha1-compress.c: Added debugging code.
5626 * md5-compress.c: Likewise.
5628 2005-10-13 Niels Möller <niels@s3.kth.se>
5630 * config.m4.in (ASM_MARK_NOEXEC_STACK): Use a diversion, to
5631 substitute the value of ASM_MARK_NOEXEC_STACK at the end of each
5634 * configure.ac (ASM_MARK_NOEXEC_STACK): Check if the C compiler
5635 generates a .note.GNU-stack section. If so, we should do the same
5636 in our assembler files.
5638 * sparc64/aes.asm: New file. Copy of sparc/aes.asm, with minor
5639 changes to the stack frame layout. Patch contributed by Henrik
5640 Grubbström. Not yet tested.
5642 * x86/md5-compress.asm: Skip copying of input to the stack, and
5643 don't allocate space for it.
5646 * testsuite/md5-test.c: Document intermediate values for first
5649 * configure.ac (asm_path): Check for sparc64, and use sparc64
5650 subdirectory. Link in md5-compress.asm, if it exists.
5652 2005-10-13 Niels Möller <nisse@lysator.liu.se>
5654 * x86/md5-compress.asm (REF): Fixed calculation of offset.
5656 2005-10-12 Niels Möller <nisse@lysator.liu.se>
5658 * x86/machine.m4 (OFFSET): Moved macro, used to be in...
5659 * x86/sha1-compress.asm (OFFSET): ... removed macro.
5661 * x86/md5-compress.asm: New file, with first attempt at md5
5662 assembler. Not yet working.
5664 2005-10-11 Niels Möller <nisse@lysator.liu.se>
5666 * Makefile.in (nettle_SOURCES): Added md5-compress.c.
5668 * md5.c: Reorganized to use _nettle_md5_compress, in analogy with
5671 * md5-compress.c (_nettle_md5_compress): New file and new function.
5673 2005-10-10 Niels Möller <niels@s3.kth.se>
5675 * testsuite/Makefile.in (EXTRA_SOURCES, EXTRA_TARGETS): New
5676 variables, for test cases that are not run by default.
5678 * testsuite/sha1-huge-test.c (test_main): New test case, with a
5679 very large sha1 input.
5681 * testsuite/testutils.c (test_hash_large): New function.
5683 * sha1.c (sha1_block): Deleted function; inlined where used.
5684 (SHA1_INCR): New macro for incrementing the block count.
5686 2005-10-06 Niels Möller <nisse@lysator.liu.se>
5688 * configure.ac: Bumped version to 1.14.
5690 * Released nettle-1.13.
5692 * configure.ac: Check for openssl/aes.h.
5694 * Makefile.in (distdir): Use a loop to pick up the contents of
5695 $(DISTFILES) from source and build directories. For some reason,
5696 $? failed to find stamp-h.in in the source directory.
5698 2005-10-05 Niels Möller <nisse@lysator.liu.se>
5700 * x86/aes-decrypt.asm: Use C_NAME(_nettle_aes_decrypt_table) when
5701 using the AES_SUBST_BYTE macro. Use PROLOGUE and EPILOGUE.
5702 * x86/sha1-compress.asm: Use PROLOGUE and EPILOGUE.
5703 * x86/arcfour-crypt.asm: Likewise.
5704 * x86/aes-encrypt.asm: Likewise.
5706 * config.m4.in (ELF_STYLE): Substitute configure's ASM_ELF_STYLE.
5708 * asm.m4 (PROLOGUE, EPILOGUE): New macros, checking the value of
5709 ELF_STYLE. So far, used and tested only for the x86 assembler
5710 files, and needed to make the assembler happy both with ELF
5711 (linux, solaris) and COFF (windows).
5713 * configure.ac (NM): Use AC_CHECK_TOOL to check for nm.
5714 (ASM_SYMBOL_PREFIX): Use $NM when examining the object file.
5715 (ASM_ELF_STYLE): New variable. Set to 'yes' if assembling a file
5716 with ELF-style .type and .size pseudo ops works.
5718 * Makefile.in (TARGETS, DISTFILES): Added nettle.pdf.
5719 (.texinfo.dvi, .dvi.ps, .ps.pdf): New targets, to build nettle.pdf.
5720 (DOCTARGETS): New variable with targets that shouldn't be deleted
5722 (maintainer-clean-here): New target. Deletes generated
5723 documentation files.
5725 * nettle.texinfo: Define AUTHOR with accents, when running in TeX
5726 mode, which doesn't handle latin-1 properly. Set UPDATED-FOR to
5727 1.13. Updated copyright years, and introduced a COPYRIGHT-YEARS
5728 symbol. Updated copyright section, to mention assembler
5730 (Cipher modes): Transformed the Cipher Block Chaining to a section
5731 Cipher modes, describing both CBC and the new CTR mode.
5733 * src/nettle/x86/aes_tables.asm: Deleted unused file.
5735 * x86/aes.asm: Deleted contents. This file is needed just to
5736 override aes.c, which isn't needed for the x86 implementation.
5738 * configure.ac (SHLIBMINOR): Increased minor number. Library
5739 version is now libnettle.so.2.4, soname still libnettle.so.2.
5741 * examples/nettle-benchmark.c (main): Reordered hash benchmarks.
5743 * x86/sha1-compress.asm (EXPAND): Use % 16 instead of & 15 to
5744 compute offsets mod 16, since m4 on FreeBSD 49.RELEASE and NetBSD
5745 doesn't implement & correctly in eval.
5747 2005-10-03 Niels Möller <nisse@lysator.liu.se>
5749 * x86/sha1-compress.asm (OFFSET): New macro.
5750 (F3): Eliminated a movl.
5751 (ROUND): New argument, for k. When using F3, it's TMP3, on the
5752 stack, otherwise, it is kept in TMP2, a register.
5754 2005-10-03 Niels Möller <niels@s3.kth.se>
5756 * examples/nettle-openssl.c: Use correct block sizes for openssl
5759 * examples/nettle-benchmark.c: Also display cycles per block.
5761 2005-10-02 Niels Möller <nisse@lysator.liu.se>
5763 * sha1-compress.c (_nettle_sha1_compress): Updated to new
5764 interface. Now responsible for byte conversion.
5766 * x86/sha1-compress.asm (_nettle_sha1_compress): Do byte order
5767 conversion, and store the input data on the stack. This leaves one
5768 more register free for other uses.
5770 * examples/nettle-benchmark.c: Now display cycles/byte, if the -f
5771 option is used to say what the clock frequency is.
5773 * sha1.c (sha1_block): Don't convert data from uint8_t to
5774 uint32_t, that's now the responsibility of _nettle_sha1_compress.
5776 * sha.h (_nettle_sha1_compress): Changed interface. Second
5777 argument is now a pointer to the input data in unaligned,
5780 2005-09-28 Niels Möller <niels@s3.kth.se>
5782 * sha1.c (sha1_final): Call sha1_block, don't call the compression
5783 function _nettle_sha1_compress directly.
5785 * nettle-internal.h (nettle_openssl_md5)
5786 (nettle_openssl_sha1): Declare.
5788 * examples/nettle-benchmark.c (main): Benchmark openssl md5 and
5791 * examples/nettle-openssl.c (nettle_openssl_md5)
5792 (nettle_openssl_sha1): Added glue for openssl hash functions.
5794 * nettle-internal.h (nettle_openssl_aes128, nettle_openssl_aes192)
5795 (nettle_openssl_aes256, nettle_openssl_arcfour128): Declare.
5797 * examples/nettle-benchmark.c: Check WITH_OPENSSL, not
5798 HAVE_LIBCRYPTO. Benchmark openssl's aes and arcfour code.
5800 * examples/nettle-openssl.c: Updated openssl des glue to use the
5801 new openssl des interface. Added glue for arcfour and aes.
5803 2005-09-27 Niels Möller <nisse@lysator.liu.se>
5805 * nettle.texinfo (RSA): Improved text about the RSA patent.
5806 Use @documentencoding ISO-8859-1.
5808 2005-09-07 Niels Möller <niels@s3.kth.se>
5810 * tools/sexp-conv.c (parse_options): New option --raw-hash, for
5811 compatibility with lsh-1.x. Equivalent to --hash.
5813 2005-09-06 Niels Möller <niels@s3.kth.se>
5815 * tools/sexp-conv.c (main): With --hash, output a newline after
5818 2005-07-02 Niels Möller <nisse@lysator.liu.se>
5820 * testsuite/Makefile.in (TS_SOURCES): Added ctr-test.c.
5822 * testsuite/testutils.c (test_cipher_ctr): New function.
5824 * testsuite/ctr-test.c: New file.
5826 * testsuite/cbc-test.c (test_main): Use static const for msg.
5828 * Makefile.in (nettle_SOURCES): Added ctr.c.
5829 (HEADERS): Added ctr.h.
5830 (HEADERS): Added nettle-types.h.
5831 (INSTALL_HEADERS): Install nettle-stdint.h.
5832 (distclean-here): Delete nettle-stdint.h, not nettle-types.h.
5834 * ctr.c (ctr_crypt): New file, new function.
5836 * memxor.c (memxor3): New function, suggested by Adam Langley.
5838 * nettle-internal.h (NETTLE_MAX_CIPHER_BLOCK_SIZE): New constant.
5840 * nettle.texinfo (Cipher functions): Fixed typo in prototype for
5841 arctwo_encrypt (noticed by Adam Langley).
5843 * nettle-meta.h: No longer needs to include cbc.h.
5845 * cbc.h (nettle_crypt_func): Moved typedef to nettle-types.h.
5846 (CBC_ENCRYPT, CBC_DECRYPT): Deleted older #if:ed out versions.
5848 * configure.ac (AX_CREATE_STDINT_H): Use the file name
5849 nettle-stdint.h, not nettle-types.h.
5851 * nettle-types.h: New file. Automatically generated declarations
5852 are now in nettle-stdint.h.
5854 2005-03-17 Niels Möller <niels@s3.kth.se>
5856 * config.guess: Support Solaris on x86_64. Fix by Henrik
5859 2005-01-03 Niels Möller <niels@s3.kth.se>
5861 * examples/io.h: Include RSA declarations only when public key
5862 algorithms are enabled. Problem reported by Meilof Veeningen
5865 2004-12-07 Niels Möller <nisse@lysator.liu.se>
5867 * Makefile.in: Install directories, using $(INSTALL) -d, only if
5868 they don't exist already.
5870 2004-12-05 Niels Möller <nisse@lysator.liu.se>
5872 * config.make.in (.PRECIOUS): Reverted earlier change. We need
5873 .PRECIOUS to stop GNU make from deleting object files for the test
5876 2004-12-02 Niels Möller <nisse@lysator.liu.se>
5878 * Makefile.in (.SUFFIXES): Moved from Makefile.in to...
5879 * config.make.in (.SUFFIXES): ... here. This helps compilation
5881 * testsuite/Makefile.in (.SUFFIXES): Deleted target.
5883 * config.make.in (.c): Disable default rule for BSD-make.
5885 * Makefile.in (all check install uninstall)
5886 (clean distclean mostlyclean maintainer-clean): Don't use the -C
5887 flag when invoking make, for compatibility with Solaris make.
5889 2004-12-02 Niels Möller <niels@s3.kth.se>
5891 * Makefile.in (aesdata, desdata): Commented out the explicit
5893 (shadata): Avoid using $< in non-pattern rule.
5895 2004-12-01 Niels Möller <nisse@lysator.liu.se>
5897 * config.make.in: Added a default target.
5899 2004-11-29 Niels Möller <nisse@lysator.liu.se>
5901 * testsuite/Makefile.in: Use .$(OBJEXT). Explicitly set .SUFFIXES.
5903 * Makefile.in: Use .$(OBJEXT).
5905 2004-11-28 Niels Möller <nisse@lysator.liu.se>
5907 * tools/Makefile.in (nettle-lfib-stream): Avoid using $< in
5910 * Makefile.in (distdir): Handle absolute $distdir.
5911 Avoid using the GNU extension $^.
5913 * examples/Makefile.in: Avoid using the GNU extension $^.
5914 * tools/Makefile.in: Likewise.
5915 * testsuite/Makefile.in: Likewise.
5917 2004-11-24 Niels Möller <niels@s3.kth.se>
5919 * configure.ac: Fixed typo, preventing the creation of dependency
5922 2004-11-23 Niels Möller <nisse@lysator.liu.se>
5924 * Makefile.in: Use DEP_INCLUDE.
5925 * tools/Makefile.in: Likewise.
5926 * testsuite/Makefile.in: Likewise.
5927 * examples/Makefile.in: Likewise.
5929 * configure.ac (dummy-dep-files): Generate only of dependency
5930 tracking is enabled.
5932 2004-11-18 Niels Möller <nisse@lysator.liu.se>
5934 * Makefile.in (clean-here): The clean target should not delete the
5935 dependency files. Moved to the distclean target.
5936 * examples/Makefile.in: Likewise.
5937 * testsuite/Makefile.in: Likewise.
5938 * tools/Makefile.in: Likewise.
5940 * configure.ac (ASM_SYMBOL_PREFIX): Fixed test.
5941 (dummy-dep-files): Added quotes to sed command.
5943 2004-11-17 Niels Möller <nisse@lysator.liu.se>
5945 * testsuite/symbols-test: Try plain nm if nm -g doesn't work.
5947 * x86/sha1-compress.asm: Use C_NAME for global symbols.
5948 * x86/aes-encrypt.asm: Likewise.
5949 * x86/aes-decrypt.asm: Likewise.
5950 * x86/arcfour-crypt.asm: Likewise.
5952 * Makefile.in (config.m4): New rule.
5954 * config.m4.in (C_NAME): New macro.
5956 * configure.ac (ASM_SYMBOL_PREFIX): Check if global symbols have a
5959 2004-11-16 Niels Möller <nisse@lysator.liu.se>
5961 * Deleted getopt.c, getopt.h and getopt1.c from the CVS tree. Link
5962 them from shared copies in lsh/misc instead.
5964 2004-11-14 Niels Möller <nisse@lysator.liu.se>
5966 * Makefile.in (DEP_FILES): Try include with only one macro
5967 argument to be expanted.
5969 * configure.ac (dummy-dep-files): Create dummy dependency files,
5970 so that they can be included by the makefiles.
5972 2004-11-13 Niels Möller <nisse@lysator.liu.se>
5974 * Makefile.in: Don't use -include, as it's GNU make specific.
5975 * examples/Makefile.in, tools/Makefile.in, testsuite/Makefile.in:
5978 * examples/nettle-openssl.c: Check WITH_OPENSSL, not HAVE_LIBCRYPTO.
5980 * configure.ac: Check for individual openssl headers blowfish.h,
5981 cast.h, des.h. Renamed symbol HAVE_LIBCRYPTO to WITH_OPENSSL. New
5982 configure option --disable-openssl.
5984 2004-11-04 Niels Möller <nisse@lysator.liu.se>
5986 * configure.ac: Bumped version to 1.13.
5988 * Released nettle-1.12.
5990 2004-11-04 Niels Möller <niels@s3.kth.se>
5992 * nettle.texinfo (UPDATED-FOR): Bumped to 1.12.
5994 2004-11-02 Niels Möller <nisse@lysator.liu.se>
5996 * nettle.texinfo (Cipher functions): Updated AES documentation,
5997 for aes_set_encrypt_key and aes_set_decrypt_key.
5998 (UPDATED-FOR): Set to 1.11. I think the manual should be updated
5999 with all user-visible changes.
6001 * aclocal.m4 (LSH_DEPENDENCY_TRACKING): Need extra quoting in case
6002 pattern. (This file really lives in the lsh tree, as
6003 lsh/acinclude.m4. For a complete ChangeLog, see lsh/Changelog).
6005 2004-10-26 Niels Möller <nisse@lysator.liu.se>
6007 * configure.ac: Bumped version to 1.12.
6009 * Released nettle-1.11.
6011 * Makefile.in (clean-here): Delete *.s files.
6012 (PRE_CPPFLAGS): Use this variable, not INCLUDES. Removed
6015 * x86/arcfour-crypt.asm: Use movzbl when extending %cl to 32 bits.
6017 2004-10-24 Niels Möller <nisse@lysator.liu.se>
6019 * x86/arcfour-crypt.asm: Reverted the latest two changes; update
6020 bost src and dst pointers in the loop, and use plain addb when
6021 updating j. These two previous changes slowed the code down on AMD
6024 2004-10-21 Niels Möller <nisse@lysator.liu.se>
6026 * Makefile.in (install-shared): Use $(INSTALL_PROGRAM).
6028 * configure.ac (SHLIBMINOR): Updated, shared library version is
6029 now libnettle.so.2.3, soname still libnettle.so.2.
6031 * Makefile.in (DISTFILES): Added asm.m4.
6033 2004-10-21 Niels Möller <niels@s3.kth.se>
6035 * examples/Makefile.in: Deleted all configure-related rules,
6036 except the one rebuilding this Makefile. One should run make at
6037 top level if other configure related files change.
6038 * tools/Makefile.in: Likewise.
6039 * testsuite/Makefile.in: Likewise.
6041 * configure.ac: Replaced AC_OUTPUT(list...) with an AC_OUTPUT
6042 without arguments, and AC_CONFIG_FILES listing the files.
6044 * Makefile.in: Changed the assembler rules as suffix rules.
6045 Rewrote the configure-related rules, mostly based on the example
6046 in the autoconf manual.
6048 2004-10-20 Niels Möller <nisse@lysator.liu.se>
6050 * examples/nettle-openssl.c (NCOMPAT): Disable openssl backwards
6053 * config.make.in: Insert $(PRE_CPPFLAGS) and $(PRE_LDFLAGS) before
6054 $(CPPFLAGS) and $(LDFLAGS). This mechanism replaces $(INCLUDES).
6056 * examples/Makefile.in (PRE_CPPFLAGS, PRE_LDFLAGS): Use these
6057 flags to get -I.. and -L.. early on the command line.
6058 * testsuite/Makefile.in: Likewise
6059 * tools/Makefile.in: Likewise.
6061 2004-10-20 Niels Möller <niels@s3.kth.se>
6063 * Makefile.in: In the assembler rules, there's no need to look in
6064 $(srcdir) for the input file.
6066 * x86/arcfour-crypt.asm: Reduced inner loop by one instruction, by
6067 precomputing the offset between src and dst.
6069 * tools/Makefile.in (.c.$(OBJEXT)): Removed redundant -I.. flag.
6071 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replaced addb ->
6072 addl + andl $0xff, improving speed on PPro by another 15%.
6074 2004-10-20 Niels Möller <nisse@lysator.liu.se>
6076 * tools/Makefile.in (install): Support DESTDIR.
6077 (uninstall): New target.
6079 * testsuite/Makefile.in (uninstall): New dummy target.
6081 * config.sub: Copied from automake-1.8.5.
6083 * examples/Makefile.in (SOURCES): Added rsa-sign.c and rsa-verify.c.
6084 (DISTFILES): Added getopt.h.
6085 (install uninstall): New dummy targets.
6087 * config.make.in (.PHONY): Added more targets.
6089 * Makefile.in (.texinfo.info, .texinfo.html): New targets. Added
6090 support for uninstall and DESTDIR. Various fixes to install and
6093 * examples/Makefile.in (INCLUDES): Added -I flags.
6094 (distdir): Use $^ to refer to the files.
6095 (distclean): New target.
6096 * testsuite/Makefile.in: Likewise.
6097 * tools/Makefile.in: Likewise.
6099 * Makefile.in (INCLUDES): Need -I flags for VPATH build.
6100 (clean distclean mostlyclean maintainer-clean): Clean
6101 subdirectories first.
6102 (DISTFILES): Added a bunch of files.
6103 (des_headers): Added desCore rules.
6104 (install-here): Split off target install-headers, which uses $^ to
6106 (distdir): Use $^ to refer to the files.
6109 * config.make.in (COMPILE): Add $(INCLUDE) to the line.
6111 2004-10-19 Niels Möller <nisse@lysator.liu.se>
6113 Stop using automake. Replaced each Makefile.am with a hand-written
6115 * configure.ac: New output variable CCPIC_MAYBE. New output file
6116 config.make. Replaced automake constructions.
6117 * .bootstrap: Don't run aclocal and automake.
6118 * config.make.in: New file, with shared Makefile variables and rules.
6120 2004-10-18 Niels Möller <nisse@lysator.liu.se>
6122 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Replace incb ->
6123 incl + andl, to improve speed on PPro and PII. Suggested by
6126 2004-10-08 Niels Möller <niels@s3.kth.se>
6128 * examples/rsa-encrypt-test: Avoid reading and executing a file at
6130 * examples/setup-env: Likewise.
6132 2004-10-06 Niels Möller <niels@s3.kth.se>
6134 * testsuite/symbols-test: Ignore __i686.get_pc_thunk.bx and
6137 2004-10-05 Niels Möller <nisse@lysator.liu.se>
6139 * twofish.c (q_table): Use a const pointer array.
6141 * sexp2dsa.c (dsa_keypair_from_sexp_alist): Use a const pointer
6142 array for the keywords.
6143 (dsa_signature_from_sexp): Likewise.
6144 * sexp2rsa.c (rsa_keypair_from_sexp_alist): Likewise.
6145 (rsa_keypair_from_sexp): Likewise.
6147 * sexp.c (sexp_iterator_check_types): Use an argument of type
6148 "const uint8_t * const *" for the types list.
6149 (sexp_iterator_assoc): Likewise, for the keys list.
6151 * list-obj-sizes.awk: Fixes to handle multiple .data and .rodata
6152 sections. Also fixed to handle the last file correctly.
6154 2004-09-23 Niels Möller <nisse@lysator.liu.se>
6156 * configure.ac (SHLIBLINK, SHLIBLIBS): On cygwin, linking needs
6157 -Wl,--whole-archive $(OBJECTS) -Wl,--no-whole-archive $(LIBS).
6159 2004-09-22 Niels Möller <niels@s3.kth.se>
6161 * configure.ac: Setup SHLIBFORLINK and friends for cygwin.
6163 * list-obj-sizes.awk: Strip *_a-prefix from all file names.
6165 * Makefile.am (libnettle_a_SOURCES): List only .c files. Headers
6166 moved to noinst_HEADERS.
6167 (SHLIBOBJECTS): Substitute from libnettle_a_SOURCES, not
6168 am_libnettle_a_OBJECTS, since the latter includes
6169 libnettle_a-prefixes with some automake versions.
6170 (SHLIBSONAME): Check if this name is empty, which is the case on
6171 cygwin, before using it.
6173 2004-08-31 Niels Möller <nisse@lysator.liu.se>
6175 * configure.ac: New command line option --disable-pic. Use
6178 * Makefile.am (libnettle_a_CFLAGS): Added $(CCPIC), to attempt to
6179 build also the static library as position independent code.
6181 2004-08-24 Niels Möller <nisse@lysator.liu.se>
6183 * des-compat.c (des_cbc_cksum): Pad input with NUL's, if it's not
6184 an integral number of blocks.
6186 2004-08-24 Niels Möller <niels@s3.kth.se>
6188 * testsuite/arctwo-test.c, arctwo.h, arctwo.c
6189 (arctwo_set_key_ekb): Fixed typo; it should be "ekb", not "ebk".
6191 Integrated arctwo patch from Simon Josefsson.
6192 * testsuite/Makefile.am (noinst_PROGRAMS): Added arctwo-test.
6194 * Makefile.am (libnettleinclude_HEADERS): Added arctwo.h.
6195 (libnettle_a_SOURCES): Added arctwo.c, arctwo.h and arctwo-meta.c.
6197 * nettle-meta.h (nettle_arctwo40, nettle_arctwo64)
6198 (nettle_arctwo64, nettle_arctwo_gutmann128): Declare ciphers.
6200 * arctwo-meta.c, arctwo.c, arctwo.h, testsuite/arctwo-test.c: New
6203 * macros.h (LE_READ_UINT16, LE_WRITE_UINT16): New macros.
6205 2004-08-23 Niels Möller <nisse@lysator.liu.se>
6207 * testsuite/md5-test.c (test_main): Added collision, found in 2004.
6208 (test_main): Added second collision.
6210 2004-08-23 Niels Möller <niels@s3.kth.se>
6212 * testsuite/md5-test.c (test_main): Added first half of a
6213 collision test case.
6215 * des-compat.c (des_cbc_cksum): Changed input argument to be of
6216 type const uint8_t * (was const des_cblock *).
6218 * des-compat.h (const_des_cblock): New bogus type. Disabled use of
6219 const, for compatibility with openssl.
6221 2004-06-08 Niels Möller <niels@s3.kth.se>
6223 * aesdata.c: Renamed log and ilog to gf2_log and gf2_exp.
6225 2004-04-07 Niels Möller <nisse@lysator.liu.se>
6227 * aes-set-encrypt-key.c (log, ilog): Deleted unused tables.
6229 * aes-set-decrypt-key.c (gf2_log, gf2_exp, mult): Renamed tables,
6232 2004-03-20 Niels Möller <nisse@lysator.liu.se>
6234 * configure.ac: Use AC_CONFIG_AUX_DIR([.]).
6236 2004-03-18 Niels Möller <niels@s3.kth.se>
6238 * examples/io.c (read_file): Display a message if fopen fails.
6240 2004-03-05 Niels Möller <nisse@lysator.liu.se>
6242 * Released nettle-1.10.
6244 * configure.ac (SHLIBMINOR): Shared library version is now 2.2.
6246 2004-03-04 Niels Möller <nisse@lysator.liu.se>
6248 * testsuite/symbols-test: Pass -g flag to nm.
6250 2004-03-02 Niels Möller <nisse@lysator.liu.se>
6252 * configure.ac: Fixed EXEEXT workaround.
6254 2004-03-02 Niels Möller <niels@s3.kth.se>
6256 * configure.ac: Added workaround to get the correct $(EXEEXT)=''
6257 when compiling with rntcl.
6259 2004-03-02 Niels Möller <nisse@lysator.liu.se>
6261 * testsuite/Makefile.am (noinst_PROGRAMS): Put test program list
6262 here, to let automake add $(EXEEXT).
6264 * configure.ac (RSA_EXAMPLES): Append $(EXEEXT) to the filenames.
6266 2004-03-01 Niels Möller <nisse@lysator.liu.se>
6268 * examples/rsa-keygen.c, examples/rsa-encrypt.c,
6269 examples/rsa-decrypt.c: Include "getopt.h" instead of <unistd.h>.
6271 * examples/Makefile.am (rsa_encrypt_SOURCES, rsa_decrypt_SOURCES)
6272 (rsa_keygen_SOURCES): Added getopt.h, getopt.c and getopt1.c.
6274 * examples/getopt.h, examples/getopt.c, examples/getopt1.c: New
6277 * testsuite/des-compat-test.c: Don't include <unistd.h>.
6279 * testsuite/testutils.c (main): Don't use getopt. Then we don't
6280 need to include <unistd.h>.
6282 2004-03-01 Niels Möller <niels@s3.kth.se>
6284 * config.guess: Copied from automake-1.8.2. Hacked to recognize
6285 Windows_NT (and Windows_95 and Windows_98) running on "x86" and
6288 * install-sh: Removed from CVS repository. Let automake supply it.
6290 2004-02-26 Niels Möller <nisse@lysator.liu.se>
6292 * nettle-meta.h (nettle_crypt_func): Typedef moved to cbc.h.
6293 Include cbc.h instead.
6295 * des-compat.c: Reverted const change, now all the des_key_sched
6296 arguments are not const. This is also what openssl's interface
6298 (cbc_crypt_func): Deleted typedef, use nettle_crypt_func instead.
6300 * cbc.h (nettle_crypt_func): Moved typedef here.
6301 * cbc.c (cbc_encrypt, cbc_decrypt_internal, cbc_decrypt): Use it
6302 for typing the f argument. Reverted the const change, for
6303 compatibility with nettle_crypt_func.
6305 2004-02-25 Niels Möller <nisse@lysator.liu.se>
6307 * testsuite/des-compat-test.c: Use des_cblock for typing more of
6308 the variables. Use const. Got rid of most of the explicit casts.
6309 Disabled the input/output alignment tests.
6311 * des.c (des_encrypt, des_decrypt): Use a const context pointer.
6312 * des3.c (des3_encrypt, des3_decrypt): Likewise.
6314 * cbc.c (cbc_encrypt, cbc_decrypt): Use a _const_ void *ctx argument.
6316 * des-compat.c: Use const for all unchanged arguments.
6317 (des_key_sched): Use a copy of the key if we need to fix the
6320 * testsuite/des-compat-test.c (C_Block, Key_schedule): Deleted
6321 defines. Deleted some of the explicit casts.
6323 * des-compat.c (des_cbc_cksum): Dereference DST pointer.
6325 2004-02-25 Niels Möller <niels@s3.kth.se>
6327 * pgp.h: Include nettle-types.h.
6329 2004-02-24 Niels Möller <nisse@lysator.liu.se>
6331 * testsuite/symbols-test: Allow symbols starting with double
6332 underscores, like on darwin.
6334 2004-02-17 Niels Möller <niels@s3.kth.se>
6336 * Makefile.am: Protected %-rules used for building pure objects,
6337 and for assembler files, by automake conditionals. Needed for
6338 makes such as tru64's, which tries to understand %-patterns, but
6339 doesn't get it right.
6340 (SUFFIXES): Added .html.
6341 (.texinfo.html): Rewrote rule to use a traditional suffix target.
6343 * configure.ac (enable_assembler): Explicitly set
6344 enable_assembler=no, on architectures where we have no assembler
6346 (ENABLE_ASSEMBLER, ENABLE_SHARED): New automake conditionals.
6348 * testsuite/testutils.c (xalloc): xalloc(0) should work also on
6349 systems where malloc(0) returns NULL.
6351 2004-02-16 Niels Möller <niels@s3.kth.se>
6353 * Makefile.am (%.o: %.asm): Added comment about OSF1 make problem.
6355 2004-02-15 Niels Möller <nisse@lysator.liu.se>
6357 * testsuite/testutils.h: #include nettle-types.h instead of
6360 2004-02-12 Niels Möller <nisse@lysator.liu.se>
6362 * examples/rsa-encrypt-test: Use -r option when invoking
6363 rsa-encrypt. Needed for the test to work on systems with no
6366 2004-02-12 Niels Möller <niels@s3.kth.se>
6368 * configure.ac (CPPFLAGS, LDFLAGS): No spaces after -I and -L, as
6369 some C compilers, in particular True64 cc, don't like that.
6371 2004-02-08 Niels Möller <nisse@lysator.liu.se>
6373 * configure.ac: Bumped version number to 1.10.
6375 2004-02-07 Niels Möller <nisse@lysator.liu.se>
6377 * Released nettle-1.9.
6379 * configure.ac (SHLIBMINOR): Bumped, library version is now 2.1.
6381 * testsuite/sexp-format-test.c: Include bignum.h only if HAVE_LIBGMP.
6382 * testsuite/rsa-encrypt-test.c: Include rsa.h only if WITH_PUBLIC_KEY.
6383 * testsuite/pkcs1-test.c: Include pkcs1.h only if WITH_PUBLIC_KEY.
6385 * pgp-encode.c [!HAVE_LIBGMP]: Kludge around the pgp.h's
6386 dependency on gmp.h.
6387 (pgp_put_mpi): Condition on HAVE_LIBGMP.
6389 * pgp.h: Don't include bignum.h, to make it possible to compile
6390 the non-bignum parts of pgp-encode.c without bignum support. Needs
6391 to be fixed properly before the pgp interface is advertised.
6393 * tools/sexp-conv.c (xalloc): New function.
6396 * tools/output.c (sexp_put_digest): Use TMP_DECL instead of alloca.
6398 * testsuite/testutils.c (xalloc): New function. Made all other
6399 functions use xalloc instead of alloca.
6401 * examples/rsa-keygen.c (main): Use xalloc for allocation.
6402 * examples/rsa-encrypt.c (write_bignum): Likewise.
6403 * examples/rsa-decrypt.c (read_bignum): Likewise.
6404 * testsuite/yarrow-test.c (open_file): Likewise.
6405 * testsuite/rsa-encrypt-test.c (test_main): Likewise.
6406 * testsuite/bignum-test.c (test_bignum): Likewise.
6408 * examples/nettle-openssl.c: When calling des_key_sched and
6409 des_ecb_encrypt, cst arguments to (void *). Openssl's typedefs
6410 des_cblock and const_des_cblock are too broken.
6412 * examples/nettle-benchmark.c (xalloc): New function. Use instead
6413 of alloca, for better portability.
6415 * examples/io.c (xalloc): New function.
6417 * Makefile.am (nodist_libnettleinclude_HEADERS): nettle-types.h
6418 should not be distributed.
6420 2004-02-06 Niels Möller <niels@s3.kth.se>
6422 * x86/sha1-compress.asm: Rename round -> ROUND.
6424 * x86/sha1-compress.asm: Store the magic constants on stack.
6425 Accessing them via %esp should be a little faster than using large
6428 * Makefile.am (EXTRA_DIST, DISTCLEANFILES): Handle
6431 * configure.ac: Use assembler file sha1-compress.asm if available.
6433 * x86/sha1-compress.asm (EXPAND): Fixed the rotation part of the
6436 2004-02-06 Niels Möller <nisse@lysator.liu.se>
6438 * x86/sha1-compress.asm: Assembler implementation of
6439 sha1_compress. (Not yet working).
6441 * Makefile.am (libnettle_a_SOURCES): Added sha1-compress.c.
6443 * sha1.c (sha1_transform): Function renamed to sha1_compress, and
6445 * sha1-compress.c: ... New file.
6447 2004-02-05 Niels Möller <nisse@lysator.liu.se>
6449 * examples/rsa-encrypt.c (process_file): Copy the leftover to the
6450 start of the buffer, when preparing for the final processing.
6452 * examples/nettle-benchmark.c (bench_hash, time_hash): New functions.
6453 (main): Benchmark hash functions too.
6454 (BENCH_BLOCK): Increased 10K.
6455 (BENCH_INTERVAL): Decreased to 0.25s.
6457 * examples/nettle-benchmark.c (time_function): Loop around calling
6458 f, until 1s has elapsed. Returns seconds per call. Updated bench
6459 functions to not loop themselves.
6460 (display): Updated MB/s calculation.
6462 * testsuite/arcfour-test.c (test_main): Use test_cipher_stream.
6464 * testsuite/testutils.c (test_cipher_stream): New function, that
6465 tries dividing the input into varying size blocks before
6468 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Bug fix, half of
6469 the S array swap was forgotten.
6470 * arcfour.c (arcfour_stream): Likewise.
6471 * arcfour-crypt.c (arcfour_crypt): Likewise.
6473 2004-02-05 Niels Möller <niels@s3.kth.se>
6475 * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Must store the new
6476 i, j at the end of the loop.
6478 * Makefile.am (EXTRA_DIST): Make sure x86 assembler files are
6480 (DISTCLEANFILES): And that the symlinks and .s files are deleted.
6482 * x86/aes-encrypt.asm, x86/aes-decrypt.asm, x86/arcfour-crypt.asm:
6483 Fixed debug information.
6485 * x86/arcfour-crypt.asm: New file. About three times faster than
6486 the optimized C code.
6488 * configure.ac: Use assembler file arcfour-crypt.asm if available.
6490 * arcfour.c (arcfour_crypt): Moved function too...
6491 * arcfour-crypt.c (arcfour_crypt): New file.
6493 * arcfour.c (arcfour_crypt): Optimization suggested by Jonas
6494 Walldén. Makes arcfour up to 50% faster on x86 and ppc, and
6495 probably on other architectures as well.
6497 2004-01-31 Niels Möller <nisse@lysator.liu.se>
6499 * configure.ac (AX_CREATE_STDINT_H): Also look for uint32_t and
6500 friends in sys/types.h.
6502 2004-01-11 Niels Möller <nisse@harpo.hack.org>
6504 * Makefile.am (libnettleinclude_HEADERS): Added bignum.h,
6505 memxor.h, pkcs1.h and rsa-compat.h.
6507 * configure.ac: Bumped version to 1.9.
6509 2004-01-10 Niels Möller <nisse@harpo.hack.org>
6511 * Released nettle-1.8.
6513 * examples/teardown-env: Delete more test files.
6515 * nettle.texinfo (Hash functions): Documented md2 and md4.
6517 * configure.ac (SHLIBMAJOR): Bumped to 2.
6519 2004-01-09 Niels Möller <nisse@harpo.hack.org>
6521 * examples/rsa-encrypt-test: New testcase.
6523 * examples/rsa-encrypt.c, examples/rsa-session.h: Expanded the
6524 comment describing the file format, and moved to rsa-session.h.
6526 * examples/rsa-decrypt.c (process_file): Finished this function.
6527 (main): Initialize x. Check the size of the session key after rsa
6530 * examples/io.c (write_string): Treat short item count as an error.
6532 2004-01-08 Niels Möller <niels@s3.kth.se>
6534 * index.html: Added instructions for CVS access.
6536 * dsa-keygen.c (dsa_nist_gen): Fixed declaration/statement order.
6538 * rsa-keygen.c (bignum_next_prime): Fixed off-by-one error when
6539 comparing input to the largest listed prime. General cleanup, as
6540 prime_limit > 0 always. Use TMP_DECL and TMP_ALLOC.
6542 * nettle-internal.h (TMP_DECL, TMP_ALLOC): New macros. When alloca
6543 is unavailable, they work by allocating a fix amount of stack and
6544 imposing a hard limit on what can be allocated. Updated all users
6547 2004-01-07 Niels Möller <nisse@harpo.hack.org>
6549 * nettle-types.h: New (generated) file, to be used instead of
6550 including <inttypes.h> directly. Updated all users of inttypes.h.
6552 * Makefile.am (DISTCLEANFILES, libnettleinclude_HEADERS): Added
6555 * configure.ac (AX_CREATE_STDINT_H): Create nettle-types.h.
6557 2003-11-16 Niels Möller <nisse@harpo.hack.org>
6559 * yarrow256.c (yarrow256_seed): Use const for the seed_file input.
6561 2003-11-12 Niels Möller <niels@s3.kth.se>
6563 * list-obj-sizes.awk: New function for decoding hex values, with a
6564 new function hex2int. Also implemented calculation of total
6565 storage, removed the dependence on the .comment section, and use
6566 the $FILTER environment variable as a regexp for restricting the
6567 object files that are considered.
6569 2003-09-21 Niels Möller <nisse@cuckoo.hack.org>
6571 * testsuite/rsa-encrypt-test.c (test_main): Don't use gmp_printf,
6572 as it seems it's only available with the newer gmp. Use
6573 mpz_out_str instead.
6575 2003-09-19 Niels Möller <niels@s3.kth.se>
6577 * examples/Makefile.am (EXTRA_DIST): Added rsa-session.h.
6579 * tools/nettle-lfib-stream.c: New tool, which outputs a sequence
6580 of pseudorandom (non-cryptographic) bytes, using Knuth's lagged
6581 fibonacci generator.
6583 * examples/rsa-decrypt.c: Fixes to get the file to compile. It
6586 * examples/Makefile.am (EXTRA_PROGRAMS): Added rsa-encrypt and
6589 * examples/io.c (write_file): New function.
6590 (write_string): Simplified error check, it's no real point in
6591 calling ferror unless we also call fflush.
6593 * examples/rsa-keygen.c (main): Check return value from
6596 * examples/rsa-decrypt.c, examples/rsa-encrypt.c,
6597 examples/rsa-session.h: New files, demonstrating rsa encryption
6600 * configure.ac (RSA_EXAMPLES): Added rsa-encrypt and rsa-decrypt.
6602 2003-09-01 Niels Möller <nisse@cuckoo.hack.org>
6604 * testsuite/testutils.c (print_hex): Use const.
6606 2003-08-30 Niels Möller <niels@s3.kth.se>
6608 * md2.c, md2.h: Added reference to RFC 1319.
6609 * md4.c, md4.h: Added reference to RFC 1320
6611 2003-08-26 Niels Möller <niels@s3.kth.se>
6613 * Makefile.am: Added md2 and md5 files. Deleted the print-path
6616 * configure.ac: Bumped version to 1.8.
6618 * testsuite/testutils.c (test_rsa_set_key_1): New function.
6619 * testsuite/rsa-test.c (test_main): Use it.
6621 * testsuite/dsa-keygen-test.c: Deleted definition of UNUSED, it's
6623 * testsuite/rsa-keygen-test.c: Likewise.
6625 * testsuite/Makefile.am (TS_PROGS): Added rsa-encrypt-test,
6626 md4-test, and md2-test.
6628 * testsuite/rsa-encrypt-test.c, testsuite/md4-test.c,
6629 testsuite/md2-test.c: New test cases.
6631 * nettle-meta.h: Declare nettle_md2 and nettle_md4.
6633 * md5.c: Reorderd functions, putting md5_final at the end.
6635 * md2.c, md2.h, md2-meta.c: New files, implemented md2.
6636 * md4.c, md4.h, md4-meta.c: New files, implemented md4.
6638 2003-08-17 Niels Möller <nisse@cuckoo.hack.org>
6640 * desCode.h (des_keymap, des_bigmap): Deleted extern declarations,
6641 they conficted with the static definition in des.c. Reported by
6644 * des.c (DesSmallFipsEncrypt, DesSmallFipsDecrypt): Moved
6645 definitions after the definition of the des_kemap array.
6647 2003-08-11 Niels Möller <nisse@cuckoo.hack.org>
6649 * rsa-encrypt.c (rsa_encrypt): Bugfix contributed by
6652 2003-06-10 Niels Möller <niels@s3.kth.se>
6654 * Makefile.am (EXTRA_DIST): Distribute sha-example.c.
6656 2003-06-05 Niels Möller <nisse@lysator.liu.se>
6658 * Makefile.am (DISTCLEANFILES): Delete .s files.
6660 2003-05-27 Niels Möller <nisse@cuckoo.hack.org>
6662 * testsuite/symbols-test: And allow symbols that start at the
6663 beginning of the line, as output by AIX nm.
6665 2003-05-26 Niels Möller <nisse@cuckoo.hack.org>
6667 * testsuite/symbols-test: Allow symbols to start with a dot.
6669 2003-05-14 Niels Möller <niels@s3.kth.se>
6671 * pgp.h (enum pgp_subpacket_tag): Copied values from RFC 2440.
6672 Renamed PGP_SUBPACKET_ISSUER to PGP_SUBPACKET_ISSUER_KEY_ID.
6674 2003-05-13 Niels Möller <nisse@cuckoo.hack.org>
6676 * pgp.h: Do proper namemangling for pgp_put_public_rsa_key and
6677 pgp_put_rsa_sha1_signature.
6679 * pgp-encode.c (pgp_put_mpi): Fixed nettle_mpz_get_str_256 call.
6681 2003-05-12 Niels Möller <nisse@cuckoo.hack.org>
6683 * rsa2openpgp.c (rsa_keypair_to_openpgp): Some bugfixes.
6685 * pgp.h (enum pgp_subpacket_tag): New enum. Definition is bogus
6686 and needs to be fixed.
6687 Added forward declarations of structs, and prototypes for
6688 pgp_put_public_rsa_key and pgp_put_rsa_sha1_signature.
6690 * pgp-encode.c (pgp_put_mpi): Take a const mpz_t argument. Gugfix,
6691 use nettle_mpz_get_str_256.
6692 (pgp_put_public_rsa_key, pgp_put_rsa_sha1_signature):
6693 Constification. Some bugfixes.
6695 * Use "config.h", not <config.h>.
6697 * Reordered includes in most or all .c-files. All should now
6700 2003-05-12 Niels Möller <niels@s3.kth.se>
6702 * configure.ac: Use LSH_FUNC_ALLOCA.
6704 2003-04-25 Niels Möller <niels@s3.kth.se>
6706 * Makefile.am (libnettle_a_SOURCES): Added hmac-sha256.c.
6708 * testsuite/hmac-test.c (test_main): Added tests for hmac-sha256,
6709 from draft-ietf-ipsec-ciph-sha-256-01.txt.
6711 * hmac-sha256.c (hmac_sha256_digest): New file.
6713 2003-04-22 Niels Möller <nisse@cuckoo.hack.org>
6715 * sha-example.c (display_hex): Simplified by using printf better.
6717 * nettle.texinfo (Example): Use @verbatiminclude to include the
6720 * sha-example.c: Example program, for inclusion in the manual.
6721 Fixed bugs reported by Mark Arking.
6723 2003-04-14 Niels Möller <niels@s3.kth.se>
6725 * x86/aes-encrypt.asm (nettle_aes_encrypt): Fixed references to
6726 _nettle_aes_encrypt_table.
6727 * x86/aes-decrypt.asm (nettle_aes_decrypt): Fixed references to
6728 _nettle_aes_decrypt_table.
6730 2003-04-12 Niels Möller <nisse@cuckoo.hack.org>
6732 * testsuite/Makefile.am (TS_SH): New test case symbols-test.
6733 (EXTRA_PROGRAMS): Added testutils, as a kludge to
6734 get automake to track dependencies for testutils.o.
6736 * x86/aes-encrypt.asm (nettle_aes_encrypt): Renamed function to
6737 use the nettle_ prefix.
6738 * x86/aes-decrypt.asm (nettle_aes_decrypt): Likewise.
6739 * sparc/aes.asm (_nettle_aes_crypt): Likewise.
6741 * examples/Makefile.am (EXTRA_PROGRAMS): Add "io", as a kludge to
6742 get automake to track dependencies for io.o.
6743 (LDADD): Added ../libnettle.a, for the dependency.
6745 * des-compat.c: Use names with the nettle_ prefix when using
6746 Nettle's des functions.
6748 * base16-meta.c (base16_encode_update): Need to undef before
6751 * New name mangling, to reduce the risk of link collisions. All
6752 functions (except memxor) now use a nettle_ or _nettle prefix when
6753 seen by the linker. For most functions, the header file that
6754 declares a function also use #define to provide a shorter more
6755 readable name without the prefix.
6757 2003-03-11 Niels Möller <nisse@cuckoo.hack.org>
6759 * Released nettle-1.7.
6761 * configure.ac: Bumped version to 1.7.
6763 * nettle.texinfo (DSA): New section.
6764 (RSA): Updated documentation.
6766 2003-03-02 Niels Möller <nisse@cuckoo.hack.org>
6768 * examples/nettle-benchmark.c (time_cipher): Don't use GNU C
6769 non-constant initializers.
6771 2003-02-23 Niels Moller <nisse@carduelis>
6773 * configure.ac: Use LSH_GCC_ATTRIBUTES.
6775 2003-02-19 Niels Möller <nisse@cuckoo.hack.org>
6777 * acinclude.m4: Deleted file from cvs, use a link to lsh's
6778 acinclude.m4 instead.
6780 2003-02-16 Niels Möller <nisse@cuckoo.hack.org>
6782 * Makefile.am (libnettleinclude_HEADERS): Added macros.h.
6784 * tools/Makefile.am (EXTRA_DIST): Added getopt.h.
6786 2003-02-14 Niels Möller <niels@s3.kth.se>
6788 * Makefile.am (print_path): Added target to print the used PATH,
6790 (print-path): Moved dependency to all-local.
6792 2003-02-11 Niels Möller <niels@s3.kth.se>
6794 * buffer.c (nettle_buffer_copy): Bug fix, it didn't return any
6797 2003-02-11 Niels Möller <nisse@cuckoo.hack.org>
6799 * testsuite/sexp-format-test.c (test_main): Added test for %( and
6802 * sexp-format.c (sexp_vformat): Handle %( and %).
6804 * realloc.c (nettle_xrealloc): Fixed out-of-memory check.
6806 * configure.ac (SHLIBMAJOR): Bumped version number to 1.
6808 * buffer.c (nettle_buffer_init_realloc): New function.
6809 * buffer-init.c (nettle_buffer_init): Use nettle_buffer_init_realloc.
6811 2003-02-10 Niels Möller <nisse@cuckoo.hack.org>
6813 * testsuite/sexp-format-test.c (test_main): New test with tokens
6814 in the format string.
6815 (test_main): Test space-searated literals too.
6817 * rsa2sexp.c (rsa_keypair_to_sexp): New argument ALGORITHM_NAME.
6818 * examples/rsa-keygen.c (main): Updated call to rsa_keypair_to_sexp.
6819 * testsuite/rsa2sexp-test.c (test_main): Likewise.
6821 * sexp-format.c (sexp_vformat): Allow whitespace in format string.
6823 * rsa2sexp.c (rsa_keypair_to_sexp): Use literals with sexp_format.
6825 * sexp-format.c (format_string): New function.
6826 (sexp_vformat): Implemented support for literals in the format
6829 2003-02-06 Niels Möller <nisse@lysator.liu.se>
6831 * testsuite/sexp-conv-test (print_raw, print_nl): New functions.
6832 The testfunctions use these instead of using echo directly.
6833 Use the test input '3:"\x' instead of '2:"\', to be friendlier to
6836 2003-02-05 Niels Möller <nisse@lysator.liu.se>
6838 * des-compat.h (des_set_key): Different name mangling, if this
6839 file is included, des_set_key should refer to a function that
6840 behaves like openssl's.
6842 * des-compat.c (des_key_sched, des_is_weak_key): Use the name
6843 nettle_des_set_key for referring to Nettle's function.
6845 * des.h (des_set_key): Name mangling, linker symbols should use a
6846 "nettle_" prefix, and this one collided with openssl. Perhaps all
6847 symbols should be mangled in a similar way, but that's for later.
6849 * configure.ac (LDFLAGS): --with-lib-path should add to LDFLAGS,
6852 2003-01-30 Niels Möller <nisse@cuckoo.hack.org>
6854 * tools/output.c (sexp_put_string): Fixed handling of escapable
6855 characters. The code generated random escape sequences for
6856 characters in the 0x10-0x1f range.
6858 * testsuite/sexp-conv-test: More tests for hex and base64 input
6861 2003-01-30 Niels Möller <niels@s3.kth.se>
6863 * sexp2bignum.c (nettle_mpz_set_sexp): Call sexp_iterator_next on
6864 success. That means the iterator argument can't be const.
6866 2003-01-29 Niels Möller <niels@s3.kth.se>
6868 * tools/Makefile.am (LDADD): Add libnettle.a, for the dependency.
6870 2003-01-27 Niels Möller <nisse@cuckoo.hack.org>
6872 * sexp2dsa.c (dsa_signature_from_sexp): New function.
6874 RSA renaming. Updated all callers.
6875 * rsa-sign.c (rsa_private_key_init, rsa_private_key_clear)
6876 (rsa_private_key_prepare): Renamed functions.
6877 * rsa.c (rsa_public_key_init, rsa_public_key_clear)
6878 (rsa_public_key_prepare): Renamed functions.
6880 2003-01-23 Niels Möller <nisse@cuckoo.hack.org>
6882 * Makefile.am (libnettle_a_SOURCES): Added new rsa and pkcs1
6883 files. Removed old rsa_md5.c and rsa_sha1.c.
6885 * testsuite/Makefile.am (TS_PROGS): Added pkcs1-test.
6887 * dsa-verify.c (dsa_verify_digest): New function.
6888 (dsa_verify): Most of the code moved to dsa_verify_digest, which
6890 * dsa-sign.c (dsa_sign_digest): New function.
6891 (dsa_sign): Most of the code moved to dsa_sign_digest, which is
6893 * dsa.c (_dsa_hash): Deleted function.
6895 * rsa_md5.c, rsa_sha1.c: Deleted files, contents spread over
6896 several files for signing and verification.
6897 * rsa-sign.c, rsa-sha1-verify.c, rsa-sha1-sign.c,
6898 rsa-md5-verify.c, rsa-md5-sign.c: New files.
6900 * rsa-sha1-verify.c (rsa_sha1_verify_digest): New function.
6901 * rsa-sha1-sign.c (rsa_sha1_sign_digest): New function.
6902 * rsa-md5-verify.c (rsa_md5_verify_digest): New function.
6903 * rsa-md5-sign.c (rsa_md5_sign_digest): New function.
6904 * rsa-verify.c (_rsa_verify): New file, new function.
6906 * rsa.c (_rsa_check_size): Renamed from rsa_check_size, and made
6907 non-static. Private key functions moved to rsa-sign.c.
6909 * pkcs1.c, pkcs1.h, pkcs1-rsa-md5.c, pkcs1-rsa-sha1.c: New files.
6910 (pkcs1_signature_prefix): New function.
6912 * testsuite/pkcs1-test.c: New test.
6914 2003-01-22 Niels Möller <niels@s3.kth.se>
6916 * examples/Makefile.am (nettle_benchmark_LDADD): Use
6919 * configure.ac (OPENSSL_LIBFLAGS): If libcrypto is found, add
6920 -lcrypto to OPENSSL_LIBFLAGS, not the plain LDFLAGS.
6922 2003-01-20 Niels Möller <nisse@cuckoo.hack.org>
6924 * testsuite/Makefile.am (CLEANFILES): Delete test.in, test1.out
6927 2003-01-17 Niels Möller <niels@s3.kth.se>
6929 * examples/Makefile.am (AM_CPPFLAGS): Use AM_CPPFLAGS instead of
6931 * testsuite/Makefile.am (AM_CPPFLAGS): Likewise.
6933 2003-01-16 Niels Möller <niels@s3.kth.se>
6935 * testsuite/Makefile.am (check): Can't use quotes around
6938 2003-01-14 Niels Möller <nisse@lysator.liu.se>
6940 * testsuite/Makefile.am (check): Don't use "run-tests" as a
6941 target, as it's confused with the file with the same name.
6943 * .bootstrap: Added missing #! /bin/sh.
6945 2003-01-12 Niels Möller <nisse@cuckoo.hack.org>
6947 * buffer.c (nettle_buffer_reset): New function.
6948 (nettle_buffer_copy): New function.
6950 * tools/input.c, tools/input.h, tools/output.c, tools/output.h,
6951 tools/parse.c, tools/parse.h, tools/misc.c, tools/misc.h: Moved
6952 parts ov sexp-conv.c to separate files
6954 * tools/sexp-conv.c (sexp_convert_list): Inlined into
6957 * tools/sexp-conv.c (struct sexp_input): Deleted string attribute.
6958 Changed all related functions to take a struct nettle_buffer *
6960 (struct sexp_compound_token): New struct.
6961 (sexp_compound_token_init, sexp_compound_token_clear): New
6963 (struct sexp_parser): Added a struct sexp_compound_token
6964 attribute, as a temporary measure.
6965 (sexp_parse): Take a struct sexp_compound_token * as argument.
6966 Updated all callers. Simplified handling of display types and
6969 * tools/sexp-conv.c (struct sexp_parser): Renamed struct (was
6970 struct sexp_parse_state). Added input pointer. Updated users to
6971 not pass around both parser and input.
6972 (sexp_check_token): handle token == 0.
6973 (sexp_parse): Simplified a little by calling sexp_check_token
6976 * tools/sexp-conv.c (sexp_convert_string): Deleted function.
6977 (sexp_skip_token): Likewise.
6979 * tools/sexp-conv.c (enum sexp_token): New constant SEXP_DISPLAY.
6980 Start constants from 1, to keep 0 free for special uses.
6981 (struct sexp_parse_state): New struct for keeping track of parser
6983 (sexp_parse_init): New function.
6984 (sexp_check_token): New function, replacing sexp_skip_token.
6985 (sexp_parse): New function.
6986 (sexp_convert_item): Simplified by using sexp_parse.
6987 (sexp_convert_list): Use sexp_parse.
6990 2003-01-08 Niels Möller <niels@s3.kth.se>
6992 * tools/sexp-conv.c (parse_options): Initialize prefer_hex.
6994 2003-01-07 Niels Möller <nisse@cuckoo.hack.org>
6996 * Makefile.am (des_headers): Refer to the desdata binary using
6999 2003-01-01 Niels Möller <nisse@cuckoo.hack.org>
7001 * testsuite/sexp-conv-test: New tests for hex and base64 literal
7004 * tools/sexp-conv.c (sexp_put_string): Print binary strings using
7005 either hex or base 64 (in advanced mode).
7006 (parse_options): Implemented -s hex, for output using hex rather
7009 2002-12-30 Niels Möller <nisse@cuckoo.hack.org>
7011 * testsuite/rsa2sexp-test.c: Don't include rsa.h (done by
7012 testutils.h, if enabled).
7013 * testsuite/sexp2rsa-test.c: Likewise.
7015 * rsa-decrypt.c: Make compilation conditional on WITH_PUBLIC_KEY.
7016 * rsa-encrypt.c: Likewise.
7017 * rsa-compat.c: Likewise.
7019 2002-12-04 Niels Möller <niels@s3.kth.se>
7021 * testsuite/Makefile.am (LDADD): Added path to ../libnettle.a,
7022 which is redundant except for the dependency.
7024 2002-12-04 Niels Möller <nisse@cuckoo.hack.org>
7026 * testsuite/sexp-format-test.c (test_main): Use %0s instead of %z.
7029 * sexp-format.c (format_length_string): Deleted function.
7030 (format_string): Deleted function.
7031 (sexp_vformat): New %t specifier, formatting an optional display
7032 type. Deleted %z specifier. Instead, introduced a new modifier "0"
7033 that can be used with %s, %l and %t, which says that the data is
7036 * rsa2sexp.c (rsa_keypair_to_sexp): Use %0s rather than %z, when
7037 formatting s-expressions.
7039 * buffer.c (nettle_buffer_grow): Fixed assertion.
7041 2002-11-22 Niels Möller <niels@s3.kth.se>
7043 * buffer.c: Include assert.h.
7045 2002-11-21 Niels Möller <nisse@cuckoo.hack.org>
7047 * testsuite/testutils.c (print_hex): Add line breaks.
7049 * Makefile.am (libnettleinclude_HEADERS): Added realloc.h.
7050 (libnettle_a_SOURCES): Added buffer-init.c and realloc.c.
7052 * sexp.c (sexp_iterator_exit_lists): New function, #if:ed out for
7055 * desdata.c: Include config.h, to get definition of UNUSED.
7056 * shadata.c: Likewise.
7058 * buffer.c (nettle_buffer_grow): New function, replacing
7060 (nettle_buffer_clear): Rewritten to use buffer->realloc.
7062 * buffer.h (struct nettle_buffer): Replaced the GROW function
7063 pointer with a nettle_realloc_func pointer and a
7065 (NETTLE_BUFFER_GROW): Deleted macro, use function instead.
7067 * buffer-init.c (nettle_buffer_init): Moved to a separate file.
7069 * realloc.c (nettle_realloc): New function.
7070 (nettle_xrealloc): New function.
7072 * realloc.h (nettle_realloc_func): New typedef.
7074 * configure.ac: Check for gcc:s __attribute__.
7076 2002-11-16 Niels Möller <nisse@cuckoo.hack.org>
7078 * sexp2dsa.c, sexp2rsa.c: (macro GET): Check sign of parsed
7081 * sexp2bignum.c (nettle_mpz_set_sexp): In the first check against
7082 limit, added some margin to allow for sign octets.
7084 2002-11-15 Niels Möller <nisse@cuckoo.hack.org>
7086 * testsuite/testutils.h (LDATA): Use sizeof instead of strlen. Now
7087 handles strings including NUL-characters. But works only with
7088 literals and character arrays, no char pointers.
7089 (LLENGTH): New macro, computing length the same way as LDATA.
7091 * testsuite/sexp-test.c (test_main): Test sexp_iterator_get_uint32.
7093 * testsuite/sexp-format-test.c (test_main): Check that %i and %b
7094 generate leading zeroes when needed. Check that %b handles
7097 * testsuite/rsa2sexp-test.c (test_main): Updated test, one leading
7098 zero is needed in the private key expression. In verbose mode,
7099 print the generated keys.
7101 * testsuite/sexp2rsa-test.c (test_main): Added a leading zero in
7102 the private key expression.
7104 * testsuite/bignum-test.c (test_bignum): Use
7105 nettle_mpz_init_set_str_256_s.
7106 (test_size): New function.
7107 (test_main): Test size computation and formatting of negative
7110 * sexp2bignum.c (nettle_mpz_set_sexp): Use
7111 nettle_mpz_set_str_256_s, to handle negative numbers correctly.
7113 * sexp-format.c (sexp_vformat): For %i, output a leading zero when
7114 needed to get a correct, positive, sign. For %b, use
7115 nettle_mpz_sizeinbase_256_s, to handle negative numbers properly.
7117 * bignum.c (nettle_mpz_sizeinbase_256_s): New function.
7118 (nettle_mpz_sizeinbase_256_u): New name, was
7119 nettle_mpz_sizeinbase_256. Updated all callers.
7120 (nettle_mpz_to_octets): New function.
7121 (nettle_mpz_get_str_256): Handle negative numbers.
7122 (nettle_mpz_from_octets): New function.
7123 (nettle_mpz_set_str_256_u): New name, was nettle_mpz_set_str_256.
7124 (nettle_mpz_init_set_str_256_u): New name, was
7125 nettle_mpz_init_set_str_256.
7126 (nettle_mpz_set_str_256_s): New function, handling negative two's
7128 (nettle_mpz_init_set_str_256_s): And an init variant.
7130 * sexp.c (sexp_iterator_get_uint32): New function.
7132 2002-11-10 Niels Möller <nisse@cuckoo.hack.org>
7134 * testsuite/sexp-conv-test: Use input files without any trailing
7135 newline character, in order to stress the end of file handling.
7137 * tools/sexp-conv.c (sexp_get_token_string): Fixed end of file
7139 (sexp_get_string): Fixed end of encoding/end of file handling.
7140 (parse_options): Check for negative width and complain.
7142 * tools/sexp-conv.c: Use supplied getopt.
7143 (werror): New function.
7144 (sexp_output_hash_init): New function.
7145 (sexp_put_char): Made base64 linebreaking configurable.
7146 Implemented hashing.
7147 (sexp_put_code_start, sexp_put_code_end): Don't output any
7149 (sexp_put_string): Output base64 delimiters.
7150 (sexp_put_digest): New function.
7151 (sexp_convert_item): Output transport delimiters.
7152 (sexp_convert_file): Deleted function, folded with main.
7153 (parse_options): New function.
7154 (main): Implemented --hash and --once, needed by lsh-authorize.
7156 * sexp.h (struct sexp_iterator): New field start.
7158 * sexp.c (sexp_iterator_subexpr): New function.
7159 (sexp_iterator_parse): Initialize ITERATOR->start.
7161 * sexp-format.c (sexp_vformat): Abort if format string contains
7162 unhandled characters.
7164 2002-11-08 Niels Möller <niels@s3.kth.se>
7166 * des-compat.c (des_ecb3_encrypt): Don't use struct initialization
7167 (c89 doesn't allow non-constant initializers). Reported by James
7169 (des_ede3_cbc_encrypt): Likewise.
7171 * examples/nettle-openssl.c: Moved from the top-level directory.
7172 Should *not* be included in the nettle library.
7174 2002-11-08 Niels Möller <nisse@cuckoo.hack.org>
7176 * testsuite/testutils.c (test_dsa_key): Bugfix for renamed DSA
7177 constant (noted by James Ralston).
7179 2002-11-07 Niels Möller <niels@s3.kth.se>
7181 * testsuite/run-tests: Copied new version rom lsh/src/testsuite.
7182 This version handles test scripts located in $srcdir.
7184 * examples/Makefile.am (AM_CFLAGS): We need -I$(top_srcdir).
7185 * tools/Makefile.am (AM_CFLAGS): Likewise.
7186 * testsuite/Makefile.am (AM_CFLAGS): Likewise.
7188 2002-11-07 Niels Möller <nisse@cuckoo.hack.org>
7190 * Makefile.am (SUBDIRS): Added tools.
7191 (libnettle_a_SOURCES): Added sexp-transport-format.c,
7192 sexp2bignum.c, sexp2dsa.c.
7194 * sexp2dsa.c (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp):
7195 New file, new functions.
7197 * rsa2sexp.c (rsa_keypair_to_sexp): %s -> %z renaming.
7199 * sexp-transport.c (sexp_transport_iterator_first): Fixed bug,
7200 length was mishandled.
7202 * sexp-transport-format.c (sexp_transport_format,
7203 sexp_transport_vformat): New file, new functions.
7205 * sexp-format.c (sexp_format): Return length of output. Allow
7206 buffer == NULL, and only compute the needed length in this case.
7207 Renamed %s to %z. New format specifiers %s, %i, and %l.
7208 (sexp_vformat): New function.
7209 (format_prefix): Rewrote to not use snprintf.
7211 * sexp2rsa.c (rsa_keypair_from_sexp): New limit argument. Use
7212 nettle_mpz_set_sexp.
7214 * dsa-keygen.c (dsa_generate_keypair): Added some newlines to
7215 progress display. Use DSA_P_MIN_BITS.
7217 * dsa.h (DSA_MIN_P_BITS): New constant (was DSA_MINIMUM_BITS).
7218 (DSA_Q_OCTETS, DSA_Q_BITS): New constants.
7219 (dsa_keypair_from_sexp_alist, dsa_keypair_from_sexp): New
7222 * configure.ac: Output tools/Makefile.
7224 * sexp2bignum.c (nettle_mpz_set_sexp): New file, and new function.
7225 Moved from sexp2rsa.c:get_value.
7227 * examples/io.c (read_rsa_key): New limit argument in
7228 call of rsa_keypair_from_sexp_alist.
7230 * examples/Makefile.am (noinst_PROGRAMS): Removed sexp-conv.
7232 * tools/sexp-conv.c: Moved file from examples directory.
7234 * testsuite/Makefile.am (TS_SH): New variable. Added
7237 * testsuite/testutils.h (LDUP): New macro.
7239 * testsuite/sexp2rsa-test.c (test_main): New limit argument in
7240 call of rsa_keypair_from_sexp_alist.
7242 * testsuite/sexp-test.c (test_main): Added test for lengths with
7243 more than one digit. Added tests for transport mode decoding.
7245 * testsuite/sexp-format-test.c (test_main): Added tests for %i and
7248 * testsuite/sexp-conv-test: Moved test from examples directory.
7249 Updated path to sexp-conv, now in ../tools/sexp-conv.
7251 2002-11-03 Niels Möller <nisse@cuckoo.hack.org>
7253 * sexp-format.c, sexp_format.c: Renamed sexp_format.c to
7255 * Makefile.am (libnettle_a_SOURCES): Renamed sexp_format.c to
7258 * examples/Makefile.am: Don't set CFLAGS or CPPFLAGS explicitly,
7259 let automake handle that.
7260 * testsuite/Makefile.am: Likewise.
7262 * sexp2rsa.c (rsa_keypair_from_sexp_alist): New function.
7263 (rsa_keypair_from_sexp): Use it.
7265 2002-11-01 Niels Möller <niels@s3.kth.se>
7267 * examples/Makefile.am (LDADD): Use -lnettle, instead of an
7268 explicit filename libnettle.a, so that we will use the shared
7269 library, if it exists.
7270 (AM_LDFLAGS): Added -L.., so we can find -lnettle.
7271 (run-tests): Set LD_LIBRARY_PATH to ../.lib, when running the
7273 * testsuite/Makefile.am: Similar changes.
7275 * Makefile.am (LIBOBJS): Put @LIBOBJS@ into the make variable
7277 (CLEANFILES): Delete libnettle.so.
7278 (clean-local): Delete the .lib linkfarm.
7279 ($(SHLIBFORLINK)): When building libnettle.so, create a link from
7280 .lib/$SHLIBSONAME. Needed at runtime, for the testsuite.
7282 2002-11-01 Niels Möller <nisse@lysator.liu.se>
7284 * configure.ac: Fixed definitions using SHLIBMAJOR and SHLIBMINOR.
7285 Also AC_SUBST SHLIBMAJOR and SHLIBMINOR. Reported by James
7288 2002-10-31 Niels Möller <niels@s3.kth.se>
7290 * examples/sexp-conv.c(sexp_put_list_start): Deleted function.
7291 (sexp_put_list_end): Likewise.
7292 (sexp_put_display_start): Likewise.
7293 (sexp_put_display_end): Likewise.
7294 (sexp_puts): Likewise.
7296 * examples/sexp-conv.c (sexp_get_quoted_string): Deleted function.
7297 Merged with sexp_get_String.
7298 (sexp_get_hex_string): Likewise.
7299 (sexp_get_base64_string): Likewise.
7300 (sexp_get_string): Do hex and base64 decoding.
7302 * examples/sexp-conv.c (enum sexp_char_type): New enum, for end
7303 markers in the input strem.
7304 (struct sexp_input): Deleted LEVEL attribute. Deleted all usage of
7306 (sexp_get_raw_char): Use INPUT->c and INPUT->ctype to store
7307 results. Deleted OUT argument.
7308 (sexp_get_char): Likewise. Also removed the
7309 INPUT->coding->decode_final call, for symmetry.
7310 (sexp_input_end_coding): Call INPUT->coding->decode_final.
7311 (sexp_next_char): New function.
7312 (sexp_push_char): New function.
7313 (sexp_get_token_char): Deleted function.
7314 (sexp_get_quoted_char): Simplified. Deleted output argument.
7315 (sexp_get_quoted_string): Simplified.
7316 (sexp_get_base64_string): Likewise.
7317 (sexp_get_token_string): Likewise.
7318 (sexp_get_string_length): Skip the character that terminates the
7320 (sexp_get_token): Cleared upp calling conventions. Always consume
7321 the final character of the token.
7322 (sexp_convert_list): Take responsibility for converting the start
7323 and end of the list.
7324 (sexp_convert_file): Call sexp_get_char first, to get the token
7326 (sexp_convert_item): Cleared up calling conventions. Should be
7327 called with INPUT->token being the first token of the expression,
7328 and returns with INPUT->token being the final token of the
7329 expression. Return value changed to void..
7331 * examples/sexp-conv-test: Added test for transport mode input.
7333 * examples/sexp-conv.c (sexp_get_char): Use the nettle_armor
7334 interface for decoding.
7335 (sexp_input_start_coding): New function.
7336 (sexp_input_end_coding): New function.
7337 (sexp_get_base64_string): Rewrote to use sexp_input_start_coding
7338 and sexp_input_end_coding.
7339 (sexp_get_token): Generate SEXP_TRANSPORT_START tokens.
7340 (sexp_convert_list): Lists are ended only by SEXP_LIST_END.
7341 (sexp_convert_item): Implemented transport mode, using
7342 sexp_input_start_coding and sexp_input_end_coding.
7344 2002-10-30 Niels Möller <nisse@cuckoo.hack.org>
7346 * Makefile.am: Added base16 files.
7348 * examples/sexp-conv-test: New tests for transport output.
7350 * examples/sexp-conv.c: Deleted hex functions, moved to Nettle's
7352 (struct sexp_output): Represent the current encoding as a
7353 nettle_armor pointer and a state struct.
7354 (sexp_output_init): Deleted MODE argument. Now passed to functions
7356 (sexp_get_char): Updated to new base64 conventions.
7357 (sexp_get_base64_string): Likewise.
7358 (sexp_put_raw_char): New function.
7359 (sexp_put_newline): Use sexp_put_raw_char.
7360 (sexp_put_char): Use nettle_armor interface for encoding data.
7361 Use OUTPUT->coding_indent for line breaking, so the INDENT
7362 argument was deleted.
7363 (sexp_put_code_start): New function, replacing sexp_put_base64_start.
7364 (sexp_put_code_end): New function, replacing sexp_put_base64_end.
7365 (sexp_put_data): Deleted argument INDENT.
7366 (sexp_puts): Likewise.
7367 (sexp_put_length): Likewise.
7368 (sexp_put_list_start): Likewise.
7369 (sexp_put_list_end): Likewise.
7370 (sexp_put_display_start): Likewise.
7371 (sexp_put_display_end): Likewise.
7372 (sexp_put_string): Likewise. Also changed base64 handling.
7373 (sexp_convert_string): Deleted argument INDENT. New argument
7375 (sexp_convert_list): New argument MODE_OUT.
7376 (sexp_convert_file): Likewise.
7377 (sexp_convert_item): Likewise. Also handle output in transport
7379 (match_argument): Simple string comparison.
7380 (main): Adapted to above changes.
7382 * testsuite/testutils.c (test_armor): Allocate a larger buffer
7383 CHECK, to make decode_update happy. Updated to new base64
7386 * testsuite/base64-test.c (test_main): Fixed overlap test to not
7387 change the base64 before decoding. Updated to new base64
7390 * testsuite/Makefile.am (TS_PROGS): Added base16-test.
7392 * testsuite/base16-test.c: New test.
7394 * sexp-transport.c (sexp_transport_iterator_first): Updated to new
7395 conventions for base64_decode_update and base64_decode_final.
7397 * nettle-meta.h: Updated ascii armor declarations. New declaration
7400 * base64-decode.c (base64_decode_single): Return -1 on error.
7401 Also keep track of the number of padding characters ('=') seen.
7402 (base64_decode_update): New argument dst_length. Return -1 on error.
7403 (base64_decode_status): Renamed function...
7404 (base64_decode_final): ... to this.
7406 * base64.h (struct base64_decode_ctx): Deleted STATUS attribute.
7407 Added PADDING attribute.
7409 * base16.h, base16-encode.c, base16-decode.c, base16-meta.c: New
7412 2002-10-28 Niels Möller <nisse@cuckoo.hack.org>
7414 * examples/sexp-conv.c (struct hex_decode_ctx): New hex decoding
7416 (sexp_get_raw_char): New function.
7417 (sexp_get_char): Use sexp_get_raw_char.
7419 2002-10-26 Niels Möller <nisse@cuckoo.hack.org>
7421 * examples/sexp-conv.c (sexp_put_length): Bugfix, don't output any
7423 (main): Implemented -s option.
7425 * examples/sexp-conv-test: Test for echo -n vs echo '\c'. Added a
7426 few tests for canonical output.
7428 2002-10-25 Niels Möller <niels@s3.kth.se>
7430 * examples/sexp-conv.c (struct sexp_input): Deleted the mode from
7431 the state, that should be passed as argument to relevant
7432 functions. Instead, introduces enum sexp_coding, to say if base64
7433 coding is in effect.
7434 (struct sexp_output): Added coding attribute.
7435 (sexp_put_char): Use output->coding.
7436 (sexp_put_base64_start): Likewise.
7437 (sexp_put_base64_end): Likewise.
7439 * base64-decode.c (base64_decode_single): Simplified, got rid of
7442 2002-10-25 Niels Möller <nisse@cuckoo.hack.org>
7444 * examples/sexp-conv.c (sexp_put_newline): Return void, die on
7446 (sexp_put_char, sexp_put_data, sexp_puts, sexp_put_length,
7447 sexp_put_base64_start, sexp_put_base64_end, sexp_put_string,
7448 sexp_put_list_start, sexp_put_list_end, sexp_put_display_start,
7449 sexp_put_display_end, sexp_convert_string, sexp_convert_list,
7450 sexp_skip_token): Likewise.
7451 (sexp_convert_item): Die on error.
7453 2002-10-24 Niels Möller <nisse@cuckoo.hack.org>
7455 * examples/sexp-conv-test: Doesn't need echo -n anymore.
7457 * examples/sexp-conv.c (die): New function.
7458 (struct sexp_input): Deleted field ITEM.
7459 (sexp_get_char): Die on failure, never return -1.
7460 (sexp_get_quoted_char): Likewise.
7461 (sexp_get_quoted_string): Die on failure, no returned value.
7462 (sexp_get_base64_string): Likewise.
7463 (sexp_get_token_string): Likewise.
7464 (sexp_get_string): Likewise.
7465 (sexp_get_string_length): Likewise.
7466 (sexp_get_token): Likewise.
7467 (sexp_convert_string): Adapted to sexp_get_token.
7468 (sexp_convert_list): Likewise.
7469 (sexp_convert_file): New function.
7470 (main): Use sexp_convert_file.
7472 2002-10-23 Niels Möller <nisse@cuckoo.hack.org>
7474 * examples/Makefile.am (TS_PROGS): Added sexp-conv-test.
7476 * examples/sexp-conv.c (sexp_input_init): Initialize input->string
7478 (sexp_get_char): Fixed non-transport case.
7479 (sexp_get_quoted_char): Fixed default case.
7480 (sexp_get_token): Loop over sexp_get_char (needed for handling of
7481 white space). Don't modify input->level. Fixed the code that skips
7483 (sexp_put_char): Fixed off-by-one bug in assertion.
7484 (sexp_put_string): Fixed escape handling for output of quoted
7486 (sexp_convert_list): Prettier output, hanging indent after the
7488 (sexp_skip_token): New function.
7489 (sexp_convert_item): Use sexp_skip_token to skip the end of a
7492 2002-10-22 Niels Möller <nisse@cuckoo.hack.org>
7494 * examples/sexp-conv-test: New test program.
7496 * examples/Makefile.am (noinst_PROGRAMS): Added sexp-conv.
7498 * examples/sexp-conv.c (sexp_convert_list): New function.
7499 (sexp_convert_item): New function.
7500 (main): New function. Compiles and runs now, but doesn't work.
7502 * base64-decode.c (base64_decode_single): New function.
7503 (base64_decode_update): Use base64_decode_single.
7505 * examples/sexp-conv.c: Added output functions.
7507 2002-10-21 Pontus Sköld <pont@soua.net>
7509 * base64-encode.c (base64_encode_raw): Fixed null statement
7510 amongst variable declarations, broke compilation for non C99
7513 2002-10-21 Niels Möller <nisse@lysator.liu.se>
7515 * examples/sexp-conv.c: New sexp conversion program.
7517 2002-10-21 Niels Möller <niels@s3.kth.se>
7519 * Makefile.am (libnettle_a_SOURCES): Added
7520 sexp-format-transport.c.
7522 * sexp-transport.c (sexp_transport_iterator_first): New file and
7524 * sexp.h (sexp_transport_iterator_first): Added protoype.
7526 * sexp.c (sexp_iterator_next): Abort if iterator type is boogus.
7528 2002-10-19 Niels Möller <nisse@cuckoo.hack.org>
7530 * testsuite/testutils.c (test_armor): Updated to new armor
7533 * testsuite/base64-test.c (test_main): Test BASE64_ENCODE_LENGTH
7534 and BASE64_DECODE_LENGTH. Updated test of base64_encode_raw (used
7535 to be base64_encode).
7537 * base64.h (BASE64_ENCODE_LENGTH, BASE64_DECODE_LENGTH): Fixed and
7540 * base64-meta.c (base64_encode_length, base64_decode_length): New
7541 functions, corresponding to the macros with the same name.
7543 * Makefile.am (libnettle_a_SOURCES): base64.c replaced by
7544 base64-encode.c and base64-decode.c.
7546 * pgp-encode.c (pgp_armor): Use new base64 conventions.
7548 * nettle-meta.h: Updated nettle_armor definitions.
7550 * base64.h: Major reorganization.
7552 * base64.c: Deleted file, contents moved to base64-encode.c or
7555 * base64-encode.c: New file. New supporting both encode-at-once
7556 and streamed operation.
7558 * base64-decode.c: New file.
7560 2002-10-09 Niels Möller <nisse@cuckoo.hack.org>
7562 * testsuite/Makefile.am (TS_PROGS): Added dsa-keygen-test.
7564 * dsa-keygen.c: Call the progress callback only if it's non-NULL.
7566 * Makefile.am (libnettle_a_SOURCES): Added bignum-random.c and
7569 * testsuite/testutils.c (test_dsa_key): New function to sanity
7570 check a dsa keypair.
7572 * testsuite/dsa-test.c (test_main): Call dsa_test_key.
7574 * testsuite/dsa-keygen-test.c: New test case.
7576 * dsa.h (DSA_MINIMUM_BITS): New constant.
7578 * bignum.h (nettle_mpz_random, nettle_mpz_random_size): Added
7581 * dsa-keygen.c: New file.
7583 * bignum-random.c: New file.
7584 (nettle_mpz_random): New function, moved from...
7585 * dsa-sign.c (nettle_mpz_random): ... here. Also changed argument
7586 ordering and updated callers.
7588 * bignum-random.c: (nettle_mpz_random_size): New function, renamed
7589 and moved here from...
7590 * rsa-keygen.c (bignum_random_size): ... here. Updated all
7593 * testsuite/testutils.c (test_dsa): Needs both public and private
7596 * testsuite/dsa-test.c (test_main): Updated to changes of the
7599 * testsuite/Makefile.am (TS_PROGS): Added dsa-test.
7601 * rsa-decrypt.c (rsa_decrypt): Constification.
7602 * rsa-encrypt.c (rsa_encrypt): Likewise.
7603 * rsa.c (rsa_compute_root): Likewise.
7604 * rsa_md5.c (rsa_md5_sign): Likewise.
7605 (rsa_md5_verify): Likewise.
7606 * rsa_sha1.c (rsa_sha1_sign): Likewise.
7607 (rsa_sha1_verify): Likewise.
7609 * dsa-verify.c (dsa_verify): Use const for the public key
7612 * dsa-sign.c (dsa_sign): Needs the public key as argument, in
7613 addition to the private key. Use const.
7615 * dsa.h (struct dsa_private_key): Don't include the public
7617 * dsa.c (dsa_private_key_init, dsa_private_key_clear): Updated to
7618 new struct dsa_private_key.
7620 * dsa-sign.c (dsa_sign): Bugfix, added missing mpz_init call.
7622 * Makefile.am (libnettle_a_SOURCES): Added dsa files.
7623 (libnettleinclude_HEADERS): Added dsa.h.
7625 * testsuite/testutils.c (test_dsa): New function.
7627 * testsuite/dsa-test.c: New test.
7629 * dsa.h, dsa.c, dsa-sign.c, dsa-verify.c: New files.
7631 * nettle-meta.h: Moved the nettle_random_func and
7632 nettle_progress_func typedefs here...
7633 * rsa.h: ... from here.
7635 2002-10-07 Niels Möller <nisse@cuckoo.hack.org>
7637 * sexp.h (enum sexp_type): Deleted SEXP_START.
7639 * sexp.c (sexp_iterator_parse): New function, similar to the old
7640 sexp_iterator_next, but independent of the previous value of the
7642 (sexp_iterator_first): Use sexp_iterator_parse.
7643 (sexp_iterator_next): Likewise.
7644 (sexp_iterator_enter_list): Use sexp_iterator_parse. SEXP_START
7646 (sexp_iterator_exit_list): Likewise.
7648 2002-10-06 Niels Möller <nisse@cuckoo.hack.org>
7650 * sexp2rsa.c (get_value): No need to call sexp_iterator_next
7653 * sexp.c (sexp_iterator_assoc): Advance the iterator to the
7654 element after a matching tag, before recording it.
7655 * testsuite/sexp-test.c (test_main): Updated test.
7657 * testsuite/sexp-test.c (test_main): No need to call
7658 sexp_iterator_next after sexp_iterator_exit_list.
7660 * sexp2rsa.c (rsa_keypair_from_sexp): No need to call
7661 sexp_iterator_next anymore.
7663 * sexp.c (sexp_iterator_next): Updated to new sexp_iterator_exit_list.
7664 (sexp_iterator_exit_list): Return with iterator pointing to the
7665 element after the list.
7666 (sexp_iterator_check_type): Call sexp_iterator_next before
7668 (sexp_iterator_check_types): Likewise.
7669 (sexp_iterator_assoc): Rearranged calls of sexp_iterator_next.
7671 * sexp.c (sexp_iterator_enter_list): Call sexp_iterator_next to
7672 get to the first element of the list. Updated callers.
7674 * base64.c (base64_encode_group): New function, used by openpgp
7677 * Makefile.am: Added openpgp files.
7679 * sexp2rsa.c (rsa_keypair_from_sexp): Use sexp_iterator_first.
7680 * testsuite/sexp-test.c (test_main): Likewise.
7682 * sexp.c (sexp_iterator_init): Made this function static.
7683 (sexp_iterator_first): New, friendlier, initialization function.
7685 * pgp-encode.c: New file. Functions for writing openpgp data
7688 * pgp.h: New file, with pgp related declarations.
7690 * rsa2openpgp.c (rsa_keypair_to_openpgp): New file, new function.
7692 2002-10-04 Niels Möller <niels@s3.kth.se>
7694 * examples/rsa-keygen.c: Use malloc, instead of asprintf.
7696 2002-10-03 Niels Möller <nisse@cuckoo.hack.org>
7698 * Released nettle-1.6.
7700 * NEWS: Note the aes api change.
7702 * examples/Makefile.am (EXTRA_DIST): Distribute setup-env and
7705 2002-10-02 Niels Möller <nisse@cuckoo.hack.org>
7707 * examples/rsa-keygen.c (main): Comment on the lax security of the
7710 * index.html: Added link to mailing list.
7712 2002-10-02 Niels Möller <niels@s3.kth.se>
7714 * Makefile.am: Fixed assembler rules, and shared libraries.
7716 * configure.ac: Fixed the enable-shared option.
7718 2002-10-01 Niels Möller <nisse@cuckoo.hack.org>
7720 * configure.ac: New option --enable-shared, and a first attempt at
7721 building a shared library (*without* using libtool).
7723 * Makefile.am: A first attempt at rules for building a shared
7726 2002-10-01 Niels Möller <niels@s3.kth.se>
7728 * examples/run-tests (test_program): Use basename.
7730 * examples/teardown-env: Delete some more files.
7732 * examples/run-tests (test_program): Strip directory part of
7735 * examples/Makefile.am (TS_PROGS): New variable. Run tests.
7737 * examples/io.c (read_file): Bug fix, used to overwrite pointer.
7739 * examples/rsa-keygen.c (main): Bug fix, private key wasn't
7742 * testsuite/Makefile.am: Some cleanup of make check.
7744 * examples/setup-env, examples/teardown-env: Test environment scripts.
7745 * examples/rsa-verify-test, examples/rsa-sign-test: New test cases.
7747 * examples/run-tests: New file (copied from lsh testsuite).
7749 * examples/Makefile.am: Use EXTRA_PROGRAMS and @RSA_EXAMPLES@.
7751 * examples/rsa-sign.c: No need to include config.h. Use werror
7753 * examples/rsa-verify.c: Likewise.
7754 * examples/rsa-keygen.c: Likewise.
7756 * examples/io.h: Forward declare struct rsa_public_key and struct
7757 rsa_private_key, to avoid dependences on config.h.
7759 * configure.ac (RSA_EXAMPLES): New substituted variable,
7760 controlling which example programs to build.
7762 * examples/rsa-verify.c: New example program.
7764 * examples/rsa-keygen.c: Use functions from io.c.
7765 * examples/rsa-sign.c: Likewise.
7767 * examples/Makefile.am (noinst_PROGRAMS): Added rsa-verify.
7768 (LDADD): Added io.o.
7770 * configure.ac: New define WITH_PUBLIC_KEY, and new configure flag
7771 --disable-public-key. Updated rsa-files to check for that, rather
7772 than for HAVE_LIBGMP.
7774 * examples/io.c, examples/io.c: New files. Miscellaneous functions
7775 used by the example programs.
7777 * base64.h (BASE64_DECODE_LENGTH): Comment fix.
7779 2002-09-30 Niels Möller <nisse@cuckoo.hack.org>
7781 * sexp2rsa.c (rsa_keypair_from_sexp): Bugfix: Call
7782 rsa_prepare_public_key and rsa_prepare_private_key.
7784 * examples/Makefile.am (noinst_PROGRAMS): Added rsa-sign.
7786 * examples/rsa-sign.c: New example program.
7788 * testsuite/base64-test.c (test_main): Test encoding and decoding
7791 * base64.c (base64_encode): Encode from the end of the data
7792 towards the start, in order to support overlapping areas.
7793 (base64_encode): Broke out some common code from the switch..
7795 2002-09-30 Niels Möller <niels@s3.kth.se>
7797 * sexp_format.c (sexp_format): Don't mix code and declarations.
7799 2002-09-29 Niels Möller <nisse@cuckoo.hack.org>
7801 * testsuite/Makefile.am (TS_PROGS): Added buffer-test
7802 sexp-format-test rsa2sexp-test sexp2rsa-test.
7805 * testsuite/sexp-test.c (test_main): Updated calls to
7806 sexp_iterator_assoc.
7808 * testsuite/testutils.h (MEMEQH): New macro.
7810 * testsuite/sexp2rsa-test.c: New test.
7811 * testsuite/sexp-format-test.c: New test.
7812 * testsuite/rsa2sexp-test.c: New test.
7813 * testsuite/buffer-test.c: New test.
7815 * testsuite/testutils.c (test_rsa_key): Copied this function
7817 testsuite/rsa-keygen-test.c: ... here.
7819 * examples/rsa-keygen.c: New file.
7821 * Makefile.am: Added new source files and headers buffer.h,
7822 buffer.c, sexp_format.c, sexp2rsa.c, rsa2sexp.c.
7824 * rsa.h (rsa_keypair_to_sexp, rsa_keypair_from_sexp): New
7827 * rsa2sexp.c, sexp2rsa.c: New files.
7829 * sexp.c (sexp_iterator_assoc): Don't enter the list, associate
7830 keys within the current list. Still exit the list when done.
7831 (sexp_iterator_assoc): Represent keys as plain NUL-terminated
7833 (sexp_iterator_check_type, sexp_iterator_check_types): New
7836 * sexp_format.c: New file, implementing an sexp canonical syntax
7839 * buffer.c, buffer.h: New files, implementing a bare-bones string
7842 * bignum.c (nettle_mpz_sizeinbase_256): New function.
7844 2002-09-28 Niels Möller <nisse@cuckoo.hack.org>
7846 * sexp.c (sexp_iterator_assoc): Return 0 for missing or duplicate
7847 keys. Now passes all the tests.
7849 * sexp.c (sexp_iterator_simple): Bugfixes. Check earlier that
7850 length doesn't grow too large.
7851 (sexp_iterator_next): Skip the current list only if type is
7852 SEXP_LIST. Handle ')'.
7853 (sexp_iterator_enter_list): Set type to SEXP_START.
7854 (sexp_iterator_exit_list): Likewise. Don't skip the ')' here.
7855 (sexp_iterator_assoc): Bug fix.
7857 * testsuite/sexp-test.c (test_main): Reordered sexp_iterator_assoc
7860 * nettle.texinfo (Randomness): Documented that yarrow256_init can
7861 be called with a zero number of sources.
7863 * testsuite/testutils.h (ASSERT): New macro.
7865 * testsuite/sexp-test.c: Test sexp parser.
7867 * Makefile.am (SUBDIRS): Added sexp files.
7869 * sexp.c, sexp.h: New files, implementing an sexp-parser.
7871 2002-08-27 Niels Möller <niels@s3.kth.se>
7873 * Makefile.am (DISTCLEANFILES): make distclean should delete the
7874 assembler-related symlinks.
7876 2002-08-26 Niels Möller <nisse@cuckoo.hack.org>
7878 * Makefile.am (%.o: %.asm): Create an empty (and unused)
7879 dependency file, to make the make/automake dependency tracking
7882 2002-07-18 Niels Möller <niels@s3.kth.se>
7884 * examples/nettle-benchmark.c (main): Try openssl's ciphers as
7887 * Makefile.am (libnettle_a_SOURCES): Added nettle-openssl.c.
7889 * nettle-openssl.c: New file.
7891 * nettle-internal.h: Declare openssl glue ciphers.
7893 * des-compat.h: Extra name-mangling, to avoid collisions in case a
7894 program links with both nettle and libcrypto (the nettle-benchmark
7897 * configure.ac: Don't use -ggdb3 with gcc-2.96.
7898 Check for openssl's libcrypto (for benchmarking).
7900 2002-05-16 Niels Möller <nisse@cuckoo.hack.org>
7902 * sparc/aes.asm: Deleted registers i and t3.
7903 (_aes_crypt): Moved some registers around. We now use input
7904 registers only for arguments, local registers for loop invariants,
7905 output registers for temporaries and loop variables, and no global
7908 * sparc/aes.asm (AES_FINAL_ROUND): New macro.
7909 (_aes_crypt): Use AES_FINAL_ROUND for the first word of the final
7911 (_aes_crypt): And for the rest of the final round.
7912 (AES_FINAL_ROUND): Don't update dst, just access it offseted by i.
7913 (_aes_crypt): Add 16 to dst at the end of the final round.
7914 (AES_ROUND): Use ldub, not ld + and, to get the third byte
7916 (AES_ROUND): Use ldub, not lduh + and, to get the second
7918 (AES_ROUND): Reordered instructions, so that we can save one
7920 (AES_ROUND): Eliminated use of t3.
7921 (AES_FINAL_ROUND): Eliminated ands.
7922 (AES_FINAL_ROUND): Reordered, so that we can save one register.
7923 (AES_FINAL_ROUND): Eliminated t3.
7924 (AES_LOAD): New macro.
7925 (_aes_crypt): Unrolled source loop.
7926 (_aes_crypt): Use AES_LOAD macro.
7927 (_aes_crypt): Deleted cruft from the old source loop.
7928 (AES_LOAD): Eliminated t3.
7930 2002-05-15 Niels Möller <nisse@cuckoo.hack.org>
7932 * sparc/aes.asm (AES_ROUND): New macro.
7933 (_aes_crypt): Use AES_ROUND for first word of the
7935 (_aes_crypt): And for the rest of the round function.
7937 * sparc/aes.asm (_aes_crypt): Deleted a bunch of additions,
7938 after accessing IDX1.
7940 * aes-internal.h (struct aes_table): sparc_idx[0] should now
7941 contain index values shifted by the size of a word, and with 2
7942 added. This saves some additions in the sparc assembler code.
7943 Updates aes-encrypt-table.c and aes-decrypt-table.c.
7945 * sparc/aes.asm (_aes_crypt): Unrolled final loop, preparing for
7947 (_aes_crypt): Eliminated i from forst copy of the loop. Some
7949 (_aes_crypt): And from second copy.
7950 (_aes_crypt): And from third.
7951 (_aes_crypt): And fourth.
7952 (_aes_crypt): Eliminated updates of i from the loop.
7953 (_aes_crypt): Access IDX1 and IDX3 through the T pointer, saving
7956 * aes-internal.h (struct aes_table): Renamed the shift_idx field
7957 to sparc_idx, as it will be tweaked to improve the sparc code.
7958 Also reduced its size to [2][4].
7959 (IDX_FACTOR): Deleted constant.
7960 * aes-encrypt-table.c (_aes_encrypt_table): Adapted initializer of
7962 * aes-decrypt-table.c (_aes_decrypt_table): Likewise.
7963 * asm.m4: Deleted AES_SIDX2, to match struct aes_table.
7965 * sparc/aes.asm (_aes_crypt): Unrolled the inner loop, preparing
7966 for optimizations suggested by Marcus Comstedt.
7967 (_aes_crypt): Eliminated i from the first copy of the inner loop.
7968 (_aes_crypt): And from the second copy.
7969 (_aes_crypt): And from the third copy.
7970 (_aes_crypt): And from the fourth copy.
7971 (_aes_crypt): Renamed .Linner_loop to .Lround_loop.
7972 (_aes_crypt): Eliminated the loop variable i from the unrolled
7974 (_aes_crypt): Deleted moves of constants into t2.
7976 2002-05-15 Niels Möller <niels@s3.kth.se>
7978 * x86/aes-encrypt.asm (aes_encrypt): Use AES_SUBST_BYTE.
7979 * x86/aes-decrypt.asm (aes_decrypt): Likewise.
7980 (aes_decrypt): Use AES_STORE.
7981 (aes_decrypt): Deleted first xchgl instruction into, permuting the
7982 AES_ROUND calls instead.
7983 (aes_decrypt): Likewise for the final round.
7984 (aes_decrypt): Got rid if the xchgl instruction after the final
7985 round, folding it into the final round.
7987 * x86/machine.m4: Renamed AES_LAST_ROUND to AES_FINAL_ROUND.
7990 * x86/aes-decrypt.asm (aes_decrypt): Use the AES_LOAD macro.
7991 (aes_decrypt): Start using AES_ROUND.
7992 (aes_decrypt): Use AES_LAST_ROUND.
7994 * x86/aes-decrypt.asm (aes_decrypt): Moved function to a separate
7996 * x86/aes.asm: ... from here.
7998 * x86/aes.asm (aes_decrypt): Use _aes_decrypt_table instead of
7999 itbl1-4. Commented out the inclusion of aes_tables.asm.
8000 (aes_decrypt): Use _aes_decrypt_table instead of isbox.
8003 * x86/aes-decrypt.asm: New file, empty at the start.
8005 * Makefile.am (libnettle_a_SOURCES): Added aes-decrypt-table.c.
8007 * aes-decrypt.c (_aes_decrypt_table): Moved from this file...
8008 * aes-decrypt-table.c (_aes_decrypt_table): ... to a new file.
8010 * testsuite/aes-test.out: New file, with the output of
8011 testsuite/aes-test, when aes.c has been compiled with debugging
8012 printouts of intermediate state.
8014 2002-05-15 Niels Möller <nisse@cuckoo.hack.org>
8016 * sparc/aes.asm: (_aes_crypt): Restore %fp at end of function, to
8017 make %fp available for other uses.
8019 * sparc/aes.asm: The frame setup was broken. Tried to fix it.
8020 Reverted to revision 1.70 + minor changes from the head revision.
8022 * x86/aes-encrypt.asm (aes_encrypt): Use test instead of cmpl $0,.
8024 * x86/machine.m4 (AES_SUBST_BYTE): New macro.
8026 * sparc/aes.asm: wtxt needs no register of it's own, as its
8027 pointed to by %sp. %g5 moved to %l0, the register previously
8028 allocated for wtxt, so that we stay clean of the reserved %g
8031 2002-05-14 Niels Möller <nisse@cuckoo.hack.org>
8033 * sparc/aes.asm: Avoid using %g6 and %g7, as they are reserved for
8034 operating sytem use. Use %i5 and %o7 instead. Also moved %g4 to %g1.
8035 (_aes_crypt): Allocate only 32 bytes local storage on the stack.
8036 Calculate wtxt and tmp using offsets from %sp, not %fp.
8038 2002-05-14 Niels Möller <niels@s3.kth.se>
8040 * x86/aes-encrypt.asm (aes_encrypt): Replaced first quarter of the
8041 round function with an invocation of AES_ROUND.
8042 (aes_encrypt): Similarly for the second column.
8043 (aes_encrypt): Similarly for the rest of the round function.
8045 * x86/machine.m4 (AES_ROUND): New macro.
8047 * x86/aes-encrypt.asm (aes_encrypt): Use AES_LOAD macro.
8049 * x86/machine.m4 (AES_LOAD): New macro.
8051 * x86/aes-encrypt.asm (aes_encrypt): Use AES_STORE.
8053 * x86/machine.m4 (AES_STORE): New macro.
8055 * x86/aes-encrypt.asm (aes_encrypt): Use the AES_LAST_ROUND macro
8056 for the first column of the final round.
8057 (aes_encrypt): Similarly for the second column.
8058 (aes_encrypt): Similarly for the third and fourth column.
8060 (aes_encrypt): Deleted xchgl instruction in final round, by
8061 reordering the second and fourth round.
8063 * x86/machine.m4 (AES_LAST_ROUND): New macro.
8065 * x86/aes-encrypt.asm (aes_encrypt): Move code here...
8066 * x86/aes.asm: ...from here.
8068 * x86/aes.asm: Use addl and subl, not add and sub. Replaced
8069 references to dtbl1-4 with references to _aes_encrypt_table.
8071 * configure.ac (asm_path): Enable x86 assembler.
8073 * x86/aes.asm (aes_decrypt): Adapted to the current interface.
8074 Notably, the order of the subkeys was reversed. Single block
8075 encrypt/decrypt works now.
8076 (aes_encrypt, aes_decrypt): Added an outer loop, so that we can
8077 encrypt more than one block at a time.
8079 2002-05-07 Niels Möller <niels@s3.kth.se>
8081 * configure.ac: Generate config.m4.
8083 * x86/aes.asm: Use C for comments, include the tables using
8084 include_src, and commented out the key setup functions.
8085 Fixed the processing of the first handling of the round function.
8086 Now, encryption of a single block works! Multiple blocks, and
8087 decryption, is still broken.
8089 * x86/machine.m4: New file (empty).
8091 * x86/aes-encrypt.asm: New file, empty for now.
8093 * Makefile.am (%.asm): Added asm.m4, machine.m4 and config.m4 to
8094 the m4 command line.
8095 (libnettle_a_SOURCES): Added aes-encrypt-table.c.
8097 * sparc/aes.asm: No need to include asm.m4, that is taken care of
8100 * config.m4.in: New file, configuration for asm.m4.
8102 * asm.m4 (C, include_src): New macros.
8104 * aes-encrypt-table.c: New file, table moved out from
8107 2002-05-06 Niels Möller <niels@s3.kth.se>
8109 * configure.ac (CFLAGS): Don't enable -Waggregate-return.
8111 2002-05-05 Niels Möller <nisse@lysator.liu.se>
8113 * configure.ac: Pass no arguments to AM_INIT_AUTOMAKE.
8115 2002-05-05 Niels Möller <nisse@cuckoo.hack.org>
8117 * configure.ac: Update for automake-1.6.
8119 * configure.ac: Renamed file, used to be configure.in.
8121 2002-03-20 Niels Möller <nisse@cuckoo.hack.org>
8123 * testsuite/run-tests (test_program): Added missing single quote.
8125 2002-03-20 Niels Möller <nisse@lysator.liu.se>
8127 * testsuite/run-tests (test_program): Test the exit status of the
8130 2002-03-19 Pontus Sköld <pont@it.uu.se>
8132 * testsuite/run-tests: Removed /bin/bashisms to use with /bin/sh.
8134 2002-03-18 Niels Möller <nisse@cuckoo.hack.org>
8136 * rsa-keygen.c (rsa_generate_keypair): Output a newline after a
8137 non-empty line of 'e':s (bad e was chosen, try again).
8139 2002-03-16 Niels Möller <nisse@cuckoo.hack.org>
8141 * configure.in (asm_path): AC_CONFIG_LINKS adds $srcdir
8144 2002-03-14 Niels Möller <nisse@cuckoo.hack.org>
8146 * sparc/aes.asm, x86/aes.asm: Added copyright notice.
8148 * Makefile.am (libnettle_a_SOURCES): Added aes-internal.h.
8149 (EXTRA_DIST): Added assembler files.
8151 * configure.in (asm_path): Use $srcdir when looking for the files.
8152 * configure.in (asm_path): For now, disable x86 assembler code.
8153 Bumped version to 1.6.
8155 2002-02-25 Niels Möller <nisse@cuckoo.hack.org>
8157 * sparc/aes.asm (_aes_crypt): Moved increment of src into the
8158 source_loop. Also fixed stop condition, the loop was run 5 times,
8159 not 4, as it should.
8160 (_aes_crypt): Use src directly when accessing the source data,
8162 (_aes_crypt): Renamed variables in source_loop.
8163 (_aes_crypt): Changed stop condition in source_loop to not depend
8164 on i. Finally reduced the source_loop to 16 instructions. Also
8165 increased the alignment of the code to 16.
8166 (_aes_crypt): In final_loop, use preshifted indices.
8167 (_aes_crypt): In final_loop, construct the result in t0. Use t0-t3
8168 for intermediate values.
8169 (_aes_crypt): In final_loop, use the register idx.
8170 (_aes_crypt): In final_loop, keep i multiplied by 4. Use key to
8171 get to the current roundkey.
8172 (_aes_crypt): In final_loop, use i for indexing.
8173 (_aes_crypt): Update dst in the output loop. This yields a delay
8174 slot that isn't filled yet.
8175 (_aes_crypt): Decrement round when looping, saving yet some
8177 (_aes_crypt): Reformatted code as blocks of four instructions
8179 (_aes_crypt): Copy the addresses of the indexing tables into
8180 registers at the start. No more need for the idx register.
8181 (_aes_crypt): Deleted idx register.
8182 (_aes_crypt): Some peep hole optimizations, duplicating some
8183 instructions to fill nop:s, and put branch instructions on even
8186 2002-02-22 Niels Möller <nisse@cuckoo.hack.org>
8188 * sparc/aes.asm (_aes_crypt): Moved some more additions out of the
8189 inner loop, using additional registers.
8190 (_aes_crypt): Deleted one more addition from the inner loop, by
8191 using the subkey pointer.
8193 2002-02-19 Niels Möller <nisse@cuckoo.hack.org>
8195 * configure.in (asm_path): Renamed "path" to "asm_path". Also look
8198 2002-02-16 Niels Möller <nisse@cuckoo.hack.org>
8200 * sparc/aes.asm: Use that IDX2(j) == j ^ 2
8202 * Makefile.am (libnettle_a_SOURCES): Reordered aes-decrypt.c and
8203 aes-encrypt.c. For some strange reason it makes the benchmark go
8206 * sparc/aes.asm (_aes_crypt): Use double-buffering, and no
8207 separate loop for adding the round key.
8208 (round): Keep round index muliplied by 16, so it can be used
8209 directly for indexing the subkeys.
8210 (_aes_crypt): In the final loop, use ctx+round to access the
8211 subkeys, no need for an extra register.
8213 2002-02-15 Niels Möller <nisse@cuckoo.hack.org>
8215 * sparc/aes.asm (_aes_crypt): Renaming variables, allocating
8216 locals starting from %l0.
8217 (_aes_crypt): Consistently use %l4, aka i, as the variable for the
8219 (_aes_crypt): Moved reading of ctx->nrounds out of the loop.
8220 (_aes_crypt): In final_loop, deleted a redundant mov, and use i as
8222 (_aes_crypt): Started renumbering registers in the inner loop. The
8223 computation for the table[j] sub-expression should be kept in
8225 (_aes_crypt): Renamed more variables in the inner loop. Now the
8226 primary variables are t0, t1, t2, t3.
8228 * sparc/aes.asm (_aes_crypt): Swapped register %i0 and %o5, %i1
8229 and %o0, %i2 and %o4, %i3 and %o3, %i4 and %o2.
8230 (_aes_crypt): wtxt was stored in both %l1 and %l2 for the entire
8231 function. Freed %l2 for other uses.
8232 (_aes_crypt): Likewise for tmp, freeing register %o1.
8234 * sparc/machine.m4: New file, for sparc-specific macros.
8236 * sparc/aes.asm (_aes_crypt): Hacked the source_loop, to get rid
8237 of yet another redundant loop variable, and one instruction.
8238 (_aes_crypt): Strength reduce loop variable in the
8239 inner loop, getting rid of one register.
8240 (_aes_crypt): Use pre-shifted indices (aes_table.idx_shift), to
8241 avoid some shifts in the inner loop.
8242 (_aes_crypt): Don't check for nrounds==0 at the start of the loop.
8244 * asm.m4: Define and use structure-defining macros.
8246 * Makefile.am (%.asm): Use a GNU pattern rule, to make %.o depend
8247 on both %.asm and asm.m4.
8249 * aes-internal.h (struct aes_table): New subtable idx_shift.
8250 Updated tables in aes_encrypt.c and aes_decrypt.c.
8252 * asm.m4: Use eval to compute values.
8254 * sparc/aes.asm (_aes_crypt): Deleted commented out old version of
8257 * asm.m4: Added constants for individual rows of the aes table.
8259 * aes.c (IDX0, IDX1, IDX2, IDX3): New macros, encapsualting the
8260 structure of the idx table.
8262 * asm.m4: Define various aes struct offsets.
8264 * testsuite/cbc-test.c (test_cbc_bulk): Use aes_set_encrypt_key
8265 and aes_set_decrypt_key.
8267 * sparc/aes.asm (_aes_crypt): Use symbolic names for the fucntion
8270 2002-02-14 Niels Möller <nisse@cuckoo.hack.org>
8272 * sparc/aes.asm: Copied gcc assembler code for _aes_crypt.
8274 * aesdata.c: New program for generating AES-related tables.
8276 * testsuite/testutils.c (print_hex): New function (moved from
8279 * testsuite/rsa-keygen-test.c (progress): Declare the ctx argument
8282 * testsuite/cbc-test.c (test_cbc_bulk): New function, testing CBC
8285 * yarrow256.c: Replaced uses of aes_set_key with
8286 aes_set_encrypt_key.
8288 * nettle-meta.h (_NETTLE_CIPHER_SEP): New macro, useful for
8289 algorithms with separate encyption and decryption key setup.
8291 * aes-internal.h (struct aes_table): New structure, including all
8292 constant tables needed by the unified encryption or decryption
8293 function _aes_crypt.
8295 * aes.c (_aes_crypt): New function, which unifies encryption and
8298 AES key setup now uses two separate functions for setting
8299 encryption and decryption keys. Applications that don't do
8300 decryption need no inverted subkeys and no code to generate them.
8301 Similarly, the tables (about 4K each for encryption and
8302 decryption), are put into separate files.
8304 * aes.h (struct aes_ctx): Deleted space for inverse subkeys. For
8305 decryption, the inverse subkeys replace the normal subkeys, and
8306 they are stored _in the order they are used_.
8308 * aes-set-key.c (aes_set_key): Deleted file, code moved...
8309 * aes-set-decrypt-key.c, aes-set-encrypt-key.c: New files,
8310 separated normal and inverse key setup.
8312 * aes-tables.c: Deleted, tables moved elsewhere...
8313 * aes-encrypt.c, aes-decrypt.c: New files; moved encryption and
8314 decryption funktions, and needed tables, into separate files.
8316 2002-02-13 Niels Möller <nisse@cuckoo.hack.org>
8318 * aes.c (aes_encrypt): Don't unroll the innerloop.
8319 (aes_encrypt): Don't unroll the loop for the final round.
8320 (aes_decrypt): Likewise, no loop unrolling.
8322 * aes-set-key.c (aes_set_key): Reversed the order of the inverted
8323 subkeys. They are now stored in the same order as they are used.
8325 * aes-tables.c (itable): New bigger table, generated by aesdata.c.
8327 * aes.c (aes_decrypt): Rewrote to use the bigger tables.
8329 2002-02-12 Niels Möller <nisse@cuckoo.hack.org>
8331 * aes.c (aes_encrypt): Interleave computation and output in the
8334 * aes-internal.h (AES_SMALL): New macro.
8336 * aes.c (aes_encrypt): Optionally use smaller rotating inner loop.
8338 * aes-tables.c (dtbl): Replaced with table generated by aesdata.
8340 * aes.c (aes_encrypt): Rewrite, now uses larger tables in order to
8343 * sparc/aes.asm (aes_encrypt): Strength reduced on j, getting rid
8344 of one register and one instruction in the inner loop.
8346 * sparc/aes.asm (idx, aes_encrypt): Multiplied tabled values by 4,
8347 making it possible to get rid of some shifts in the inner loop.
8349 * configure.in: Fixed spelling of --enable-assembler. Commented
8352 * asm.m4: New file. For now, only doing changequote and changecom.
8354 * sparc/aes.asm (aes_encrypt): Added comments.
8355 (aes_encrypt): Cut off redundant instruction per block, also
8356 saving one redundant register pointing to idx.
8357 (idx_row): New macro. Include asm.m4.
8359 2002-02-11 Niels Möller <nisse@cuckoo.hack.org>
8361 * sparc/aes.asm (key_addition_8to32): Cleaned up.
8362 Deleted gcc-generated debugging information.
8364 * sparc/aes.asm (key_addition32): First attempt at optimization.
8367 * sparc/aes.asm (key_addition32): Unrolled loop, gained 4%
8368 speed, payed four instructions compared to gcc
8371 * Makefile.am (.asm.o): New rule for assembling via m4.
8372 (libnettle_a_SOURCES): Added new rsa and aes files.
8374 * configure.in: New command line option --enable-assembler.
8375 Selects assembler code depending on the host system.
8377 * rsa-decrypt.c, rsa-encrypt.c: New files for rsa pkcs#1
8380 * aes-set-key.c, aes-tables.c: New files, split off from aes.c.
8381 Tables are now not static, but use a _aes_ prefix on their names.
8383 * aes-internal.h: New file.
8385 * cast128-meta.c (_NETTLE_CIPHER_FIX): Use _NETTLE_CIPHER_FIX.
8387 * cbc.c (cbc_decrypt_internal): New function, doing the real CBC
8388 procesing and requiring that src != dst.
8389 (cbc_decrypt): Use cbc_decrypt_internal. If src == dst, use a
8390 buffer of limited size to copy the ciphertext.
8392 * nettle-internal.c (nettle_blowfish128): Fixed definition, with
8395 * nettle-meta.h (_NETTLE_CIPHER_FIX): New macro, suitable for
8396 ciphers with a fixed key size.
8398 * examples/nettle-benchmark.c (display): New function for
8399 displaying the results, including MB/s figures.
8401 * sparc/aes.asm: New file. Not yet tuned in any way (it's just the
8402 code generated by gcc).
8404 2002-02-11 Niels Möller <nisse@lysator.liu.se>
8406 * x86/aes.asm, x86/aes_tables.asm: New assembler implementation by
8409 2002-02-06 Niels Möller <nisse@cuckoo.hack.org>
8411 Applied patch from Dan Egnor improving the base64 code.
8412 * base64.h (BASE64_ENCODE_LENGTH): New macro.
8413 (struct base64_ctx): New context struct, for decoding.
8414 (BASE64_DECODE_LENGTH): New macro.
8415 * base64.c (base64_decode_init): New function.
8416 (base64_decode_update): New function, replacing base64_decode.
8417 Takes a struct base64_ctx argument.
8418 * nettle-meta.h: Updated nettle_armor, and related typedefs and
8420 * testsuite/testutils.c (test_armor): Updated.
8421 * configure.in: Use AC_PREREQ(2.50).
8423 2002-02-01 Niels Möller <nisse@cuckoo.hack.org>
8425 * Released nettle-1.5.
8427 2002-01-31 Niels Möller <nisse@cuckoo.hack.org>
8429 * acinclude.m4: Commented out gmp-related macros, they're probably
8432 2002-01-31 Niels Möller <nisse@lysator.liu.se>
8434 * configure.in: Added command line options --with-lib-path and
8435 --with-include-path. Use the RPATH-macros to get correct flags for
8436 linking the test programs with gmp.
8438 * acinclude.m4: New file.
8440 2002-01-31 Niels Möller <nisse@cuckoo.hack.org>
8442 * nettle.texinfo (Randomness): New subsection on Yarrow.
8444 2002-01-30 Niels Möller <nisse@cuckoo.hack.org>
8446 * nettle.texinfo (Randomness): New chapter.
8447 Spell checking and ispell configuration.
8449 * md5.c: Added reference to RFC 1321.
8451 2002-01-24 Niels Möller <nisse@cuckoo.hack.org>
8453 * nettle.texinfo (Public-key algorithms): Minor fixes.
8455 2002-01-22 Niels Möller <nisse@cuckoo.hack.org>
8457 * nettle.texinfo (Nettle soup): New chapter.
8458 (Hash functions): New subsection on struct nettle_hash.
8459 (Hash functions): New subsection on struct nettle_cipher.
8460 (Keyed hash functions): New section, describing MAC:s and HMAC.
8461 (Public-key algorithms): New chapter.
8463 * testsuite/testutils.c (test_armor): New function.
8465 * testsuite/base64-test.c: New testcase.
8467 * testsuite/Makefile.am (TS_PROGS): Added base64-test.
8469 * nettle-meta.h (struct nettle_armor): New struct.
8471 * configure.in: Bumped version to 1.5.
8473 * Makefile.am (libnettle_a_SOURCES): Added base64 files, and some
8474 missing header files.
8476 * base64.c, base64.h, base64-meta.c: New files, hacked by Dan
8479 2002-01-16 Niels Möller <nisse@cuckoo.hack.org>
8481 * testsuite/yarrow-test.c: Deleted ran_array code, use
8482 knuth-lfib.h instead.
8484 * testsuite/testutils.c (test_rsa_md5, test_rsa_sha1): Moved
8486 * testsuite/rsa-test.c: ...from here.
8488 * testsuite/rsa-keygen-test.c: New file.
8490 * testsuite/knuth-lfib-test.c: New file.
8492 * Makefile.am (libnettle_a_SOURCES): Added knuth-lfib.c and
8495 * rsa-keygen.c: New file.
8497 * rsa.h (RSA_MINIMUM_N_OCTETS): New constant.
8498 (RSA_MINIMUM_N_BITS): New constant.
8499 (nettle_random_func, nettle_progress_func): New typedefs. Perhaps
8500 they don't really belong in this file.
8501 (rsa_generate_keypair): Added progress-callback argument.
8503 * macros.h (READ_UINT24, WRITE_UINT24, READ_UINT16, WRITE_UINT16):
8506 * knuth-lfib.c, knuth-lfib.h: New files, implementing a
8507 non-cryptographic prng.
8509 2002-01-15 Niels Möller <nisse@cuckoo.hack.org>
8511 * hmac-sha1.c: New file.
8513 2002-01-14 Niels Möller <nisse@cuckoo.hack.org>
8515 * configure.in: Bumped version to 1.1.
8517 * testsuite/hmac-test.c (test_main): Added hmac-sha1 test cases.
8519 * rsa.c (rsa_init_private_key, rsa_clear_private_key): Handle d.
8521 * rsa.h (struct rsa_private_key): Reintroduced d attribute, to be
8522 used only for key generation output.
8523 (rsa_generate_keypair): Wrote a prototype.
8525 * Makefile.am (libnettle_a_SOURCES): Added hmac-sha1.c and
8528 * des.c: Use static const for all tables.
8529 (des_set_key): Use a new const * variable for the parity
8530 procesing, for constness reasons.
8532 * list-obj-sizes.awk: New file.
8534 * nettle-internal.c, nettle-internal.h: New files.
8536 * testsuite/Makefile.am (TS_PROGS): Added hmac-test. Deleted old
8539 * testsuite/testutils.h (LDATA): Moved this macro here,...
8540 * testsuite/rsa-test.c: ... from here.
8542 * testsuite/hmac-test.c: New file.
8544 * hmac.h: General cleanup. Added declarations of hmac-md5,
8545 hmac-sha1 and hmac-sha256.
8547 * hmac.c: Bug fixes.
8549 * hmac-md5.c: First working version.
8551 * Makefile.am (libnettle_a_SOURCES): Added hmac.c and hmac-md5.c.
8552 (libnettleinclude_HEADERS): Added hmac.h.
8554 * testsuite/rsa-test.c: Also test a 777-bit key.
8556 * rsa.c (rsa_check_size): Changed argument to an mpz_t. Updated
8558 (rsa_prepare_private_key): Compute the size of the key by
8559 computing n = p * q.
8561 * rsa-compat.c: Adapted to new private key struct.
8562 * rsa_md5.c: Likesize.
8563 * rsa_sha1.c: Likesize.
8565 * rsa.c (rsa_check_size): New function, for computing and checking
8566 the size of the modulo in octets.
8567 (rsa_prepare_public_key): Usa rsa_check_size.
8568 (rsa_init_private_key): Removed code handling n, e and d.
8569 (rsa_clear_private_key): Likewise.
8570 (rsa_compute_root): Always use CRT.
8572 * rsa.h (struct rsa_private_key): Deleted public key and d from
8573 the struct, as they are not needed. Added size attribute.
8575 2002-01-12 Niels Möller <nisse@cuckoo.hack.org>
8577 * Makefile.am: Added *-meta files.
8579 * rsa.c (rsa_init_public_key): New function.
8580 (rsa_clear_public_key): Likewise.
8581 (rsa_init_private_key): Likewise.
8582 (rsa_clear_private_key): Likewise.
8584 * aes-meta.c: New file.
8585 * arcfour-meta.c: New file.
8586 * cast128-meta.c: New file.
8587 * serpent-meta.c: New file.
8588 * twofish-meta.c: New file.
8590 * examples/nettle-benchmark.c: Use the interface in nettle-meta.h.
8592 2002-01-11 Niels Möller <nisse@cuckoo.hack.org>
8594 Don't use m4 for generating test programs, it's way overkill. Use
8595 the C preprocessor instead.
8596 * testsuite/*-test.c: New file.
8598 * hmac.c, hmac.h, hmac-md5.c: New files.
8600 Defined structures describing the algoriths. Useful for code that
8601 wants to treat an algorithm as a black box.
8602 * nettle-meta.h, md5-meta.c, sha1-meta.c, sha256-meta.c: New
8605 2002-01-09 Niels Möller <nisse@cuckoo.hack.org>
8607 * rsa-compat.c: Updated for new md5 and rsa conventions.
8609 * rsa_md5.c: Represent a signature as an mpz_t, not a string.
8610 Updated calls of md5 functions.
8611 * rsa_sha1.c: Likewise.
8613 * rsa.c (rsa_prepare_public_key): Renamed function, was
8614 rsa_init_public_key.
8615 (rsa_prepare_private_key): Renamed function, was
8616 rsa_init_private_key.
8618 * nettle.texinfo (Hash functions): Update for the changed
8619 interface without *_final. Document sha256.
8621 * testsuite/md5-test.m4, testsuite/sha1-test.m4,
8622 testsuite/sha256-test.m4, testsuite/yarrow-test.c: Updated for new
8623 hash function interface.
8625 * yarrow256.c: Removed calls of sha256_final and and some calls of
8628 * md5-compat.c (MD5Final): Call only md5_digest.
8630 * md5.c (md5_digest): Call md5_final and md5_init.
8631 (md5_final): Declared static.
8632 sha1.c, sha256.c: Analogous changes.
8634 * bignum.c (nettle_mpz_get_str_256): Declare the input argument
8637 2001-12-14 Niels Möller <nisse@cuckoo.hack.org>
8639 * Makefile.am (EXTRA_DIST): Added $(des_headers). Changed
8640 dependencies for $(des_headers) to depend only on the source file
8641 desdata.c, not on the executable.
8643 2001-12-12 Niels Möller <nisse@cuckoo.hack.org>
8645 * testsuite/yarrow-test.c (main): Updated testcase to match fixed
8646 generator. Send verbose output to stdout, not stderr.
8648 * yarrow256.c (yarrow_slow_reseed): Bug fix, update the fast pool
8649 with the digest of the slow pool.
8650 (yarrow256_init): Initialize seed_file and counter to zero, to
8653 2001-12-07 Niels Möller <nisse@cuckoo.hack.org>
8655 * bignum.c (nettle_mpz_get_str_256): Fixed handling of leading
8658 2001-12-05 Niels Möller <nisse@cuckoo.hack.org>
8660 * testsuite/yarrow-test.c (main): Updated test to match the fixed
8661 key event estimator.
8663 * yarrow_key_event.c (yarrow_key_event_estimate): Fixed handling
8666 * nettle.texinfo (Copyright): Say that under certain
8667 circumstances, Nettle can be used as if under the LGPL.
8669 * README: Added a paragraph on copyright.
8671 2001-11-15 Niels Möller <nisse@cuckoo.hack.org>
8673 * yarrow256.c (yarrow256_force_reseed): New function.
8675 2001-11-14 Niels Möller <nisse@ehand.com>
8677 * testsuite/yarrow-test.c (main): Use yarrow256_is_seeded.
8679 * yarrow256.c (yarrow256_needed_sources): New function.
8680 (yarrow256_is_seeded): New function.
8681 (yarrow256_update): Use yarrow256_needed_sources.
8683 2001-11-14 Niels Möller <nisse@cuckoo.hack.org>
8685 * testsuite/yarrow-test.out: Updated, to match the seed-file aware
8688 * testsuite/yarrow-test.c: Updated expected_output. Check the seed
8689 file contents at the end.
8691 * yarrow256.c (yarrow256_seed): New function.
8692 (yarrow_fast_reseed): Create new seed file contents.
8694 2001-11-13 Niels Möller <nisse@cuckoo.hack.org>
8696 * yarrow.h: Deleted yarrow160 declarations.
8698 2001-11-02 Niels Möller <nisse@ehand.com>
8700 * yarrow256.c (yarrow256_init): Fixed order of code and
8703 2001-10-30 Niels Möller <nisse@ehand.com>
8705 * rsa-compat.h: Added real prototypes and declarations.
8707 * Makefile.am (libnettle_a_SOURCES): Added rsa-compat.h and
8710 * rsa-compat.c: New file, implementing RSA ref signature and
8711 verification functions.
8713 * configure.in: Check for libgmp. Deleted tests for SIZEOF_INT and
8716 * rsa_sha1.c: New file, PKCS#1 rsa-sha1 signatures.
8717 * rsa_md5.c: New file, PKCS#1 rsa-md5 signatures.
8719 * rsa.c: New file with general rsa functions.
8721 * Makefile.am (libnettle_a_SOURCES): Added rsa and bignum files.
8723 * bignum.c, bignum.h: New file, with base256 functions missing in
8726 * testsuite/Makefile.am: Added bignum-test.
8728 * testsuite/run-tests (test_program): Check the exit code more
8729 carefully, and treat 77 as skip. This convention was borrowed from
8732 * testsuite/macros.m4: New macro SKIP which exits with code 77.
8734 * testsuite/bignum-test.m4: New file.
8736 2001-10-15 Niels Möller <nisse@ehand.com>
8738 * testsuite/Makefile.am (EXTRA_DIST): Include rfc1750.txt in the
8741 2001-10-14 Niels Möller <nisse@cuckoo.hack.org>
8743 * testsuite/des-test.m4: Added testcase taken from applied
8746 * testsuite/yarrow-test.c: Use sha256 instead of sha1 for checking
8747 input and output. Updated the expected values.
8749 * yarrow256.c (YARROW_RESEED_ITERATIONS): New constant.
8750 (yarrow_iterate): New function.
8751 (yarrow_fast_reseed): Call yarrow_iterate.
8753 * testsuite/yarrow-test.c: Added verbose flag, disabled by
8756 2001-10-12 Niels Möller <nisse@ehand.com>
8758 * examples/nettle-benchmark.c: Added more ciphers.
8760 * Makefile.am (SUBDIRS): Added the examples subdir.
8762 * configure.in: Output examples/Makefile.
8764 2001-10-12 Niels Möller <nisse@cuckoo.hack.org>
8766 * examples/nettle-benchmark.c: New benchmarking program.
8768 2001-10-10 Niels Möller <nisse@ehand.com>
8770 * testsuite/yarrow-test.c: Open rfc1750.txt. Hash input and
8771 output, and compare to expected values.
8773 * testsuite/Makefile.am (CFLAGS): Don't disable optimization.
8774 (run-tests): Set srcdir in the environment when running run-tests.
8776 * testsuite/rfc1750.txt: Added this rfc as test input for yarrow.
8778 * yarrow_key_event.c (yarrow_key_event_estimate): Check if
8780 (yarrow_key_event_init): Initialize previous to zero.
8782 * yarrow256.c: Added debug some output.
8784 * testsuite/yarrow-test.c (main): Better output of entropy
8785 estimates at the end.
8787 2001-10-09 Niels Möller <nisse@ehand.com>
8789 * testsuite/Makefile.am (TS_PROGS): Added yarrow-test.
8791 * testsuite/yarrow-test.c: New file.
8793 * yarrow256.c (yarrow256_init): Initialize the sources.
8794 (yarrow256_random): Fixed loop condition.
8796 * yarrow.h (YARROW_KEY_EVENT_BUFFER): New constant.
8798 * yarrow_key_event.c: New file.
8800 * Makefile.am (libnettle_a_SOURCES): Added yarrow_key_event.c.
8802 2001-10-08 Niels Möller <nisse@cuckoo.hack.org>
8804 * yarrow.h (struct yarrow_key_event_ctx): New struct.
8806 * yarrow256.c (yarrow_fast_reseed): Generate two block of output
8807 using the old key and feed into the pool.
8809 * yarrow.h (struct yarrow256_ctx): Deleted buffer, index and
8812 * yarrow256.c (yarrow_fast_reseed): New function.
8813 (yarrow_slow_reseed): New function.
8814 (yarrow256_update): Check seed/reseed thresholds.
8815 (yarrow_gate): New function, extracted from
8816 yarrow_generate_block_with_gate which was deleted.
8817 (yarrow_generate_block_with_gate): Deleted function.
8818 (yarrow256_random): Don't buffer any output, instead gate after
8820 (YARROW_GATE_THRESHOLD): Deleted constant.
8822 2001-10-07 Niels Möller <nisse@cuckoo.hack.org>
8824 * Makefile.am: Added yarrow files.
8826 * yarrow256.c: New file, implementing Yarrow. Work in progress.
8828 * sha256.c: New file, implementing sha256.
8830 * testsuite/Makefile.am (CFLAGS): Added sha256-test.
8832 * testsuite/sha256-test.m4: New testcases for sha256.
8834 * shadata.c: New file, for generating sha256 constants.
8836 * sha.h: Renamed sha1.h to sha.h, and added declarations for
8839 2001-10-05 Niels Möller <nisse@ehand.com>
8841 * testsuite/aes-test.m4: Added a comment with NIST test vectors.
8843 2001-10-04 Niels Möller <nisse@ehand.com>
8845 * rsa.h, rsa-compat.h, yarrow.h: New files.
8847 2001-09-25 Niels Möller <nisse@cuckoo.hack.org>
8849 * Released version 1.0.
8851 2001-09-25 Niels Möller <nisse@ehand.com>
8853 * sha1.c: Include stdlib.h, for abort.
8855 * md5.c: Include string.h, for memcpy.
8857 * testsuite/Makefile.am (M4_FILES): New variable. Explicitly list
8858 those C source files that should be generated by m4.
8860 * configure.in: Changed package name from "libnettle" to "nettle".
8862 * Makefile.am (EXTRA_DIST): Added .bootstrap.
8864 * AUTHORS: Added a reference to the manual.
8866 2001-09-25 Niels Möller <nisse@lysator.liu.se>
8868 * des-compat.c (des_cbc_cksum): Bug fix, local variable was
8869 declared in the middle of a block.
8871 2001-09-19 Niels Möller <nisse@cuckoo.hack.org>
8873 * nettle.texinfo (Compatibility functions): New section,
8874 mentioning md5-compat.h and des-compat.h.
8876 2001-09-18 Niels Möller <nisse@ehand.com>
8878 * index.html: New file.
8880 2001-09-16 Niels Möller <nisse@cuckoo.hack.org>
8882 * nettle.texinfo: Added description of des3. Minor fixes.
8884 * testsuite/des-compat-test.c (cbc_data): Shorten to 32 bytes (4
8885 blocks), the last block of zeroes wasn't used anyway.
8887 * des-compat.c (des_compat_des3_decrypt): Decrypt in the right
8889 (des_ncbc_encrypt): Bug fixed.
8890 (des_cbc_encrypt): Rewritten as a wrapper around des_ncbc_encrypt.
8892 2001-09-14 Niels Möller <nisse@ehand.com>
8894 * testsuite/des-compat-test.c: New file, copied from libdes
8895 (freeswan). All implemented functions but des_cbc_cksum seems to
8898 * testsuite/Makefile.am (TS_PROGS): Added des-compat-test.
8900 * des-compat.c: Added libdes typedef:s. Had to remove all use of
8901 const in the process.
8902 (des_check_key): New global variable, checked by des_set_key.
8904 * des.c (des_set_key): Go on and expand the key even if it is
8907 * des-compat.c (des_cbc_cksum): Implemented.
8908 (des_key_sched): Fixed return values.
8910 2001-09-11 Niels Möller <nisse@cuckoo.hack.org>
8912 * Makefile.am: Added des-compat.c and des-compat.h
8914 * des-compat.c: Bugfixes, more functions implemented.
8916 * des-compat.h: Define DES_ENCRYPT and DES_DECRYPT. Bugfixes.
8918 2001-09-10 Niels Möller <nisse@ehand.com>
8920 * nettle.texinfo (Copyright): Added copyright information for
8922 (Miscellaneous functions): Started writing documentation on the CBC
8924 (Cipher Block Chaining): This section more or less complete now.
8926 2001-09-09 Niels Möller <nisse@cuckoo.hack.org>
8928 * testsuite/cbc-test.m4: Record intermediate values in a comment.
8929 * testsuite/des3-test.m4: Likewise.
8931 * testsuite/aes-test.m4: Added test case that appeared broken in
8934 * cbc.c (cbc_encrypt): Bug fix, encrypt block *after* XOR:ing the
8937 * Makefile.am (libnettleinclude_HEADERS): Added cbc.h. Deleted
8939 (libnettle_a_SOURCES): Added des3.c.
8941 * testsuite/Makefile.am (TS_PROGS): Added des3-test and cbc-test.
8943 * testsuite/cbc-test.m4: New testcase.
8945 * testsuite/des3-test.m4: New testcase.
8947 * cbc.h (CBC_CTX): New macro.
8948 (CBC_ENCRYPT): New macro.
8949 (CBC_DECRYPT): New macro.
8951 * des.c (des_fix_parity): New function.
8953 * des3.c: New file, implementing triple des.
8955 2001-09-06 Niels Möller <nisse@cuckoo.hack.org>
8957 * cbc.c, cbc.h: New files, for general CBC encryption.
8959 * des-compat.h: Added some prototypes.
8961 2001-09-05 Niels Möller <nisse@ehand.com>
8963 * testsuite/Makefile.am (TS_PROGS): Added md5-compat-test.
8965 * README: Copied introduction from the manual.
8967 * configure.in: Bumped version to 1.0.
8969 * Makefile.am (libnettleinclude_HEADERS): Added missing includes.
8970 (libnettle_a_SOURCES): Added md5-compat.c and md5-compat.h.
8972 * md5-compat.c, md5-compat.h: New files, implementing an RFC
8973 1321-style interface.
8975 2001-09-02 Niels Möller <nisse@cuckoo.hack.org>
8977 * twofish.c (twofish_decrypt): Fixed for();-bug in the block-loop.
8978 Spotted by Jean-Pierre.
8979 (twofish_encrypt): Likewise.
8981 2001-07-03 Niels Möller <nisse@ehand.com>
8983 * testsuite/testutils.c: Include string.h.
8985 * twofish.c: Include string.h.
8987 2001-06-17 Niels Möller <nisse@lysator.liu.se>
8989 * Makefile.am (des_headers): Dont use $(srcdir)/-prefixes as that
8990 seems to break with GNU make 3.79.1.
8992 * testsuite/testutils.c, testsuite/testutils.h: Use <inttypes.h>,
8996 2001-06-17 Niels Möller <nisse@cuckoo.hack.org>
8998 * Use <inttypes.h>, not <stdint.h>.
9000 * blowfish.h (BLOWFISH_MAX_KEY_SIZE): Fixed, should be 56.
9002 * Fixed copyright notices.
9004 * Makefile.am (libnettle_a_SOURCES): Added desinfo.h and
9006 (info_TEXINFOS): Added manual.
9007 (EXTRA_DIST): Added nettle.html.
9008 (%.html): Added rule for building nettle.html.
9010 * nettle.texinfo: New manual.
9012 * configure.in: Bumped version to 0.2.
9014 * testsuite/Makefile.am (TS_PROGS): Added cast128 test.
9018 * testsuite/serpent-test.m4: Added a few rudimentary tests
9019 extracted from the serpent package.
9021 * twofish.c: Adapted to nettle. Made constant tables const.
9022 Deleted bytes_to_word and word_to_bytes; use LE_READ_UINT32 and
9023 LE_WRITE_UINT32 instead.
9024 (twofish_selftest): Deleted. Moved the tests to the external
9026 (twofish_set_key): Don't silently truncate too large keys.
9028 * sha1.c (sha1_update): Use unsigned for length.
9030 * serpent.c (serpent_set_key): Read the key backwards. Fixed
9031 padding (but there are no test vectors for key_size not a multiple
9033 (serpent_encrypt): Read and write data in the strange order used
9034 by the reference implementation.
9035 (serpent_decrypt): Likewise.
9037 * macros.h (FOR_BLOCKS): New macro, taken from lsh.
9039 * blowfish.h (struct blowfish_ctx): Use a two-dimensional array
9042 * blowfish.c (initial_ctx): Arrange constants into a struct, to
9044 (F): Deleted all but one definitions of the F function/macro.
9045 Added a context argument, and use that to find the subkeys.
9046 (R): Added context argument, and use that to find the subkeys.
9047 (blowfish_set_key): Some simplification.
9049 (encrypt): Deleted code for non-standard number of rounds. Deleted
9050 a bunch of local variables. Using the context pointer for
9051 everything should consume less registers.
9052 (decrypt): Likewise.
9054 * Makefile.am (libnettle_a_SOURCES): Added twofish.
9056 2001-06-16 Niels Möller <nisse@cuckoo.hack.org>
9058 * testsuite/blowfish-test.m4: Fixed test.
9060 * Added twofish implementation.
9062 * blowfish.h (struct blowfish_ctx): Use the correct size for the p
9065 2001-06-15 Niels Möller <nisse@ehand.com>
9067 * testsuite/blowfish-test.m4: Fixed testcase, use correct key
9070 * Makefile.am (libnettle_a_SOURCES): Added blowfish files.
9071 ($(des_headers)): Strip directory part when passing file name to
9074 * testsuite/blowfish-test.m4: Added one test, from GNUPG.
9076 * Created blowfish.c and blowfish.h (from GNUPG via LSH). Needs
9079 * aes.h: Fixed copyright notice to not mention GNU MP. XXX: Review
9080 all nettle copyrights.
9082 * testsuite/Makefile.am (TS_PROGS): Added tests for twofish and
9085 2001-06-13 Niels Möller <nisse@ehand.com>
9087 * Makefile.am (libnettle_a_SOURCES): Added serpent files.
9089 2001-06-12 Niels Möller <nisse@cuckoo.hack.org>
9091 * des.c (des_encrypt, des_decrypt): Assert that the key setup was
9094 * testsuite/Makefile.am (TS_PROGS): Added tests for des and sha1.
9096 * testsuite/sha1-test.m4: New file.
9098 * testsuite/des-test.m4: New file.
9102 * Added desCore files.
9104 * Makefile.am: Added desCore and sha1.
9106 2001-04-17 Niels Möller <nisse@cuckoo.hack.org>
9108 * install-sh: Copied the standard install script.
9110 * testsuite/Makefile.am (CFLAGS): Disable optimization. Add
9111 $(top_srcdir) to the include path.
9112 (EXTRA_DIST): Added testutils.h, testutils.c and run-tests.
9113 (run-tests): Fixed path to run-tests.
9115 * Makefile.am (EXTRA_DIST): Added memxor.h.
9116 (libnettleinclude_HEADERS): Install headers in
9117 $(libnettleincludedir).
9119 2001-04-13 Niels Möller <nisse@cuckoo.hack.org>