Re: [Cfrg] I-D Action:draft-kiyomoto-kcipher2-02.txt

Joachim Strömbergson <> Thu, 21 April 2011 07:53 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id D646DE0741 for <>; Thu, 21 Apr 2011 00:53:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Status: No, score=-2.699 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, J_CHICKENPOX_54=0.6, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id rEEe+s7NKmst for <>; Thu, 21 Apr 2011 00:52:59 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 387A0E0692 for <>; Thu, 21 Apr 2011 00:52:58 -0700 (PDT)
Received: from ([] helo=snabbis.local) by with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from <>) id 1QCoh6-0001oG-Bc; Thu, 21 Apr 2011 09:52:56 +0200
Message-ID: <>
Date: Thu, 21 Apr 2011 09:52:55 +0200
From: =?UTF-8?B?Sm9hY2hpbSBTdHLDtm1iZXJnc29u?= <>
Organization: Kryptologik
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9
MIME-Version: 1.0
To: Wook Shin <>
References: <> <>
In-Reply-To: <>
X-Enigmail-Version: 1.1.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname -
X-AntiAbuse: Original Domain -
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain -
Cc: "" <>
Subject: Re: [Cfrg] I-D Action:draft-kiyomoto-kcipher2-02.txt
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Crypto Forum Research Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 21 Apr 2011 07:53:01 -0000

Hash: SHA1


I've looked at the draft, the code and tested it using the clang+llvm
compiler. Here are some comments. Most things are minor nits.

* I would recommend that you change the name of the code from CamelCase
and esp from ANaiveKCipher2Impl to something more readable. How about
kcipher2_simple, kcipher2_basic or similarly. Naive has a bit of a bad
ring to it.

* Is CamelCase the naming convention used by you? I'm quite certain it
is generally not for C code and makes it a bit harder to read. And
readibility and understandability is the point of this code.

* Move the S_box, INIT and NORMAL definitions to the .c-file. They are
internal to the cipher, not part of the API. A small name thing: In the
draft it is S-box, in the code S_box. Almost the same, just a detail.

* You get extra points for presenting internal state values during
execution of the test vectors. Very usable, good!

* There are two minor errors in the code, probably simple copy crimes.
KCipher2.c:201:51: warning: data argument not used by format string
    printf("\nFinally, after the Init() call:\n", i); // for debugging
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^

KCipher2.c:380:39: warning: data argument not used by format string
        printf(" are as follows: \n", j);
               ~~~~~~~~~~~~~~~~~~~~~  ^

* I really like the comment structure of the code with headers
describing what is done, what is being changed etc.

* I would change the declarations to use definitions in <stdint.h>
instead of "unsigned int", "unisgned char". This makes more clear what
bit widths are used.

* Add a license/copyright header to the .h-file too.

* Question: What is the license for KCipher2? The code points to the
draft which reiterates the IETF copyright. Basically this states that
the code is under simplified BSD license. (And you should probably add
such license in the code to make it clearer)

But what I would like to see, both in the draft and in the code is
something that clarifies the KDDI R&D Laboratories, Inc stand on the
license for the KCipher2. Is if free for non commercial, is there patent
claims related to the cipher etc?

Compare to the statement for CAST-128:

* In the draft, how about calling the shift registers "LFSR"? They are
normal linear shift registers as far as I can see and IMHO LFSR is the
more common term.

That is all for now.

- -- 
Med vänlig hälsning, Yours

Joachim Strömbergson - Alltid i harmonisk svängning.
Kryptoblog - IT-säkerhet på svenska
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla -