[Cfrg] Bign

"Agievich Sergei V." <agievich@bsu.by> Sun, 09 August 2015 13:46 UTC

Return-Path: <agievich@bsu.by>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 869361B2CEA for <cfrg@ietfa.amsl.com>; Sun, 9 Aug 2015 06:46:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 2.137
X-Spam-Level: **
X-Spam-Status: No, score=2.137 tagged_above=-999 required=5 tests=[BAYES_50=0.8, HTML_MESSAGE=0.001, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1FW7ca49O5WM for <cfrg@ietfa.amsl.com>; Sun, 9 Aug 2015 06:46:03 -0700 (PDT)
Received: from xwall.bsu.by (xwall.bsu.by [217.21.43.224]) by ietfa.amsl.com (Postfix) with ESMTP id 54BF81B2CEF for <cfrg@irtf.org>; Sun, 9 Aug 2015 06:46:01 -0700 (PDT)
Received: from mail.bsu ([10.0.0.5]) by xwall.bsu.by with XWall v3.50 ; Sun, 9 Aug 2015 16:45:59 +0300
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01D0D2A9.B944550E"
X-MimeOLE: Produced By Microsoft Exchange V6.5
Date: Sun, 09 Aug 2015 16:45:59 +0300
Message-ID: <3170B593C27D3D4C8B243E4BD5E936E74ACBCA@Mail.bsu>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: Bign
Thread-Index: AdDSqbknQenHalUcRryYw2kKVDE9/w==
From: "Agievich Sergei V." <agievich@bsu.by>
To: cfrg@irtf.org
X-XWALL-BCKS: auto
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/pI92HSRjMBg50NVEz32L5RciVBk>
Subject: [Cfrg] Bign
X-BeenThere: cfrg@mail.ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.mail.ietf.org>
List-Unsubscribe: <https://mail.ietf.org/mailman/options/cfrg>, <mailto:cfrg-request@mail.ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@mail.ietf.org>
List-Help: <mailto:cfrg-request@mail.ietf.org?subject=help>
List-Subscribe: <https://mail.ietf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@mail.ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 09 Aug 2015 13:46:06 -0000

Dear CFRG members,

In the course of the debates on the new signature scheme let me share
information about Bign, that is, a Schnorr-type signature scheme which
we developed a few years ago. In 2013 Bign was adopted as the
Belarusian standard STB 34.101.45 and now is widely used in our
(Republic of Belarus) government and commercial PKI systems.

I hope that our experience will be useful for CFRG. A sketch of our
design is provided below. You can find further details in the full
specification http://apmi.bsu.by/assets/files/std/bign-spec29.pdf
(unfortunately, in Russian only right now) and in the reference
implementation https://github.com/agievich/bee2 (bign.h, bign.c).

Parameters
----------

l \in {128, 192, 256} -- a security level;

q -- a 2l-bit prime number;

G -- a generator of an Abelian group <G> of order q. 
Let O be the unity (zero) of this group; 

H -- an external hash function {0,1}^* -> {0,1}^{2l};

OID(H) -- an octet string which uniquely identify H
(in fact, an ASN.1 object identifier);

h -- an internal hash function {0,1}^* -> {0,1}^l.

Binary words are interpreted as unsigned integers (under little-endian
conventions) and otherwise. Residues mod q and nonzero elements of <G>
are represented by 2l-bit words.

Private key
-----------

d -- a secret random / pseudorandom element of {1, 2,..., q - 1}. 

Public key
----------

Q = dG.

Message to be sign
------------------

X \in {0,1}^*.

Signing
-------

1 Choose k in random (or pseudorandom, see later) from {1, 2,..., q - 1}. 
2 R <- kG.
3 s0 <- h(OID(H) || R || H(X)).
4 s1 <- (k - H(X) - (s0 + 2^l)d) mod q.
5 s <- s0 || s1.
6 Return s.

Verification 
------------

1 If |s| != 3l return 0.
2 Parse s and extract s0 and s1: s = s0 || s1, |s0| = l, |s1| = 2l.
3 If s1 >= q return 0.
5 R <- (s1 + H(X))G + (s0 + 2^l)Q.
6 If R = O return 0.
7 If h(OID(h) || R || H(X)) != s0 return 0.
8 Return 1.

Design rationale
----------------

1 Short signatures. 

The most Schnorr-type signature schemes use 2l bits for s0 and 2l bits
for s1. We apply so-called Schnorr's compression and truncate s0 to l
bits. Truncation is not only shorten total length of signature but also
speed-up verification: it takes only 1.5 exponentiation in <G> and
closely approaches signing time (1 constant-time exponentiation).

We use similar short signatures in our instantiations of MQV / STS
protocols (see http://apmi.bsu.by/assets/files/std/bake-spec19.pdf) 
and in a Schnorr-type identity based signature scheme
(http://apmi.bsu.by/assets/files/std/bign-spec29.pdf, appendix B).

2 Pre-hashing. 

Instead of the classical direct-hashing during the calculation of s0: 
	s0 <- h(R || X),
we use the pre-hashing approach:
	s0 <- h(OID(H) || R || H(X)).
Pre-hashing protects against multiple-target preimage attacks based on
consecutive extensions of X and described recently by D. Bernstein.
Additionally, pre-hashing facilitates integration with existing APIs
and data formats.

3 Whitening. 

The second part of signature (s1) is whitened by Y = H(X). In such
manner we block the signature collisions. Such a collision can be
found by a malicious signatory in time about 2^{l/2}. Whitening makes
the overall signature s a safe checksum of expected strength 2^l.

4 Hashing of Q.

Let s be a valid signature of X under Q. An adversary can change Q by
Q' and s by s' so that s' will be the valid signature of X under Q'.

To protect against this attack we can hash Q during the calculation of s0:
 	s0 <- h(OID(H) || R || Y || Q).
But we reject such a solution because, in our opinion, hashing of Q
duplicates a standard proof-of-possession during public key
distribution: any signature scheme will be weak with weak key
distribution; hashing of Q is useless with strong key distribution.
                                                         
5 Deterministic signature.

The ephemeral public key k can be generated using either TRNG or PRNG.
In the latter case k is generated by the special deterministic
algorithm genk.

This algorithm takes q, d, OID(H), Y = H(X) and arbitrary additional
data t \in {0,1}^*.

Firstly, OID(H), d and t are hashed using a function 
h_{256}: {0,1}^* -> {0,1}^{256}. This function is an extension of h 
(in fact, h is a restriction of h_{256}). The resulting hash value 
	\theta <- h_{256}(OID(H) || d || t)
is used as a key to encrypt Y:
	k <- Encr_1(Y, \theta).
Encryption is continued
	k <- Encr_2(k, \theta), 
	k <- Encr_3(k, \theta), ...
until k \in {1, 2, ..., q - 1}.

Here {Encr_i, i = 1, 2,...} is a family of symmetric encryption
functions: Encr_i(B, theta) is a result of encryption of B \in
{0,1}^{2l} under the key \theta \in {0,1}^{256}. Fortunately, we had
standardized a keywrap encryption mode which was transformed into
{Encr_i}.

Due to repeating encryptions genk isn't a constant-time algorithm. But
in practical settings q is very close to 2^{2l} and chances for even
second encryption are enough small.

We didn't use the constant-time constructions like
"wide-hash-then-reduce-mod-q" because of their quite heaviness.

6 Sign + transport.

In our standard STB 34.101.45 the pair (d, Q) can be used not only in
the signature algorithms but also for key transport (encryption) of
ElGamal type.

We consider the tandem "sign + transport" controlled by a single key pair as
a very useful cryptographic primitive. For example, we can imagine a key-centric
architecture like Bitcoin in which addresses -- public keys -- support both 
data authenticity and confidentiality. 

Best regards,
Sergey Agievich
Research Institute for Applied Problems of Mathematics and Informatics
Belarusian State University