fix licensing (CC-BY-4.0 notice, no ISC overclaim, Pyodide attribution) and polish the page
Browse files- CONTRIBUTING.md +43 -0
- LICENSE-FIXTURES +43 -0
- README.md +67 -5
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing to the hw-verify static Space
|
| 2 |
+
|
| 3 |
+
## `cone.py` is vendored β never edit it here
|
| 4 |
+
|
| 5 |
+
It is a byte-for-byte copy of `ctbench/ctbench/cone.py`, served to the browser through
|
| 6 |
+
Pyodide. Fix analyzer bugs upstream in `ctbench`, then re-vendor:
|
| 7 |
+
|
| 8 |
+
```bash
|
| 9 |
+
cp ../ctbench/ctbench/cone.py cone.py
|
| 10 |
+
python -c "import json,pathlib; ..." # regenerate fixtures.json, see build notes below
|
| 11 |
+
pytest tests -q
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
`test_vendored_cone_matches_ctbench_exactly` fails the moment the copy drifts. A stale
|
| 15 |
+
analyzer served to the public is worse than no demo at all.
|
| 16 |
+
|
| 17 |
+
## `fixtures.json` is extracted, not authored
|
| 18 |
+
|
| 19 |
+
It carries the 18 scored fixtures from ctbench's manifest with their sources, observation
|
| 20 |
+
signals, declared secrets, and expected verdicts.
|
| 21 |
+
`test_vendored_fixtures_match_the_ctbench_manifest` compares every field against upstream.
|
| 22 |
+
|
| 23 |
+
## Keep the SDK static
|
| 24 |
+
|
| 25 |
+
`sdk: static` in the card is deliberate. A Gradio SDK needs an HF PRO subscription and
|
| 26 |
+
will not deploy on a free account β a test asserts the SDK line.
|
| 27 |
+
|
| 28 |
+
## `short_description` must be β€ 60 characters
|
| 29 |
+
|
| 30 |
+
The Hub rejects longer ones, and the CLI reports that failure as an unrelated HTTP 402,
|
| 31 |
+
which costs an afternoon to diagnose. There is a test.
|
| 32 |
+
|
| 33 |
+
## Keep the scope and boundary text
|
| 34 |
+
|
| 35 |
+
The page states what the verdict covers (completion timing, over-approximate, declared
|
| 36 |
+
secrets) and where the commercial boundary sits. Tests assert both. They are the
|
| 37 |
+
difference between a visitor reading "CONSTANT_TIME" as "secure" and reading it as what it
|
| 38 |
+
actually says.
|
| 39 |
+
|
| 40 |
+
## No network calls beyond the two local assets
|
| 41 |
+
|
| 42 |
+
A test asserts the page fetches exactly `cone.py` and `fixtures.json` and nothing else.
|
| 43 |
+
The claim "nothing is uploaded" has to stay literally true.
|
LICENSE-FIXTURES
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Licensing of the bundled RTL
|
| 2 |
+
|
| 3 |
+
This Space ships two kinds of material under two different licences. The `LICENSE`
|
| 4 |
+
file (Apache-2.0) does **not** cover all of it.
|
| 5 |
+
|
| 6 |
+
## 1. Apache License 2.0
|
| 7 |
+
|
| 8 |
+
- `index.html` β the page and its demo logic.
|
| 9 |
+
- `cone.py` β a verbatim vendored copy of the cone-of-influence analyzer from
|
| 10 |
+
[ctbench](https://github.com/nickharris808/ctbench), which is Apache-2.0.
|
| 11 |
+
|
| 12 |
+
See `LICENSE`.
|
| 13 |
+
|
| 14 |
+
## 2. Creative Commons Attribution 4.0 International
|
| 15 |
+
|
| 16 |
+
The **18 Verilog sources inlined in `fixtures.json`** are licensed **CC-BY-4.0**:
|
| 17 |
+
<https://creativecommons.org/licenses/by/4.0/>
|
| 18 |
+
|
| 19 |
+
They are the scored half of the ctbench corpus. Attribution is the only condition β
|
| 20 |
+
cite ctbench if you reuse them:
|
| 21 |
+
|
| 22 |
+
ctbench: a matched-pair constant-time RTL benchmark corpus, version 1.0.0.
|
| 23 |
+
https://github.com/nickharris808/ctbench
|
| 24 |
+
|
| 25 |
+
## 3. Runtime dependency β Pyodide (not bundled)
|
| 26 |
+
|
| 27 |
+
The page loads Pyodide from a version-pinned CDN
|
| 28 |
+
(`https://cdn.jsdelivr.net/pyodide/v0.28.3/full/pyodide.js`). Pyodide is distributed
|
| 29 |
+
under the **Mozilla Public License 2.0**. It is fetched by the browser at runtime and
|
| 30 |
+
is not redistributed as part of this Space.
|
| 31 |
+
|
| 32 |
+
## What is *not* bundled here
|
| 33 |
+
|
| 34 |
+
ctbench additionally contains four fixtures derived from the
|
| 35 |
+
[picorv32](https://github.com/YosysHQ/picorv32) project by Claire Wolf, which remain
|
| 36 |
+
under the upstream **ISC** licence: `pcpi_div.v`, `pcpi_mul.v`, `pcpi_div_wiped.v`,
|
| 37 |
+
and `pcpi_div_halfwipe.v`.
|
| 38 |
+
|
| 39 |
+
**None of those four ship in this Space.** They are *unscored* in ctbench β their
|
| 40 |
+
observable is a secret-residue property rather than a completion signal β and this
|
| 41 |
+
demo bundles only the 18 scored fixtures. If you need them, take them from the
|
| 42 |
+
[ctbench repository](https://github.com/nickharris808/ctbench), where the full ISC
|
| 43 |
+
notice travels with them in `LICENSE-FIXTURES`.
|
README.md
CHANGED
|
@@ -6,7 +6,9 @@ colorTo: indigo
|
|
| 6 |
sdk: static
|
| 7 |
app_file: index.html
|
| 8 |
pinned: false
|
| 9 |
-
license:
|
|
|
|
|
|
|
| 10 |
short_description: Constant-time Verilog checker, in your browser
|
| 11 |
tags:
|
| 12 |
- hardware
|
|
@@ -20,12 +22,37 @@ tags:
|
|
| 20 |
|
| 21 |
# hw-verify β constant-time checker in your browser
|
| 22 |
|
| 23 |
-
**Paste Verilog, get a formal verdict with the leaking signals named β not a guess.**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
This Space runs the **real analyzer**: the same `ctbench` cone-of-influence checker you can
|
| 26 |
install from [GitHub](https://github.com/nickharris808/ctbench), compiled to WebAssembly via
|
| 27 |
Pyodide and executed **in your browser**. Nothing is uploaded; nothing leaves the page.
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
## Try it in 30 seconds
|
| 30 |
|
| 31 |
1. The page opens with a deliberately leaky tag comparator already loaded. Press **Check**.
|
|
@@ -43,6 +70,35 @@ sensitive produces confident verdicts about the wrong property.
|
|
| 43 |
It **over-approximates**, so `CONSTANT_TIME` is conservative and `LEAKY` names the reaching
|
| 44 |
signals so you can confirm rather than take it on faith.
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
## Scope
|
| 47 |
|
| 48 |
Verdicts cover **completion timing** against declared secrets β not power, EM, cache, or
|
|
@@ -67,6 +123,12 @@ problem and a commercial one. It is not in any of these packages.
|
|
| 67 |
|
| 68 |
## Licence
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
sdk: static
|
| 7 |
app_file: index.html
|
| 8 |
pinned: false
|
| 9 |
+
license:
|
| 10 |
+
- apache-2.0
|
| 11 |
+
- cc-by-4.0
|
| 12 |
short_description: Constant-time Verilog checker, in your browser
|
| 13 |
tags:
|
| 14 |
- hardware
|
|
|
|
| 22 |
|
| 23 |
# hw-verify β constant-time checker in your browser
|
| 24 |
|
| 25 |
+
**Paste Verilog, get a formal verdict with the leaking signals named β not a guess. No install, no upload.**
|
| 26 |
+
|
| 27 |
+
[](LICENSE)
|
| 28 |
+
[](https://huggingface.co/spaces/nickh007/hw-verify)
|
| 29 |
+
[](https://pyodide.org)
|
| 30 |
+
[](https://github.com/nickharris808/ctbench)
|
| 31 |
+
|
| 32 |
+
## Why this exists
|
| 33 |
+
|
| 34 |
+
Nobody installs a formal verification tool to find out whether it is worth installing.
|
| 35 |
+
This is the thirty-second version β and it is not a mock-up: it runs the **same analyzer**
|
| 36 |
+
that ships in `ctbench`, compiled to WebAssembly, on your machine.
|
| 37 |
|
| 38 |
This Space runs the **real analyzer**: the same `ctbench` cone-of-influence checker you can
|
| 39 |
install from [GitHub](https://github.com/nickharris808/ctbench), compiled to WebAssembly via
|
| 40 |
Pyodide and executed **in your browser**. Nothing is uploaded; nothing leaves the page.
|
| 41 |
|
| 42 |
+
## Run it locally
|
| 43 |
+
|
| 44 |
+
No build step β it is three static files and a CDN script tag:
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
git clone https://github.com/nickharris808/hw-verify-static.git && cd hw-verify-static
|
| 48 |
+
python -m http.server 8000 # then open http://127.0.0.1:8000
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
```console
|
| 52 |
+
$ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8000/index.html
|
| 53 |
+
200
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
## Try it in 30 seconds
|
| 57 |
|
| 58 |
1. The page opens with a deliberately leaky tag comparator already loaded. Press **Check**.
|
|
|
|
| 70 |
It **over-approximates**, so `CONSTANT_TIME` is conservative and `LEAKY` names the reaching
|
| 71 |
signals so you can confirm rather than take it on faith.
|
| 72 |
|
| 73 |
+
## Example output
|
| 74 |
+
|
| 75 |
+
Press **Check** on the leaky comparator that loads by default:
|
| 76 |
+
|
| 77 |
+
```console
|
| 78 |
+
β LEAKY
|
| 79 |
+
|
| 80 |
+
`done` depends on `x`, `y`. The cycle it asserts on is a function of secret data,
|
| 81 |
+
so timing reveals secret-dependent behaviour.
|
| 82 |
+
|
| 83 |
+
Fix: make the completion condition a function of a data-oblivious counter and drop
|
| 84 |
+
the early-exit branch, then re-run.
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
Load `ct_cmp.v` β same module interface, opposite verdict:
|
| 88 |
+
|
| 89 |
+
```console
|
| 90 |
+
β
CONSTANT_TIME
|
| 91 |
+
|
| 92 |
+
No declared secret reaches `done`. Its fan-in cone spans 6 signals and contains
|
| 93 |
+
none of `x`, `y`.
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
Press **Run all 18** and the whole bundled benchmark scores in the browser:
|
| 97 |
+
|
| 98 |
+
```console
|
| 99 |
+
18/18 correct on the bundled benchmark
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
## Scope
|
| 103 |
|
| 104 |
Verdicts cover **completion timing** against declared secrets β not power, EM, cache, or
|
|
|
|
| 123 |
|
| 124 |
## Licence
|
| 125 |
|
| 126 |
+
Two licences, because this Space ships two kinds of material β see
|
| 127 |
+
[`LICENSE-FIXTURES`](LICENSE-FIXTURES) for the full text:
|
| 128 |
+
|
| 129 |
+
- **Apache-2.0** β `index.html` and `cone.py` (the latter vendored verbatim from
|
| 130 |
+
[ctbench](https://github.com/nickharris808/ctbench)). See [`LICENSE`](LICENSE).
|
| 131 |
+
- **CC-BY-4.0** β the 18 Verilog sources inlined in `fixtures.json`.
|
| 132 |
+
|
| 133 |
+
The four picorv32-derived fixtures that remain under the upstream ISC licence are
|
| 134 |
+
**not bundled here** β they are unscored in ctbench, so this demo does not carry them.
|