Niels Möller | 31 Aug 21:12 2014
Picon
Picon
Picon

Hashing with EdDSA

I'm looking into EdDSA. According to the paper, signing of a message M,
using private key (a, k), corresponding to public key A, is essentially

  r = H(k | M),    with k the second half of the private key
  R = rB,          with B the specified generator of the curve,
  S = ((r + H(R | A | M) a) mod l, l is the curve order

with some rules to encode R, A, S as strings. H is typically sha-512.

If M is the original, arbitrarily long, message to be signed, this
breaks the common structure that you can first compute a message digest,
and then apply the secret key to produce a signature. But this doesn't
work above, because the complete message has to be hashed twice, first
with the secret prefix k, next with the prefix R | A, and any hashing
without the private key available is useless. And even worse, one has to
buffer the complete message because the prefix of the second hash
depends on the output of the first hash.

Or should M itself be a digest of the message to be signed? That will
enable a more main-stream signature interface, where the inputs to the
signature function are the private key and the short message digest.

Regards,
/Niels

--

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
Niels Möller | 29 Jul 16:51 2014
Picon
Picon
Picon

curve25519 progress

I've now pushed some crude code (on the curve25519 branch) which agrees
with the test vectors in draft-josefsson-tls-curve25519-05.

It uses the equivalent Edwards curve for the internal operations. For
scalar multiplication of the fix generator, it uses Pippenger's
algorithm and tables very similar to the other curves, just with
different point operations and no special caes (since the Edwards
operations are "complete"). At the end, the x-coordinate of the
corresponding point on the Montgomery-form curve25519 is computed.

For scalar multiplication of an arbitrary point (with only x coordinate
provided), I first have to compute the y-coordinate using
Shanks-Tonelli (this could be used to implement "point compression") also
for other curves). Then transform to a point on the Edwards curve, using
homogeneneous/projective coordinates. Then the actual scalar multiply is
currently done with the binary algorithm; I have code for window-based
scalar multiply, but it needs a bit more debugging. All this is very
similar to the other corves, but without special cases.

Regards,
/Niels

--

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
Daniel Kahn Gillmor | 11 Jul 19:27 2014
Picon

[PATCH] fix typo in ecc-mod.c

---
 ecc-mod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ecc-mod.c b/ecc-mod.c
index 7876d02..3301506 100644
--- a/ecc-mod.c
+++ b/ecc-mod.c
 <at>  <at>  -40,7 +40,7  <at>  <at> 
 #include "ecc-internal.h"

 /* Computes r mod m, where m is of size mn. bp holds B^mn mod m, as mn
-   limbs, but the upper mn - bn libms are zero. */
+   limbs, but the upper mn - bn limbs are zero. */
 void
 ecc_mod (mp_limb_t *rp, mp_size_t rn, mp_size_t mn,
 	 const mp_limb_t *bp, mp_size_t bn,
--

-- 
2.0.0
Niels Möller | 2 Jul 10:24 2014
Picon
Picon
Picon

curve25519

I'v started to look closer at curve25519, and I've added support for it
in the eccdata program.

For the ecc operations, my current thinking is that one should use the
Edwards curve equivalence outlined in
http://cr.yp.to/papers.html#newelliptic, rather than the Montgomery
x-coordinate method suggested in the curve25519 paper. The x-coordinate
method needs an addition chain with additional values, which is a bit
alien to all other scalar ecc multiplication in Nettle. The equivalent
Edwards curve is

   x^2 + y^2 = 1 + (121665/121666) x^2 y^2 (mod p).

Computations should be about as fast (according to the paper), and since
the constant (121665/121666) is a non-square, the formulas are
"complete", with no need to handle any special cases.

One needs conversion of the coordinates, and one also needs a square
root to get the y coordinate, but I hope that shouldn't be too
difficult.

Regards,
/Niels

--

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
Martin Storsjö | 26 Jun 09:30 2014

[PATCH 1/3] Don't hardcode the -lgmp linker flag in the hogweed pkg-config file

---
 hogweed.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hogweed.pc.in b/hogweed.pc.in
index 457f5f2..839f7d0 100644
--- a/hogweed.pc.in
+++ b/hogweed.pc.in
 <at>  <at>  -13,6 +13,6  <at>  <at>  URL: http://www.lysator.liu.se/~nisse/nettle
 Version:  <at> PACKAGE_VERSION <at> 
 Requires.private: nettle
 Libs: -L${libdir} -lhogweed
-Libs.private: -lgmp
+Libs.private:  <at> LIBS <at> 
 Cflags: -I${includedir}

--

-- 
1.8.5.2 (Apple Git-48)
Niels Möller | 24 Jun 21:32 2014
Picon
Picon
Picon

Simplifying pic vs non-pic object files

Currently, the nettle Makefile creates two object files for each source
file, .o for inclusion in the static library, and .po ("pure object")
for the shared library. By default, both are compiled as pic code, but
--disable-pic drops the pic flags when compiling the .o files, to get
non-pic code into the static library.

I'm considering dropping this complication. Just build a single .o file,
which is pic by default, and non-pic if --disable-pic is given.

To build a non-pic static library, one would configure with
"--disable-pic --disable-shared" (since just --disable-pic would produce
a shared library with non-pic code, which is highly undesirable). And to
produce a static non-pic library and a shared pic library, one would
need to use separate build trees.

Does that make sense? It would make things simpler, shorten build time,
and eliminate the problem of naming two types of object files.

One might also have --disable-pic imply --disable-shared 
(unless explicitly overridden by the user).

Regards,
/Niels

--

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
Nikos Mavrogiannopoulos | 20 Jun 14:50 2014
Picon

OCB mode

Hello,
 What do you think of having OCB mode in nettle? I particularly like
OCB due to it's simplicity and performance comparing to GCM/CCM, but
was always patented. However in [0] there is license1 which states:
"Under this license, you are authorized to make, use, and distribute
open-source software implementations of OCB. This license terminates
for you if you sue someone over their open-source software
implementation of OCB claiming that you have a patent covering their
implementation."

What do you think? Should the FSF be consulted on that?

regards,
Nikos

[0]. http://www.cs.ucdavis.edu/~rogaway/ocb/license.htm
Nikos Mavrogiannopoulos | 20 Jun 14:38 2014
Picon

turn RSA blinding off in openssl


_______________________________________________
nettle-bugs mailing list
nettle-bugs@...
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs
Aapo Talvensaari | 10 Jun 01:22 2014
Picon

pbkdf2 functions return longer values than requested

I started implementing LuaJIT FFI bindings to Nettle, and I found that

nettle_pbkdf2_hmac_sha1
and
nettle_pbkdf2_hmac_sha256

sometimes return longer dst than what was requested. See:

https://github.com/bungle/lua-resty-nettle/blob/master/lib/resty/nettle/pbkdf2.lua#L21

I had to put ":sub(1, len)" to overcome that.

Is it by a design or is it a bug (maybe in my code?).

Regards
Aapo
Niels Möller | 7 Jun 10:35 2014
Picon
Picon
Picon

ANNOUNCE: Nettle-3.0

I'm happy to announce a new version of GNU Nettle, a low-level
cryptographics library. The Nettle home page can be found at
http://www.lysator.liu.se/~nisse/nettle/.

This release is dual licensed as LGPLv3 or later, or GPLv2 or later. See
the manual for details.

NEWS for the Nettle 3.0 release

	This is a major release, including several interface changes,
	and new features, some of which are a bit experimental.
	Feedback is highly appreciated.

	It is *not* binary (ABI) compatible with earlier versions. It
	is mostly source-level (API) compatible, with a couple of
	incompatibilities noted below. The shared library names are
	libnettle.so.5.0 and libhogweed.so.3.0, with sonames
	libnettle.so.5 and libhogweed.so.3.
	
	There may be some problems in the new interfaces and new
	features which really need incompatible fixes. It is likely
	that there will be an update in the form of a 3.1 release in
	the not too distant future, with small but incompatible
	changes, and if that happens, bugfix-only releases 3.0.x are
	unlikely. Users and applications which desire better API and
	ABI stability are advised to stay with nettle-2.7.x (latest
	version is now 2.7.1) until the dust settles.

	Interface changes:

(Continue reading)

Niels Möller | 30 May 12:02 2014
Picon
Picon
Picon

Problem with w32 shared libraries

I just tested w32 support,

  ./configure --host=i586-mingw32msvc

which produces shared libraries (and I'm not sure I've tested this
eariler, I may have used --disable-shared on earlier builds for w32).

When I run the testsuite with make check EMULATOR=wine, the arcfour
testcase fails. wine reports the error like

Unhandled exception: page fault on read access to 0x70dc344d in 32-bit code (0x70dc344d).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:70dc344d ESP:0061fc5c EBP:0061fdc8 EFLAGS:00010202(  R- --  I   - - - )
 EAX:0061fcba EBX:00000001 ECX:00000001 EDX:00000001
 ESI:001139ef EDI:001139b0
Stack dump:
0x0061fc5c:  004014bd 0061fcba 00000001 001139f0
0x0061fc6c:  001139b0 0061fcd0 7bc4abf6 00000001
0x0061fc7c:  00113990 001139f8 001139b0 001139d0
0x0061fc8c:  00000000 00000000 00113988 001139a8
0x0061fc9c:  001139c8 00000008 00000009 001139f0
0x0061fcac:  7bc3812f 00000020 0061fcc8 df019956
Backtrace:
=>0 0x70dc344d (0x0061fdc8)
  1 0x00401767 test_main+0x36() [/home/nisse/hack/nettle/testsuite/arcfour-test.c:73] in
arcfour-test (0x0061fde8)
  2 0x00401767 test_main+0x36() [/home/nisse/hack/nettle/testsuite/arcfour-test.c:73] in
arcfour-test (0x0061fe08)

(Continue reading)


Gmane