Re: SIV-CMAC

2019-07-02 Thread Nikos Mavrogiannopoulos
Looks good to me, but I'm adding Mirek in CC who is using SIV-AES-CMAC for NTS/NTP implementation to verify that the final code is sufficient for this implementation. regards, Nikos On Tue, Jul 2, 2019 at 4:25 PM Niels Möller wrote: > > Nikos Mavrogiannopoulos writes: > > > I prefer the second

[PATCH] nettle-types: drop w field from nettle_block16

2019-07-02 Thread Dmitry Eremin-Solenikov
"unsigned long w" comes from the time when Nettle didn't use uint64_t. It is unused now and thus can be dropped. Signed-off-by: Dmitry Eremin-Solenikov --- nettle-types.h | 1 - 1 file changed, 1 deletion(-) diff --git a/nettle-types.h b/nettle-types.h index 5addf3600d69..93a68f3b305c 100644 --

[PATCH] cmac: add 64-bit mode CMAC

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- cmac.c | 125 - cmac.h | 69 +++ nettle-types.h | 6 +++ 3 files changed, 199 insertions(+), 1 deletion(-) diff --git a/cmac.c b/cmac.c index 70ce8132d9d1..36ad8e

Re: [PATCH 2/4] cmac: add 64-bit mode CMAC

2019-07-02 Thread Dmitry Eremin-Solenikov
ср, 3 июл. 2019 г. в 00:15, Niels Möller : > > Dmitry Eremin-Solenikov writes: > > > +union nettle_block8 > > +{ > > + uint8_t b[8]; > > + unsigned long w[8 / sizeof(unsigned long)]; > > + uint64_t u64; > > +}; > > The "unsigned long w" seems unneeded (in nettle_block16, it could > also be reti

Re: [PATCH 2/4] cmac: add 64-bit mode CMAC

2019-07-02 Thread Niels Möller
Dmitry Eremin-Solenikov writes: > +union nettle_block8 > +{ > + uint8_t b[8]; > + unsigned long w[8 / sizeof(unsigned long)]; > + uint64_t u64; > +}; The "unsigned long w" seems unneeded (in nettle_block16, it could also be retired; it's from a time when Nettle didn't use uint64_t). Maybe on

Re: [PATCH 1/4] Move MAC testing code to generic place from cmac-test

2019-07-02 Thread Niels Möller
Dmitry Eremin-Solenikov writes: > Signed-off-by: Dmitry Eremin-Solenikov > --- > testsuite/cmac-test.c | 100 +++--- > testsuite/testutils.c | 64 +++ > testsuite/testutils.h | 6 +++ > 3 files changed, 96 insertions(+), 74 deletion

Re: Add check for ECC at point 0

2019-07-02 Thread Simo Sorce
On Tue, 2019-07-02 at 22:12 +0200, Niels Möller wrote: > Simo Sorce writes: > > > On Wed, 2019-05-15 at 10:48 -0400, Simo Sorce wrote: > > > On Wed, 2019-05-15 at 11:42 +0200, Niels Möller wrote: > > > > Simo Sorce writes: > > > > > > > > > Attached find patch that adds points checks to the ECD

Re: Add check for ECC at point 0

2019-07-02 Thread Niels Möller
Simo Sorce writes: > On Wed, 2019-05-15 at 10:48 -0400, Simo Sorce wrote: >> On Wed, 2019-05-15 at 11:42 +0200, Niels Möller wrote: >> > Simo Sorce writes: >> > >> > > Attached find patch that adds points checks to the ECDH test case. >> > > Let me know if that's ok or if you prefer a whole new

Re: siv and cmac

2019-07-02 Thread Nikos Mavrogiannopoulos
On Thu, Jun 6, 2019 at 9:44 AM Niels Möller wrote: > > ni...@lysator.liu.se (Niels Möller) writes: > > > I think the siv code could benefit from a funtion to create a cmac > > digest in one step, without the update/digest split and the intermediate > > buffer. That would be something like > > > >

Re: SIV-CMAC

2019-07-02 Thread Niels Möller
Nikos Mavrogiannopoulos writes: > I prefer the second option because I think the zero nonce variant > requires a disproportionate, to its usefullness and use, discussion to > define the "right" semantics. Merged siv-mode to the master branch now. Does it look right to you? Regards, /Niels --

[PATCH 14/14] hmac-sha512/hmac-sha384: use new hmac and hash split state/buffer interface

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac-sha384.c | 4 ++-- hmac-sha512.c | 6 +++--- hmac.h| 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hmac-sha384.c b/hmac-sha384.c index 30008b5f85c1..d162c4a0fab8 100644 --- a/hmac-sha384.c +++ b/hmac-sha384.c @@ -41,12

[PATCH 05/14] hmac: add interface for working with separate hash state and buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac.c | 62 ++ hmac.h | 27 + 2 files changed, 89 insertions(+) diff --git a/hmac.c b/hmac.c index 6ac5e11a0686..6b925ce6e147 100644 --- a/hmac.c +++ b/hmac.c @@ -115,3 +11

[PATCH 13/14] sha512/sha384: split context into hash state and byte buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h | 12 + sha2.h| 45 -- sha384-meta.c | 3 ++ sha512-meta.c | 3 ++ sha512.c | 129 -- 5 files changed, 152 insertions(+), 40 deletions(-) diff --git a/n

[PATCH 10/14] hmac-sha1: use new hmac and hash split state/buffer interface

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac-sha1.c | 6 +++--- hmac.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hmac-sha1.c b/hmac-sha1.c index 5e7188f92cf2..e968a51cd431 100644 --- a/hmac-sha1.c +++ b/hmac-sha1.c @@ -41,19 +41,19 @@ void hmac_sha1_set_key(s

[PATCH 01/14] sha512-224, -256: use _NETTLE_HASH_US instead of hand-coding structure definitions

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h | 10 ++ sha512-224-meta.c | 12 ++-- sha512-256-meta.c | 12 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/nettle-meta.h b/nettle-meta.h index 74e50e59cd2e..e3db0e9d63aa 100644 --- a/nett

[PATCH 11/14] sha256/sha224: split context into hash state and byte buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h | 2 ++ sha2.h| 42 ++-- sha224-meta.c | 3 ++ sha256-meta.c | 3 ++ sha256.c | 76 +++ 5 files changed, 106 insertions(+), 20 deletions(-) diff --git

[PATCH 12/14] hmac-sha256/hmac-sha224: use new hmac and hash split state/buffer interface

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac-sha224.c | 4 ++-- hmac-sha256.c | 6 +++--- hmac.h| 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hmac-sha224.c b/hmac-sha224.c index c5bc8750a054..303337fe257f 100644 --- a/hmac-sha224.c +++ b/hmac-sha224.c @@ -41,12

[PATCH 07/14] ripemd160: split context into hash state and byte buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h| 1 + ripemd160-meta.c | 3 +++ ripemd160.c | 50 ripemd160.h | 29 +--- 4 files changed, 68 insertions(+), 15 deletions(-) diff --git a/nettle-meta.h

[PATCH 06/14] hmac-md5: use new hmac and hash split state/buffer interface

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac-md5.c | 6 +++--- hmac.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hmac-md5.c b/hmac-md5.c index a27e64f6f61b..910d8a508a11 100644 --- a/hmac-md5.c +++ b/hmac-md5.c @@ -41,19 +41,19 @@ void hmac_md5_set_key(struct h

[PATCH 02/14] hash: start separating state and block contexts

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h | 28 nettle-types.h | 15 +++ 2 files changed, 43 insertions(+) diff --git a/nettle-meta.h b/nettle-meta.h index e3db0e9d63aa..f21dcd9b344d 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -107,6

[PATCH 09/14] sha1: split context into hash state and byte buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta.h | 1 + sha1-meta.c | 3 +++ sha1.c| 56 --- sha1.h| 29 +++--- 4 files changed, 70 insertions(+), 19 deletions(-) diff --git a/nettle-meta.h b/nettle-m

[PATCH 00/14] HMAC implementation rework

2019-07-02 Thread Dmitry Eremin-Solenikov
This is my current attempt to rework hash/HMAC internal API to use separate block buffer from main hash state and thus decrease HMAC context data size by removing byte buffer duplication. Unfortunately this breaks GnuTLS accelerated implementations. Patch for GnuTLS will be provided, if this approa

[PATCH 04/14] md5: split context into hash state and byte buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- md5-meta.c| 3 +++ md5.c | 52 +-- md5.h | 29 +--- nettle-meta.h | 2 ++ 4 files changed, 69 insertions(+), 17 deletions(-) diff --git a/md5-meta.c b/md5-meta

[PATCH 08/14] hmac-ripemd160: use new hmac and hash split state/buffer interface

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- hmac-ripemd160.c | 6 +++--- hmac.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hmac-ripemd160.c b/hmac-ripemd160.c index 24e2cbe7a578..fa4e6a09075c 100644 --- a/hmac-ripemd160.c +++ b/hmac-ripemd160.c @@ -41,19 +41,1

[PATCH 03/14] macros: add interface for working with separate hash state and buffer

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- macros.h | 66 1 file changed, 66 insertions(+) diff --git a/macros.h b/macros.h index 990d32ee3b36..615f06c4c7de 100644 --- a/macros.h +++ b/macros.h @@ -215,6 +215,45 @@ do {

[PATCH 4/6] Add HMAC functions for GOSTHASH94 and GOSTHASH94CP

2019-07-02 Thread Dmitry Eremin-Solenikov
GOST hash functions can be used to generate MAC using HMAC algorithm. Add functions implementing HMAC with GOSTHASH94/GOSTHASH94CP. Signed-off-by: Dmitry Eremin-Solenikov --- Makefile.in | 6 ++-- hmac-gosthash94.c | 79 +++ hmac.h

[PATCH 1/6] Start separating GOST 28147-89 from GOST R 34.11-94

2019-07-02 Thread Dmitry Eremin-Solenikov
Hash function GOST R 34.11-94 (gosthash94) in its compression function uses Russian block cipher (GOST 28147-89, Magma). Start separating block cipher code from hash function code. For now there is no public interface for this cipher, it will be added later. Signed-off-by: Dmitry Eremin-Solenikov

[PATCH 2/6] Add GOST R 34.11 to nettle_hashes

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle-meta-hashes.c | 1 + testsuite/meta-hash-test.c | 1 + 2 files changed, 2 insertions(+) diff --git a/nettle-meta-hashes.c b/nettle-meta-hashes.c index 37552edec5ca..f0ef026d359f 100644 --- a/nettle-meta-hashes.c +++ b/nettle-meta-hashes.c @

[PATCH 6/6] gosthash94: switch to using MD_UPDATE() macro

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- gosthash94.c | 43 +-- gosthash94.h | 5 +++-- 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/gosthash94.c b/gosthash94.c index 0e84553f9a03..8105530516ee 100644 --- a/gosthash94.c +++ b/gosthash

[PATCH 5/6] Add PBKDF2 support for gosthash94cp

2019-07-02 Thread Dmitry Eremin-Solenikov
Russian technical comitee working on standartization of cryptography algorithms has published the document describing usage of GOST R 34.11-94 hash function with PBKDF2 algorithm (http://tc26.ru/methods/containers_v1/Addition_to_PKCS5_v1_0.pdf). Add test vectors from that document and a special fun

[PATCH 3/6] Add support for GOSTHASH94CP: GOST R 34.11-94 hash with CryptoPro S-box

2019-07-02 Thread Dmitry Eremin-Solenikov
Hash gosthash94 implements GOST R 34.11-94 standard using S-Box defined in the standard 'for testing purposes only'. RFC 4357 defines S-Box (CryptoPro one) for GOST R 34.11-94 hash function that is widely used in applications. Add separate hash function algorithm (gosthash94cp) implementing GOST R

[PATCH 2/4] cmac: add 64-bit mode CMAC

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- cmac.c | 125 - cmac.h | 69 +++ nettle-types.h | 7 +++ 3 files changed, 200 insertions(+), 1 deletion(-) diff --git a/cmac.c b/cmac.c index c5a59b18e572..e93e26

[PATCH 3/4] cmac: add CMAC-DES3 (CMAC-TDES) implementation

2019-07-02 Thread Dmitry Eremin-Solenikov
Implement CMAC using TrippleDES as underlying cipher. Signed-off-by: Dmitry Eremin-Solenikov --- Makefile.in | 2 +- cmac-des3.c | 61 +++ cmac.h| 17 testsuite/cmac-test.c | 32 +++ 4 f

[PATCH 4/4] Expand documentation to cover CMAC-64

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- nettle.texinfo | 38 ++ 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/nettle.texinfo b/nettle.texinfo index b8579a6ed59b..57e6345f78df 100644 --- a/nettle.texinfo +++ b/nettle.texinfo @@ -3718,14 +3718

[PATCH 1/4] Move MAC testing code to generic place from cmac-test

2019-07-02 Thread Dmitry Eremin-Solenikov
Signed-off-by: Dmitry Eremin-Solenikov --- testsuite/cmac-test.c | 100 +++--- testsuite/testutils.c | 64 +++ testsuite/testutils.h | 6 +++ 3 files changed, 96 insertions(+), 74 deletions(-) diff --git a/testsuite/cmac-test.c b/tes

Re: Changes after 3.5.1

2019-07-02 Thread Dmitry Eremin-Solenikov
Hello, вт, 2 июл. 2019 г. в 15:03, Niels Möller : > > Dmitry Eremin-Solenikov writes: > > > I have several patch series that were sitting in my local gost tree. > > Most of them were posted to this mailing list for review with little > > to no feedback. > > > - CMAC-64 support (together with CMA

Re: Changes after 3.5.1

2019-07-02 Thread Niels Möller
Dmitry Eremin-Solenikov writes: > I have several patch series that were sitting in my local gost tree. > Most of them were posted to this mailing list for review with little > to no feedback. > - CMAC-64 support (together with CMAC-TDES for testing). > - Changes to GOST R 34.11-94 (gosthash94)