DOI: 10.5281/zenodo.3752634
title: From A to Z: Projective coordinates leakage in the wild: research data and tooling

description: Description This dataset and software tool are for reproducing the research results related to CVE-2020-10932 and CVE-2020-11735, resulting from the article "From A to Z: Projective coordinates leakage in the wild" (to appear at CHES 2020). The data was used to carry out the attack in Section 6 of the article. Data format txt files The <code>[int].txt</code> files contain an encoded page-fault trace prefixed by <code>trace:</code>. A trace represents the sequence of tracked memory pages that were executed during the generation of an ECDSA signature. The trace is encoded using ASCII characters for better visualization. The encoding follows this table: <pre><code class="language-markdown">| Functions | Symbol | Page offset | | ---------------------- |:------:|:-------:| | _gcry_ecc_ecdsa_sign | T | 0xa1000 | | _gcry_mpi_invm | . | 0xcf000 | | _gcry_mpi_set | S | 0xd5000 | | _gcry_mpi_add | A | 0xcd000 | | _gcry_mpih_sub_n | - | 0xd8000 | | _gcry_mpih_rshift | - | 0xd8000 |</code></pre> <code>_gcry_ecc_ecdsa_sign</code> is the highest level function tracked in the attack. This allows to differentiate different calls to the <code>_gcry_mpi_invm</code> function which contains an insecure version of a Binary Extended Euclidean Algorithm (BEEA). Using these pages it is possible to locate the execution of <code>_gcry_mpi_invm</code> corresponding to the computation of <code>Z mod p</code> during projective to affine coordinates conversion (see <code>preprocess_trace</code> function). It can be seen, that <code>_gcry_mpih_sub_n</code> and <code>_gcry_mpih_rshift</code> shares a page. However, they can be differentiated using mainly the caller memory page. This sharing, instead of being a drawback, allows a straightforward recovery of BEEA execution flow (see <code>extract_Zi</code> and <code>extract_Xi</code> functions in <code>recover_z.py</code>). dat files The format of the <code>[int].dat</code> files is as follows. <code># X [hex]</code>: Ground truth projective output of scalar multiplication, before affine conversion <code># Y [hex]</code>: Ground truth projective output of scalar multiplication, before affine conversion <code># Z [hex]</code>: Ground truth projective output of scalar multiplication, before affine conversion <code># curve_name [str]</code>: The curve (P256) <code># h [hex]</code>: Hash of the message to be signed <code># k [hex]</code>: Ground truth ECDSA nonce <code># q [hex]</code>: Curve order <code># r [hex]</code>: First component of the ECDSA signature <code># s [hex]</code>: Second component of the ECDSA signature <code># x [hex]</code>: Ground truth ECDSA private key <code># y [hex] [hex]</code>: Public key coordinates <code># leak_pad [int],[int],[int]</code>: Leakage recovered during backtracking. Example: <code>0,4,15 =&gt; 0 = k % 2**4 = k & 15</code> Tooling The <code>recover_z.py</code> script Loads a trace. Recovers the corresponding Z coordinate from the trace data. verifies the recovered Z matches the ground truth Z. Example Unpack the data: <pre><code>tar xf traces.tar.gz</code></pre> Run the tooling on trace index 123: <pre><code>$ python2 recover_z.py 123 INFO:recovered Z:65b9b7006bc7b030218bef1b6e569f9f7acaee059b53d669388c6b860f67e213 INFO: real Z:65b9b7006bc7b030218bef1b6e569f9f7acaee059b53d669388c6b860f67e213</code></pre> The output demonstrates the recovered Z coordinate is correct, i.e. matches the ground truth. Credits Authors Alejandro Cabrera Aldaya (Tampere University, Tampere, Finland) Cesar Pereida García (Tampere University, Tampere, Finland) Billy Bob Brumley (Tampere University, Tampere, Finland) Funding This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 804476). License This project is distributed under MIT license.