Re: [TLS] [Cfrg] Citing specs in specs

Paul Lambert <paul@marvell.com> Tue, 04 March 2014 10:58 UTC

Return-Path: <paul@marvell.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0ACCB1A02CE; Tue, 4 Mar 2014 02:58:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.833
X-Spam-Level: *
X-Spam-Status: No, score=1.833 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, IP_NOT_FRIENDLY=0.334, J_BACKHAIR_44=1, J_CHICKENPOX_46=0.6, J_CHICKENPOX_51=0.6, J_CHICKENPOX_56=0.6, J_CHICKENPOX_57=0.6, SPF_PASS=-0.001] 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 meVzC-Dg5FaN; Tue, 4 Mar 2014 02:58:16 -0800 (PST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by ietfa.amsl.com (Postfix) with ESMTP id F2A8A1A06D6; Tue, 4 Mar 2014 02:58:15 -0800 (PST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id s24Aw1GW022475; Tue, 4 Mar 2014 02:58:01 -0800
Received: from sc-owa03.marvell.com ([199.233.58.149]) by mx0b-0016f401.pphosted.com with ESMTP id 1jcrfcw98c-17 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 04 Mar 2014 02:58:01 -0800
Received: from SC-vEXCH2.marvell.com ([10.93.76.134]) by SC-OWA03.marvell.com ([fe80::4561:8e1c:d59b:f770%17]) with mapi; Tue, 4 Mar 2014 02:58:00 -0800
From: Paul Lambert <paul@marvell.com>
To: Watson Ladd <watsonbladd@gmail.com>
Date: Tue, 04 Mar 2014 02:57:58 -0800
Thread-Topic: [Cfrg] Citing specs in specs
Thread-Index: Ac83mJvkWMeWwwBDQkKRJ68Rj1zacg==
Message-ID: <CF3BC8BA.34258%paul@marvell.com>
References: <530FDC7A.4060404@cisco.com> <CABqy+srTqCXjOR4DMNgWyxf2pZ7dwZfWyznhBuJaY5w8VeuR4Q@mail.gmail.com> <5310B12E.4070603@cisco.com> <CABqy+srrbtdHOckjPqTj5SFuQwQEqXBjgc8kwagMi8E6ZRf=qg@mail.gmail.com> <28A7736F-A791-4552-8D42-DB99AC7B7F9B@vpnc.org> <CF37EA5F.338D8%paul@marvell.com> <CACsn0cmewBrOzaRF5XXC1p1A_gUSwkdE1_7V-1x8nta-ESyA+A@mail.gmail.com> <CF38F2D4.33940%paul@marvell.com> <2A0EFB9C05D0164E98F19BB0AF3708C711EF97AD05@USMBX1.msg.corp.akamai.com> <7BAC95F5A7E67643AAFB2C31BEE662D018B8516C6E@SC-VEXCH2.marvell.com> <7A2637AF-5A16-404B-B7A1-49FB17D5345A@callas.org> <CF3B846F.3415E%paul@marvell.com> <CACsn0cnyvkD1X5JDPJaoB83jZeFrj=uugMmWG9nPB+4jaC+POw@mail.gmail.com>
In-Reply-To: <CACsn0cnyvkD1X5JDPJaoB83jZeFrj=uugMmWG9nPB+4jaC+POw@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/14.3.9.131030
acceptlanguage: en-US
Content-Type: text/plain; charset="euc-kr"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.87, 1.0.14, 0.0.0000 definitions=2014-03-04_04:2014-03-04, 2014-03-04, 1970-01-01 signatures=0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1403040016
Archived-At: http://mailarchive.ietf.org/arch/msg/tls/upXfIBJs1BzqlOLK1z5JaCAAB0U
Cc: "cfrg@irtf.org" <cfrg@irtf.org>, Jon Callas <jon@callas.org>, "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] [Cfrg] Citing specs in specs
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Mar 2014 10:58:18 -0000


On 3/4/14, 3:03 PM, "Watson Ladd" <watsonbladd@gmail.com> wrote:

>On Mon, Mar 3, 2014 at 9:32 PM, Paul Lambert <paul@marvell.com> wrote:
>>
>>
>> On 3/3/14, 2:52 PM, "Jon Callas" <jon@callas.org> wrote:
>>
>>>On Mar 2, 2014, at 3:40 PM, Paul Lambert <paul@marvell.com> wrote:
>>>
>>>> Implementations are possible by using the readily available open
>>>>source
>>>> implementation.  This is a good thing, but it is also desirable
>>>> to have a unambiguous description of the algorithms that is not
>>>> a C code file.  This is why we write RFCs...
>>>
>>>It's hard to disagree with this, in a similar way that it's hard to
>>>disagree with the idea of peace on earth, living at one with nature,
>>>etc.
>>>
>>>But in practice, code needs to be in a computer language rather than
>>>English and I've seen (and been involved with) a document that started
>>>with rough consensus and running code, translated that into English, and
>>>the English was (and is) devilishly hard to compile back into C.
>> Yes - I¹e seen the same problem.  English is not a concise or clear way
>>to
>> document an algorithm.
>
>Really? Because all the people doing algorithms I've seen use English
>to describe their results because it is clearer then code.
>
>For instance, consider the following short C code.


No I will not.  Read my suggestion - C code sucks for readability.  Yes -
English is always needed, even in code for comments.

Pseudo code is just ‘psuedo’ and lacks defined syntax.  Higher level
languages like Python or Ruby provide an opportunity for clear and
syntactically well defined algorithm definitions.  Specifically where we
are describing equations for things like - iterating over a range,
recursive algorithms, etc.  Examples would look like:

def add_points(curve, p1, p2):
    """ Add two points on the curve """
    x1 = p1.x;  x2 = p2.x;  y1 = p1.y;  y2 = p2.y
    d = curve.d; a = curve.a; p = curve.p; inv = curve.inverse
        
    # Edwards curve addition
    x3 = ( (x1*y2+x2*y1) * inv(1+d*x1*x2*y1*y2) ) % p
    y3 = ( (y1*y2-a*x1*x2) * inv(1-d*x1*x2*y1*y2) ) % p
    return curve.point(x3, y3)

#or

class Curve25519( MontgomeryCurveFp ):
    """ y**2 == x**3 + 486662*x**2 + x  mod 2**255-19 """
    curveId = 'curve25519'
    strength = 126
    oid = None
    p  = 2**255-19
    a  = 486662
    xG = 9
    yG =  
0x20ae19a1b8a086b4e01edd2c7748d14c923d4d7e6d7c61b229e9c5a27eced3d9
    n  = 2**252 + 27742317777372353535851937790883648493
    h  = 8



Your example below is irrelevant and I’m not sure why you are always
disagreeing with anything anyone posts on the list.




>
>typedef struct{ member *p; int rank} member;
>
>void init(member *a){a->p=a; rank=0;}
>
>member * find(member *a){
>   member *q=a;
>   member *r=NULL;
>   member *t;
>   while(q !=q->p){
>            t=q->p;
>            q->p=r;
>            r=q;
>            q=t;
>    }
> while (r !=NULL){
>         t=r->p;
>         r->p=q;
>        r=t;
>  }
>return q;
>}
>
>void union(member *a, member *b){
>   a=find(a);
>   b=find(b);
>   if(a->rank<b->rank){
>          a->p=b->p;
>          b->rank++;
>    } else {
>       b->p=a->p;
>      a->rank++;
>   }
>}
>
>The above code is of course union-find. However, I don't know what
>looking at the above code tells you about the algorithm. By contrast
>the following description gets the point across much more clearly.
>"We consider a forest where the root node of each tree points to
>itself, and pointers point up. The find operation takes the node it is
>given, and follows the chain of pointers to the root, reversing each
>pointer. It then descends the chain, setting each encountered pointer
>to the root. The union operation links the root with lower rank to the
>one with greater rank and increments the rank of the new root."
>
>In particular the description makes clear the invariant that is
>maintained: each set has a unique element that points to itself, the
>rank of a node is an upper bound on the height of the tree rooted at
>that node. The code makes none of this clear: it is concerned entirely
>with bookkeeping that seems as important as the main idea.
>
>For something like F5, or point counting, or inverse square root, or
>direct sparse matrix factoring, or the Fast Fourier Transform, the gap
>between what English is able to do and what an executable
>representation can do in terms of ideas is only bigger. There is a
>reason computer science produces books, not code.
>
>>
>> HAC is pretty clear and is a decent example of cryptographic algorithm
>> descriptions (http://cacr.uwaterloo.ca/hac/about/chap8.pdf), but still
>> uses a mix of math notation and english text.
>
>Your use of the word "still" implies that you think the two are in
>some way opposed. They aren't: programming languages have nowhere near
>the capacity of expressing ideas that the English language does.

Yes - both are required.
>
>>>
>>>Portably implemented algorithms are hard to do in any computer language.
>>>They're harder to do in words. I don't see how you're going to get an
>>>unambiguous description of the language in anything but a computer
>>>language. It doesn't have to be C, it could be Python, Ruby, or Algol-58
>>>(which I mention because it was originally designed as an algorithmic
>>>description language). English is a suboptimal implementation language.
>>
>> Yes, exactly!   'Readable code¹ would be a very good way to provide an
>> algorithm description.  Why bother with pseudo code when a executable
>> syntax could be used.   I submitted earlier on this list some Python
>>code
>> fragments as examples of this approach.  Python allows operator
>> overloading, so it can provide some very readable ECC algorithm
>> descriptions.
>
>Readable without a working Python implementation to see what happens?
>
>Note that Python code implementing Curve25519 exists in "Cryptography
>in NaCl", which also contains test vectors.

Pieces of the code read well … the code by it’s self is not a
specification.
The ‘add’ code is a good example of something that could be used:


def add((xn,zn), (xm,zm), (xd,zd)):
    x = 4 * (xm * xn - zm * zn) ** 2 * zd
    z = 4 * (xm * zn - zm * xn) ** 2 * xd
    return (x % P, z % P)



>Does anyone have an objection to putting equivalent Python in the
>draft/would this satisfy those calling for more documentation?
>If I have the nroff source of the draft I can do it in a few hours.

‘readable' code written to closely map to the algorithm description
would be good - but this is not a raw nroff of the source file.
I’m suggesting that what is needed is a document using english text
in the style of:
 http://www.nsa.gov/ia/_files/nist-routines.pdf
Where the psuedo code is replaced with real Python functions.

That said … your flip and negative comments are very frustrating to deal
with and it’s not a good way to get any consensus.  The note was also not
directed to you and I do not expect you take any action from this
suggestion.  I’m hoping others will carry the flag for this documentation
exercise and that they will be easier to communicate with on the mailing
list.


Paul




>
>Sincerely,
>Watson Ladd
>>
>> Paul
>>
>>
>>
>>
>>>
>>>       Jon
>>>
>>
>
>
>
>-- 
>"Those who would give up Essential Liberty to purchase a little
>Temporary Safety deserve neither  Liberty nor Safety."
>-- Benjamin Franklin