Documentation

QedShareCli.FastUntag

Checking the secret tag on a byte array #

untagSecret (in Pipeline) checks and removes the tag of the rebuilt bytes, given as a List GF256: for qs3, the AMD tag over GF(2¹²⁸) and the token of every share. The list, its 16-byte blocks and the result each cost tens of megabytes for a 1 MiB secret.

untagBytes does the same on a ByteArray. The AMD tag is computed block by block, reading 16 bytes at a time from the array, and the secret is returned as a slice of the array. The old formats are read from the array too: the AMD tag alone for qs2, and the CRC-32 of qs1. untagBytes_eq proves it returns exactly what untagSecret returns on the list of the bytes.

Bytes i to j of the array, as field elements.

Equations
Instances For

    Horner's rule over blocks n − 1, …, 0 (block i is blk i): the loop of Amd.hornerX, without a list of blocks.

    Equations
    Instances For

      The AMD tag of the first slen bytes of e under the key x (amdTagOf_eq).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Check and remove the secret tag of the rebuilt bytes e (and, for qs3, check the tokens of the shares used). Returns exactly what untagSecret returns (untagBytes_eq).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          untagBytes = untagSecret #

          A slice of the array is the same slice of the list of its bytes.

          Reading the first n bytes of an array one by one gives the first n of its bytes.

          theorem QedShare.Cli.hornerRev_eq (blk : Nat → GF2_128) (x : GF2_128) (n : Nat) (acc : GF2_128) :
          hornerRev blk x n acc = List.foldl (fun (acc b : GF2_128) => b + x * acc) acc (List.map blk (List.range n)).reverse

          hornerRev is the fold of Amd.hornerX over the list of blocks.

          theorem QedShare.Cli.take_drop_take {α : Type} (L : List α) (a s : Nat) :
          List.take 16 (List.drop a (List.take s L)) = List.drop a (List.take (min (a + 16) s) L)

          Block i of the first s elements: 16 elements from a, cut at s.

          theorem QedShare.Cli.amdTagOf_eq (e : ByteArray) (slen : Nat) (h : slen ≤ e.size) (x : GF2_128) :

          amdTagOf is Amd.tag of the first slen bytes.

          untagBytes computes exactly untagSecret. For every format, threshold, byte array and tokens, untagBytes returns what untagSecret returns on the list of the bytes, as a byte array.