aboutsummaryrefslogtreecommitdiff
path: root/notes/comptime_generated_code.txt
blob: 9b94cba9a6e01e3508601c6c24083b0503bf6a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

comptime / generated code
=========================

This can be useful for:

* Computing hash values
* Building binary encoded data (e.g. ASN.1 DER / protobuf / CBOR)

Performance requirements:

* If it should support computation of hashes, then it must be reasonably fast.
  (maybe native code compilation)
* Must not require multiple slow steps (e.g. native compilation) to happen if
  there are multiple comptime evaluations.
* No evaluation inside interfaces. That could be really really slow.
  (But interface files could be generated files).

Security requirements:

* MUST be fully sandboxed
* Allocation should be limited to a small amount of memory.
* MUST not allow for heap-spraying or other stepping stones for attacks.
* MUST not allow for rowhammer, meltdown, or other forms of hardware attacks.
    - Perhaps use an alternative representations in memory?
      (maybe encode with a reversible function, e.g.
       `y = x + iv + address_offset`)