[CFRG] Re: Where should test vectors live?

Christopher Patton <cpatton@cloudflare.com> Fri, 20 September 2024 22:43 UTC

Return-Path: <cpatton@cloudflare.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 83CA4C1840EA for <cfrg@ietfa.amsl.com>; Fri, 20 Sep 2024 15:43:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.104
X-Spam-Level:
X-Spam-Status: No, score=-2.104 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=cloudflare.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oWkAgqM-QDtk for <cfrg@ietfa.amsl.com>; Fri, 20 Sep 2024 15:43:52 -0700 (PDT)
Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C5C0AC180B69 for <cfrg@irtf.org>; Fri, 20 Sep 2024 15:43:52 -0700 (PDT)
Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-4582c4aa2c2so15138121cf.0 for <cfrg@irtf.org>; Fri, 20 Sep 2024 15:43:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1726872232; x=1727477032; darn=irtf.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=MBGjxVyQOMzk7Iz1I9S0MbZLFPmrOSVhHK2/rjVbdLs=; b=HtQ4P8Y+kAfBEPlnTZKV04MNMm1Gx+k8ODBaqKjPpRQIQ9JIS/TEY/kCOXmEfKIjlF f6AePrqe7WnWlMBxcwAG4KGWAiFuMUE81yS91O/U+MwYfvhKPCq28ucr6TjkkG87pZps TXmiEUJv+UMqyHjpvgK9CrKJfUiS9qSsuTW3a+4kHHJyx0pvWL9FGhhamZxxVzX+YYrx mwRRDbmXH/Bqn/8TFobEbo7YeqUomzi/BiJ9MDY5t7rqsDDMx4MYsGg21KyC8HuTIe/2 F6z515DfyZ0CU5BWHLNk9rmdDi0qwPbS0LSQgHzCHLPGuQ3CbGJgR8/9PPnC51NOoHTv +Htw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726872232; x=1727477032; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MBGjxVyQOMzk7Iz1I9S0MbZLFPmrOSVhHK2/rjVbdLs=; b=S64BsvYmVvIRWm/nIaI7RNtTe79F8FZZiNvRqLkTFqJxe5SUi79guPOOyLnq0tl6Vh l7DJXNPkThanxTHFhW8Blna2bgJ2AWDEz9UhXgatm9fDYWOJDqvJ5Fs7UUhD7I3BembH B5i+dVDAILejGpJYY1k4DCxnuz08ISJE4aZuXhJ2+bStk45VyDmbuZ4mPVumiI/4GeG/ moJ/QBl/cd6dhunPc8ANIfO4rPcJy6FYbJBXn/KH72+RCIEMwmdyVWQUUpajai4E528E m9U8YTBQom07mZoSg++3sHUtSuDHc43tmf/29NUfbXzuzT8cKqoznDqTtxULmL5c7Nw/ Qf8Q==
X-Gm-Message-State: AOJu0YzaFAFaS6h/yq6SBBbXzsxoQXKO282NJUOkXeXyBlfmJTiMFD4b OP0NXvtLUqYyyakpbCNftL+PX/xufXqzov+74KgFG8KammBOSq6IaWbB1McJnNVfpyICrfOunDS 6unhlHzHGyA79PI1e0kY3gOx3l3YlJhQdNUUYeBkW3O1hArD0AMaxvg==
X-Google-Smtp-Source: AGHT+IHw/zmoVJAlrcDYiEQ/t4+HnhTfCJFvvY780jd8OrfndBqSBcpZWidacd4t6IixCj2fxN3fB8RyxkLz/YsreYg=
X-Received: by 2002:a05:622a:45:b0:458:5482:c565 with SMTP id d75a77b69052e-45b2053cf5dmr55404421cf.41.1726872231753; Fri, 20 Sep 2024 15:43:51 -0700 (PDT)
MIME-Version: 1.0
References: <CAG2Zi22ya_6h1Q_rs9Tf6tJ3qao-X2_wWhCgxoXD3OQnf+MOUw@mail.gmail.com> <20240920200220.402868.qmail@cr.yp.to>
In-Reply-To: <20240920200220.402868.qmail@cr.yp.to>
From: Christopher Patton <cpatton@cloudflare.com>
Date: Fri, 20 Sep 2024 15:43:41 -0700
Message-ID: <CAG2Zi21QNTZ8rZ-j5nrkbRbrk4pdknXjdsCiLip30HjvweK9HA@mail.gmail.com>
To: cfrg@irtf.org
Content-Type: multipart/alternative; boundary="000000000000f25baf062294c56b"
Message-ID-Hash: UV3R4MD47IR2LL2DQNGPPOW44CRREV4A
X-Message-ID-Hash: UV3R4MD47IR2LL2DQNGPPOW44CRREV4A
X-MailFrom: cpatton@cloudflare.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [CFRG] Re: Where should test vectors live?
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/ezlx-v3e4p7pgCglEDXqTeTiYjg>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

Dan,


Instead of defining formats for test vectors, I would suggest defining a
> format for reference code (e.g., Python script meeting a specified API;
> can have the format say which Python version). An obvious illustration
> of using the format would be a general-purpose tool to create test
> vectors given the reference code---and then there's no reason to post
> the test vectors; people should run the tools locally. SUPERCOP already
> generates tests for thousands of C implementations meeting the SUPERCOP
> API, and there are examples online of how to do the same tests in
> Python. SUPERCOP also supports generating implementation-specific tests;
> this is sometimes useful for testing slow-to-find corner cases.
>
> One advantage of this modularity is that implementors will easily be
> able to swap in different testing tools (e.g., using fuzzers, or simply
> testing more inputs) without being constrained by the limits of posted
> test vectors. Of course, reference code is also useful for much more
> than just testing.


The draft in question does have reference code (
https://github.com/cfrg/draft-irtf-cfrg-vdaf/tree/main/poc/vdaf_poc) and
in fact we use this to generate test vectors and the spec itself (by
copy-pasting). The reference code is Python, but it requires SageMath to
run (e.g., `sage -python gen_test_vec.py` to generate test vectors). It
would be really cool to see implementers integrate the reference code
itself into their tests, though I think sage is too big a dependency to
carry around. We could probably remove it for this particular draft.

I think Python is by far the most common language for reference code at
CFRG. Some drafts require sage, others don't.

You may be interested in reviewing
https://github.com/cfrg/draft-irtf-cfrg-cryptography-specification.

Chris P.