Skip to content

New vitaminc-ore crate: one order encoding per kind, with block ORE, CLLW ORE and CLLW OPE as pluggable schemes #374

Closed

Description

@coderdan

Background

An order term lets the database answer <, > and ORDER BY on
encrypted values. EQL stores two order schemes: block ORE (in ore-rs) and
CLLW OPE (in cllw-ore). Both take bytes whose order is the value's order, then
encrypt them.

Problem

  1. Each scheme encodes plaintext its own way. cllw-ore hand-rolls integers and
    floats, and keeps -0.0 distinct from +0.0 where orderable-bytes
    folds it.
  2. Stack Encrypt derives CLLW terms only, so no EQL block-ORE type is
    producible (stashgen refuses TextOrdOre and TextSearchOre — EQL stores block ORE terms and the engine derives CLLW ORE stack#1132).
  3. Date, timestamp and decimal are OPE-only in cllw-ore.

Proposal

  1. Plaintext layer: orderable-bytes (cipherstash/ore.rs, orderable-bytes has no variable-length encoding — text and bytes can't share the order layer ore.rs#94), plus
    canonicalisation:

    Order terms fold where equality terms don't: a folded order term only
    produces ties, while a folded equality would match the wrong rows.

  2. A Scheme trait with three implementations: block ORE (over ore-rs,
    at each kind's natural width, with no 8-byte padding), CLLW ORE and CLLW
    OPE (over cllw-ore).

  3. Order terms derived from &Value, with one exhaustive match. Every
    orderable kind works under every scheme, except Bool, which gets no order
    terms. Block ORE for text waits for Tracking: review and release chained block ORE (ore v2) so text can use block ORE ore.rs#95 and is listed as
    an exception until then.

  4. Prerequisite, in cipherstash-suite (which has Issues turned off):

    • put cllw-ore's typed impls behind a cargo feature that is on by default,
      so cipherstash-client's stored terms don't change;
    • add a bytes-level "encrypt these orderable bytes" entry point;
    • release a minor version.

Needs cipherstash/ore.rs#94, #372 and the cllw-ore release. Decided in ADR-0002
(cipherstash/stack#1139).

Relationship to other work

Activity

  1. added 9 commits that reference this issue on Oct 16, 2026
    b4bb092
    0ca3a6f
    ee3cbbf
    4f09176
    9af10d7
    ecddf97
    c832dfd
    bf8192b
    c9b230b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions