<?xml version="1.0" encoding="UTF-8"?><rss 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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eduardo Antuña Díez on Medium]]></title>
        <description><![CDATA[Stories by Eduardo Antuña Díez on Medium]]></description>
        <link>https://medium.com/@eduadiez?source=rss-41a607904e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S5pSn7BPVlWXF8T4J-fiCQ.jpeg</url>
            <title>Stories by Eduardo Antuña Díez on Medium</title>
            <link>https://medium.com/@eduadiez?source=rss-41a607904e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 15:20:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eduadiez/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Perpetual Powers of Tau Ceremony on an Intel SGX]]></title>
            <link>https://medium.com/@eduadiez/perpetual-powers-of-tau-ceremony-on-an-intel-sgx-88c7ca62d0e3?source=rss-41a607904e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/88c7ca62d0e3</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[intel-sgx]]></category>
            <category><![CDATA[zksnark]]></category>
            <dc:creator><![CDATA[Eduardo Antuña Díez]]></dc:creator>
            <pubDate>Fri, 31 Jan 2020 18:28:57 GMT</pubDate>
            <atom:updated>2020-01-31T18:28:57.155Z</atom:updated>
            <content:encoded><![CDATA[<p>The Ethereum community has recently launched a multi-party trusted setup we dub the <a href="https://medium.com/coinmonks/announcing-the-perpetual-powers-of-tau-ceremony-to-benefit-all-zk-snark-projects-c3da86af8377">Perpetual Powers of Tau Ceremony</a>. You have a great explanation of what it is in the linked article, but I will try to make an informal explanation here:</p><p>There are broadly three types of zero-knowledge proofs categorized by their setups: 1) STARKS do not require trusted setup, at the cost of a greater size proof. 2) SONIC and PLONK need an universal trusted setup but no specific setups per circuit, at the trade off of proof computations being longer. And 3) SNARKs, which require a universal trusted setup + a specific setup per circuit. The smaller and shorter proofs are traded for the need for both universal and specific setups. We are going to focus on the SNARK technology and what is described below can be applied in both the universal and the specific setups.</p><p>zk-SNARK circuits require what is called a “trusted setup” in order to be deployed with a proving key and a verifying key. The generation of such keys produces a series of numbers that must be destroyed because they would allow anyone to produce fake proofs. Since this would defy the security purpose of zk-SNARKS, these numbers are called “toxic waste” and must be eliminated. We call the process “trusted” because we are trusting whoever generated the circuit to have eliminated these numbers and for nobody else to have acquired them.</p><p>To minimize this security concerns, the Perpetual Powers of Tau Ceremony allows multiple participants to perform a trusted setup sequentially, and adding their results to a public transcript so the protocol can be entirely verified, creating a “chain of trusted setups” that can be used as a circuit itself as a whole. If only one of the participants has successfully eliminated the toxic waste, the whole protocol can be considered secure even if all other participants coordinate to attack the system or are compromised by an attacker.</p><p>Again, decentralization and variety of approaches is the name of the game: the more people participate using a variety of countermeasures to secure the elimination of toxic waste, the more likely the protocol can be used safely, because it becomes harder to attack everyone successfully or to maliciously coordinate with everyone in an open ceremony that anyone can join without disclosing who they are.</p><p>In order to provide for another layer of security and another method to protect the toxic waste from “leaking” from the trusted setup, we are going to use the Intel Secure Guard eXtensions (SGX) in order to <strong>generate the proof and eliminate the toxic waste, all inside a secure enclave of memory that nobody, not even the initiator of the ceremony, can access.</strong> Since the toxic waste never leaves the enclave and gets eliminated immediately after the generation, we have a high degree of security that it won’t be compromised.</p><p>Also briefly, SGX is a set of security-related instruction codes built into modern Intel CPUs. They allow the creation of “enclaves”, private regions of memory that cannot be read or saved by any process outside of the enclave itself, no matter the privilege level. It uses encryption by the CPU, which is decrypted on the fly within the CPU and only for code within the enclave itself. All processes outside of the enclave are considered hostile and therefore cannot access the memory.</p><p>We can’t assure that an execution inside an enclave it’s completely secure, as it is well known that the Intel SGX has been broken several times over the last few years, but it significantly reduces the attack surface in this particular case. We can understand the Intel SGX as an extra layer of security.</p><p>Please check <a href="https://www.intel.com/content/www/us/en/security-center/default.html">https://www.intel.com/content/www/us/en/security-center/default.html</a> for the latest Intel CPU security vulnerabilities found.</p><p>Using this implementation means that to obtain and store the toxic values, an attacker you perform an attack to the SGX during the generation of the response. If we assume the initiator of the ceremony is not at the same time the attacker and that other security measures are taken (running the ceremony offline, for example), we can assume that this implementation is harder to attack than the default implementation, since it’s run inside protected memory.</p><p><strong>The perks of this method:</strong></p><p>The powers of tau MPC (Multi Party Computation) can benefit from the execution on an enclave at 3 different levels.</p><ul><li>Generation of a keypair inside an enclave</li><li>SGX Random generator</li><li>Intel Attestation process</li></ul><p><strong>Generation of a keypair inside an enclave</strong></p><p>All the computation related to the private key (toxic waste) happens inside of an enclave without the possibility of getting this toxic waste form the outside in anyway (unless whoever runs the application also performs a successful SGX attack at the same time). This is a pretty good guarantee that we got rid of toxic waste after generation.</p><p><strong>SGX Random Generation</strong></p><p>Another very important point on the powers of tau ceremony is to provide as much entropy as possible from sources which are truly hard to replicate. The libc in SGX doesn’t support rand(), and instead provides the function sgx_read_rand; This function calls the hardware-based pseudorandom generator (PRNG) available in Intel CPUs through the RDRAND instruction. This random generator is then combined with the user’s input entropy, making it more resilient.</p><p><strong>Intel Attestation process</strong></p><p>You can generate a response inside an enclave, but if you can’t prove that it was indeed generated inside of it, why would anyone trust you? To provide this extra layer of trust, the person running the binary is going to get a <em>quote</em>. This quote allows them to get an Intel signed proof that the particular response was generated inside an enclave signed by 0KIMS association (<a href="http://iden3.io/">IDEN3</a>), and also that this response was generated according to Intel security standards. In this quote, the 64 bytes of the `report_data` field are filled with the sha256 hash of the proving/verification key used to generate the report and the sha256 hash of the blake2b of the previous response. This means that this quote is only valid for that specific public key and challenge.</p><p><strong>The building process</strong></p><p>The <a href="https://github.com/apache/mesatee-sgx">Rust SGX SDK</a> was used because it helps writing Intel SGX applications in Rust. Since the current implementation of the ceremony is also implemented in Rust, using this SDK made possible the reuse of most of the code of the original implementation, making it easy to audit or compare it. As a bonus, like this we still have benefit from the multithread capabilities of the current implementation.</p><p>The first part was migrating <a href="https://github.com/eduadiez/ff_ce-sgx">ff_ce</a> (Finite Fields) and <a href="https://github.com/eduadiez/pairing_ce-sgx">pairing_ce</a> Rust libraries from the current powers of tau implementation to make them compatible with rust-sgx (it was also needed to port <a href="https://github.com/eduadiez/byteorder-sgx">byteorder</a> since rust-sgx has its own std libraries sgx_tstd). So now, if you want, you can use them to implement other zero knowledge applications inside an SGX enclave.</p><p>After having all the libraries ready to run within SGX, it was necessary to move all the random generation inside the enclave so the toxic waste is protected and not even whoever executes it can access it. The only thing that can be obtained externally through an ecall call is the proving/verification key (public key) that identifies the toxic waste.</p><p>Finally, the binary generated is needed to ensure that you are running the enclave from the source code that the repository has, and you must be able to verify it. For that you can follow the instructions from the repository, but as a summary, since it’s a reproducible build you can get the MR_ENCLAVE value and check that it’s the same as the provided binary.</p><p>You can review all the work done on the <a href="https://github.com/eduadiez/PowersOfTau-SGX">PowersOfTauSGX</a> repository. If you would like to be part of this MPC you have a public <a href="https://groups.google.com/a/ethereum.org/forum/?hl=en#!forum/perpetual-powers-of-tau-ceremony-group">mailing list</a> where interested parties can coordinate to schedule their involvement. The attestations and participation instructions can be found on <a href="https://github.com/weijiekoh/perpetualpowersoftau">this Github repository</a>. Interested members of the community should join the mailing list to get involved.</p><p><strong>The result</strong></p><p>Recently, I had the opportunity to participate in the ceremony contributing to it with the result generated by this implementation as the participant number <a href="https://github.com/weijiekoh/perpetualpowersoftau/tree/master/0020_edu_response">20</a>.</p><p>As a result of the `compute_constrained_sgx` execution, in addition to the response file necessary for the ceremony, a file with the quote is generated. This JSON file allows us to verify the execution and generation of the proving/verification key within the enclave by calling the Intel Attestation services.</p><blockquote>X-IASReport-Signature: G9mOXkfiIbK3m5v…</blockquote><blockquote>X-IASReport-Signing-Certificate: — — -BEGIN%20CERTIFICATE — — -</blockquote><blockquote>{“id”:”204955653670173282863145566959457621871&quot;,”timestamp”:”2020–01–28T12:20:20.947848&quot;,”version”:3,”isvEnclaveQuoteStatus”:”OK”,”isvEnclaveQuoteBody”:”AgAAAIYLAAAKAAkAAAAAAODpGN28hJIVaOQDutDJ/Ah17UYs7+opWcNky9jY4V16AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAADAAAAAAAAAFezT7RffLAzldx+6OtJPKYG0p1OtHfZ92R5aJyM/rvqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw56oBvWVB3AC6ZGkHrQLUnWvkTcvZllW8HAzyCD0ZOgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC9/XWWRh64ji3oG5Bx3J8jX33ExQkpMJhutfOjzaxfTAR1fRt1sRSWNBRrBauzj655gRAkNpHhynhAe9mjB0fi”}</blockquote><p>After calling the Intel Attestation service we get an “OK” on the “isvEnclaveQuoteStatus” object from the json response (you can check on the <a href="https://github.com/weijiekoh/perpetualpowersoftau/blob/master/0020_edu_response/0020_edu_response.md">official response</a> the full results) which validates the content of the “isvEnclaveQuoteBody”. On the other hand Intel signs the response provided by using the “X-IASReport-Signature” and “X-IASReport-Signing-Certificate” headers.</p><p>The “isvEnclaveQuoteBody” allow us to discover the proving/verification key (public key) generated on that enclave and the Blake2b hash from the previous participant.</p><p>In this case the “report_data” from the “isvEnclaveQuoteBody” is:</p><blockquote>bdfd7596461eb88e2de81b9071dc9f235f7dc4c5092930986eb5f3a3cdac5f4c04757d1b75b1149634146b05abb38fae798110243691e1ca78407bd9a30747e2</blockquote><p>Where its first part is the public part of the keypair used to generate the response (the proving/verification key is written at the end of the response and has a size of 768 bytes):</p><blockquote>$ shasum -a 256 &lt;(xxd -s -768 -ps response | tr -d \n) bdfd7596461eb88e2de81b9071dc9f235f7dc4c5092930986eb5f3a3cdac5f4c</blockquote><p>and the second one is the sha256 of the previous blake2b challenge hash:</p><blockquote>$ echo -n “5bfc69715a5f57d29170410c04cfb19db079de9da94f9b81770d7cfd6cfb7b14d05e3268596722a6546a40b679194ce9682d395623a664a9a7d836c967a41d7d” | shasum -a 256</blockquote><blockquote>04757d1b75b1149634146b05abb38fae798110243691e1ca78407bd9a30747e2 -</blockquote><p>As a conclusion we can say that we were able to have a signed Intel Attestation proof that the toxic waste has been generated within an enclave with the sole purpose of generating a response using the hash corresponding to the previous participant.</p><p>The next steps in this work are to provide a SGX binary that allows the generation of the necessary material for the Phase II. This will help to projects that wish to demonstrate that they have used the Perpetual Power of Tau ceremony to generate their circuit and that they have been carried out within a SGX enclave, which offers a high degree of confidence to their users.</p><p>For more information, please check the repo <a href="https://github.com/eduadiez/PowersOfTau-SGX/">here</a> and the Powers of Tau ceremony <a href="https://github.com/weijiekoh/perpetualpowersoftau">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88c7ca62d0e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>