
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sat, 04 Apr 2026 15:13:14 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Post-quantumify internal services: Logfwrdr, Tunnel, and gokeyless]]></title>
            <link>https://blog.cloudflare.com/post-quantumify-cloudflare/</link>
            <pubDate>Fri, 25 Feb 2022 16:03:12 GMT</pubDate>
            <description><![CDATA[ A big challenge is coming: to change all internal connections at Cloudflare to use post-quantum cryptography. Read how we are tackling this challenge! ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Theoretically, there is no impediment to adding <a href="/post-quantum-taxonomy">post-quantum cryptography</a> to any system. But the reality is harder. In the middle of last year, we posed ourselves a big challenge: <b>to change all</b> <b><i>internal connections</i></b> <b>at Cloudflare to use post-quantum cryptography</b>. We call this, in a cheeky way, “post-quantum-ifying” our services. Theoretically, this should be simple: swap algorithms for post-quantum ones and move along. But with dozens of different services in various programming languages (as we have at Cloudflare), it is not so simple. The challenge is big, but we are here and up for the task! In this blog post, we will look at what our plan was, where we are now, and what we have learned so far. Welcome to the first announcement of a post-quantum future at Cloudflare: our connections are going to be quantum-secure!</p>
    <div>
      <h3>What are we doing?</h3>
      <a href="#what-are-we-doing">
        
      </a>
    </div>
    <p>The life of most requests at Cloudflare <a href="/more-data-more-data/">begins and ends at the edge</a> of our global network. Not all requests are equal and on their path they are transmitted by several protocols. Some of those protocols provide security properties whilst others do not. For the protocols that do, for context, Cloudflare uses: <a href="/rfc-8446-aka-tls-1-3/">TLS</a>, <a href="/tag/quic/">QUIC</a>, <a href="/1111-warp-better-vpn/">WireGuard</a>, <a href="/tag/dnssec/">DNSSEC</a>, <a href="/anycast-ipsec/">IPsec</a>, <a href="/privacy-pass-v3/">Privacy Pass</a>, and more. Migrating all of these protocols and connections to use post-quantum cryptography is a formidable task. It is also a task that we do not treat lightly because:</p><ul><li><p>We have to be assured that the security properties provided by the protocols are not diminished.</p></li><li><p>We have to be assured that performance is not negatively affected.</p></li><li><p>We have to be wary of other requirements of our ever-changing ecosystem (like, for example, keeping in mind our <a href="https://www.cloudflare.com/en-gb/press-releases/2021/cloudflare-hits-milestone-in-fedramp-approval/">FedRAMP certification efforts</a>).</p></li></ul><p>Given these requirements, we had to decide on the following:</p><ul><li><p>How are we going to introduce post-quantum cryptography into the protocols?</p></li><li><p>Which protocols will we be migrating to post-quantum cryptography?</p></li><li><p>Which Cloudflare services will be targeted for this migration?</p></li></ul><p>Let’s explore now what we chose: welcome to our path!</p>
    <div>
      <h3>TLS and post-quantum in the real world</h3>
      <a href="#tls-and-post-quantum-in-the-real-world">
        
      </a>
    </div>
    <p>One of the most used security protocols is Transport Layer Security (TLS). It is the vital protocol that protects most of the data that flows over the Internet today. Many of Cloudflare’s internal services also rely on TLS for security. It seemed natural that, for our migration to post-quantum cryptography, we would start with this protocol.</p><p>The protocol provides three security properties: integrity, authentication, and confidentiality. The algorithms used to provide the first property, integrity, seem to not be <a href="https://research.kudelskisecurity.com/2017/02/01/defeating-quantum-algorithms-with-hash-functions/">quantum-threatened</a> (there is <a href="https://eprint.iacr.org/2012/606.pdf">some research</a> on the matter). The second property, authentication, is under quantum threat, but we will not focus on it for reasons detailed later. The third property, confidentiality, is the one that we are interested in protecting as it is urgent to do this now.</p><p>Confidentiality assures that no one other than the intended receiver and sender of a message can read the transmitted message. Confidentiality is especially threatened by quantum computers as an attacker can record traffic now and decrypt it in the future (when they get access to a quantum computer): this means that all past and current traffic, not just future traffic, is vulnerable to be read by anyone who obtains a quantum computer (and has stored the encrypted traffic captured today).</p><p>At Cloudflare, to protect many of our connections, we use TLS. We mainly use the latest version of the protocol, TLS 1.3, but we sometimes do still use TLS 1.2 (as seen in the image, though, it only shows the connections between websites to our network).  As we are a company that pushes for innovation, this means that we are intent on using this time of migration to post-quantum cryptography as an opportunity to also update TLS handshakes to 1.3 and be assured that we are using TLS in the right way (by, for example, ensuring that we are not using deprecated features of TLS).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5toLKjOnOcTdY4jkqTodFb/80452cac0010e2311e76e31c0a138820/image2-24.png" />
            
            </figure><p>Cloudflare’s TLS and QUIC usage <a href="https://radar.cloudflare.com/#anchor-tls-versions-vs">taken on</a> the 17/02/2022 and showing the last 7 days.</p><p>Changing TLS 1.3 to provide quantum-resistant security for its confidentiality means changing the ‘key exchange’ phase of the TLS handshake. Let’s briefly look at how the TLS 1.3 handshake works.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5qFzOkZw6F47b7q1FeoJrf/c781aa2f7621d61664b7f7efafe3927e/image3-26.png" />
            
            </figure><p>The TLS 1.3 handshake</p><p>In <a href="https://datatracker.ietf.org/doc/html/rfc8446">TLS 1.3</a>, there will always be two parties: a client and a server. A client is a party that wants the server to “serve” them something, which could be a website, emails, chat messages, voice messages, and more. The handshake is the process by which the server and client attempt to agree on a shared secret, which will be used to encrypt the subsequent exchange of data (this shared secret is called the “master secret”). The client selects their favorite key exchange algorithms and submits one or more “key shares” to the server (they send both the name of the key share and its public key parameter). The server picks one of the key exchange algorithms (assuming that it supports one of them), and replies with their own key share. Both the server and the client then combine the key shares to compute a shared secret (the “master secret”), which is used to protect the remainder of the connection. If the client only chooses algorithms that the server does not support, the server instead replies with the algorithms that it does support and asks the client to try again. During this initial conversation, the client and server also agree on authentication methods and the parameters for encryption, but we can leave that aside for today in this blog post. This description is also simplified to focus only in the “key exchange” phase.</p><p>There is a mechanism to add post-quantum cryptography to this procedure: you advertise post-quantum algorithms in the list of key shares, so the final derived shared key (the “master secret”) is quantum secure. But there are requirements we had to take into account when doing this with our connections: the security of much post-quantum cryptography is still under debate, and we need to respect our <a href="https://www.cloudflare.com/en-gb/trust-hub/compliance-resources/">compliance efforts</a>. The solution to these requirements is to use a <a href="https://datatracker.ietf.org/doc/draft-ietf-tls-hybrid-design/">“hybrid” mechanism</a>.</p><p>A “hybrid” mechanism means to use both a “pre-quantum” or “classical” algorithm and a “post-quantum” algorithm, and mixing both generated shared secrets into the derivation of the “master secret”. The combination of both shared secrets is of the form \Z′ = Z || T\ (for TLS and with the fixed size shared secrets, simple concatenation is secure. In other cases, you have to be a bit more careful). This procedure is a concatenation consisting of:</p><ul><li><p>A “classical” shared secret <i>Z</i>, derived following the guidelines of <a href="https://www.nist.gov/standardsgov/compliance-faqs-federal-information-processing-standards-fips#:~:text=are%20FIPS%20developed%3F-,What%20are%20Federal%20Information%20Processing%20Standards%20(FIPS)%3F,by%20the%20Secretary%20of%20Commerce.">Federal Information Processing Standards</a> (FIPS 104-2) <a href="https://en.wikipedia.org/wiki/FIPS_140-2">approved mechanisms</a> (as recommended <a href="https://csrc.nist.gov/publications/detail/sp/800-56a/rev-3/final">over</a> <a href="https://csrc.nist.gov/publications/detail/sp/800-56b/rev-2/final">here</a>), like, for example, the <a href="https://csrc.nist.gov/csrc/media/events/workshop-on-elliptic-curve-cryptography-standards/documents/papers/session6-adalier-mehmet.pdf">P-256 elliptic curve</a>.</p></li><li><p>An auxiliary shared secret <i>T</i>, derived with some other method: in this case, in a quantum-secure way.</p></li></ul><p>The usage of a “hybrid” approach allows us to safeguard our connections in case the security of the post-quantum algorithm fails. It also results in a suitable-for-FIPS secret, as it is approved in the <a href="https://csrc.nist.gov/publications/detail/sp/800-56c/rev-2/final">“Recommendation for Key-Derivation Methods in Key-Establishment Schemes”</a> (SP 800-56C Rev. 2), which is listed in the <a href="https://csrc.nist.gov/csrc/media/publications/fips/140/2/final/documents/fips1402annexd.pdf">Annex D</a>, as an approved key establishing technique for FIPS 140-2.</p><p>At Cloudflare, we are using different TLS libraries. We decided to add post-quantum cryptography to those, specifically, to the <a href="https://csrc.nist.gov/projects/cryptographic-module-validation-program/Certificate/3318"><i>BoringCrypto</i></a> library or the compiled version of <a href="https://github.com/golang/go/tree/dev.boringcrypto.go1.8">Golang with <i>BoringCrypto</i></a>. We added <a href="https://github.com/cloudflare/circl/tree/master/kem/kyber">our implementation</a> of the <a href="https://pq-crystals.org/kyber/resources.shtml">Kyber-512</a> algorithm (this algorithm can be eventually swapped by another one; we’re not picking any here. Not only that, but we are using it for our testing phase) to those libraries and implemented the “hybrid” mechanism as part of the TLS handshake. For the “classical” algorithm we used <a href="https://en.wikipedia.org/wiki/Elliptic-curve_cryptography">curve P-256</a>. We then compiled certain services with these new TLS libraries.</p><table><tr><td><p><b>Name of algorithm</b></p></td><td><p><b>Number of times loop executed</b></p></td><td><p><b>Average runtime per operation</b></p></td><td><p><b>Number of bytes required per operation</b></p></td><td><p><b>Number of allocations</b></p></td></tr><tr><td><p>Curve P-256</p></td><td><p>23,056</p></td><td><p>52,204 ns/op</p></td><td><p>256™p</p></td><td><p>5 allocs/op</p></td></tr><tr><td><p>Kyber-512</p></td><td><p>100,977</p></td><td><p>11,793 ns/op</p></td><td><p>832 B/op</p></td><td><p>3 allocs/op</p></td></tr></table><p>Table 1: Benchmarks of the “key share” operation of Curve P-256 and Kyber-512: Scalar Multiplication and Encapsulation respectively. Benchmarks ran on Darwin, amd64, Intel(R) Core(TM) i7-9750H CPU @ 2.60 GHz.</p><p>Note that as TLS supports the described “negotiation” mechanism for the key exchange, the client and server have a way of mutually deciding what algorithms they want to use. This means that it is not required that both a client or a server support or even prefer the exact same algorithms: they just need to share support for a single algorithm for a handshake to succeed. In turn, herewith, even if we advertise post-quantum cryptography and a server/client does not support it, they will not fail but rather agree on some other algorithm they share.</p><p>A note on a matter we left on hold above: why are we not migrating the authentication phase of TLS to post-quantum? Certificate-based authentication in TLS, which is the one we commonly use at Cloudflare, also depends on systems on the wider Internet. Thus, changes to authentication require a coordinated and much wider effort to change. Certificates are attested as proofs of identity by outside parties: migrating authentication means coordinating a ceremony of migration with these outside parties. Note though that at Cloudflare we use a <a href="/how-to-build-your-own-public-key-infrastructure/">PKI with internally-hosted Certificate Authorities (CAs)</a>, which means that we can more easily change our algorithms. This will still need careful planning. We will not do this today, but we will in the near future.</p>
    <div>
      <h3>Cloudflare services</h3>
      <a href="#cloudflare-services">
        
      </a>
    </div>
    <p>The first step of our post-quantum migration is done. We have TLS libraries with post-quantum cryptography using a hybrid mechanism. The second step is to test this new mechanism in specific Cloudflare connections and services. We will look at three systems from Cloudflare that we have started migrating to post-quantum cryptography. The services in question are: Logfwrdr, Cloudflare Tunnel, and GoKeyless.</p>
    <div>
      <h3>A post-quantum Logfwdr</h3>
      <a href="#a-post-quantum-logfwdr">
        
      </a>
    </div>
    <p><a href="/more-data-more-data/">Logfwdr</a> is an internal service, written in Golang, that handles structured logs, and sends them from our servers for processing (to a subservice called ‘Logreceiver’) where they write them to Kafka. The connection between Logfwdr and Logreceiver is protected by TLS. The same goes for the connection between Logreceiver and <a href="https://kafka.apache.org/">Kafka</a> in core. Logfwdr pushes its logs through “streams” for processing.</p><p>This service seemed an ideal candidate for migrating to post-quantum cryptography as its architecture is simple, it has long-lived connections, and it handles a lot of traffic. In order to first test the viability of using post-quantum cryptography, and, we created our own instance of Logreceiver and deployed it. We also created our own stream (the “pq-stream”), which is basically a copy of a HTTP stream (which was remarkably easy to add). We then compiled these services with the modified TLS library, and we got a post-quantum protected Logfwdr.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2YlRJqczYHpPshoEZzpu9b/160d794b37b407bb09fd345b889101c7/image7-5.png" />
            
            </figure><p>Figure 1: TLS latency of Logfwdr for selected metals. Notice how post-quantum cryptography is faster than non-post-quantum one (it is labeled with a “PQ” acronym).</p><p>What we found was that using post-quantum cryptography is faster than using “classical” cryptography! This was expected, though, as we are using a lattice-based post-quantum algorithm (Kyber512). The TLS latency of both post-quantum handshakes and “classical” ones can be noted in Figure 1. The figure shows more handshakes are executed than usual behavior as these servers are frequently restarted.</p><p>Note though that we are not using “only” post-quantum cryptography but rather the “hybrid” mechanism described above. This could increase performance times: in this case, the increase was minimal and still kept the post-quantum handshakes faster than the classical ones. Perhaps what makes the TLS handshakes faster in the post-quantum case is the usage of TLS 1.3, as the “classical” Logfwdr is using TLS 1.2. Logfwdr, though, is a service that executes long-lived handshakes, so in aggregate TLS 1.2 is not “slower” but it does have a slower start time.</p><p>As shown in Figure 2, the average batch duration of the post-quantum stream is lower than when not using post-quantum cryptography. This may be in part due to the fact that we are not sending the quantum-protected data all the way to Kafka (as the non-post-quantum stream is doing). We didn’t yet change the connection to Kafka post-quantum.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7s0OprfksLusP0685ydiYl/69af1192a703c1224f746673d83c44d2/image8-3.png" />
            
            </figure><p>Figure 2: Average batch send duration: post-quantum (orange) and non-post-quantum streams (green).</p><p>We didn’t encounter any failures during this testing that ran for about some weeks. This gave us good insight that putting post-quantum cryptography into our internal network with actual data is possible. It also gave us confidence to begin migrating codebases to modified TLS libraries, which we will maintain.</p><p>What are the next steps for Logfwdr? Now that we confirmed it is possible, we will first start migrating stream by stream to this hybrid mechanism until we reach full post-quantum migration.</p>
    <div>
      <h3>A post-quantum gokeyless</h3>
      <a href="#a-post-quantum-gokeyless">
        
      </a>
    </div>
    <p><a href="/going-keyless-everywhere/"><i>gokeyless</i></a> is our own way to separate servers and TLS long-term private keys. With it, private keys are kept on a specialized key server operated by customers on their own architecture or, if using <a href="/introducing-cloudflare-geo-key-manager/">Geo Key Manager</a>, in selected Cloudflare locations. We also use it for Cloudflare-held private keys with a service creatively known as <i>gokeyless-internal</i>. The final piece of this architecture is another service called <a href="/scaling-geo-key-manager/"><i>Keynotto</i></a>. Keynotto is a service written in Rust that only mints RSA and <a href="https://www.cloudflare.com/learning/dns/dnssec/ecdsa-and-dnssec/">ECDSA</a> key signatures (that are executed with the stored private key).</p><p>How does the overall architecture of gokeyless work? Let’s start with a request. The request arrives at the Cloudflare network, and we perform TLS termination. Any signing request is forwarded to Keynotto. A small portion of requests (specifically from GeoKDL or external gokeyless) cannot be handled by Keynotto directly, and are instead forwarded to gokeyless-internal. gokeyless-internal also acts as a key server proxy, as it redirects connections to the customer’s keyservers (external gokeyless). <a href="https://github.com/cloudflare/gokeyless">External gokeyless</a> is both the server that a customer runs and the client that will be used to contact it. The architecture can be seen in Figure 3.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5c2XtFKTmHLgy9XNmAfJsh/496e49511e6aea34309abbae92b846f5/image5-10.png" />
            
            </figure><p>Figure 3: The life of a gokeyless request.</p><p>Migrating the transport that this architecture uses to post-quantum cryptography is a bigger challenge, as it involves migrating a service that lives on the customer side. So, for our testing phase, we decided to go for the simpler path that we are able to change ourselves: the TLS handshake between Keynotto and gokeyless-internal. This small test-bed means two things: first, that we needed to change another TLS library (as Keynotto is written in Rust) and, second, that we needed to change gokeyless-internal in such a way that it used post-quantum cryptography only for the handshakes with Keynotto and for nothing else. Note that we did not migrate the signing operations that gokeyless or Keynotto executes with the stored private key; we just migrated the transport connections.</p><p>Adding post-quantum cryptography to the <a href="https://github.com/rustls/rustls">rustls codebase</a> was a straightforward exercise and we exposed an easy-to-use API call to signal the usage of post-quantum cryptography (as seen in Figure 4 and Figure 5). One thing that we noted when reviewing the TLS usage in several Cloudflare services is that giving the option to choose the algorithms for a ciphersuite, key share, and authentication in the TLS handshake confuses users. It seemed more straightforward to define the algorithm at the library level, and have a boolean or API call signal the need for this post-quantum algorithm.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4i2qzprdHeQ5F7Y9CLn1S2/354947695ac81ead9fd7e414a562bc37/image9-3.png" />
            
            </figure><p>Figure 4: post-Quantum API for rustls.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5rk2okKUdjZmpisim3f5bk/bd2b2bec41309221236591c53b071d6d/image4-16.png" />
            
            </figure><p>Figure 5: usage of the post-quantum API for rustls.</p><p>We ran a small test between Keynotto and gokeyless-internal with much success. Our next steps are to integrate this test into the real connection between Keynotto and gokeyless-internal, and to devise a plan for a customer post-quantum protected gokeyless external. This is the first instance in which our migration to post-quantum will not be ending at our edge but rather at the customer’s connection point.</p>
    <div>
      <h3>A post-quantum Cloudflare Tunnel</h3>
      <a href="#a-post-quantum-cloudflare-tunnel">
        
      </a>
    </div>
    <p><a href="https://www.cloudflare.com/en-gb/products/tunnel/">Cloudflare Tunnel</a> is a reverse proxy that allows customers to quickly connect their private services and networks to the Cloudflare network without having to expose their public IPs or ports through their firewall. It is mainly managed at the customer level through the <a href="https://github.com/cloudflare/cloudflared">usage of <i>cloudflared</i></a><i>,</i> a lightweight server-side daemon_,_ in their infrastructure. <i>cloudflared</i> opens several long-lived TCP connections (although, <i>cloudflared</i> is <a href="/getting-cloudflare-tunnels-to-connect-to-the-cloudflare-network-with-quic/">increasingly using the QUIC</a> protocol) to servers on <a href="https://www.cloudflare.com/en-gb/learning/serverless/glossary/what-is-edge-computing/">Cloudflare’s global network</a>. When a request to a hostname comes, it is proxied through these connections to the origin service behind <i>cloudflared</i>.</p><p>The easiest part of the service to make post-quantum secure appears to be the connection between our network (with a service part of Tunnel called <i>origintunneld</i> located there) and <i>cloudflared</i>, which we have started migrating. While exploring this path and looking at the whole life of a Tunnel connection, we found something more interesting, though. When the Tunnel connections eventually reach core, they end up going to a service called <i>Tunnelstore</i>. <i>Tunnelstore</i> runs as a stateless application in a Kubernetes deployment, and to provide TLS termination (alongside load balancing and more) it uses a <a href="https://kubernetes.io/">Kubernetes</a> <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/">ingress</a>.</p><p>The <a href="/cloudflare-ingress-controller/">Kubernetes ingress</a> we use at Cloudflare is made of <a href="https://www.envoyproxy.io/">Envoy</a> and <a href="https://projectcontour.io/">Contour</a>. The latter configures the former depending on Kubernetes resources. Envoy uses the <a href="https://www.envoyproxy.io/docs/envoy/latest/faq/build/boringssl">BoringSSL library</a> for TLS. Switching TLS libraries in Envoy seemed difficult: there are <a href="https://github.com/envoyproxy/envoy-openssl">thoughts</a> on how to integrate OpenSSL to it (and <a href="https://github.com/open-quantum-safe/oqs-demos/issues/79">even some thoughts</a> on adding post-quantum cryptography) and <a href="https://github.com/envoyproxy/envoy/pull/7377">ways to switch TLS libraries</a>. Adding post-quantum cryptography to a modified version of BoringSSL, and then specifying <a href="https://github.com/google/boringssl/blob/master/INCORPORATING.md">that dependency</a> in the <a href="https://github.com/envoyproxy/envoy/blob/main/bazel/repository_locations.bzl#L74">Bazel file of Envoy</a> seems to be the path to go for, as our internal test has confirmed (as seen in Figure 6). As for Contour, for many years, Cloudflare has been running their own patched version of it: we will have to again patch this version with our Golang library to provide post-quantum cryptography. We will make these libraries (and the TLS ones) available for usage.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/itO6WZ2vhxBBR8Jy8iWRp/5c435ec9ccac61b74fe0f9499b171011/image1-27.png" />
            
            </figure><p>Figure 6: Option to allow post-quantum cryptography in Envoy.</p><p>Changing the Kubernetes ingress at Cloudflare not only makes Tunnel completely quantum-safe (beyond the connection between our global network and <i>cloudflared</i>), but it also makes any other services using ingress safe. Our first tests on migrating Envoy and Contour to TLS libraries that contain post-quantum protections have been successful, and now we have to test how it behaves in the whole ingress ecosystem.</p>
    <div>
      <h3>What is next?</h3>
      <a href="#what-is-next">
        
      </a>
    </div>
    <p>The main tests are now done. We now have TLS libraries (in Go, Rust, and C) that give us post-quantum cryptography. We have two systems ready to deploy post-quantum cryptography, and a shared service (Kubernetes ingress) that we can change. At the beginning of the blog post, we said that “the life of most requests at Cloudflare begins and ends at the edge of our global network”: our aim is that post-quantum cryptography does not end there, but rather reaches all the way to where customers connect as well. Let’s explore the future challenges and this customer post-quantum path in this <a href="/post-quantum-future">other blog post</a>!</p> ]]></content:encoded>
            <category><![CDATA[Research]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Post-Quantum]]></category>
            <guid isPermaLink="false">6Idg7A13yPnfsxtQpwQXs1</guid>
            <dc:creator>Sofía Celi</dc:creator>
            <dc:creator>Goutam Tamvada</dc:creator>
            <dc:creator>Thom Wiggers</dc:creator>
        </item>
        <item>
            <title><![CDATA[Using EasyCrypt and Jasmin for post-quantum verification]]></title>
            <link>https://blog.cloudflare.com/post-quantum-easycrypt-jasmin/</link>
            <pubDate>Thu, 24 Feb 2022 16:23:46 GMT</pubDate>
            <description><![CDATA[ This blogpost will touch upon how to practically use Jasmin and EasyCrypt to achieve better security guarantees when verifying KEMs ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Cryptographic code is everywhere: it gets run when we connect to the bank, when we send messages to our friends, or when we <a href="https://www.sciencedirect.com/science/article/abs/pii/S0747563215004343">watch cat videos</a>. But, it is not at all easy to take a cryptographic specification written in a natural language and produce running code from it, and it is even harder to validate both the theoretical assumptions and the correctness of the implementation itself. Mathematical <a href="https://en.wikipedia.org/wiki/Mathematical_proof">proofs</a>, as we talked about in <a href="/post-quantum-formal-analysis">our previous blog post</a>, and <a href="https://en.wikipedia.org/wiki/Code_review">code inspection</a> are simply not enough. <a href="https://en.wikipedia.org/wiki/Software_testing">Testing</a> and <a href="/a-gentle-introduction-to-linux-kernel-fuzzing/">fuzzing</a> can catch common or well-known bugs or mistakes, but might miss rare ones that can, nevertheless, be triggered by an attacker. <a href="https://en.wikipedia.org/wiki/Static_program_analysis">Static analysis</a> can detect mistakes in the code, but cannot check whether the code behaves as described by the specification in natural-language (for functional correctness). This gap between implementation and validation can have <a href="https://www.mitls.org/pages/attacks">grave consequences</a> in terms of security in the real world, and we need to bridge this chasm.</p><p>In this blog post, we will be talking about ways to make this gap smaller by making the code we deploy better through analyzing its security properties and its implementation. This blog post continues our work on high assurance cryptography, for example, on using Tamarin to <a href="/post-quantum-formal-analysis">analyze entire protocol specifications</a>. In this one, we want to look more on the side of verifying implementations. Our desire for high assurance cryptography isn’t specific to <a href="https://www.cloudflare.com/learning/ssl/quantum/what-is-post-quantum-cryptography/">post-quantum cryptography</a>, but because quantum-safe algorithms and protocols are so new, we want extra reassurance that we’re doing the best we can. The post-quantum era also gives us a great opportunity to try and apply all the lessons we’ve learned while deploying classical cryptography, which will hopefully prevent us from making the same mistakes all over again.</p><p>This blog post will discuss <a href="https://eprint.iacr.org/2019/1393.pdf">formal verification</a>. Formal verification is a technique we can use to prove that a piece of code correctly implements a specification. Formal verification, and <a href="https://en.wikipedia.org/wiki/Formal_methods">formal methods</a> in general, have been around for a long time, appearing as early as the 1950s. Today, they are being applied in a variety of ways: from <a href="https://csrc.nist.gov/CSRC/media/Events/third-pqc-standardization-conference/documents/accepted-papers/meijers-formal-verification-pqc2021.pdf">automating the checking of security proofs</a> to automating checks for functional correctness and the absence of side-channels attacks. Code verified using such formal verification has been deployed in popular products like <a href="https://blog.mozilla.org/security/2020/07/06/performance-improvements-via-formally-verified-cryptography-in-firefox/">Mozilla Firefox</a> and <a href="https://boringssl.googlesource.com/boringssl/+/refs/heads/master/third_party/fiat/">Google Chrome</a>.</p><p><i>Formal verification</i>, as opposed to <i>formal analysis</i>, the topic of <a href="/post-quantum-formal-analysis">other blog posts</a>, deals with verifying code and checking that it correctly implements a specification. <i>Formal analysis</i>, on the other hand, deals with establishing that a specification has the desired properties, for example, having a specific security guarantee.</p><p>Let’s explore what it means for an algorithm to have a proof that it achieves a certain security goal and what it means to have an implementation we can prove correctly implements that algorithm.</p>
    <div>
      <h3>Goals of a formal analysis and verification process</h3>
      <a href="#goals-of-a-formal-analysis-and-verification-process">
        
      </a>
    </div>
    <p>Our goal, given a description of an algorithm in a natural language, is to produce two proofs: first, one that shows that the algorithm has the security properties we want and, second, that we have a correct implementation of it. We can go about this in four steps:</p><ol><li><p>Turn the algorithm and its security goals into a formal specification. This is us defining the problem.</p></li><li><p>Use formal analysis to prove, in our case using a computer-aided proof tooling, that the algorithm attains the specified properties.</p></li><li><p>Use formal verification to prove that the implementation correctly implements the algorithm.</p></li><li><p>Use formal verification to prove that our implementation has additional properties, like memory safety, running in constant time, efficiency, etc.</p></li></ol><p>Interestingly we can do step 2 in parallel with steps 3 and 4, because the two proofs are actually independent. As long as they are both building from the same specification established in step 1, the properties we establish in the formal analysis should flow down to the implementation.</p><p>Suppose, more concretely, we’re looking at an implementation and specification of a Key Encapsulation Mechanism (a KEM, such as <a href="https://frodokem.org/files/FrodoKEM-specification-20210604.pdf"><i>FrodoKEM</i></a>). FrodoKEM is designed to achieve <a href="https://en.wikipedia.org/wiki/Ciphertext_indistinguishability">IND-CCA security</a>, so we want to prove that it does, and that we have an efficient, side-channel resistant and correct implementation of it.</p><p>As you might imagine, achieving even one of these goals is no small feat. Achieving all, especially given the way they conflict (efficiency clashes with side-channel resistance, for example), is a Herculean task. <a href="https://eprint.iacr.org/2019/1393.pdf">Decades of research have gone into this space</a>, and it is huge; so let’s carve out and examine a small subsection to look at: we’ll look at two tools, <a href="https://github.com/EasyCrypt/easycrypt">EasyCrypt</a> and <a href="https://acmccs.github.io/papers/p1807-almeidaA.pdf">Jasmin</a>.</p><p>Before we jump into the tools, let’s take a brief aside to discuss why we’re not using Tamarin, which we’ve talked about in our <a href="/post-quantum-formal-analysis">other blog posts</a>. Like EasyCrypt, <a href="https://tamarin-prover.github.io/">Tamarin</a> is also a tool used for formal analysis, but beyond that, the two tools are quite different. Formal analysis broadly splits into two camps, symbolic analysis and computational analysis. Tamarin, as <a href="/post-quantum-formal-analysis">we saw</a>, uses symbolic analysis, which treats all functions effectively as black boxes, whereas EasyCrypt uses computational analysis. Computational analysis is much closer to how we program, and functions are given specific implementations. This gives computational analysis a much higher “resolution”: we can study properties in much greater detail and, perhaps, with greater ease. This detail, of course, comes at a cost. As functions grow into full protocols, with multiple modes, branching paths, and in the case of the Transport Layer Security (TLS), sometimes even resumption, computational models become unwieldy and difficult to work with, even with computer-assisted tooling. We therefore have to pick the correct tool for the job. When we need maximum assurance, sometimes both computational and symbolic proofs are constructed, with each playing to its strengths and compensating for the other’s drawbacks.</p>
    <div>
      <h3>EasyCrypt</h3>
      <a href="#easycrypt">
        
      </a>
    </div>
    <p>EasyCrypt is a <i>proof assistant</i> for cryptographic algorithms and <a href="https://en.wikipedia.org/wiki/Imperative_programming">imperative programs</a>. A proof is basically a formal demonstration that some statement is true. EasyCrypt is called a proof assistant because it “assists” you with creating a proof; it does not create a proof for you, but rather, helps you come to it and gives you the power to have a machine check that each step logically follows from the last. It provides a language to write definitions, programs, and theorems along with an environment to develop machine-checked proofs.</p><p>A proof starts from a set of assumptions, and by taking a series of logical steps demonstrates that some statement is true. Let’s imagine for a moment that we are <a href="https://en.wikipedia.org/wiki/Perseus">the hero Perseus</a> on a quest to kill a mythological being, the terrifying <a href="https://en.wikipedia.org/wiki/Medusa">Medusa</a>. How can we prove to everyone that we’ve succeeded? No one is going to want to enter Medusa's cave to check that she is dead because they’ll be turned to stone. And we cannot just state, “I killed the Medusa.” Who will believe us without proof? After all, is this not a <a href="https://en.wikipedia.org/wiki/Leap_of_faith">leap of faith</a>?</p><p>What we can do is bring the head of the Medusa as proof. Providing the head as a demonstration is our proof because no mortal <a href="https://en.wikipedia.org/wiki/Gorgon">Gorgon</a> can live without a head. Legend has it that Perseus completed the proof by demonstrating that the head was indeed that of the Medusa: Perseus used the head’s powers to turn <a href="https://en.wikipedia.org/wiki/Polydectes">Polydectes</a> to stone (the latter was about to force Perseus’ mother to marry him, so let’s just say it wasn’t totally unprovoked). One can say that this proof was done “by hand” in that it was done without any mechanical help. For computer security proofs, sometimes the statements we want to prove are so cumberstone to prove and are so big that having a machine to help us is needed.</p><p>How does EasyCrypt achieve this? How does it help you? As we are dealing with cryptography here, first, let’s start by defining how one can reason about cryptography, the security it provides, and the proofs one uses to corroborate them.</p><p>When we encrypt something, we do this to hide whatever we want to send. In a perfect world, it would be <i>indistinguishable</i> from noise. Unfortunately, only the <a href="https://en.wikipedia.org/wiki/One-time_pad">one-time-pad</a> truly offers this property, so most of the time we make do with “close enough”: it should be infeasible to differentiate a true encrypted value from a random one.</p><p>When we want to show that a certain cryptographic protocol or algorithm has this property, we write it down as an “indistinguishability game.” The idea of the game is as follows:</p><blockquote><p>Imagine a gnome is sitting in a box. The gnome takes a message as input to the box and produces a ciphertext. The gnome records each message and the ciphertext they see generated. A troll outside the box chooses two messages (m1 and m2) of the same length and sends them to the box. The gnome records the box operations and flips a coin. If the coin lands on its face, then the gnome sends the ciphertext (c1) corresponding to m1. Otherwise, they send c2 corresponding to m2. In order to win, the troll, knowing the messages and the ciphertext, has to guess which message was encrypted.</p></blockquote><p>In this example, we can see two things: first, choices are random as the ciphertext sent is chosen by flipping a coin; second, the goal of the adversary is to win a game.</p><p>EasyCrypt takes this approach. Security goals are modeled as probabilistic programs (basically, as games) played by an adversary. Tools from program verification and programming language theory are used to justify the cryptographic reasoning. EasyCrypt relies on a “<a href="https://arxiv.org/abs/cs/0603118">goal directed proof” approach</a>, in which two important mechanisms occur: lemmas and tactics. Let’s see how this approach works (following this <a href="https://arxiv.org/abs/cs/0603118">amazing paper</a>):</p><ol><li><p>The prover (in this case, you) enters a small <i>statement</i> to prove. For this, one uses the command <i>lemma</i> (meaning this is a <a href="https://en.wikipedia.org/wiki/Lemma_(mathematics)">minor statement</a> needed to be proven)<i>.</i></p></li><li><p>EasyCrypt will display the formula as a statement to be proved (i.e <i>the goal</i>) and will also display all the known hypotheses (unproven lemmas) at any given point.</p></li><li><p>The prover enters a command (a <i>tactic</i>) to either decompose the statement into simpler ones, apply a hypothesis, or make progress in the proof in some other way.</p></li><li><p>EasyCrypt displays a new set of hypotheses and the parts that still need to be proved.</p></li><li><p>Back to step 3.</p></li></ol><p>Let’s say you want to prove something small, like the statement “if <i>p</i> <i>in conjunction</i> with <i>q</i>, then <i>q</i> <i>in conjunction with p.</i>” In <a href="https://www.site.uottawa.ca/~lucia/courses/2101-10/lecturenotes/03PredicateLogic.pdf">predicate logic terms</a>, this will be written as <code><i>(p ∧ q) → (q ∧ p)</i></code>. If we translate this into English statements, as Alice will say in <a href="https://en.wikipedia.org/wiki/Alice%27s_Adventures_in_Wonderland">Alice in Wonderland</a>, it could be:</p><p> <i>p</i>: I have a world of my own. <i>q:</i> Everything is nonsense. <i>p∧q:</i> I have a world of my own and everything is nonsense. <i>(p ∧ q) → (q ∧ p):</i> If I have a world of my own and everything is nonsense, then, everything is nonsense, and I have a world of my own.</p><p>We will walk through such a <a href="https://github.com/alleystoughton/EasyTeach/blob/master/SimpLogic.ec">statement and its proof</a> in EasyCrypt. For more of these examples, see these <a href="https://github.com/alleystoughton/EasyTeach">given by</a> the marvelous Alley Stoughton.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4WeNK8JivTymXgaqSVJwf2/a8e168b85e1c03381099770f71638919/image9-2.png" />
            
            </figure><p>Our lemma and proof in EasyCrypt.</p>
            <pre><code>lemma implies_and () :

This line introduces the stated lemma and creatively calls it “implies_and”. It takes no parameters.

(forall (P, Q: bool) =&gt; P /\ Q =&gt; Q /\ P.

This is the statement we want to prove. We use the variables P and Q of type bool (booleans), and we state that if P and Q, then Q and P.</code></pre>
            <p>Up until now we have just declared our statement to prove to EasyCrypt. Let’s see how we write the proof:</p>
            <pre><code>proof.
This line demarcates the start of the proof for EasyCrypt.


move =&gt; p q H.
We introduce the hypothesis we want to prove (we move them to the “context”). We state that P and Q are both booleans, and that H is the hypothesis P /\ Q.


elim H.

We eliminate H (the conjunctive hypothesis) and we get the components: “p =&gt; q =&gt; q /\ p”.

trivial.

The proof is now trivial.

qed.</code></pre>
            <p><i>Quod erat demonstrandum</i> (QED) denotes the end of the proof (if both are true, then the conjunction holds). Whew! For such a simple statement, this took quite a bit of work, because EasyCrypt leaves no stone unturned. If you get to this point, you can be sure your proof is absolutely correct, unless there is a bug in EasyCrypt itself (or unless we are proving something that we weren't supposed to).</p><p>As you see, EasyCrypt helped us by guiding us in decomposing the statement into simpler terms, and stating what still needed to be proven. And by strictly following logical principles, we managed to realize a proof. If we are doing something wrong, and our proof is incorrect, EasyCrypt will let us know, saying something like:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1kHg8ZYbefNDYuO5ys4IeA/f6af0a3ef1a3b566134fc49dc4f666ca/image2-23.png" />
            
            </figure><p>Screenshot of EasyCrypt showing us that we did something wrong.</p><p>What we have achieved is a computer-checked proof of the statement, giving us far greater confidence in the proof than if we had to scan over one written with pen and paper. But what makes EasyCrypt particularly attractive in addition to this is its tight integration with the <a href="https://github.com/jasmin-lang">Jasmin programming language</a> as we will see later.</p><p>EasyCrypt will also interactively guide us to the proof, as it easily works with <a href="https://proofgeneral.github.io/">ProofGeneral</a> in Emacs. In the image below we see, for example, that EasyCrypt is guiding us by showing the variables we have declared (p, q, and H) and what is missing to be proven (after the dashed line).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3ZxKXX1WhxdT4ooPSWct8b/1e8bc66f731517bfec8e8c2d74392f30/image8-2.png" />
            
            </figure><p>EasyCrypt interactively showing us at which point of the proof we are at: the cyan section shows us up until which point we have arrived.</p><p>If one is more comfortable with <a href="https://cs-people.bu.edu/gaboardi/teaching/S21-CS591/labs/week3/hoare.pdf">Coq</a> proof assistant (you can find <a href="https://www.youtube.com/watch?v=z861PoZPGqk&amp;list=PLDD40A96C2ED54E99&amp;index=5&amp;ab_channel=AndrejBauer">very good tutorials</a> of it), a similar proof can be given:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4UKDlNoMQOtzkKB9qTxF3W/dc414f9f886dbd86df346a031e59180e/image3-25.png" />
            
            </figure><p>Our lemma and proof in Coq.</p><p>EasyCrypt allows us to prove statements in a faster and more assured manner than if we do proofs by hand. Proving the truthness of the statement we just showed would be easy with the usage of truth tables, for example. But, it is only easy to find these truth tables or proofs when the statement is small. If one is given a complex cryptography algorithm or protocol, the situation is much harder.</p>
    <div>
      <h3>Jasmin</h3>
      <a href="#jasmin">
        
      </a>
    </div>
    <p><a href="https://acmccs.github.io/papers/p1807-almeidaA.pdf">Jasmin</a> is an assembly-like programming language with some high-level syntactic conveniences such as loops and procedure calls while using assembly-level instructions. It does support function calls and functional arrays, as well. The Jasmin compiler predictably transforms source code into assembly code for a chosen platform (currently only <a href="https://www.intel.com/content/dam/develop/external/us/en/documents/introduction-to-x64-assembly-181178.pdf">x64</a> is supported). This transformation is verified: the correctness of some compiler passes (like function inlining or loop unrolling) are proven and verified in the Coq proof assistant. Other passes are programmed in a conventional programming language and the results are validated in Coq. The compiler also comes with a built-in checker for memory safety and constant-time safety.</p><p>This assembly-like syntax, combined with the stated assurances of the compiler, means that we have deep control over the output, and we can optimize it however we like without compromising safety. Because low-level cryptographic code tends to be concise and non-branching, Jasmin doesn’t need full support for general purpose language features or to provide lots of libraries. It only needs to support a set of basic features to give us everything we need.</p><p>One reason Jasmin is so powerful is that it provides a way to formally verify low-level code. The other reason is that Jasmin code can be automatically converted by the compiler into equivalent EasyCrypt code, which lets us reason about its security. In general terms, whatever guarantees apply to the EasyCrypt code also flow into the Jasmin code, and subsequently into the assembly code.</p><p>Let’s use the example of a very simple Jasmin function that performs multiplication to see Jasmin in action:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6qKbsZ1rUwceP0AXOM23ms/c3032102605dd62282bbe1f4548f72bc/image1-23.png" />
            
            </figure><p>A multiplication function written in Jasmin.</p><p>What the function (“fn”) “mul” does, in this case, is to multiply by whatever number is provided as an argument to the function (the variable <code><i>a</i></code>). The syntax of this small function should feel very familiar to anyone that has worked with the <a href="https://en.wikipedia.org/wiki/List_of_C-family_programming_languages">C family of programming languages</a>. The only big difference is the use of the words <code><i>reg</i></code> and <code><i>u64</i></code>. What they state is that the variable <code><i>a</i></code>, for example, is <a href="https://en.wikipedia.org/wiki/Register_allocation">allocated in registers</a> (hence, the use of <i>reg</i>: this defines the storage of the variable) and that it is <a href="https://en.wikipedia.org/wiki/Word_(computer_architecture)">64-bit machine-word</a> (hence, the use of <i>u64</i>). We can convert now this to “pure” x64 assembly:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2TFayfomwD2qaL1cR1Dx3b/22f7cb3762b6db4970e8cfc7080f49a0/image7-4.png" />
            
            </figure><p>A multiplication function written in Jasmin and transformed to Assembly.</p><p>The first lines of the assembly code are just “setting all up”. They are then followed by the <a href="https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf">“imulq” instruction</a>, which just multiplies the variable by the constant (which in this case is labeled as “param”). While this small function might not show the full power of having the ability of safely translating to assembly, it can be seen when more complex functions are created. Functions that use while loops, arrays, calls to other functions are accepted by Jasmin and will be safely translated to assembly.</p><p>Assembly language has a <a href="http://flint.cs.yale.edu/cs421/papers/art-of-asm/pdf/FORWARD.PDF">little bit of a bad reputation</a> because it is thought to be hard to learn, hard to read, and hard to maintain. Having a tool that helps you with translation is very useful to a programmer, and it is also useful as you can manually or automatically check what the assembly code looks like.</p><p>We can further check the code for its safety:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/70mzl8XIVNieFBNw1FShm7/8e3919506941636d7956eb62b78842e6/image6-9.png" />
            
            </figure><p>A multiplication function written and checked in Jasmin.</p><p>In this check, there are many things to understand. First, it checks that the inputs are allocated in a memory region of at least 0 bytes. Second, the “Rel” entry checks the allocated memory region safety pre-condition: for example, <i>n</i> must point to an allocated memory region of sufficient length.</p><p>You can then <a href="https://github.com/jasmin-lang/jasmin/wiki/Extraction-to-EasyCrypt">extract this functionality to EasyCrypt</a> (and even configure EasyCrypt to verify Jasmin programs). Here is the corresponding EasyCrypt code, automatically produced by the Jasmin compiler:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3wYndYnFsKrBcIPhDIDizI/84d6571ef41d3f4ea060199564f2b0c3/image4-15.png" />
            
            </figure><p>A multiplication function written in Jasmin and extracted to EasyCrypt.</p><p>Here’s a slightly more involved example, that of a FrodoKEM utility function written in Jasmin.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2kXt7r2F4RguoMalUYiUWl/3698b3ef4e117d181d6fcfe2f09aadf6/image5-9.png" />
            
            </figure><p>A utility function for addition for FrodoKEM.</p><p>With a C-like syntax,  this function adds two arrays (<code><i>a</i></code> and <code><i>b</i></code>), and returns the result (in <i>out</i>). The value <i>NBAR</i> is just a parameter you can specify in a C-like manner. You can then take this function and <a href="https://github.com/jasmin-lang/jasmin/wiki/Compilation-to-assembly">compile it to assembly</a>. You can also use the Jasmin compiler to analyze <a href="https://github.com/jasmin-lang/jasmin/wiki/Safety-checker">the safety of the code</a> (for example, that array accesses are in bounds, that memory accesses are valid, that arithmetic operations are applied to valid arguments) and <a href="https://github.com/jasmin-lang/jasmin/wiki/Constant-time-verification">verify the code runs in constant-time</a>.</p><p>The addition function as used by FrodoKEM can also be extracted to EasyCrypt:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/9IZw1XeDt61yAapX1P1za/b92bb7634516c873a3328d611a43e52c/image10-2.png" />
            
            </figure><p>The addition function as extracted to EasyCrypt.</p><p>A theorem expressing the correctness (meaning that addition is correct) is expressed in EasyCrypt as so:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5SDmCcTq5mHAJV73C8dzdd/02dee858a0fe99c404b5d2676ed41738/image12-2.png" />
            
            </figure><p>The theorem of addition function as extracted to EasyCrypt.</p><p>Note that EasyCrypt uses <a href="https://cs-people.bu.edu/gaboardi/teaching/S21-CS591/labs/week3/hoare.pdf">While Language and Hoare Logic</a>. The corresponding proof that states that addition is correct:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3JiYmQNHCVA7MHZv4xOPB4/385433d548dc3f1be1d216c4c54e4abb/image11-2.png" />
            
            </figure><p>The proof of the addition function as extracted to EasyCrypt.</p>
    <div>
      <h3>Why formal verification for post-quantum cryptography?</h3>
      <a href="#why-formal-verification-for-post-quantum-cryptography">
        
      </a>
    </div>
    <p>As we have previously stated, cryptographic implementations are very hard to get right, and even if they are right, the security properties they claim to provide are sometimes wrong for their intended application. The reason why this matters so much is that post-quantum cryptography is the cryptography we will be using in the future due to the arrival of quantum computers. Deploying post-quantum cryptographic algorithms with bugs or flaws in their security properties would be a disaster because connections and data that travels through it can be decrypted or attacked. We are trying to prevent that.</p><p>Cryptography is difficult to get right, and it is not only difficult to get right by people new to it, but it is also difficult for anyone, even for the experts. The designs and code we write are error-prone as we all are, as humans, prone to errors. Some examples of when some designs got it wrong are as follows (luckily, these example  were not deployed, and they did not have the usual disastrous consequences):</p><ul><li><p><a href="https://falcon-sign.info/">Falcon</a> (a post-quantum algorithm currently part of the <a href="https://csrc.nist.gov/projects/post-quantum-cryptography">NIST procedure</a>), produced valid signatures “but leaked information on the private key,” according to an <a href="https://csrc.nist.gov/CSRC/media/Projects/post-quantum-cryptography/documents/round-2/official-comments/FALCON-round2-official-comment.pdf">official comment</a> posted to the NIST post-quantum process on the algorithm. The comment also noted that “the fact that these bugs existed in the first place shows that the traditional development methodology (i.e. “being super careful”) has failed.“</p></li><li><p>“The De Feo–Jao–Plût identification scheme (the basis for <a href="https://en.wikipedia.org/wiki/Supersingular_isogeny_key_exchange">SIDH signatures</a>) contains an invalid assumption and provide[s] a counterexample for this assumption: thus showing the proof of soundness is invalid,” according to a <a href="https://eprint.iacr.org/2021/1023.pdf">finding</a> that one proof of a post-quantum algorithm was not valid. This is an example of an incorrect proof, whose flaws were discovered and eliminated prior to any deployment.</p></li></ul><p>Perhaps these two examples might convince the reader that formal analysis and formal verification of implementations are needed. While they help us avoid some human errors, they are not perfect. As for us, we are convinced of these methods. We are working towards a <a href="https://github.com/xvzcf/VeriFrodo/">formally verified implementation of FrodoKEM</a> (we have a first implementation of it in our <a href="https://github.com/cloudflare/circl/pull/311">cryptographic library, CIRCL</a>), and we are collaborating to create a <a href="https://github.com/jasmin-lang/cryptolib">formally verified and implemented library</a> we can run in real-world connections. If you are interested in learning more about EasyCrypt and Jasmin, visit the <a href="https://github.com/claucece/formal-tutorials">resources we have put together</a>, try to <a href="https://github.com/xvzcf/VeriFrodo/blob/main/install.md">install it following our guidelines</a>, or follow <a href="https://cryptojedi.org/programming/jasmin.shtml">some tutorials</a>.</p><p>See you on other adventures in post-quantum (and some <a href="https://www.youtube.com/c/utahactor">cat videos for you</a>)!</p>
    <div>
      <h3>References:</h3>
      <a href="#references">
        
      </a>
    </div>
    <ul><li><p>“SoK: Computer-Aided Cryptography” by Manuel Barbosa, Gilles Barthe, Karthik Bhargavan, Bruno Blanchet, Cas Cremers, Kevin Liao and Bryan Parno: <a href="https://eprint.iacr.org/2019/1393.pdf">https://eprint.iacr.org/2019/1393.pdf</a></p></li><li><p>“EasyPQC: Verifying Post-Quantum Cryptography” by Manuel Barbosa, Gilles Barthe, Xiong Fan, Benjamin Grégoire, Shih-Han Hung, Jonathan Katz, Pierre-Yves Strub, Xiaodi Wu and Li Zhou: <a href="https://eprint.iacr.org/2021/1253">https://eprint.iacr.org/2021/1253</a></p></li><li><p>“Jasmin: High-Assurance and High-Speed Cryptography” by José Bacelar Almeida, Manuel Barbosa, Gilles Barthe, Arthur Blot, Benjamin Grégoire, Vincent Laporte, Tiago Oliveira, Hugo Pacheco, Benedikt Schmidt and Pierre-Yves Strub: <a href="https://dl.acm.org/doi/pdf/10.1145/3133956.3134078">https://dl.acm.org/doi/pdf/10.1145/3133956.3134078</a></p></li><li><p>“The Last Mile: High-Assurance and High-Speed Cryptographic Implementations” by José Bacelar Almeida, Manuel Barbosa, Gilles Barthe, Benjamin Grégoire, Adrien Koutsos, Vincent Laporte,Tiago Oliveira and Pierre-Yves Strub: <a href="https://arxiv.org/pdf/1904.04606.pdf">https://arxiv.org/pdf/1904.04606.pdf</a></p></li></ul><p></p> ]]></content:encoded>
            <category><![CDATA[Research]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Post-Quantum]]></category>
            <guid isPermaLink="false">6LJZAgw1hZFYKF1ogqsnAr</guid>
            <dc:creator>Sofía Celi</dc:creator>
            <dc:creator>Goutam Tamvada</dc:creator>
        </item>
        <item>
            <title><![CDATA[Deep dive into a post-quantum key encapsulation algorithm]]></title>
            <link>https://blog.cloudflare.com/post-quantum-key-encapsulation/</link>
            <pubDate>Tue, 22 Feb 2022 13:59:26 GMT</pubDate>
            <description><![CDATA[ In this blog post, we will look at what Key Encapsulation Mechanisms are and why they matter in a post-quantum world ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The Internet is accustomed to the fact that any two parties can exchange information securely without ever having to meet in advance. This magic is made possible by key exchange algorithms, which are core to certain protocols, such as the Transport Layer Security (TLS) protocol, that are used widely across the Internet.</p><p>Key exchange algorithms are an elegant solution to a vexing, seemingly impossible problem. Imagine a scenario where keys are transmitted in person: if <a href="https://en.wikipedia.org/wiki/Persephone">Persephone</a> wishes to send her mother <a href="https://en.wikipedia.org/wiki/Demeter">Demeter</a> a secret message, she can first generate a key, write it on a piece of paper and hand that paper to her mother, Demeter. Later, she can scramble the message with the key, and send the scrambled result to her mother, knowing that her mother will be able to unscramble the message since she is also in possession of the same key.</p><p>But what if Persephone is kidnapped (as <a href="https://www.perseus.tufts.edu/hopper/text?doc=HH+2+4">the story goes</a>) and cannot deliver this key in person? What if she can no longer write it on a piece of paper because someone (by chance <a href="https://en.wikipedia.org/wiki/Hades">Hades</a>, the kidnapper) might read that paper and use the key to decrypt any messages between them? Key exchange algorithms come to the rescue: Persephone can run a key exchange algorithm with Demeter, giving both Persephone and Demeter a <i>secret value</i> that is known only to them (no one else knows it) <i>even if</i> Hades is eavesdropping. This secret value can be used to encrypt messages that Hades cannot read.</p><p>The most widely used key exchange algorithms today are based on hard mathematical problems, such as <a href="https://en.wikipedia.org/wiki/Integer_factorization">integer factorization</a> and the <a href="https://crypto.stanford.edu/pbc/notes/crypto/factoring.html">discrete logarithm problem</a>. But these problems can be efficiently solved by a quantum computer, as we have <a href="/quantum-solace-and-spectre">previously learned</a>, breaking the secrecy of the communication.</p><p>There are other mathematical problems that are hard even for quantum computers to solve, such as those based on lattices or isogenies. These problems can be used to build key exchange algorithms that are secure even in the face of quantum computers. Before we dive into this matter, we have to first look at one algorithm that can be used for Key Exchange: Key Encapsulation Mechanisms (KEMs).</p><p>Two people could agree on a <i>secret value</i> if one of them could send the secret in an encrypted form to the other one, such that only the other one could decrypt and use it. This is what a KEM makes possible, through a collection of three algorithms:</p><ul><li><p>A key generation algorithm, <i>Generate</i>, which generates a public key and a private key (a keypair).</p></li><li><p>An encapsulation algorithm, <i>Encapsulate,</i> which takes as input a public key, and outputs a shared secret value and an “encapsulation” (a ciphertext) of this secret value.</p></li><li><p>A decapsulation algorithm, <i>Decapsulate</i>, which takes as input the encapsulation and the private key, and outputs the shared secret value.</p></li></ul><p>A KEM can be seen as similar to a Public Key Encryption (PKE) scheme, since both use a combination of public and private keys. In a PKE, one encrypts a message using the public key and decrypts using the private key. In a KEM, one uses the public key to create an “encapsulation” — giving a randomly chosen shared key — and one decrypts this “encapsulation” with the private key. The reason why KEMs exist is that PKE schemes are usually less efficient than <a href="https://en.wikipedia.org/wiki/Symmetric-key_algorithm">symmetric encryption schemes</a>; one can use a KEM to only transmit the shared/symmetric key, and later use it in a symmetric algorithm to efficiently encrypt data.</p><p>Nowadays, in most of our connections, we do not use KEMs or PKEs per se. We either use Key Exchanges (KEXs) or Authenticated Key Exchanges (AKE). The reason for this is that a KEX allows us to use public keys (solving the <i>key exchange problem</i> of how to securely transmit keys) in order to generate a shared/symmetric key which, in turn, will be used in a symmetric encryption algorithm to encrypt data efficiently. A famous KEX algorithm is <a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange">Diffie-Hellman</a>, but classical Diffie-Hellman based mechanisms do not provide security against a quantum adversary; post-quantum KEMs do.</p><p>When using a KEM, Persephone would run <i>Generate</i> and publish the public key. Demeter takes this public key, runs <i>Encapsulate</i>, keeps the generated secret to herself, and sends the encapsulation (the ciphertext) to Persephone. Persephone then runs <i>Decapsulate</i> on this encapsulation and, with it, arrives at the same shared secret that Demeter holds. Hades will not be able to guess even a bit of this secret value even if he sees the ciphertext.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7bbaBxcIILEzrNhIFZNb6p/11e6723fc4c28fdfa43009db7892e9a3/image3-21.png" />
            
            </figure><p>In this post, we go over the construction of one particular post-quantum KEM, called <i>FrodoKEM</i>. Its design is simple, which makes it a good choice to illustrate how a KEM can be constructed. We will look at it from two perspectives:</p><ul><li><p>The underlying mathematics: a cryptographic algorithm is built as a Matryoshka doll. The first doll is, most of the time, the mathematical base, which hardness should be strong so that security is maintained. In the post-quantum world, this is usually the hardness of some lattice problems (more on this in the next section).</p></li><li><p>The algorithmic construction : these are all the subsequent dolls that take the mathematical base and construct an algorithm out of it. In the case of a KEM, first you construct a Public Key Encryption (PKE) scheme and transform it (putting another doll on top) to make a KEM, so better security properties are attained, as we will see.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6EAd5Cm1yP22B42GNMq19P/39d0e79590bb89c001e1d792df8130ac/image7-3.png" />
            
            </figure><p>The core of <i>FrodoKEM</i> is a public-key encryption scheme called <i>FrodoPKE</i>, whose security is based on the hardness of the “Learning with Errors” (LWE) problem over lattices. Let us look now at the first doll of a KEM.</p><p><b>Note to the reader:</b> Some mathematics is coming in the next sections, but do not worry, we will guide you through it.</p>
    <div>
      <h3>The Learning With Errors Problem</h3>
      <a href="#the-learning-with-errors-problem">
        
      </a>
    </div>
    <p>The security (and mathematical foundation) of <i>FrodoKEM</i> relies on the hardness of the Learning With Errors (LWE) problem, a generalization of the classic Learning Parities with Noise <a href="https://cims.nyu.edu/~regev/papers/qcrypto.pdf">problem, first defined by Regev</a>.</p><p>In cryptography, specifically in the mathematics underlying it, we often use sets to define our operations. A set is a collection of any element, in this case, we will refer to collections of numbers. In cryptography textbooks and articles, one can often read:</p><p>Let $Z_q$ denote the set of integers $\{0, …, q-1\}$ where $(q &gt; 2)$,</p><p>which means that we have a collection of integers from 0 to a number <i>q</i> (which has to be bigger than 2. It is assumed that <i>q</i>, in a cryptographic application, is a prime. In the main theorem, it is an arbitrary integer).</p><p>Let $\{Z^n\}_q$ denote a vector $(v1, v2, …, vn)$ of <i>n</i> elements, each of which belongs to $Z_q$.</p><p>The LWE problem asks to recover a secret vector $s = (s1, s2, …, sn)$ in $\{Z^n\}_q$ given a sequence of random, “approximate” linear equations on <i>s</i>. For instance, if $(q = 23)$ the equations might be:</p><p>[s1 + s2 + s3 + s4 ≈ 30 (mod 23)</p><p>2s1 + s3 + s5 + … + sn ≈ 40 (mod 23)</p><p>10s2 + 13s3 + 1s4 ≈ 50 (mod 23)</p><p>…]</p><p>We see the left-hand sides of the equations above are not exactly equal to the right-hand side (the equality sign is not used but rather the “≈” sign: approximately equal to); they are off by an introduced slight “error”, (which will be defined as the variable <i>e</i>. In the equations above, the error is, for example, the number 10). If the error was a known, public value, recovering <i>s</i> (the hidden variable) would be easy: after about <i>n</i> equations, we can recover <i>s</i> in a reasonable time using <a href="https://en.wikipedia.org/wiki/Gaussian_elimination">Gaussian elimination</a>. Introducing this unknown error makes the problem difficult to solve (it is difficult with accuracy to find <i>s</i>), even for quantum computers.</p><p>An equivalent formulation of the LWE problem is:</p><ol><li><p>There exists a vector <i>s</i> in $\{Z^n\}_q$, called the secret (the hidden variable).</p></li><li><p>There exists random variables <i>a</i>.</p></li><li><p>χ is a distribution, <i>e</i> is the integer error introduced from the distribution χ.</p></li><li><p>You have: (a, ⟨a, s⟩ + e). ⟨a, s⟩ is the inner product modulo <i>q</i> of <i>s</i> and <i>a</i>.</p></li><li><p>Given ⟨a, s⟩ + e ≈ b, the input to the problem is <i>a</i> and <i>b,</i> the goal is to output a guess for <i>s</i> which is very hard to achieve with accuracy.</p></li></ol><p>Blum, Kalai and Wasserman <a href="https://arxiv.org/abs/cs/0010022">provided the first subexponetial algorithm</a> for solving this problem. It requires 2<sup>O(n /log n)</sup> equations/time.</p><p>There are two main kinds of computational LWE problems that are difficult to solve for quantum computers (given certain choices of both <i>q</i> and χ):</p><ol><li><p>Search, which is to recover the secret/hidden variable <i>s</i> by only being given a certain number of samples drawn from the distribution χ.</p></li><li><p>Decision, which is to distinguish a certain number of samples drawn from the distribution (a, ⟨a, s⟩ + e) from random samples.</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3FTWefsA5VM4m5OetAKHJQ/533bee8f2eb83b992ac6a5cbfd117e14/image5-7.png" />
            
            </figure><p>The LWE problem: search and decision.</p><p>LWE is just noisy linear algebra, and yet it seems to be a very hard problem to solve. In fact, there are many reasons to believe that the LWE problem is hard: the best algorithms for solving it run in exponential time. It also is closely related to the <a href="https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.724.4038&amp;rep=rep1&amp;type=pdf">Learning Parity with Noise (LPN)</a> problem, which is extensively studied in learning theory, and it is believed to be hard to solve (any progress in breaking LPN will potentially lead to a breakthrough in coding theory). How does it relate to building cryptography? LWE is applied to the cryptographic applications of the type of public-key. In this case, the secret value s becomes the private key, and the values b<sub>i</sub> and e<sub>i</sub> are the public key.</p><p>So, why is this problem related to lattices? In <a href="/quantum-solace-and-spectre">other blog posts</a>, we have seen that certain algorithms of <a href="https://www.cloudflare.com/learning/ssl/quantum/what-is-post-quantum-cryptography/">post-quantum cryptography</a> are based on lattices. So, how does LWE relate to them? One can view LWE as the problem of decoding from random linear codes, or reduce it to lattices, in particular to problems such as the Short Vector Problem (SVP) or the Shortest independent vectors problem (SIVP): an efficient solution to LWE implies a quantum algorithm to SVP and SIVP. In <a href="/post-quantum-signatures">other blog posts</a>, we talk about SVP, so, in this one, we will focus on the random bounded distance decoding problem on lattices.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6xOnjfYoHaqK06BOZuobgw/caaacc6a318bffe35af6f5c63b9dbd07/image1-18.png" />
            
            </figure><p>Lattices (as seen in the image), as a regular and periodic arrangement of points in space, have emerged as a foundation of cryptography in the face of quantum adversaries; one modern problem in which they rely on is the Bounded Distance Decoding (BDD) problem. In the BDD problem, you are given a lattice with an arbitrary basis (a basis is a list of vectors that generate all the other points in a lattice. In the case of the image, it is the pair of vectors b<sub>1</sub> and b<sub>2</sub>). You are then given a vector b<sub>3</sub> on it. You then perturb the lattice point b<sub>3</sub> by adding some noise (or error) to give <i>x</i>. Given <i>x</i>, the goal is to find the nearest lattice point (in this case b<sub>3</sub>), as seen in the image. In this case, LWE is an average-case form of BDD (Regev also gave a worst-case to average-case reduction from BDD to LWE: the security of a cryptographic system is related to the worst-case complexity of BDD).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5q6amGgRvbV2qDx82I0HbF/4a19e3224d839860af5a0107f0484f26/image2-19.png" />
            
            </figure><p>The first doll is built. Now, how do we build encryption from this mathematical base? From LWE, we can build a public key encryption algorithm (PKE), as we will see next with <i>FrodoPKE</i> as an example.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/51MCMCJSxznDdeKsLjSs5j/a8f7e494c928c05ae76a0faf62f0efac/image6-7.png" />
            
            </figure>
    <div>
      <h3>Public Key Encryption: FrodoPKE</h3>
      <a href="#public-key-encryption-frodopke">
        
      </a>
    </div>
    <p>The second doll of the Matryoshka is using a mathematical base to build a Public Key Encryption algorithm from it. Let’s look at <i>FrodoPKE</i>. <i>FrodoPKE</i> is a public-key encryption scheme which is the building block for <i>FrodoKEM</i>. It is made up of three components: <a href="https://www.esat.kuleuven.be/cosic/blog/introduction-to-lattice-based-cryptography-part-2-lwe-encryption/">key generation, encryption, and decryption</a>. Let’s say again that Persephone wants to communicate with Demeter. They will run the following operations:</p><ol><li><p><i>Generation</i>: Generate a key pair by taking a LWE sample (like <i>(A, B = As + e mod q)</i>). The public key is <i>A, B</i> and the private key is <i>s</i>. Persephone sends this public key to Demeter.</p></li><li><p><i>Encryption</i>: Demeter receives this public key and wants to send a private message with it, something like “come back”. She generates two secret vectors (<i>(s1, e1)</i> and <i>(e2)</i>). She then:</p></li><li><p>Makes the sample <i>(b1 = As1 + e1 mod q)</i>.</p></li><li><p>Makes the sample <i>(v1 = Bs1 + e2 mod q)</i>.</p></li><li><p>Adds the message <i>m</i> to the most significant bit of <i>v1</i>.</p></li><li><p>Sends <i>b1</i> and <i>v1</i> to Persephone (this is the ciphertext).</p></li><li><p>Decryption: Persephone receives the ciphertext and proceeds to:</p></li><li><p>Calculate <i>m = v1 - b1  *  s</i> and is able to recover the message, and she proceeds to leave to meet her mother.</p></li></ol><p>Notice that computing <i>v = v1- b1  * s</i> gives us <i>m + e2</i> (the message plus the error matrix sampled during encryption). The decryption process performs rounding, which will output the original message <i>m</i> if the error matrix <i>e2</i> is carefully chosen. If not, notice that there is the potential of decryption failure.</p><p>What kind of security does this algorithm give? In cryptography, we design algorithms with security notions in mind, notions they have to attain. This algorithm, <i>FrodoPKE</i> (as with other PKEs), satisfies only <i>IND-CPA</i> (<i>Indistinguishability under chosen-plaintext attack</i>) security. Intuitively, this notion means that a passive eavesdropper listening in can get no information about a message from a ciphertext. Even if the eavesdropper knows that a ciphertext is an encryption of just one of two messages of their choice, looking at the ciphertext should not tell the adversary which one was encrypted. We can also think of it as a game:</p><blockquote><p>A gnome can be sitting inside a box. This box takes a message and produces a ciphertext. All the gnome has to do is record each message and the ciphertext they see generated. An outside-of-the-box adversary, like a troll, wants to beat this game and know what the gnome knows: what ciphertext is produced if a certain message is given. The troll chooses two messages (m1 and m2) of the same length and sends them to the box. The gnome records the box operations and flips a coin. If the coin lands on its face, then they send the ciphertext (c1) corresponding to m1. Otherwise, they send c2 corresponding to m2. The troll, knowing the messages and the ciphertext, has to guess which message was encrypted.</p></blockquote><p>IND-CPA security is not enough for all secure communication on the Internet. Adversaries can not only passively eavesdrop, but also mount <i>chosen-ciphertext attacks</i> (<i>CCA</i>): they can actively modify messages in transit and trick the communicating parties into decrypting these modified messages, thereby obtaining a <i>decryption oracle</i>. They can use this decryption oracle to gain information about a desired ciphertext, and so compromise confidentiality. Such attacks are practical and all that an attacker has to do is, for example, ​​send several million test ciphertexts to a decryption oracle, see <a href="https://medium.com/@c0D3M/bleichenbacher-attack-explained-bc630f88ff25">Bleichenbacher’s attack</a> and the <a href="https://www.robotattack.org/">ROBOT attack</a>, for example.</p><p>Without CCA security, in the case of Demeter and Persephone, what this security means is that Hades can generate and send several million test ciphertexts to the decryption oracle and eventually reveal the content of a valid ciphertext that Hades did not generate. Demeter and Persephone then might not want to use this scheme.</p>
    <div>
      <h3>Key Encapsulation Mechanisms: FrodoKEM</h3>
      <a href="#key-encapsulation-mechanisms-frodokem">
        
      </a>
    </div>
    <p>The last figure of the Matryoshka doll is taking a secure-against-CPA scheme and making it secure against CCA. A secure-against-CCA scheme must not leak information about its private key, even when decrypting arbitrarily chosen ciphertexts. It must also be the case that an adversary cannot craft valid ciphertexts without knowing what the plaintext message is; suppose, again, that the adversary knows the messages encrypted could only be either <i>m0</i> or <i>m1</i>. If the attacker can craft another valid ciphertext, for example, by flipping a bit of the ciphertext in transit, they can send this modified ciphertext, and see whether a message close to <i>m1</i> or <i>m0</i> is returned.</p><p>To make a CPA scheme secure against CCA, one can use the <a href="https://eprint.iacr.org/2017/604.pdf">Hofheinz, Hovelmanns, and Kiltz (HHK) transformations</a> (see this <a href="https://hss-opus.ub.ruhr-uni-bochum.de/opus4/frontdoor/deliver/index/docId/7758/file/diss.pdf">thesis</a> for more information). The HHK transformation constructs an IND-CCA-secure KEM from both an IND-CPA PKE and three hash functions. In the case of the algorithm we are exploring, FrodoKEM, it uses a slightly tweaked version of the HHK transform. It has, again, three functions (some parts of this description are simplified):</p><p><i>Generation</i>:</p><ol><li><p>We need a hash function <i>G1</i>.</p></li><li><p>We need a PKE scheme, such as FrodoPKE.</p></li><li><p>We call the <i>Generation</i> function of FrodoPKE, which returns a public (pk) and private key (sk).</p></li><li><p>We hash the public key <i>pkh ← G1(pk)</i>.</p></li><li><p>We chose a value <i>s</i> at random.</p></li><li><p>The public key is <i>pk</i> and the private key <i>sk1</i> is <i>(sk, s, pk, pkh)</i>.</p></li></ol><p><i>Encapsulate</i>:</p><ol><li><p>We need two hash functions: <i>G2</i> and <i>F</i>.</p></li><li><p>We generate a random message <i>u.</i></p></li><li><p>We hash the received public key <i>pkh</i> with the random message <i>(r, k) ← G2(pkh || u)</i>.</p></li><li><p>We call the <i>Encryption</i> function of FrodoPKE: <i>ciphertext ← Encrypt(u, pk, r)</i>.</p></li><li><p>We hash: <i>shared secret ← F(c || k)</i>.</p></li><li><p>We send the ciphertext and the shared secret.</p></li></ol><p><i>Decapsulate</i>:</p><ol><li><p>We need two hash functions (<i>G2</i> and <i>F</i>) and we have <i>(sk, s, pk, pkh)</i>.</p></li><li><p>We receive the ciphertext and the shared secret.</p></li><li><p>We call the decryption function of FrodoPKE: <i>message ← Decrypt(shared secret, ciphertext)</i>.</p></li><li><p>We hash: <i>(r , k) ← G2(pkh || message)</i>.</p></li><li><p>We call the <i>Encryption</i> function of FrodoPKE: <i>ciphertext1 ← Encrypt(message, pk, r)</i>.</p></li><li><p>If <i>ciphertext1 == ciphertext</i>, <i>k = k0</i>; else, <i>k = s</i>.</p></li><li><p>We hash: <i>ss ← F(ciphertext || k)</i>.</p></li><li><p>We return the shared secret <i>ss</i>.</p></li></ol><p>What this algorithm achieves is the generation of a shared secret and ciphertext which can be used to establish a secure channel. It also means that no matter how many ciphertexts Hades sends to the decryption oracle, they will never reveal the content of a valid ciphertext that Hades himself did not generate. This is ensured when we run the encryption process again in <i>Decapsulate</i> to check if the ciphertext was computed correctly, which ensures that an adversary cannot craft valid ciphertexts simply by modifying them.</p><p>With this last doll, the algorithm has been created, and it is safe in the face of a quantum adversary.</p>
    <div>
      <h3>Other KEMs beyond Frodo</h3>
      <a href="#other-kems-beyond-frodo">
        
      </a>
    </div>
    <p>While the <a href="https://en.wikipedia.org/wiki/Frodo_Baggins">ring bearer,</a> Frodo, wanders around and transforms, he was not alone in his journey.  FrodoKEM is currently designated as an alternative candidate for standardization as part of the post-quantum NIST process. But, there are others:</p><ul><li><p>Kyber, NTRU, Saber: which are based on variants of the LWE problem over lattices and,</p></li><li><p>Classic McEliece: which is based on error correcting codes.</p></li></ul><p>The lattice-based variants have the advantage of being fast, while producing relatively small keys and ciphertexts. There are concerns about <a href="https://www.youtube.com/watch?v=iAjkEF0x5qw&amp;ab_channel=SimonsInstitute">their</a> <a href="https://www.youtube.com/watch?v=K5Apl_qCnDA&amp;ab_channel=SimonsInstitute">security</a>, which need to be properly verified, however. More confidence is found in the security of the Classic McEliece scheme, as its underlying problem has been studied for longer (It is only one year older than RSA!). It has a disadvantage: it produces extremely large public keys. Classic-McEliece-348864 for example, produces public keys of size 261,120 bytes, whereas Kyber512, which claims comparable security, produces public keys of size 800 bytes.</p><p>They are all Matryoshka dolls (including sometimes non-post-quantum ones). They are all algorithms that are placed one inside the other. They all start with a small but powerful idea: a mathematical problem whose solution is hard to find in an efficient time. They then take the algorithm approach and achieve one cryptographic security. And, by the magic of hashes and length preservation, they achieve more cryptographic security. This just goes to show that cryptographic algorithms are not perfect in themselves; they stack on top of each other to get the best of each one. Facing quantum adversaries with them is the same, not a process of isolation but rather a process of stacking and creating the big picture from the smallest one.</p>
    <div>
      <h3>References:</h3>
      <a href="#references">
        
      </a>
    </div>
    <ul><li><p>NIST Post-Quantum Cryptography process FAQ: <a href="https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs">https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs</a></p></li><li><p>“A Decade of Lattice Cryptography” by Chris Peikert: <a href="https://eprint.iacr.org/2015/939.pdf">https://eprint.iacr.org/2015/939.pdf</a></p></li><li><p>“FrodoKEM: Learning With Errors Key Encapsulation Algorithm Specifications and Supporting Documentation” by Erdem Alkim, Joppe W. Bos, Léo Ducas, Patrick Longa, Ilya Mironov, Michael Naehrig, Valeria Nikolaenko, Chris Peikert, Ananth Raghunathan and Douglas Stebila: <a href="https://frodokem.org/files/FrodoKEM-specification-20171130.pdf">https://frodokem.org/files/FrodoKEM-specification-20171130.pdf</a></p></li><li><p>“The Learning with Errors Problem” by Oded Regev: <a href="https://cims.nyu.edu/~regev/papers/lwesurvey.pdf">https://cims.nyu.edu/~regev/papers/lwesurvey.pdf</a></p></li><li><p>“Wonk post: chosen ciphertext security in public-key encryption” by Matthew Green: <a href="https://blog.cryptographyengineering.com/2018/07/20/wonk-post-chosen-ciphertext-security-in-public-key-encryption-part-2/">https://blog.cryptographyengineering.com/2018/07/20/wonk-post-chosen-ciphertext-security-in-public-key-encryption-part-2/</a></p></li><li><p>“A Designer's Guide to KEMs” by Alexander W. Dent: <a href="https://eprint.iacr.org/2002/174">https://eprint.iacr.org/2002/174</a></p></li><li><p>“A Modular Analysis of the Fujisaki-Okamoto Transformation” by Dennis Hofheinz, Kathrin Hövelmanns and Eike Kiltz: <a href="https://eprint.iacr.org/2017/604.pdf">https://eprint.iacr.org/2017/604.pdf</a></p></li></ul><p></p> ]]></content:encoded>
            <category><![CDATA[Research]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Post-Quantum]]></category>
            <guid isPermaLink="false">49wRKGXrzIHjgTPhrb6x4w</guid>
            <dc:creator>Goutam Tamvada</dc:creator>
            <dc:creator>Sofía Celi</dc:creator>
        </item>
        <item>
            <title><![CDATA[Deep dive into a post-quantum signature scheme]]></title>
            <link>https://blog.cloudflare.com/post-quantum-signatures/</link>
            <pubDate>Tue, 22 Feb 2022 13:59:15 GMT</pubDate>
            <description><![CDATA[ How can one attest to an identity and prove it belongs to one self? And how can one do it in the face of quantum computers? In this blog post, we examine these questions and explain what post-quantum signatures are ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1ewsKSumB2t0mCKIp9i1yo/6d79a6e2ec066820b1c17bdb06fb96fe/image6-5.png" />
            
            </figure><p>To provide authentication is no more than to assert, to provide proof of, an identity. We can claim who we claim to be but if there is no proof of it (recognition of our face, voice or mannerisms) there is no assurance of that. In fact, we can claim to be someone we are not. We can even claim we are someone that does not exist, as clever Odysseus did once.</p><p>The story goes that there was a man named <a href="https://en.wikipedia.org/wiki/Odysseus">Odysseus</a> who angered the gods and was punished with perpetual wandering. He traveled and traveled the seas meeting people and suffering calamities. On one of his trips, he came across the <a href="https://en.wikipedia.org/wiki/Polyphemus">Cyclops Polyphemus</a> who, in short, wanted to eat him. Clever Odysseus got away (as he usually did) by wounding the cyclops’ eye. As he was wounded, he asked for Odysseus name to which the latter replied:</p><blockquote><p>“Cyclops, you asked for my glorious name, and I will tell it; but do give the stranger's gift, just as you promised. <i>Nobody</i> I am called. <i>Nobody</i> they called me: by mother, father, and by all my comrades”</p></blockquote><p><i>(As seen in </i><a href="https://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A1999.01.0135%3Abook%3D9%3Acard%3D360"><i>The Odyssey, book 9</i></a><i>. Translation by the authors of the blogpost).</i></p><p>The cyclops believed that was Odysseus' name (<a href="https://en.wikipedia.org/wiki/Outis">Nobody</a>) and proceeded to tell everyone, which resulted in no one believing him. “How can nobody have wounded you?” they questioned the cyclops. It was a trick, a play of words by Odysseus. Because to give an identity, to tell the world who you are (or who you are pretending to be) is easy. To provide proof of it is very difficult. The cyclops could have asked Odysseus to prove who he was, and the story would have been different. And Odysseus wouldn’t have left the cyclops laughing.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Pkg7X1JgYTojfc5AgbTxY/ce721f84c91d55c5e110a3e4d57c7f04/image1-17.png" />
            
            </figure><p>In the digital world, proving your identity is more complex. In face-to-face conversations, we can often attest to the identity of someone by knowing and verifying their face, their voice, or by someone else introducing them to us. From computer to computer, the scenario is a little different. But there are ways. When a user connects to their banking provider on the Internet, they need assurance not only that the information they send is secured; but that they are also sending it to their bank, and not a malicious website masquerading as their provider. The Transport Layer Security (TLS) protocol provides this through digitally signed statements of identity (certificates). Digital signature schemes also play a central role in <a href="https://www.cloudflare.com/learning/dns/dnssec/ecdsa-and-dnssec/">DNSSEC</a> as well, an extension to the <a href="https://www.cloudflare.com/learning/dns/what-is-dns/">Domain Name System (DNS)</a> that protects applications from accepting forged or manipulated DNS data, which is what happens during <a href="https://en.wikipedia.org/wiki/DNS_spoofing">DNS cache poisoning</a>, for example.</p><p>A digital signature is a demonstration of authorship of a document, conversation, or message sent using digital means. As with “regular” signatures, they can be publicly verified by anyone that knows that it is a signature made by someone.</p><p>A digital signature scheme is a collection of three algorithms:</p><ol><li><p>A key generation algorithm, <i>Generate</i>, which generates a public verification key and a private signing key (a keypair).</p></li><li><p>A signing algorithm, <i>Sign</i>, which takes the private signing key, a message, and outputs a signature of the message.</p></li><li><p>A verification algorithm, <i>Verify</i>, which takes the public verification key, the signature and the message, and outputs a value stating whether the signature is valid or not.</p></li></ol><p>In the case of the Odysseus' story, what the cyclops could have done to verify his identity (to verify that he indeed was <i>Nobody</i>) was to ask for a proof of identity: for example, for other people to vouch that he is who he claims to be. Or he could have asked for a digital signature (attested by several people or registered as his own) attesting he was <i>Nobody.</i> Nothing like that happened, so the cyclops was fooled.</p><p>In the Transport Layer Security protocol, TLS, authentication needs to be executed at the time a connection or conversation is established (as data sent after this point will be authenticated until that is explicitly disabled), rather than for the full lifetime of the data (as with confidentiality). Because of that, the need to transition to post-quantum signatures is not as urgent as it is for post-quantum key exchange schemes, and we do not believe there are sufficiently powerful quantum computers at the moment that can be used to listen in on connections and forge signatures. At some point, that will no longer be true, and the transition will have to be made.</p><p>There are various candidates for authentication schemes (including digital signatures) that are quantum secure: some use cryptographic hash functions, some use problems over lattices, while others use techniques from the field of <a href="https://en.wikipedia.org/wiki/Secure_multi-party_computation">multi-party computation</a>. It is also possible to use Key Encapsulation Mechanisms (or KEMs) to achieve authentication in cryptographic protocols.</p><p>In this post, much like in the one about <a href="/post-quantum-key-encapsulation">Key Encapsulation Mechanisms</a>, we will give a bird’s-eye view of the construction of one particular post-quantum signature algorithm. We will discuss <a href="https://pq-crystals.org/dilithium/data/dilithium-specification-round3.pdf">CRYSTALS-Dilithium</a>, as an example of how a signature scheme can be constructed. Dilithium is a finalist candidate in the <a href="https://csrc.nist.gov/Projects/post-quantum-cryptography/round-3-submissions">NIST post-quantum cryptography standardization process</a> and provides an example of a standard technique used to construct digital signature schemes. We chose to explain Dilithium here as it is a finalist and its design is straightforward to explain.</p><p>We will again build the algorithm up layer-by-layer. We will look at:</p><ul><li><p>Its mathematical underpinnings: as we see in <a href="/post-quantum-key-encapsulation">other blog posts</a>, a cryptographic algorithm can be built as a Matryoshka doll or a <a href="https://en.wikipedia.org/wiki/Chinese_boxes">Chinese box</a>. Let us use the Chinese box analogy here. The first box, in this case, is the mathematical base, whose hardness should be strong so that security is maintained. In the post-quantum world, this is usually the hardness of some lattice or isogeny problems.</p></li><li><p>Its algorithmic construction: these are all the subsequent boxes that take the mathematical base and construct an algorithm out of it. In the case of a signature, first one constructs an identification scheme, which we will define in the next sections, and then transform it to a signature scheme using the <a href="https://www.iacr.org/archive/asiacrypt2009/59120596/59120596.pdf">Fiat-Shamir transformation</a>.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6HkQpmpEYsnuu4tZx9NM9C/3f22f53e364162d3ed551bc5cc06fce9/image5-6.png" />
            
            </figure><p>The mathematical core of <i>Dilithium</i> is, as with <a href="https://csrc.nist.gov/Projects/post-quantum-cryptography/round-3-submissions">FrodoKEM</a>, based on the hardness of a variant of the Learning with Errors (LWE) problem and the Short Integer Solution (SIS) problem. As we have already <a href="/post-quantum-key-encapsulation">talked about LWE</a>, let’s now briefly go over SIS.</p><p><b>Note to the reader</b>: Some mathematics is coming in the next sections; but don’t worry, we will guide you through it.</p>
    <div>
      <h3>The Short Integer Solution Problem</h3>
      <a href="#the-short-integer-solution-problem">
        
      </a>
    </div>
    <p>In order to properly explain what the SIS problem is, we need to first start by understanding what a <i>lattice</i> is. A lattice is a regular repeated arrangement of objects or elements over a space. In geometry, these objects can be points; in physics, these objects can be atoms. For our purposes, we can think of a lattice as a set of points in <i>n</i>-dimensional space with a periodic (repeated) structure, as we see in the image. It is important to understand the meaning of <i>n</i>-dimensional space here: a two-dimensional space is, for example, the one that we often see represented on planes: a projection of the physical universe into a plane with two dimensions which are length and width. Historically, lattices have been investigated since the late 18th century for various reasons. For a more comprehensive introduction to lattices, you can read this <a href="https://cims.nyu.edu/~regev/papers/qcrypto.pdf">great paper</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4XTU1HRx6QrSZx9fsPjhEa/0a51d0469b64c83428759635be0c5c88/image4-11.png" />
            
            </figure><p>Picture of a lattice. They are found in the wild in Portugal.</p><p>What does <a href="https://crypto.stanford.edu/cs355/18sp/lec9.pdf">SIS</a> pertain to? You are given a positive integer <i>q</i> and a <a href="https://en.wikipedia.org/wiki/Matrix_(mathematics)">matrix</a> (a rectangular array of numbers) <i>A</i> of dimensions <i>n x m</i> (the number of rows is <i>n</i> and the number of columns is <i>m</i>), whose elements are integers between 0 and a number <i>q</i>. You are then asked to find a <a href="https://en.wikipedia.org/wiki/Vector_(mathematics_and_physics)">vector</a> <i>r</i> (smaller than a certain amount, called the “norm bound”) such that <i>Ar = 0</i>. The conjecture is that, for a sufficiently large <i>n</i>, finding this solution is hard even for quantum computers. This problem is “dual” to the LWE problem that we explored in <a href="/post-quantum-key-encapsulation">another blog post</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/26WDPtAXRotNflQ4IqzL0s/e7bdb4a467589e0db87f950e4482306c/image2-18.png" />
            
            </figure><p>We can define this same <a href="https://web.eecs.umich.edu/~cpeikert/pubs/slides-abit2.pdf">problem over a lattice</a>. Take a lattice <i>L(A)</i>, made up of <i>m</i> different <i>n</i>-dimensional vectors <i>y</i> (the repeated elements)<i>.</i> The goal is to find non-zero vectors in the lattice such that <i>Ay = 0 (mod q)</i> (for some <i>q</i>), whose size is less than a certain specified amount. This problem can be seen as trying to find the “short” solutions in the lattice, which makes the problem the <a href="https://en.wikipedia.org/wiki/Lattice_problem#Shortest_vector_problem_(SVP)">Short Vector Problem</a> (SVP) in the average case. Finding this solution is simple to do in two dimensions (as seen in the diagram), but finding the solution in more dimensions is hard.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3CDPZWUUhMGnb2VKGMoxyG/eedf163a85ea7567b55003d382fe8b21/image3-20.png" />
            
            </figure><p>The SIS problem as the SVP. The goal is to find the “short” vectors in the radius.</p><p>The SIS problem is often used in cryptographic constructions such as one-way functions, collision resistant hash functions, digital signature schemes, and identification schemes.</p><p>We have now built the first Chinese box: the mathematical base. Let’s take this base now and create schemes from it.</p>
    <div>
      <h3>Identification Schemes</h3>
      <a href="#identification-schemes">
        
      </a>
    </div>
    <p>From the mathematical base of our Chinese box, we build the first computational algorithm: an identification scheme. An identification scheme consists of a key generation algorithm, which outputs a public and private key, and an interactive protocol between a prover <i>P</i> and a verifier <i>V</i>. The prover has access to the public key and private key, and the verifier only has access to the public key. A series of messages are then exchanged such that the prover can demonstrate to the verifier that they know the private key, without leaking any other information about the private key.</p><p>More specifically, a three-move (three rounds of interaction) identification scheme is a collection of algorithms. Let’s think about it in the terms of Odysseus trying to prove to the cyclops that he is <i>Nobody</i>:</p><ul><li><p>Odysseus (the prover) runs a key generation algorithm, <i>Generate</i>, that outputs a public and private keypair.</p></li><li><p>Odysseus then runs a commitment algorithm, <i>Commit,</i> that uses the private key, and outputs a commitment <i>Y</i>. The commitment is nothing more than a statement that this specific private key is the one that will be used. He sends this to the cyclops.</p></li><li><p>The cyclops (the verifier) takes the commitment and runs a challenge algorithm, <i>Challenge</i>, and outputs a challenge <i>c</i>. This challenge is a question that asks: are you really the owner of the private key?</p></li><li><p>Odysseus receives the challenge and runs a response algorithm, <i>Response</i>. This outputs a response <i>z</i> to the challenge. He sends this value to the cyclops.</p></li><li><p>The cyclops runs the verification algorithm, <i>Verify</i>, which outputs either accept (1) or reject (0) if the answer is correct.</p></li></ul><p>If Odysseus was really the owner of the private key for <i>Nobody</i>, he would have been able to answer the challenge in a positive manner (with a 1). But, as he is not, he runs away (and this is the last time we see him in this blogpost).</p>
    <div>
      <h3>The Dilithium Identification Scheme</h3>
      <a href="#the-dilithium-identification-scheme">
        
      </a>
    </div>
    <p>The basic building blocks of Dilithium are polynomials and rings. This is the second-last box of the Chinese box, and we will explore it now.</p><p>A polynomial ring, <i>R</i>, is a <a href="https://en.wikipedia.org/wiki/Ring_(mathematics)">ring</a> of all polynomials. A ring is a set in which two operations can exist: addition and multiplication of integers; and a polynomial is an expression of variables and coefficients. The “size” of these polynomials, defined as the size of the largest coefficient, plays a crucial role for these kinds of algorithms.</p><p>In the case of Dilithium, the <i>Generation</i> algorithm creates a <i>k x l</i> matrix <i>A</i>. Each entry of this matrix is a polynomial in the defined ring. The generation algorithm also creates random private vectors <i>s1</i> and <i>s2</i>, whose components are elements of <i>R</i>, the ring_._ The public key is the matrix <i>A</i> and <i>t = As1 + s2</i>. It is infeasible for a quantum computer to know the secret values given just <i>t</i> and <i>A</i>. This problem is called Module-Learning With Errors (MLWE) problem, and it is a variant of LWE as seen <a href="/post-quantum-key-encapsulation">in this blog post</a>.</p><p>Armed with the public and private keys, the Dilithium <i>identification scheme</i> proceeds as follows (some details are left out for simplicity, like the rejection sampling):</p><ol><li><p>The prover wants to prove they know the private key. They generate a random secret nonce y whose coefficient is less than a security parameter. They then compute Ay and set a commitment w1 to be the “high-order”<sup>1</sup> bits of the coefficients in this vector.</p></li><li><p>The verifier accepts the commitment and creates a challenge c.</p></li><li><p>The prover creates the potential signature z = y + cs1 (notice the usage of the random secret nonce and of the private key) and performs checks on the sizes of several parameters which makes the signature secure. This is the answer to the challenge.</p></li><li><p>The verifier receives the signature and computes w1 to be the “high-order” bits of Az−ct (notice the usage of the public key). They accept this answer if all the coefficients of z are less than the security parameter, and if w1 is equal to w0.</p></li></ol><p>The identity scheme previously mentioned is an interactive protocol that requires participation from both parties. How do we turn this into a non-interactive signature scheme where one party issues signatures and other parties can verify them (the reason for this conversation is that anyone should be able to publicly verify)? Here, we place the last Chinese box.</p><p>A three-move identification scheme can be turned into a signature scheme using the Fiat–Shamir transformation: instead of the verifier accepting the commitment and sending a challenge <i>c</i>, the prover computes the challenge as a hash <i>H(M || w1)</i>  of the message <i>M</i> and of the value <i>w1</i> (computed in step 1 of the previous scheme). This is an approach in which the signer has created an instance of a lattice problem, which only the signer knows the solution to.</p><p>This in turn means that if a message was signed with a key, it could have only been signed by the person with access to the private key, and it can be verified by anyone with access to the public key.</p><p>How is this procedure related to the lattice’s problems we have seen? It is used to prove the security of the scheme: specifically the M-SIS (module SIS) problem and the LWE decisional problem.</p><p>The Chinese box is now constructed, and we have a digital signature scheme that can be used safely in the face of quantum computers.</p>
    <div>
      <h3>Other Digital Signatures beyond Dilithium</h3>
      <a href="#other-digital-signatures-beyond-dilithium">
        
      </a>
    </div>
    <p>In Star Trek, <a href="https://en.wikipedia.org/wiki/Dilithium_(Star_Trek)"><i>Dilithium</i></a> is a rare material that cannot be replicated. Similarly, signatures cannot be replicated or forged: each one is unique. But this does not mean that there are no other algorithms we can use to generate post-quantum signatures. Dilithium is currently designated as a finalist candidate for standardization as part of the post-quantum NIST process. But, there are others:</p><ul><li><p><a href="https://falcon-sign.info/">Falcon</a>, another lattice-based candidate, based on NTRU lattices.</p></li><li><p><a href="https://www.pqcrainbow.org/">Rainbow</a>, a scheme based on multivariate polynomials.</p></li></ul><p>We have seen examples of KEMs in <a href="/post-quantum-key-encapsulation">other blog posts</a> and signatures that are resistant to attacks by quantum computers. Now is the time to step back and take a look at the bigger picture. We have the building blocks, but the problem of actually building post-quantum secure cryptographic protocols with them remains, as well as making existing protocols such as TLS post-quantum secure. This problem is not entirely straightforward, owing to the trade-offs that post-quantum algorithms present. As we have carefully stitched together mathematical problems and cryptographic tools to get algorithms with the properties we desire, so do we have to carefully compose these algorithms to get the secure protocols that we need.</p>
    <div>
      <h3>References:</h3>
      <a href="#references">
        
      </a>
    </div>
    <ul><li><p>“Fiat-Shamir With Aborts: Applications to Lattice and Factoring-Based Signatures” by Vadim Lyubashevsky: <a href="https://www.iacr.org/archive/asiacrypt2009/59120596/59120596.pdf">https://www.iacr.org/archive/asiacrypt2009/59120596/59120596.pdf</a></p></li><li><p>“A Concrete Treatment of Fiat-Shamir Signatures in the Quantum Random-Oracle Model” by Eike Kiltz, Vadim Lyubashevsky and Christian Schaffner: <a href="https://eprint.iacr.org/2017/916.pdf">https://eprint.iacr.org/2017/916.pdf</a></p></li><li><p>“On Lattices, Learning with Errors, Random Linear Codes, and Cryptography” by Oded Regev: <a href="https://cims.nyu.edu/~regev/papers/qcrypto.pdf">https://cims.nyu.edu/~regev/papers/qcrypto.pdf</a></p></li><li><p>“CRYSTALS: (Cryptographic Suite for Algebraic Lattices) Dilithium” by Léo Ducas, Eike Kiltz, Tancrede Lepoint, Vadim Lyubashevsky, Peter Schwabe, Gregor Seiler and Damien Stehle: <a href="https://csrc.nist.gov/CSRC/media/Presentations/crystals-dilithium-round-2-update/images-media/crystals-dilithium-lyubashevsky.pdf">https://csrc.nist.gov/CSRC/media/Presentations/crystals-dilithium-round-2-update/images-media/crystals-dilithium-lyubashevsky.pdf</a></p></li><li><p>“The Design and Cryptanalysis of Post-Quantum Digital Signature Algorithms” by Ward Beullens: <a href="https://www.esat.kuleuven.be/cosic/publications/thesis-417.pdf">https://www.esat.kuleuven.be/cosic/publications/thesis-417.pdf</a></p></li><li><p>“How To Prove Yourself: Practical Solutions to Identification and Signature Problems” by Amos Fiat and Adi Shamir: <a href="https://link.springer.com/content/pdf/10.1007/3-540-47721-7_12.pdf">https://link.springer.com/content/pdf/10.1007/3-540-47721-7_12.pdf</a></p></li></ul><p>.....</p><p><sup>1</sup>This “high-order” and “low-order” procedure decomposes a vector, and there is a specific procedure for this for Dilithium. It aims to reduce the size of the public key.</p> ]]></content:encoded>
            <category><![CDATA[Research]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Post-Quantum]]></category>
            <guid isPermaLink="false">U0ZZL2iHPnagcIJvsEI3A</guid>
            <dc:creator>Goutam Tamvada</dc:creator>
            <dc:creator>Sofía Celi</dc:creator>
        </item>
    </channel>
</rss>