Re: [Cbor] draft-ietf-cbor-network-addresses: tag validity; deterministic encoding

Brian E Carpenter <brian.e.carpenter@gmail.com> Fri, 15 October 2021 19:41 UTC

Return-Path: <brian.e.carpenter@gmail.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 85CE93A0A24 for <cbor@ietfa.amsl.com>; Fri, 15 Oct 2021 12:41:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 lmVm_9Geu7C3 for <cbor@ietfa.amsl.com>; Fri, 15 Oct 2021 12:41:49 -0700 (PDT)
Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C18693A0A1A for <cbor@ietf.org>; Fri, 15 Oct 2021 12:41:48 -0700 (PDT)
Received: by mail-pl1-x633.google.com with SMTP id 21so6995486plo.13 for <cbor@ietf.org>; Fri, 15 Oct 2021 12:41:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nhjtNXi6Fb7svpSaGt1EyWOam3bSVa0Q/3vX1O0xUNg=; b=HwAmtqXkPeyuWtpG6smxAnlMtGfWooBxS1x4p1e2diLF99vIxSG/4ppw/qF9d9s+16 yPorg38RXjzlAmsrhfa6qTnJBRDH2j9oTGoirqS3j9fOmsF+RTS/JwhNtGaL6vt8HBaH cTpGHMv1nzeyUL2mr8Gf1PimacxLUYhB0++nivPy5tMr31/YAWyHGZioCIDTsIXaqBFK KLNH1U5OAKqR/OGTWeRn2a2hIDK+qE7AX7apRCgMDVFSNmrFwEFrk917VJ+cyLnBeukz 8DkyWREBtddLkQoFJGJsMVESX8MSU8yPs2TKIfYYAOSVEdwtXfo4uDNtL0fW9hhpRfx/ XV6g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nhjtNXi6Fb7svpSaGt1EyWOam3bSVa0Q/3vX1O0xUNg=; b=TySqTmZd5C8KQhZDTV50ejrr5YYRlw/FCSxZ99YMEWnw/VJBRZjv/0EjxOFnaBQiSF f2uwNBndeIzw3O3Tq2TgyJNu/UyAIWBxMZeO2PwsaJ0GZRPHrCBON0Vaz98bFw9jtEio NalQV+sXaeYYpjGzHcfRhAh4PnjtyUfUnpveLynwvPu+/hOFBIBgd4rsNXsWrohvHtCb avwlP9UJIwV1QU/n8KrKR5UVgsYVl87yQdrwuOfzv4vyUxDGiBCeNcjJgzPoQFbx2zRZ RsKmEjMoTiojPCv4uWY9UjhZIgYm3VYj5MKk0yHgulnGG1BDbs2CXrQ7OFqJ6W+6OicK /O6w==
X-Gm-Message-State: AOAM532cEaNCo6QJqqsH52VTRCJPb83oXh0PQ5BR/stK7Fmu0eCT7jbK Bs2jiDBt7wfGLp/okHpJQ88=
X-Google-Smtp-Source: ABdhPJyhcqpYQX1zMBm2VhSHGWZjzWiqk7ezpoDhfzn0/8hYCnhJDC5zUAJpB8VWKY3ZA/pio1T5eQ==
X-Received: by 2002:a17:90b:3684:: with SMTP id mj4mr30215395pjb.3.1634326907949; Fri, 15 Oct 2021 12:41:47 -0700 (PDT)
Received: from ?IPv6:2406:e003:102d:e801:db7:d041:a2d:ce65? ([2406:e003:102d:e801:db7:d041:a2d:ce65]) by smtp.gmail.com with ESMTPSA id t9sm11940363pjm.36.2021.10.15.12.41.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Oct 2021 12:41:47 -0700 (PDT)
To: Carsten Bormann <cabo@tzi.org>
Cc: cbor@ietf.org, Michael Richardson <mcr+ietf@sandelman.ca>
References: <891995AA-2854-431E-9242-98FFCDA5E161@tzi.org> <dab25fe3-43c4-865e-2c7a-54b24340c295@gmail.com> <19BCDB95-AB61-4F92-A38D-F6FD5CA8BBB1@tzi.org> <a616b11c-0fc3-436b-96b0-12a6156c37f5@gmail.com> <DAE0122E-D6AB-45B2-A287-AC270AD8A7CD@tzi.org>
From: Brian E Carpenter <brian.e.carpenter@gmail.com>
Message-ID: <c837d973-b136-8f1d-1b08-6516544cdc1f@gmail.com>
Date: Sat, 16 Oct 2021 08:41:42 +1300
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <DAE0122E-D6AB-45B2-A287-AC270AD8A7CD@tzi.org>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/mblK1kKTvs6-YNzIUm5DZhHTuDc>
Subject: Re: [Cbor] draft-ietf-cbor-network-addresses: tag validity; deterministic encoding
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Oct 2021 19:41:54 -0000

Thanks. I have to do some other things more urgently, but I will work on your comments in due course. In the context of my code, anything that gets passed to detag() was manufactured by build(), so the verification is always going to succeed. I didn't build a test harness and throw invalid tags at detag(), but of course I should have done that.

I'd actually prefer if these tags were supported directly in the underlying libraries, so that the code could be optimized and the validation could be complete. Or possibly there should be a separate library providing build and detag/verify functions in a generic way.

Regards
   Brian

On 15-Oct-21 17:50, Carsten Bormann wrote:
> On 15. Oct 2021, at 06:35, Brian E Carpenter <brian.e.carpenter@gmail.com> wrote:
>>
>> So, my ugly code is in the functions build5254() and detag5254() in https://github.com/becarpenter/graspy/blob/master/pfxm4.py
> 
> Nice.
> 
> After line 122, there needs to be the Python equivalent of a
> 
> prefix.sub!(/\x00*\z/, ‘’)
> 
> (Why not mix floating point calculations and a regex in the same five lines of code :-)
> 
> Before line 146, you’d need to check whether the size really is 
`asize`.
> 
> I think the while loop in 154 needs to be before 151.
> 
> If v[0] == 128 and prefix is 16 bytes, what does prefix[v[0]//8] yield in Python?
> 
> Grüße, Carsten
>