Seeking community feedback on which signature formats should be supported by FIPS 206 (FN-DSA/ Falcon)

4,474 views
Skip to first unread message

Perlner, Ray A. (Fed)

unread,
Oct 22, 2024, 1:54:08 PM10/22/24
to pqc-forum

Dear all,

 

Multiple encodings are currently specified for signature in section 3.11.3 of the Falcon submission document: https://falcon-sign.info/falcon.pdf . We are looking for community feedback on which of these should be supported by FIPS 206. Briefly, these options may be described as

 

  1. Compressed signatures padded with zeroes to a fixed byte length: This is currently the default encoding
  2. Unpadded compressed signatures: These are variable length, but on average, shorter than padded signatures
  3. Uncompressed signatures:  These are longer than the other encodings, but may be useful in applications where signatures or signed messages need to be kept secret. The lack of compression  is intended to avoid leakage of information about signatures or signed messages via a timing side channel.

 

If the FIPS ends up supporting multiple encodings, we intend to include domain separation in the message digest to maintain strong unforgeability. In any case, we intend to specify a signature format for the output of FN-DSA rather than a signed message format, which will consist of a domain separator (if needed), the salt, and the encoded s_2 value. We are currently leaning towards including both a and c in the standard.

 

Thank You,

 

Ray Perlner (NIST PQC)

 

niux_d...@icloud.com

unread,
Oct 22, 2024, 7:05:19 PM10/22/24
to Perlner, Ray A. (Fed), pqc-forum
I don't think C meet up to its expectations.

The input to DSS is already hashed, so there shouldn't be anything that leaks the signed message in practice. If it's varying in length that we worry leaking information from signature, then A got us covered.

ML-DSA already have trailing zeros when the hamming weight of the hint vector is less than the maximum, so I think we can be fine with A. The final thing to consider I think, is whether the benefit of B is great enough to opt against A. In the early days NIST concerned variable-length signature may hamper interoperability, so that can be one reason against B, but in reality, even ECDSA signatures are variable length, since it uses ASN.1 DER encoding which is a variable-length encoding (if the most significant bit is set, an extra octet is needed to keep the encoded value unsigned and positive).

-- 
You received this message because you are subscribed to the Google Groups "pqc-forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pqc-forum+...@list.nist.gov.
To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/DM6PR09MB4855D7C7586D7138728C16FF9C4C2%40DM6PR09MB4855.namprd09.prod.outlook.com.

Sebastien Riou

unread,
Oct 23, 2024, 3:35:31 AM10/23/24
to niux_d...@icloud.com, Perlner, Ray A. (Fed), pqc-forum
It is a common practice in critical systems to deal with raw key material, without any encoding such as ASN.1. In those systems the emphasis is on "keep it simple, keep it lean". I think the current default, option A, is the ideal one in those systems. Adding other encodings is going to add complexity or reduce the interoperability of such devices (because a single encoding would be supported and anything else rejected).
That said, "leakage of information about signatures or signed messages via a timing side channel" sounds like a serious issue (for the signed message part). If the leakage is about the length of the message, then I think it is not an issue, that's going to leak anyway unless the message is padded (and if it is padded, the padded version could be signed, removing the leakage). If the leakage is about the message content, then this is a serious issue and if it can be fixed only by encoding C then that would be the way to go in my opinion.

Best regards,

Sebastien Riou


Bas Westerbaan

unread,
Oct 28, 2024, 6:45:09 AM10/28/24
to Perlner, Ray A. (Fed), pqc-forum
Hi Ray,

Could you expand on the timing side channel concerns of the padded signature?

It seems to me that Compress() can be implemented in constant-time in software.

Is the concern the number of iterations (line 4 algorithm 10)? I haven't fully understood Falcon yet, so excuse me if the following suggestion is naive, but what about picking a new r in the rare care Compress() fails?

Best,

 Bas


--

Perlner, Ray A. (Fed)

unread,
Oct 28, 2024, 5:24:10 PM10/28/24
to Bas Westerbaan, pqc-forum

Hi Bas,

 

You ask: “Is the concern the number of iterations (line 4 algorithm 10)? I haven't fully understood Falcon yet, so excuse me if the following suggestion is naive, but what about picking a new r in the rare care Compress() fails?”

 

I hadn’t considered this particular loop. I agree that choosing a new r in each iteration seems like it would rule out any leakage from compression failure (although I’m not sure why we should be more worried about timing leakage from compression failure than about timing leakage from the check on line 8.)

 

That said, the concern about timing comes directly from the Falcon submission document which says on page 48: “This uncompressed format yields larger signatures and is meant to support the uncommon situations in which signature values and signed messages are secret: uncompressed signatures can be decoded and encoded with constant-time implementations that do not leak information through timing-based side channels.”

 

At least within the quoted text, it seems like the concern is the timing of compression and decompression itself. Speaking for myself, it seems like compress and decompress could be quite inefficient to implement in constant time (and no secret dependent memory access), given that the encoding of each coefficient can vary between 9 to 24 bits (with low values like 9 and 10 being predominant.) But perhaps compression and decompression are fast enough to begin with that even slowing them down by several orders of magnitude has no meaningful impact on overall performance of signing and verification.

 

Also speaking for myself, of the applications listed here I’m more concerned about the case where the signature itself is the secret, e.g. SAML assertions where the signature is used as a bearer token.

 

For cases where the message needs to be secret, I am less concerned. I would assume the signature would also be encrypted (otherwise the signature could be used to mount a dictionary attack regardless of any timing leakage). Then, I would think timing leakage could at most reveal a randomized hash of the message, where the salt is unknown (I don’t see any way there should be a timing leakage revealing the salt if the hashing is done in a constant time way.)  

 

Hope this clarifies,

Ray

Message has been deleted

Bas Westerbaan

unread,
Oct 29, 2024, 8:24:28 AM10/29/24
to John Preuß Mattsson, pqc-forum, Perlner, Ray A. (Fed)
John wrote:
 
Could someone give an estimate on what "but on average, shorter than padded signatures" means in practice?

See line 162 https://falcon-sign.info/impl/falcon.h.html

Ray wrote:
 

That said, the concern about timing comes directly from the Falcon submission document which says on page 48: “This uncompressed format yields larger signatures and is meant to support the uncommon situations in which signature values and signed messages are secret: uncompressed signatures can be decoded and encoded with constant-time implementations that do not leak information through timing-based side channels.”

 

At least within the quoted text, it seems like the concern is the timing of compression and decompression itself. Speaking for myself, it seems like compress and decompress could be quite inefficient to implement in constant time (and no secret dependent memory access), given that the encoding of each coefficient can vary between 9 to 24 bits (with low values like 9 and 10 being predominant.) But perhaps compression and decompression are fast enough to begin with that even slowing them down by several orders of magnitude has no meaningful impact on overall performance of signing and verification.


The sign and lower bits are easy to encode in constant time. The question is how to do constant time unary coding. A naive implementation is not fast, but certainly an order of magnitude faster than verification itself [1] with plenty of room for improvement. We can also trade signing success for easier decompression: if we compress 128 coefficients at the same time instead of all N, this makes (de)compression faster, increasing the chance we need to redo the signature generation.

Taking a step back, I think it's rare for people to require that signature verification does not leak the signature by timing. It indeed does for many signatures schemes in use today.

There is a big downstream cost to having different variants of the same signature scheme. I'd prefer it if we can do a little more design work that one variant suffices.

Best,

 Bas


[1]  The following naive unary compression runs in 15,000 cycles on my old Intel laptop.

 // number of coefficients
#define N 512

// maximum size of output in bytes
#define M 154

// number of uint64s required to hold the output
#define L 20

// Computes unary code for the 512 entries in
int unary(uint8_t *out, uint8_t *in) {
    uint64_t buf[L] = {0};
    int total = 0;

    for (int i = 0; i < N; i++) {
        int shift = in[i] + 1;
        total += shift;

        for (int j = L-1; j > 0; j--) {
            buf[j] = (buf[j] << shift) | (buf[j-1] >> (64-shift));
        }

        buf[0] <<= shift;
        buf[0] ^= (1 << (shift-1));
    }

    for (int i = 0; i < M; i++) {
        out[i] = (buf[i>>3] >> (i&7)) & 255;
    }

    return total;
}

John Mattsson

unread,
Oct 30, 2024, 3:55:33 AM10/30/24
to Bas Westerbaan, John Preuß Mattsson, pqc-forum, Perlner, Ray A. (Fed)

Thanks Bas,


(Google groups seem to have sent my previous mail to the spamfolder…)

So,
651.59 ± 2.55 bytes instead of 666. While I personally, as a heavy metal fan, is strangely drawn to the number 666, I think the right choice for most applications is (b). Most protocols do not rely on signatures being a fixed size, i.e., they have a signature length field. I think (b) should be the default. I don’t see any problems with variable length signatures in general.

 

Is the suggestion for (b) to not only remove the padding but also the “abort if str is too long” in the compress() function?

7: if (|str| > slen) then

8: str ← Abort if str is too long

9: else

10: str ← (str0slen−|str|) Pad str to slen bits

 

I like the idea of getting rid of aborts unless it has some security reasons. I have not read up on FN-DSA enough yet.

 

Thinking about protocols (X.509, CMP, CRL, OCSP, TLS, IKEv2, JOSE, COSE, EDHOC, Group OSCORE, MIKEY,…) I cannot come up with a single one that does not have a signature length field.

 

(c) seems like it could be useful to protect against side-channels in Sign-then-Encrypt, which is how you should compose sign and encrypt. My understanding is that the (c) signatures would be 809 bytes for level 1.

 

I think NIST should include (b) and (c). I currently don’t see any use of (a).

 

Cheers,

John

 

From: 'Bas Westerbaan' via pqc-forum <pqc-...@list.nist.gov>
Date: Tuesday, 29 October 2024 at 13:24
To: John Preuß Mattsson <john.m...@gmail.com>
Cc: pqc-forum <pqc-...@list.nist.gov>, Perlner, Ray A. (Fed) <ray.p...@nist.gov>
Subject: Re: [pqc-forum] Seeking community feedback on which signature formats should be supported by FIPS 206 (FN-DSA/ Falcon)

--

You received this message because you are subscribed to the Google Groups "pqc-forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pqc-forum+...@list.nist.gov.

Kris Kwiatkowski

unread,
Oct 30, 2024, 5:01:54 AM10/30/24
to Perlner, Ray A. (Fed), pqc-forum
Hello,

From an integration perspective, implementing unpadded compressed signatures can be a bit more challenging. Some existing software interfaces assume that signatures have a fixed size, making variable sizes inconvenient and potentially leading to insecure implementations.

Additionally, the size difference between padded-compressed and unpadded-compressed signatures is minimal, with the latter being slightly longer in the worst-case scenario. This suggests that the benefits of a smaller unpadded-compressed signature do not outweigh the complications it introduces. Therefore, I believe that not standardizing unpadded-compressed signatures is a sound decision. This aligns with the design choices made for Dilithium, which also includes padding.

Currently, I don't have a strong preference between options a) and c). I think making Falcon easier to implement securely in different scenarios (even if they don't exist yet) could be beneficial. On the other hand, NIST IR 8413-upd1 mentions that Falcon was selected partly due to its short signature size (one of the reasons). Following that reasoning, the compressed padded signature is about 200 bytes smaller than the constant-time signature (for 512), indicating that keeping this option is a way to go.

I also acknowledge that we will have both Pre-hash and Pure signing versions. If NIST chooses to retain options a, b, and c, we could potentially end up with six different variations. It seems wise to minimize these variations, as the differences among them are relatively slight.

I think keeping a) and c) makes sense. And if we can choose only one, that would be perfect.

--
Kris Kwiatkowski
Cryptography Dev
> --
> You received this message because you are subscribed to the Google Groups "pqc-forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pqc-forum+...@list.nist.gov.

Kris Kwiatkowski

unread,
Oct 30, 2024, 5:22:47 AM10/30/24
to John Mattsson, Perlner, Ray A. (Fed), pqc-forum
> I think the assumption that the signature length is always fixed

I don’t assume the signature length is always fixed.

John Mattsson

unread,
Oct 30, 2024, 9:03:25 AM10/30/24
to Kris Kwiatkowski, Perlner, Ray A. (Fed), pqc-forum

As pointed out by Danny Niu, ECDSA signatures are variable length in many encodings including the most common ASN.1 DER. I think the assumption that the signature length is always fixed is bad, and the quicker we can force such badly designed software to update, the better.

 

Cheers,

John

 

From: pqc-...@list.nist.gov <pqc-...@list.nist.gov> on behalf of Kris Kwiatkowski <kr...@amongbytes.com>
Date: Wednesday, 30 October 2024 at 10:02
To: Perlner, Ray A. (Fed) <ray.p...@nist.gov>
Cc: pqc-forum <pqc-...@list.nist.gov>
Subject: Re: [pqc-forum] Seeking community feedback on which signature formats should be supported by FIPS 206 (FN-DSA/ Falcon)

Hello,

From an integration perspective, implementing unpadded compressed signatures can be a bit more challenging. Some existing software interfaces assume that signatures have a fixed size, making variable sizes inconvenient and potentially leading to insecure implementations.

Additionally, the size difference between padded-compressed and unpadded-compressed signatures is minimal, with the latter being slightly longer in the worst-case scenario. This suggests that the benefits of a smaller unpadded-compressed signature do not outweigh the complications it introduces. Therefore, I believe that not standardizing unpadded-compressed signatures is a sound decision. This aligns with the design choices made for Dilithium, which also includes padding.

Currently, I don't have a strong preference between options a) and c). I think making Falcon easier to implement securely in different scenarios (even if they don't exist yet) could be beneficial. On the other hand, NIST IR 8413-upd1 mentions that Falcon was selected partly due to its short signature size (one of the reasons). Following that reasoning, the compressed padded signature is about 200 bytes smaller than the constant-time signature (for 512), indicating that keeping this option is a way to go.

I also acknowledge that we will have both Pre-hash and Pure signing versions. If NIST chooses to retain options a, b, and c, we could potentially end up with six different variations. It seems wise to minimize these variations, as the differences among them are relatively slight.

I think keeping a) and c) makes sense. And if we can choose only one, that would be perfect.

--
Kris Kwiatkowski
Cryptography Dev




> On 22 Oct 2024, at 18:53, 'Perlner, Ray A. (Fed)' via pqc-forum <pqc-...@list.nist.gov> wrote:
>
> Dear all,



>     • Compressed signatures padded with zeroes to a fixed byte length: This is currently the default encoding
>     • Unpadded compressed signatures: These are variable length, but on average, shorter than padded signatures
>     • Uncompressed signatures:  These are longer than the other encodings, but may be useful in applications where signatures or signed messages need to be kept secret. The lack of compression  is intended to avoid leakage of information about signatures or signed messages via a timing side channel.
>  If the FIPS ends up supporting multiple encodings, we intend to include domain separation in the message digest to maintain strong unforgeability. In any case, we intend to specify a signature format for the output of FN-DSA rather than a signed message format, which will consist of a domain separator (if needed), the salt, and the encoded s_2 value. We are currently leaning towards including both a and c in the standard.
>  Thank You,
>  Ray Perlner (NIST PQC)

> --
> You received this message because you are subscribed to the Google Groups "pqc-forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pqc-forum+...@list.nist.gov.




--
You received this message because you are subscribed to the Google Groups "pqc-forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pqc-forum+...@list.nist.gov.

John Preuß Mattsson

unread,
Oct 30, 2024, 9:03:33 AM10/30/24
to pqc-forum, Perlner, Ray A. (Fed), pqc-forum, Bas Westerbaan
Hi Ray,

Could someone give an estimate on what "but on average, shorter than padded signatures" means in practice?

Unless the difference is very small, Option b (Unpadded compressed signatures) makes most sense to me. Most protocols already have a length field for the signature length. Protocols not having a length field could add one or pad themselves. 

Cheers,
John Preuß Mattsson

Phillip Gajland

unread,
Oct 30, 2024, 1:34:34 PM10/30/24
to pqc-forum, Bas Westerbaan, pqc-forum, Perlner, Ray A. (Fed)
Hi Bas,

I agree that selecting a new salt when compression fails is a good approach and improves security. In fact, our work actually suggests choosing a new salt if the preimages from the sampler are too large. You can find more details in our post here: https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/IvlTWZE4IIk.

While we didn't specifically address the compression procedure, the same rationale applies to both compression and sampling.

Regards,

Phillip (with Eike and Jonas)

Sebastien Riou

unread,
Nov 1, 2024, 8:01:16 AM11/1/24
to John Mattsson, Kris Kwiatkowski, Perlner, Ray A. (Fed), pqc-forum
About fix sized keys/signature: 
  • secure boot typically relies on OTP for storage. That memory is fixed and very limited (when the size is kilo bits, that's already a large one!). In such cases having something "smaller on average" does not help because we have to reserve the maximum size.
  • high security devices will always prefer things with fixed size. variable size introduces complexity, complexity is hard to verify (both from functional and security point of view). With a variable size object, I need a test vector for each size. If I have multiple variable size objects, ideally I need to test all size combinations...
In summary: what is considered bad in some context is the ideal in some other context.



Sebastien Riou

unread,
Nov 1, 2024, 9:00:04 AM11/1/24
to Axel Keskikangas, John Mattsson, Kris Kwiatkowski, Perlner, Ray A. (Fed), pqc-forum
That's a common pattern used for device authentication, OTP stores the following:
  • A key pair unique to each chip
  • A signature of the public key by a root key (typically this signature is done by an HSM owned by the chip manufacturer)
This allows to prove that the device is a legitimate one.

NOTE: I wrote "signature" rather than certificate because it is really just a raw signature without any kind of container format around, to save OTP bits but also to keep it simple.

Best regards,

Sebastien Riou

Director, Product Security Architecture

PQShield Ltd

 

M:             +33 782 320 285

E:              sebasti...@pqshield.com

W:             www.pqshield.com



On Fri, 1 Nov 2024 at 13:07, Axel Keskikangas <Axel.Kes...@axis.com> wrote:
Do you have any examples for applications/hardware/products where storing signatures in OTP would make sense? 
For keys I fully agree, then storing either the key directly, the hash of the key ladder or the seed to expand the key makes sense - however I've never encountered the same for signatures.

Agree on the second point though.

Best regards,
Axel Keskikangas
Expert Engineer, Core Technologies Systems

Axis Communications AB 
Gränden 1, SE-223 69 Lund, Sweden

From: 'Sebastien Riou' via pqc-forum <pqc-...@list.nist.gov>
Sent: Wednesday, October 30, 2024 16:44
To: John Mattsson <john.m...@ericsson.com>
Cc: Kris Kwiatkowski <kr...@amongbytes.com>; Perlner, Ray A. (Fed) <ray.p...@nist.gov>; pqc-forum <pqc-...@list.nist.gov>

Thomas Pornin

unread,
Nov 2, 2024, 11:15:46 AM11/2/24
to pqc-forum, Sebastien Riou, John Mattsson, Kris Kwiatkowski, Perlner, Ray A. (Fed), pqc-forum, Axel Keskikangas
Some comments on the formats -- after all, I am the one who came up with these things in the first place:
  • The "constant-time" hashing came out mostly as a reflex, i.e. when I implemented the hashing I noticed that it was not, in general, constant-time. Usually, people don't worry about that; for instance, in plain RSA signature verification, implementations run the modular exponentiation, then check that the padding is there, extract the hashed message, and compare that hash value with the expected hash value. That last comparison is typically done with a non-constant-time memcmp() and nobody minds that, because it is generally accepted that signature verification uses only public data.

    For that question of constant-time hashing to matter, you have to imagine a rather contrived scenario in which the signed data is secret and has low entropy, making it amenable to enumeration ("brute force"). But that's not sufficient! For the scenario to make sense, you also need the signature value to be public; indeed, in Falcon, what is hashed is the concatenation of a random 40-byte nonce and the message; if the attacker does not have the nonce, then the brute force does not work. On the other hand, if the signature is known to the attacker, and the public key is also known to the attacker, then an approximate hashed message can be recomputed: indeed, in Falcon, the signature is a polynomial s2 such that s1 + s2*h = hashed-message, "h" being the public key (another polynomial) and s1 a "short polynomial" (a polynomial with a small norm). Given s2 (signature) and h (public key), an attacker can enumerate possible messages, and see if the hash process yields a polynomial s1 which is indeed short. Note that the ability to extract the hashed message from the public key + signature is not a new property; again, RSA has it.

    Thus, we are now considering an hypothetical scenario where signatures are computed over secret data with low entropy; the said secret data must be known to the signer but also the verifier; the signature value is public, but the public key is not public. I am not aware of any plausible situation that matches all these conditions; and if there is one, then other existing schemes such as RSA are already inappropriate. So my intuition is that such situations do not exist, the "constant-time hashing of the message in Falcon" is not a real worry, and I was wrong to raise it in the first place. It would be better if we all simply forgot that such a debate existed in the first place.
  • For the signature size: the difference in size between the compressed (variable-size) and padded (fixed-size) signatures is small; we are talking about an average gain of less than 3% here (651 vs 666). Sometimes a small gain matters, and I have seen situations where people run ECDSA repeatedly in a loop until the (r,s) values happen to be slightly smaller, just to gain a few bits in a dedicated encoded format! But in general, a less than 3% change is not going to matter.

    I have observed (and written!) many implementations of various cryptographic protocols over the last two decades (and more), and many times have I witnessed that variable-sized elements are a problem. They require a length field, and thus some parsing. On the reception site, the receiver still has to account for the maximum possible size (not everybody has the luxury of dynamic memory allocation! Small microcontrollers exist). Parsing code is a source of bugs and buffer overflows, and invariably this is where security vulnerabilities occur (I professionally audit cryptographic implementations most of the time, and this is what I observe: the issues are usually in the parsing, not in the cryptography). It is true that many existing protocols use length fields and variable-size elements, e.g. for signatures and public keys; this is Bad and we should be ashamed. When the size gain is very slight, having a variable size is not a feature; it's a mistake, that we should endeavour not to make. It's a traditional error, but we are not compelled to follow tradition for the sake of it, especially when it's misguided.

    On top of that, the fixed vs variable size question is, in fact, mostly meaningless. When a Falcon signature has the "padded" format, it is in fact padded with zeros. It is thus completely possible to define an extra "compressed encoding" of signatures for people who do have or want a length field: simply remove the trailing bytes of value zero when writing out the signature, and add them back when reading it. This can be done without any knowledge of the involved keys, so that's in fact not something that needs to be addressed in the FN-DSA standard; anybody can do that after the fact, it's only an encoding convention of the transport layer. The only part of the question that is really relevant to the FN-DSA standard is not whether the output signature has a fixed size, but whether it has a bounded size, i.e. whether the signer enforces a given maximum size for signatures. Having such a bound is very valuable for implementations, since that allows some guarantees on required buffer sizes. Enforcing a maximum bound (at e.g. 666 bytes for Falcon-512) is something that only the signer can do (by restarting if the generated signature turns out to be too long) so it must be part of the standard.
To summarize:
  • Forget the "constant-time" thing for message hashing, it's a freak notion that does not make sense in that context (and it's my fault it ever happened, sorry).
  • Signatures should be fixed-size, which means they should have, internally, a maximum size enforced by the signer, and with some padding with bytes of value zero to reach that size. People who want a variable size can strip the padding bytes at the transport level, if that's what they wish; they would be wrong and it will lead them to a path of sorrow, but I cannot prevent them from doing it.
Thomas

John Mattsson

unread,
Nov 8, 2024, 2:10:09 PM11/8/24
to Thomas Pornin, pqc-forum, Sebastien Riou, Kris Kwiatkowski, Perlner, Ray A. (Fed), pqc-forum, Axel Keskikangas

Hi,

 

I think it is important that signature algorithms (for a fixed message length) can be implemented in close to constant time for practical reasons, i.e. not only because of timing side-channels. This applies to both signing and verification. For many use cases, worst case time is the important measure to meet requirements, not average time (but you can ignore things that have very little probability like < 2^128). At a minimum, you would like guarantees that FN-DSA completes with X nines probability within a certain time. An example use of the nines terminology is this web server written in Erlang (Ericsson language), which claims nine nines (99.9999999%) availability. https://ninenines.eu/

 

I dislike loops with an unlimited number of integrations. Not only do you need to over dimension the CPU/ASIC/FPGA to meet requirements, but it might be very hard to theoretically understand how the probability distribution for the completion time looks like.

 

I don't think variable length fields is a big problem in general. Fixed sizes and padding on the other hand have in the past led to a large amount of practical vulnerabilities, CBC, RSA, etc. If a length field is considered complex, I don’t think you should use compression in the first place.

 

While 15 bytes on average might not sound much, if you design all aspects of your system like this, the end result becomes slow and inefficient. As we say in Europe: “Många bäckar små gör en stor å”, “Les petits ruisseaux font les grandes rivières”,  “Kleinvieh macht auch Mist”…

 

Thomas Pornin wrote that the padding "can be done without any knowledge of the involved keys, so that's in fact not something that needs to be addressed in the FN-DSA standard". I would say that this points to that padding should be left to the application. My understanding is that the also the compression function can be done without any knowledge of the involved keys (correct me if I am wrong). I think it makes sense to move the compression and padding outside of the sign() function. The number of the beast 666, seems like an arbitrarily chosen tradeoff between uncompressed and variable length, which might not be the best tradeoff for all applications.

 

Cheers,

John

 

Bas Westerbaan

unread,
Nov 8, 2024, 4:46:11 PM11/8/24
to John Mattsson, Thomas Pornin, pqc-forum, Sebastien Riou, Kris Kwiatkowski, Perlner, Ray A. (Fed), Axel Keskikangas
On Fri, Nov 8, 2024 at 8:10 PM 'John Mattsson' via pqc-forum <pqc-...@list.nist.gov> wrote:

Hi,

 

I think it is important that signature algorithms (for a fixed message length) can be implemented in close to constant time for practical reasons, i.e. not only because of timing side-channels.


ML-DSA signing is not constant time. And its rejection probability is much worse than anything we propose here for Falcon.
 

I dislike loops with an unlimited number of integrations. Not only do you need to over dimension the CPU/ASIC/FPGA to meet requirements, but it might be very hard to theoretically understand how the probability distribution for the completion time looks like.


We can cut off at 2^-128 probability.
  

John Mattsson

unread,
Nov 8, 2024, 5:21:43 PM11/8/24
to Bas Westerbaan, Thomas Pornin, pqc-forum, Sebastien Riou, Kris Kwiatkowski, Perlner, Ray A. (Fed), Axel Keskikangas

Bas Westerban wrote:

>ML-DSA signing is not constant time. And its rejection probability is much worse than anything we >propose here for Falcon.

 

Yes, I am not completely happy about that, but I don't remember the specific details of ML-DSA. For Falcon, I hope NIST standardizes (c) and allow people to do (b) and (a), and potentially (a)’ with other tradeoffs. I am not against (a), but I don't think it is a good solution for everything.

 

Bas Westerban wrote:

>We can cut off at 2^-128 probability.

 

Yes.

Thomas Pornin

unread,
Nov 9, 2024, 4:31:55 PM11/9/24
to pqc-forum, John Mattsson, Thomas Pornin, pqc-forum, Sebastien Riou, Kris Kwiatkowski, Perlner, Ray A. (Fed), Axel Keskikangas, Bas Westerbaan
If you want guarantees on time, then the encoding size is not actually your main problem. In Falcon, there are two separate reasons why a restart occurs (in the spec on https://falcon-sign.info/falcon.pdf these are checks in steps 8 and 11 in algorithm 10 on page 39). The first one is when the sampled vector turns out not to be short enough, i.e. its L2 norm is too high (step 8); the second reason is when the encoding does not fit in the target size (step 11). To get some data on these, I ran an experiment with 12.3 million signature generation attempts (using a new random key pair every 1000 signature attempts). This yielded the following:

total: 12300000

failed on step 8 (L2 norm): 55
length    number
  644          2
  645         23
  646        217
  647       1712
  648       9523
  649      42910
  650     146717
  651     398673
  652     857067
  653    1470559
  654    2025989
  655    2250651
  656    2024118
  657    1482775
  658     889549
  659     438755
  660     178744
  661      60428
  662      16671
  663       3943
  664        797
  665        108
  666         12
  667          2


In other words, out of the 12.3 million attempts, 55 were rejected because of the check on the L2 norm, but only 2 were rejected because of the encoding size (i.e. these two would have required 667 bytes, not 666). This implies that regardless of what you do with regard to variable or fixed length with padding, you cannot avoid restarts altogether.

This is not a new result; the length of "666" was not arbitrary and whimsical, we already did that kind of experiment previously. The cutoff for the padded length was chosen such that the restart rate would be negligible with regard to the restarts that you already have to tolerate because of the check on the L2 norm (arguably we could have set the threshold at 665 instead of 666, even, but it is true that 666 was more "memorable"). Note that the probability of restarts related to the L2 norm is upper bounded by an expression given in the Falcon spec (end of section 2.6, page 19), and that expression says that the probability is lower than about 1/20000; it's not a tight bound and the experiment above shows that it's closer to about 1/230000, i.e. 11.5x less probable that the bound. Still, it happens.

You can still get some reasonable guarantees. For instance, the "nine-nines" that you talk about are not that hard to reach, it's just a probability of about 2^(-30). With Falcon-512, you'll get a signature in one or two attempts with probability about 1 - 2.1*10^(-11) (i.e. the risk of failing twice in a row is about (57/12300000)^2), which is better than the magical nine-nines (it's actually better than ten-nines).
(With ML-DSA, the probability of restart is a lot higher and if you want that kind of nine-nines guarantee you need to account for much more than twice the average signing time. But with Falcon, the restart probability is low enough.)


As for the size gain: as show above, the average should be around 655 bytes, so you could hope for saving 11 bytes, except that you'll need a length field somewhere, so make that saving maybe 9 bytes. On the other hand, a variable size implies some extra parsing. I honestly don't buy the argument that if you cannot handle that parsing then you should not use compression either. First, in the actual practice, people who implement the low-level cryptographic primitives are often not the same people as the ones who use these primitives in a custom protocol; the signing or verification engine is used as a black box. Moreover, even when the same person does both, it's not the same skillset (e.g. I am myself much more likely to fumble with parsing than with the crypto primitives). I have seen many times exploitable parsing failures (in particular with lack of check on integer overflow when verifying that the length is within the correct bounds). Having a fixed object length makes it feasible to define the protocol as a basic concatenation, which avoids a lot of trouble and makes everything simpler. It avoids considerable sorrow.

TL;DR: you'll get restarts even if you allow a variable length, because of the L2 norm check.

Thomas

Thomas Pornin

unread,
Nov 10, 2024, 11:07:06 AM11/10/24
to pqc-forum, Thomas Pornin, John Mattsson, pqc-forum, Sebastien Riou, Kris Kwiatkowski, Perlner, Ray A. (Fed), Axel Keskikangas, Bas Westerbaan
One may note that the argument could hold for Falcon-1024, though. The probability of a restart due to the L2 norm in Falcon-1024 is much lower (the formula in the spec upper-bounds it to about 2.4*10^(-9), in practice it's probably lower than that, as is the case for Falcon-512). On the other hand, with the target size of 1280 bytes, a restart will be enforced due to the target encoding size with probability about 0.95*10^(-3), which is much higher. If we want encoded-related restarts to be no more probable than L2-norm-related restarts (and to achieve single-attempt success with "nine-nines" probability), then the target signature size for Falcon-1024 should be 1290 bytes, not 1280. In other words, it's not the "666 bytes" which was the arbitrary number selected for its good looks, it's the "1280 bytes" for Falcon-1024.

(Specifically, I let my program run last night, I got 116900000 signatures, average size is 1270.67 bytes and standard deviation is about 3.123, you need to add 6 times the standard deviation to get the encoded signature to fit in the target with probability about 10^(-9).)

Thomas

Reply all
Reply to author
Forward
0 new messages