Zcash 백서

Zcash

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 23쪽

OMM ′𝑟(SHA256Compress(𝑥)||𝑦) . Suppose we make the reasonable assumption that COMM′ is a computationallybindingandhiding commitment scheme. If SHA256Compress iscollision-resistantwith the standard IV 15, then NoteCommitSprout is as secure forbindingas COMM′. Also NoteCommitSprout is as secure forhidingas COMM′ (without any assumption onSHA256Compress). This effectively rules out potential concerns about the Merkle–Damgård structure [Damgård1989] of SHA-256 causing any security problem forNoteCommit Sprout. [ Sprout]Note: Sprout-pool note commitmentsare not statisticallyhiding, so for Sprout-pool notes,Zcashdoes not support the “everlasting anonymity” property described in [BCGGMTV2014, section 8.1], even when used as described in that section. While it is possible to define a statisticallyhiding, computationallybinding commitment schemefor this use at a 128-bit security level, the overhead of doing so within theJoinSplit statementwas not considered to justify the benefits. [ Sapling onward] In Sapling,PedersenorSinsemillacommitments are used instead of SHA256Compress. These commitments are statisticallyhiding, and so “everlasting anonymity” is supported for Sapling-pool and Orchard-pool notesunder the same conditions as inZerocash(by the protocol, not necessarily by zcashd). Note thatdiversified payment addressescan be linked if theDecisional Diffie–Hellman Problemon theJubjub curveor thePallas curve can be broken. 15IfSHA256Compressis notcollision-resistantwith the standard IV, thenSHA-256is notcollision-resistantfor a2-block input. 151 8.6 Changes to PRF inputs and truncation #truncation The format of inputs to thePRFsinstantiated in §5.4.2 ‘Pseudo Random Functions’ on p.89 has changed relative toZerocash. There is also a requirement for anotherPRF, PRFρ, which must be domain-separated from the others. In theZerocashprotocol, ρold𝑖 is truncated from256 to 254 bits in the input toPRFsn (which corresponds toPRFnfSprout inZcash). Also, hSig is truncated from 256 to 253 bits in the input to PRFpk. These truncations are not taken into account in the security proofs. Both truncations affect the validity of the proof sketch for Lemma D.2 in the proof of Ledger Indistinguishability in [BCGGMTV2014, Appendix D]. In more detail: • In the argument relating H and ⅁2, it is stated that in ⅁2, “for each 𝑖∈{1,2},sn 𝑖 :=PRF snask(ρ) for a random (and not previously used) ρ” . It is also argued that “the calls toPRFsnask are each by definition unique” . The latter assertion depends on the fact that ρ is “not previously used” . However, the argument is incorrect because the truncated input toPRF snask, i.e.[ρ] 254, may repeat even ifρdoes not. • In the same argument, it is stated that “with overwhelming probability, hSig is unique” . In fact what is required to be unique is the truncated input toPRFpk, i.e. [hSig]253 = [CRH(pksig)]253. In practice this value will be unique under a plausible assumption on CRH provided that pksig is chosen randomly, but no formal argument for this is presented. Note that ρ is truncated in the input to PRFsn but not in the input to COMMrcm, which further complicates the analysis. As further evidence that it is essential for the proofs to explicitly take any such truncations into account, consider a slightly modified protocol in which ρ is truncated in the input to COMMrcm but not in the input to PRFsn. In that case, it would be possible to violate balance by creating twonotesfor which ρ differs only in the truncated bits. Thesenoteswould have the samenote commitmentbut differentnullifiers, so it would be possible to spend the same value twice. [ Sprout] For resistance to Faerie Gold attacks as described in §8.4 ‘Faerie Gold attack and fix’ on p. 149,Zcash depends oncollision resistanceof hSigCRH and PRFρ (instantiated using BLAKE2b-256 and SHA256Compress re- spectively).Collision resistanceof a truncated hash does not follow fromcollision resistanceof the original hash, even if the truncation is only by one bit. This motivated avoiding truncation along any path from the inputs to the computation ofh Sig to the uses ofρ. [ Sprout] Since thePRFsare instantiated using SHA256Compress which has an input block size of 512 bits (of which 256 bits are used for thePRFinput and 4 bits are used for domain separation), it was necessary to reduce the size of the PRF key to 252 bits. The key is set to ask in the case of PRFaddr, PRFnfSprout, and PRFpk, and to φ (which does not exist inZerocash) for PRFρ, and so those values have been reduced to 252 bits. This is preferable to requiring reasoning about truncation, and252bits is quite sufficient for security of these cryptovalues. SaplingusesPedersen hashesand BLAKE2s where Sproutused SHA256Compress.Pedersen hashescan be efficiently instantiated for arbitrary input lengths.BLAKE2s has an input block size of512 bits, and uses a finalization flag rather than padding of the last input block; it also supports domain separation via a personalization parameter distinct from the input. Therefore, there is no need for truncation in the inputs to any of these hashes. Note however that the output of CRHivk is truncated, requiring a security assumption on BLAKE2s truncated to 251 bits (see §5.4.1.5 ‘CRHivk Hash Function’ on p.80). OrchardreplacesPedersen hashesbySinsemilla hasheswhich can also be efficiently instantiated for arbitrary input lengths. It replaces uses of BLAKE2s in the circuit by thecommitment scheme Commitivk, and by a construction for nullifierderivation that uses the Poseidon-based PRFnfOrchard (along with scalar multiplication on thePallas curve). Again, there is no need for truncation in the inputs to any of these functions, and the need for truncation in the derivation ofivkis removed. 152 8.7 In-band secret distribution #inbandrationale Zerocashspecified ECIES (referencing Certicom’s SEC 1 standard) as the encryption scheme used for thein-band secret distribution. This has been changed to akey agreement schemebased on Curve25519 (for Sprout) or Jubjub (for Sapling) and the authenticated encryption algorithm AEAD_CHACHA20_POLY1305. This scheme is still loosely based on ECIES, and on thecrypto_box_sealscheme defined in libsodium [libsodium-Seal]. The motivations for this change were as follows: • TheZerocashpaper did not specify the curve to be used. We believe that Curve25519 has significantside- channelresistance, performance, implementation complexity, and robustness advantages over most other available curve choices, as explained in[Bernstein2006]. For Sapling, theJubjub curvewas designed according to a similar design process following the “Safe curves” criteria [BL-SafeCurves] [Hopwood2018]. This retains Curve25519’s advantages while keepingshielded payment addresssizes short, because the samepublic key material supports both encryption and spend authentication. For Orchard, we define aprime-order curve Pallas[Hopwood2020], with similar advantages toJubjub. • ECIES permits many options, which were not specified. There are at least –counting conservatively– 576 possible combinations of options and algorithms over the four standards (ANSI X9.63, IEEE Std 1363a-2004, ISO/IEC 18033-2, and SEC 1) that define ECIES variants [MÁEÁ2010]. • Although theZerocashpaper states that ECIES satisfieskey privacy(as defined in [BBDP2001]), it is not clear that this holds for all curve parameters and key distributions. For example, if a group of non-prime order is used, the distribution of ciphertexts could be distinguishable depending on the order of the points representing the ephemeral and recipientpublic keys. Public key validity is also a concern. Curve25519 (and Jubjub) key agreement is defined in a way that avoids these concerns due to the curve structure and the “clamping” of private keys(or explicit cofactor multiplication and point validation for Sapling). ThePallas curveis prime- order, but we still validate points, and use a similarkey agreement schemeto Saplingfor consistency and ease of analysis. • Unlike the DHAES/DHIES proposal on which it is based [ABR1999], ECIES does not require a representation of the sender’sephemeral public keyto be included in the input to the KDF, which may impair the security properties of the scheme. (The Std 1363a-2004 version of ECIES [IEEE2004] has a “DHAES mode” that allows this, but the representation of the key input is underspecified, leading to incompatible implementations.) The scheme we use for Sprouthas both the ephemeral and recipientpublic keyencodings –which are unambiguous for Curve25519– and also hSig and a nonce as described below, as input to the KDF. For Saplingand Orchard, it is only possible to include the ephemeral public key encoding, but this is sufficient to retain the original security properties of DHAES. Note that being able to break the Elliptic Curve Diffie–Hellman Problem on Curve25519 or Jubjub or Pallas (without breaking AEAD_CHACHA20_POLY1305 as an authenticated encryption scheme or BLAKE2b-256 as a KDF) would not help to decrypt thetransmitted note(s) ciphertextunless pkenc or pkd is known or guessed. • [ Sprout] The KDF also takes a public seed hSig as input. This can be modeled as using a different “randomness extractor” for eachJoinSplit transfer, which limits degradation of security with the number ofJoinSplit transfers. This facilitates security analysis as explained in [DGKM2011] — see section 7 of that paper for a security proof that can be applied to this construction under the assumption that single-block BLAKE2b-256 is a “weak PRF”. Note thathSig is authenticated, by thezk-SNARK proof, as having been chosen with knowledge of aoldsk,1..Nold, so an adversary cannot modify it in a ciphertext from someone else’s transaction for use in a chosen-ciphertext attack without detection. (In Saplingand Orchard, there is no equivalent to hSig, but the binding signatureandspend authorization signaturesprevent such modifications.) • [ Sprout] The scheme used by Sproutincludes an optimization that reuses the same ephemeral key (with different nonces) for the two ciphertexts encrypted in eachJoinSplit description. The security proofs of [ABR1999] can be adapted straightforwardly to the resulting scheme. Although DHAES as defined in that paper does not pass the recipientpublic keyor a public seed to thehash function 𝐻, this does not impair the proof because we can consider 𝐻 to be the specialization of our KDF to a given recipient key and seed. 153 (Passing the recipientpublic keyto the KDF could in principle compromisekey privacy, but not confidentiality of encryption.) [ Sprout] It is necessary to adapt the “HDH independence” assumptions and the proof slightly to take into account that the ephemeral key is reused for two encryptions. Note that the 256-bit key for AEAD_CHACHA20_POLY1305 maintains a high concrete security level even under attacks using parallel hardware [Bernstein2005] in the multi-user setting [Zaverucha2012]. This is especially neces- sary because the privacy ofZcashtransactions may need to be maintained far into the future, and upgrading the encryption algorithm would not prevent a future adversary from attempting to decrypt ciphertexts encrypted before the upgrade. Other cryptovalues that could be attacked to break the privacy of transactions are also sufficiently long to resist parallel brute force in the multi-user setting: for Sprout, ask is 252 bits, and skenc is no shorter than ask. In Sapling, ivk is an output of CRHivk, which is a 251-bit value. In Orchard, ivk is an 𝑥-coordinate on thePallas curve. This degree of divergence from a uniform distribution on the scalar field is not expected to cause any weakness in noteencryption. For allshielded protocols, the checking ofnote commitmentsmakespartitioning oracle attacks [LGR2021] against thetransmitted note ciphertextinfeasible, at least in the absence ofside-channelattacks. The following argument applies to Saplingand Orchard, but can be adapted to Sproutby replacing ivk with skenc, pkd with pkenc, and using a fixed base. The decryption procedure fortransmitted note ciphertextsin Saplingand Orchardis specified in §4.20.2 ‘Decryption using an Incoming Viewing Key (Sapling and Orchard)’ on p. 71; it ensures that a successful decryption cannot occur unless the decryptednote plaintextencodes anoteconsistent with thenote commitment (encoded as the cm𝑢 field of theOutput descriptionor the cm𝑥 field of theAction description). Suppose that it were feasible to find a pair oftransmitted note ciphertextandnote commitmentthat decrypts successfully for two differentincoming viewing keys ivk1 and ivk2. Assuming that thenote commitment schemeisbindingand that note commitmentopens to anotewith pkd and gd, we must have pkd =KA.Agree(ivk 1,g d) =KA.Agree(ivk 2,g d). But this is impossible given that gd has order greater than the maximum value of ivk that can be an output of CRHivk or Commitivk. There is also a decryption procedure making use ofoutgoing ciphertextsin Saplingand Orchard, as specified in §4.20.3 on p.73. It checks (viaKA.DerivePublic, and also viaPRF expandrseed in the case of post-[ZIP-212] ciphertexts with note plaintext lead byte̸= 0x01) that the decrypted esk value is consistent with thetransmitted note ciphertext, which is protected frompartitioning oracle attacksas described above. It also checks that the pkd value is consistent with thenote commitment. Since these are the only fields in anoutgoing ciphertext, even if apartitioning oracle attackoccurred against anoutgoing ciphertext, it could not result in any equivocation of the decrypted data. Because ovk and ock are each 256 bits,partitioning oracle attacksthat speed up a search for these keys (analogous to the attacks against Password-based AEAD in [LGR2021]) are infeasible, even given knowledge ofivk. 8.8 Omission in Zerocash security proof #crprf The abstractZerocashprotocol requires PRFaddr only to be aPRF; it is not specified to becollision-resistant. This reveals a flaw in the proof of the Balance property. Suppose that an adversary finds a collision on PRFaddr such that a1sk and a2sk are distinctspending keysfor the same apk. Because thenote commitmentis toa pk, but thenullifieris computed froma sk (andρ), the adversary is able to double-spendthe note, once with each ask. This is not detected because each Spend reveals a differentnullifier. TheJoinSplit statementsare still valid because they can only check that the ask in the witness is some preimage of thea pk used in thenote commitment. The error is in the proof of Balance in [BCGGMTV2014, Appendix D.3]. For the “𝒜 violates Condition I” case, the proof says: “(i) If cmold1 =cm old2 , then the fact that snold1 ̸=sn old2 implies that the witness 𝑎 contains two distinct openings of cmold1 (the first opening contains (aoldsk,1,ρ old1 ), while the second opening contains (aoldsk,2,ρ old2 )). This violates the bindingproperty of thecommitment schemeCOMM. " In fact the openings do not contain aoldsk,𝑖; they contain aoldpk,𝑖. (In Sproutcmold𝑖 opens directly to (aoldpk,𝑖,v old𝑖 ,ρ old𝑖 ), and in Zerocashit opens to(v old𝑖 ,COMM s(aoldpk,𝑖,ρ old𝑖 ).) 154 A similar error occurs in the argument for the “𝒜violates Condition II” case. The flaw is not exploitable for the actual instantiations of PRFaddr inZerocashand Sprout, which are collision- resistantassuming thatSHA256Compressis. The proof can be straightforwardly repaired. The intuition is that we can rely oncollision resistanceof PRFaddr (on both its arguments) to argue that distinctness of aoldsk,1 and aoldsk,2, together with constraint 1(b) of theJoinSplit statement(see §4.18.1 ‘JoinSplit Statement (Sprout)’ on p. 63), implies distinctness of aoldpk,1 and aoldpk,2, therefore distinct openings of thenote commitmentwhen Condition I or II is violated. 8.9 Miscellaneous #miscdiffs • The paper defines anoteas ((apk,pk enc),v,ρ,rcm,s,cm) , whereas this specification defines a Sprout-pool note as (apk,v,ρ,rcm) . The instantiation of COMMs in section 5.1 of the paper did not actually uses, and neither does the new instantiation of NoteCommitSprout in Sprout. pkenc is also not needed as part of anote: it is not an input to NoteCommitSprout nor is it constrained by theZerocash POUR statementor theZcashJoinSplit statement. cm can be computed from the other fields. (The definition ofnotesfor Saplingis different again.) • The length of proof encodings given in the paper is288 bytes. [ Sprout] This differs from the 296 bytes specified in §5.4.10.1 ‘BCTV14’ on p. 113, because both the 𝑥-coordinate and compressed 𝑦-coordinate of each point need to be represented. Although it is possible to encode a proof in 288 bytes by making use of the fact that elements of F𝑞 can be represented in 254 bits, we prefer to use the standard formats for points defined in [IEEE2004]. The fork oflibsnarkused byZcashuses this standard encoding rather than the less efficient (uncompressed) one used by upstreamlibsnark. In Sapling, a customized encoding is used for BLS12-381 points inGroth16proofs to minimize length, and similarly forPallasandVestapoints in Orchard. • The range of monetary values differs. InZcashthis range is {0..MAX_MONEY} , while inZerocashit is {0..2 ℓvalue−1}. (TheJoinSplit statementstill only directly enforces that the sum of amounts in a givenJoinSplit transferis in the latter range; this enforcement is technically redundant given that the Balance property holds.) 9 Acknowledgements #acknowledgements The inventors ofZerocashare Eli Ben-Sasson, Alessandro Chiesa, Christina Garman, Matthew Green, Ian Miers, Eran Tromer, and Madars Virza. The designers of theZcashprotocol are theZerocashinventors and also Daira-Emma Hopwood, Sean Bowe, Jack Grigg, Simon Liu, Taylor Hornby, Nathan Wilcox, Zooko Wilcox, Jay Graber, Eirik Ogilvie-Wigley, Ariel Gabizon, George Tankersley, Ying Tong Lai, Kris Nuttycombe, Jack Gavigan, Steven Smith, and Greg Pfeil. TheEquihash proof-of-workalgorithm was designed by Alex Biryukov and Dmitry Khovratovich. The authors would like to thank everyone with whom they have discussed theZerocashandZcashprotocol designs; in addition to the preceding, this includes Mike Perry, isis agora lovecruft, Leif Ryge, Andrew Miller, Ben Blaxill, Samantha Hulsey, Alex Balducci, Jake Tarren, Solar Designer, Ling Ren, John Tromp, Paige Peterson, jl777, Alison Stevenson, Maureen Walsh, Filippo Valsorda, Zaki Manian, Kexin Hu, Brian Warner, Mary Maller, Michael Dixon, Andrew Poelstra, Benjamin Winston, Josh Cincinnati, Kobi Gurkan, Weikeng Chen, Henry de Valence, Deirdre Connolly, Chelsea Komlo, Zancas Wilcox, Jane Lusby, teor, Izaak Meckler, Zac Williamson, Vitalik Buterin, Jakub Zalewski, Oana Ciobotaru, Andre Serrano, Brad Miller, Charlie O’Keefe, David Campbell, Elena Giralt, Francisco Gindre, Joseph Van Geffen, Josh Swihart, Kevin Gorham, Larry Ruane, Marshall Gaucher, Ryan Taylor, Sasha Meyer, Conrado Gouvêa, Aditya Bharadwaj, Andrew Arnott, Arya, Andrea Kobrlova, Lukáš Korba, Honza Rychnovský, Schell Scivally, and no doubt others. We would also like to thank the designers and developers ofBitcoinand BitcoinCore. Zcashhas benefited from security audits performed by NCC Group, Coinspect, Least Authority, Mary Maller, Kudelski Security, QEDIT, and Trail of Bits. We also thank Mary Maller for her work on reviewing the security proofs forHalo 2(any remaining errors are ours). 155 The Faerie Gold attack was found by Zooko Wilcox (who also came up with the name) and Brian Warner. The fix for this attack in Sproutwas proposed by Daira-Emma Hopwood; subsequent analysis of variations on the attack was performed by Daira-Emma Hopwood and Sean Bowe. The internal hash collision attack was found by Taylor Hornby. The error in theZerocashproof of Balance relating tocollision resistanceof PRFaddr was found by Daira-Emma Hopwood. The errors in the proof of Ledger Indistinguishability mentioned in §8.6 ‘Changes to PRF inputs and truncation’ on p.152 were also found by Daira-Emma Hopwood. The
프로젝트로 돌아가기