Open-source aspects of GOST Cryptography
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Open-source aspects of GOST Cryptography
	<oss-gost-crypto@lists.altlinux.org>
Subject: Re: [oss-gost-crypto] Модули Linux с криптографией ГОСТ [PATCH]
Date: Tue, 9 Oct 2018 03:46:56 +0300
Message-ID: <20181009004656.c4cee5frw7xxwaaz@sole.flsd.net> (raw)
In-Reply-To: <CADqLbzJgJvQn8uyFo2cYiTawJx4U8P9_0h8BvjtWiQND9QAgjQ@mail.gmail.com>

On Mon, Oct 08, 2018 at 09:19:11PM +0300, Dmitry Belyavsky wrote:
>    Привет!
>    Виталий, у меня в тестах на Стрибог был тест на корректную работу
>    add512.
>    [1]https://github.com/gost-engine/engine/tree/master/etalon файл carry.
>    В реализации исходно была ошибка, и на этом файле она вылезала.

Я протестил с этим вектором, но не добавлял его в патч. Если кому надо,
то патч прилагаю.

>    По XLPS - доступны ли в ядре gcc-шные intrinsics?

Что-то есть, но я использую макросы, которые определены в ядре
зависимости оттого что и как есть на конкретных архитектурах.

Например, include/uapi/linux/swab.h:

  #ifdef __HAVE_BUILTIN_BSWAP64__
  #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
  #else
  #define __swab64(x)                             \
	  (__builtin_constant_p((__u64)(x)) ?     \
	  ___constant_swab64(x) :                 \
	  __fswab64(x))
  #endif

где __fswab64 использует __arch_swab64, который может быть определен на
разных архитектурах, если нет то используется generic версия (она может
использовать __arch_swab32, если он есть, если нет то ещё более generic.).

---
ps. PATCH s carry векторами из gost-engine:

>From 4cf05497958599ab21f02a9ebb20c7c5d8183a18 Mon Sep 17 00:00:00 2001
From: Vitaly Chikunov <vt@altlinux.org>
Date: Tue, 9 Oct 2018 03:28:44 +0300
Subject: [PATCH 1/1] crypt: streebog - carry test vectors to tests

---
 crypto/testmgr.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 9f9b7d6e4072..42eff1d2d3d2 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -2340,6 +2340,31 @@ static const struct hash_testvec sb256_tv_template[] = {
 			"\xc0\xca\xc6\x28\xfc\x66\x9a\x74"
 			"\x1d\x50\x06\x3c\x55\x7e\x8f\x50",
 	},
+	{
+		.plaintext =
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\x16\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x16",
+		.psize = 128,
+		.digest =
+			"\x81\xbb\x63\x2f\xa3\x1f\xcc\x38"
+			"\xb4\xc3\x79\xa6\x62\xdb\xc5\x8b"
+			"\x9b\xed\x83\xf5\x0d\x3a\x1b\x2c"
+			"\xe7\x27\x1a\xb0\x2d\x25\xba\xbb"
+	},
 };
 
 static const struct hash_testvec sb512_tv_template[] = {
@@ -2378,6 +2403,35 @@ static const struct hash_testvec sb512_tv_template[] = {
 			"\x3f\x0c\xb9\xdd\xdc\x2b\x64\x60"
 			"\x14\x3b\x03\xda\xba\xc9\xfb\x28",
 	},
+	{ /* carry */
+		.plaintext =
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+			"\x16\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x11"
+			"\x11\x11\x11\x11\x11\x11\x11\x16",
+		.psize = 128,
+		.digest =
+			"\x8b\x06\xf4\x1e\x59\x90\x7d\x96"
+			"\x36\xe8\x92\xca\xf5\x94\x2f\xcd"
+			"\xfb\x71\xfa\x31\x16\x9a\x5e\x70"
+			"\xf0\xed\xb8\x73\x66\x4d\xf4\x1c"
+			"\x2c\xce\x6e\x06\xdc\x67\x55\xd1"
+			"\x5a\x61\xcd\xeb\x92\xbd\x60\x7c"
+			"\xc4\xaa\xca\x67\x32\xbf\x35\x68"
+			"\xa2\x3a\x21\x0d\xd5\x20\xfd\x41"
+	},
 };
 
 /* Example vectors below taken from
-- 
2.11.0



  parent reply	other threads:[~2018-10-09  0:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 10:48 [oss-gost-crypto] Модули Linux с криптографией ГОСТ Dmitry Eremin-Solenikov
2018-10-03 14:34 ` Vitaly Chikunov
2018-10-08  9:09   ` Vitaly Chikunov
2018-10-09  0:46       ` Vitaly Chikunov [this message]
2018-10-12  8:54   ` Vitaly Chikunov
2018-10-12  9:16     ` Dmitry Eremin-Solenikov
2018-10-12 11:28       ` Vitaly Chikunov
2018-10-17  9:35         ` Vitaly Chikunov
2018-10-23 10:54 ` Dmitry Eremin-Solenikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181009004656.c4cee5frw7xxwaaz@sole.flsd.net \
    --to=vt@altlinux.org \
    --cc=oss-gost-crypto@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Open-source aspects of GOST Cryptography

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/oss-gost-crypto/0 oss-gost-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 oss-gost-crypto oss-gost-crypto/ http://lore.altlinux.org/oss-gost-crypto \
		oss-gost-crypto@lists.altlinux.org oss-gost-crypto@lists.altlinux.ru oss-gost-crypto@lists.altlinux.com
	public-inbox-index oss-gost-crypto

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.oss-gost-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git