From eaa900ff78d5659a97aacf7c26b06cb18aff586b Mon Sep 17 00:00:00 2001 From: Karthikeyan Bhargavan Date: Wed, 15 Jul 2026 10:08:34 +0200 Subject: [PATCH] feat(proofs): add Lean (Aeneas) extraction of the crypto core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A third extraction lane alongside F* and ProVerif: a functional-model lifting of the SD-APKE / SD-PKE / Ed25519 crypto core to Lean 4 via the hax aeneas-lean backend (rustc -> charon -> aeneas). - proofs/proverif/hax.py `extract-lean`: runs `cargo hax into aeneas-lean` over the crypto-core `--start-from` set (mirrors the ProVerif targets), injecting a dev hax-lib (pending cryspen/hax#2069 + #2071) via a temporary [patch.crates-io] and restoring Cargo.toml/lock afterwards. - Source: aeneas can't yet translate the `&'static` domain tags, `tagged_preimage`, or the `decrypt_with_sender` trial-decrypt loop, so these are made opaque for the Lean backend only via `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]` — F* and normal builds are unaffected (verified with `cargo check`). `cfg(hax_backend_lean)` added to the workspace check-cfg allowlist. - Snapshot of the generated Lean committed under proofs/aeneas-lean/ (llbc/ and the aeneas error log git-ignored); see its README for the toolchain pins and the upstream aeneas limitations (AeneasVerif/aeneas#392, #464). Co-Authored-By: Claude Opus 4.8 (1M context) --- securedrop-protocol/Cargo.toml | 2 +- .../proofs/aeneas-lean/.gitignore | 3 + .../proofs/aeneas-lean/README.md | 53 + .../SecuredropProtocolMinimal.lean | 1 + .../Extraction/Funs.lean | 3320 +++++++++++++++++ .../Extraction/FunsExternal_Template.lean | 785 ++++ .../Extraction/Types.lean | 827 ++++ .../Extraction/TypesExternal_Template.lean | 67 + .../proofs/aeneas-lean/lakefile.toml | 17 + .../proofs/aeneas-lean/lean-toolchain | 1 + .../protocol-minimal/proofs/proverif/hax.py | 116 + .../protocol-minimal/src/encrypt_decrypt.rs | 5 + .../protocol-minimal/src/sign.rs | 10 + 13 files changed, 5206 insertions(+), 1 deletion(-) create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/.gitignore create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/README.md create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal.lean create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Funs.lean create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/FunsExternal_Template.lean create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Types.lean create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/TypesExternal_Template.lean create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lakefile.toml create mode 100644 securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lean-toolchain diff --git a/securedrop-protocol/Cargo.toml b/securedrop-protocol/Cargo.toml index e652ff5a..f022c31d 100644 --- a/securedrop-protocol/Cargo.toml +++ b/securedrop-protocol/Cargo.toml @@ -22,4 +22,4 @@ license = "GPL-3.0" # `cfg(hax_backend_proverif)` is set only by hax during `cargo hax into proverif` # (it gates the ProVerif-specific annotations). Normal builds, `cargo test`, and # `into fstar` never set it, so those lanes strip the gated annotations entirely. -unexpected_cfgs = { level = "warn", check-cfg = ["cfg(hax)", "cfg(hax_backend_proverif)"] } +unexpected_cfgs = { level = "warn", check-cfg = ["cfg(hax)", "cfg(hax_backend_proverif)", "cfg(hax_backend_lean)"] } diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/.gitignore b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/.gitignore new file mode 100644 index 00000000..30cdcfb9 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/.gitignore @@ -0,0 +1,3 @@ +# Generated diagnostics — not part of the committed Lean snapshot. +llbc/ +aeneas-error.log diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/README.md b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/README.md new file mode 100644 index 00000000..25521825 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/README.md @@ -0,0 +1,53 @@ +# Lean (Aeneas) extraction of the crypto core + +A functional-model extraction of `securedrop-protocol-minimal`'s cryptographic core +to **Lean 4**, via the hax **aeneas-lean** backend (`rustc → charon → aeneas`). This +complements the F\* extraction (`proofs/fstar/`) and the ProVerif symbolic model +(`proofs/proverif/`) with a third, independent lifting of the same Rust. + +## What is extracted + +The driver mirrors the ProVerif target set — the loop-free SD-APKE / SD-PKE / Ed25519 +core and the envelope operations: + +| Module | Functions (translated to Lean `def`) | +|---|---| +| `message` | `auth_enc`, `auth_dec` (SD-APKE), keygen, ciphertext/key types | +| `metadata` | `encrypt`, `decrypt` (SD-PKE), keygen, ciphertext types | +| `sign` | Ed25519 `sign` / `verify` | +| `encrypt_decrypt` | `encrypt`, `decrypt` (envelope build / open) | + +Aeneas cannot yet translate a few constructs; these are made opaque **for the Lean +backend only** via `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]` (F\* and normal +builds are unaffected), and appear as `axiom`s in `Extraction/FunsExternal_Template.lean`: + +| Item | Why opaque | Upstream | +|---|---|---| +| `sign::DomainTag::tag` | returns `&'static [u8]` (promoted literal) → "no bottoms in the value" | [AeneasVerif/aeneas#392](https://github.com/AeneasVerif/aeneas/issues/392) | +| `sign::tagged_preimage` | builds the preimage from the opaque tag with `Vec` ops | (same) | +| `encrypt_decrypt::decrypt_with_sender` | trial-decrypt loop over `Vec<&MessageKeyBundle>` (iterator + nested borrows) | [AeneasVerif/aeneas#464](https://github.com/AeneasVerif/aeneas/issues/464) | + +## Running + +```sh +python3 proofs/proverif/hax.py extract-lean +``` + +Output lands in `SecuredropProtocolMinimal/Extraction/*.lean` (committed as a snapshot); +`llbc/` and `aeneas-error.log` are diagnostics and git-ignored. + +## Toolchain (pending upstream) + +The lane depends on two hax changes, injected at extraction time so the committed +manifest stays on crates.io `hax-lib 0.3.7`: + +- **[cryspen/hax#2069](https://github.com/cryspen/hax/pull/2069)** — `into aeneas-lean` + sets target-side `--cfg hax` so `cfg(hax)`-gated dependencies (libcrux) compile. +- **[cryspen/hax#2071](https://github.com/cryspen/hax/pull/2071)** — `hax_lib::opaque` / + `hax_lib::exclude` emit charon's native `charon::opaque` / `charon::exclude`, so the + `#[cfg_attr(hax_backend_lean, …)]` markers above take effect. + +Point `HAX_LEAN_DIR` (default `~/hax`) at a hax checkout carrying both; `hax.py +extract-lean` uses its `cargo-hax` and injects its `hax-lib` via a temporary +`[patch.crates-io]`. Pinned tool versions (charon `0.1.218`, aeneas +`nightly-2026.07.01`, Lean `v4.30.0-rc2`) come from hax's `pins.toml`. diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal.lean b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal.lean new file mode 100644 index 00000000..9aa07bbd --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal.lean @@ -0,0 +1 @@ +import SecuredropProtocolMinimal.Extraction.Funs diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Funs.lean b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Funs.lean new file mode 100644 index 00000000..394c1f15 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Funs.lean @@ -0,0 +1,3320 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [securedrop_protocol_minimal]: function definitions +import Aeneas +import SecuredropProtocolMinimal.Extraction.Types +import SecuredropProtocolMinimal.Extraction.FunsExternal +open Aeneas Aeneas.Std Result ControlFlow Error +open Std.Do +set_option linter.dupNamespace false +set_option linter.hashCommand false +set_option linter.unusedVariables false + +/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/ +set_option maxHeartbeats 1000000 + +/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/ +set_option maxRecDepth 2048 + +/- You can remove the following line by using the CLI option `-all-computable`: -/ +noncomputable section + +namespace securedrop_protocol_minimal + +/-- Trait implementation: [core::convert::{impl core::fmt::Debug for core::convert::Infallible}] + Source: '/rustc/library/core/src/convert/mod.rs', lines 941:0-941:30 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def core.convert.Infallible.Insts.CoreFmtDebug : core.fmt.Debug + core.convert.Infallible := { + fmt := core.convert.Infallible.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [core::convert::{impl core::fmt::Display for core::convert::Infallible}] + Source: '/rustc/library/core/src/convert/mod.rs', lines 948:0-948:32 + Name pattern: [core::fmt::Display] -/ +@[reducible, rust_trait_impl "core::fmt::Display"] +def core.convert.Infallible.Insts.CoreFmtDisplay : core.fmt.Display + core.convert.Infallible := { + fmt := core.convert.Infallible.Insts.CoreFmtDisplay.fmt +} + +/-- Trait implementation: [core::convert::{impl core::error::Error for core::convert::Infallible}] + Source: '/rustc/library/core/src/convert/mod.rs', lines 955:0-955:25 + Name pattern: [core::error::Error] -/ +@[reducible, rust_trait_impl "core::error::Error"] +def core.convert.Infallible.Insts.CoreErrorError : core.error.Error + core.convert.Infallible := { + fmtDebugInst := core.convert.Infallible.Insts.CoreFmtDebug + fmtDisplayInst := core.convert.Infallible.Insts.CoreFmtDisplay +} + +/-- Trait implementation: [core::fmt::num::imp::{impl core::fmt::Display for usize}] + Source: '/rustc/library/core/src/fmt/num.rs', lines 134:8-134:39 + Name pattern: [core::fmt::Display] -/ +@[reducible, rust_trait_impl "core::fmt::Display"] +def Usize.Insts.CoreFmtDisplay : core.fmt.Display Std.Usize := { + fmt := core.fmt.num.imp.DisplayUsize.fmt +} + +/-- Trait implementation: [alloc::string::{impl core::fmt::Display for alloc::string::String}] + Source: '/rustc/library/alloc/src/string.rs', lines 2722:0-2722:28 + Name pattern: [core::fmt::Display] -/ +@[reducible, rust_trait_impl "core::fmt::Display"] +def alloc.string.String.Insts.CoreFmtDisplay : core.fmt.Display String := { + fmt := alloc.string.String.Insts.CoreFmtDisplay.fmt +} + +/-- Trait implementation: [alloc::string::{impl core::fmt::Debug for alloc::string::String}] + Source: '/rustc/library/alloc/src/string.rs', lines 2730:0-2730:26 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def alloc.string.String.Insts.CoreFmtDebug : core.fmt.Debug String := { + fmt := alloc.string.String.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [anyhow::error::{impl core::fmt::Debug for anyhow::Error}] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/error.rs', lines 707:0-707:20 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def anyhow.Error.Insts.CoreFmtDebug : core.fmt.Debug anyhow.Error := { + fmt := anyhow.Error.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [hpke_rs::{impl core::fmt::Debug for hpke_rs::HpkeError}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 158:9-158:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def hpke_rs.HpkeError.Insts.CoreFmtDebug : core.fmt.Debug hpke_rs.HpkeError + := { + fmt := hpke_rs.HpkeError.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [hpke_rs_crypto::error::{impl core::fmt::Debug for hpke_rs_crypto::error::Error}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/error.rs', lines 9:9-9:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def hpke_rs_crypto.error.Error.Insts.CoreFmtDebug : core.fmt.Debug + hpke_rs_crypto.error.Error := { + fmt := hpke_rs_crypto.error.Error.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [hpke_rs_crypto::error::{impl core::fmt::Display for hpke_rs_crypto::error::Error}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/error.rs', lines 54:0-54:22 + Name pattern: [core::fmt::Display] -/ +@[reducible, rust_trait_impl + "core::fmt::Display"] +def hpke_rs_crypto.error.Error.Insts.CoreFmtDisplay : core.fmt.Display + hpke_rs_crypto.error.Error := { + fmt := hpke_rs_crypto.error.Error.Insts.CoreFmtDisplay.fmt +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl core::fmt::Debug for hpke_rs_libcrux::HpkeLibcrux}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 30:9-30:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def hpke_rs_libcrux.HpkeLibcrux.Insts.CoreFmtDebug : core.fmt.Debug + hpke_rs_libcrux.HpkeLibcrux := { + fmt := hpke_rs_libcrux.HpkeLibcrux.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl zeroize::Zeroize for hpke_rs_libcrux::HpkeLibcruxPrng}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 40:0-40:32 + Name pattern: [zeroize::Zeroize] -/ +@[reducible, rust_trait_impl + "zeroize::Zeroize"] +def hpke_rs_libcrux.HpkeLibcruxPrng.Insts.ZeroizeZeroize : zeroize.Zeroize + hpke_rs_libcrux.HpkeLibcruxPrng := { + zeroize := hpke_rs_libcrux.HpkeLibcruxPrng.Insts.ZeroizeZeroize.zeroize +} + +/-- Trait implementation: [rand_core::{impl rand_core::Rng for R}] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 65:0-67:43 + Name pattern: [rand_core::Rng<@R>] -/ +@[reducible, rust_trait_impl "rand_core::Rng<@R>"] +def rand_core.Rng.Blanket {R : Type} (TryRngRInfallibleInst : rand_core.TryRng + R core.convert.Infallible) : rand_core.Rng R := { + TryRngSelfInfallibleInst := TryRngRInfallibleInst + next_u32 := rand_core.Rng.Blanket.next_u32 TryRngRInfallibleInst + next_u64 := rand_core.Rng.Blanket.next_u64 TryRngRInfallibleInst + fill_bytes := rand_core.Rng.Blanket.fill_bytes TryRngRInfallibleInst +} + +/-- Trait implementation: [rand_core::{impl rand_core::CryptoRng for R}] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 97:0-97:74 + Name pattern: [rand_core::CryptoRng<@R, core::convert::Infallible>] -/ +@[reducible, rust_trait_impl + "rand_core::CryptoRng<@R, core::convert::Infallible>"] +def rand_core.CryptoRngRInfallible.Blanket {R : Type} + (TryCryptoRngRInfallibleInst : rand_core.TryCryptoRng R + core.convert.Infallible) : rand_core.CryptoRng R core.convert.Infallible := { + RngInst := rand_core.Rng.Blanket TryCryptoRngRInfallibleInst.TryRngInst + TryCryptoRngInst := TryCryptoRngRInfallibleInst +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeTestRng for hpke_rs_libcrux::HpkeLibcruxPrng}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 568:0-568:36 + Name pattern: [hpke_rs_crypto::HpkeTestRng] -/ +@[reducible, rust_trait_impl + "hpke_rs_crypto::HpkeTestRng"] +def hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError : + hpke_rs_crypto.HpkeTestRng hpke_rs_libcrux.HpkeLibcruxPrng + hpke_rs_crypto.error.Error := { + corefmtDebugInst := hpke_rs_crypto.error.Error.Insts.CoreFmtDebug + corefmtDisplayInst := hpke_rs_crypto.error.Error.Insts.CoreFmtDisplay + try_fill_test_bytes := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError.try_fill_test_bytes + seed := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError.seed +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl rand_core::TryRng for hpke_rs_libcrux::HpkeLibcruxPrng}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 551:0-551:31 + Name pattern: [rand_core::TryRng] -/ +@[reducible, rust_trait_impl + "rand_core::TryRng"] +def hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible : + rand_core.TryRng hpke_rs_libcrux.HpkeLibcruxPrng core.convert.Infallible := { + coreerrorErrorInst := core.convert.Infallible.Insts.CoreErrorError + try_next_u32 := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_next_u32 + try_next_u64 := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_next_u64 + try_fill_bytes := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_fill_bytes +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl rand_core::TryCryptoRng for hpke_rs_libcrux::HpkeLibcruxPrng}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 549:0-549:37 + Name pattern: [rand_core::TryCryptoRng] -/ +@[reducible, rust_trait_impl + "rand_core::TryCryptoRng"] +def hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryCryptoRngInfallible : + rand_core.TryCryptoRng hpke_rs_libcrux.HpkeLibcruxPrng + core.convert.Infallible := { + TryRngInst := hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible +} + +/-- Trait implementation: [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 46:0-46:31 + Name pattern: [hpke_rs_crypto::HpkeCrypto] -/ +@[reducible, rust_trait_impl + "hpke_rs_crypto::HpkeCrypto"] +def + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + : hpke_rs_crypto.HpkeCrypto hpke_rs_libcrux.HpkeLibcrux + hpke_rs_libcrux.HpkeLibcruxPrng core.convert.Infallible + hpke_rs_crypto.error.Error := { + corefmtDebugInst := hpke_rs_libcrux.HpkeLibcrux.Insts.CoreFmtDebug + rand_coreCryptoRngInst := rand_core.CryptoRngRInfallible.Blanket + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryCryptoRngInfallible + HpkeTestRngInst := + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError + zeroizeZeroizeInst := hpke_rs_libcrux.HpkeLibcruxPrng.Insts.ZeroizeZeroize + «name» := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.name + supports_kdf := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_kdf + supports_kem := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_kem + supports_aead := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_aead + prng := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.prng + kdf_extract := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kdf_extract + kdf_expand := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kdf_expand + dh := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.dh + secret_to_public := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.secret_to_public + kem_key_gen := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_key_gen + kem_key_gen_derand := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_key_gen_derand + kem_encaps := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_encaps + kem_decaps := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_decaps + dh_validate_sk := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.dh_validate_sk + aead_seal := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.aead_seal + aead_open := + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.aead_open +} + +/-- Trait implementation: [libcrux_kem::{impl core::fmt::Debug for libcrux_kem::Error}] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 116:9-116:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl "core::fmt::Debug"] +def libcrux_kem.Error.Insts.CoreFmtDebug : core.fmt.Debug libcrux_kem.Error + := { + fmt := libcrux_kem.Error.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [libcrux_ml_kem::mlkem768::{impl libcrux_traits::kem::arrayref::Kem<1184usize, 2400usize, 1088usize, 32usize, 64usize, 32usize> for libcrux_ml_kem::mlkem768::MlKem768}] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/lib.rs', lines 120:8-128:26 + Name pattern: [libcrux_traits::kem::arrayref::Kem] -/ +@[reducible, rust_trait_impl + "libcrux_traits::kem::arrayref::Kem"] +def + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432 + : libcrux_traits.kem.arrayref.Kem libcrux_ml_kem.mlkem768.MlKem768 1184#usize + 2400#usize 1088#usize 32#usize 64#usize 32#usize := { + keygen := + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.keygen + encaps := + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.encaps + decaps := + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.decaps +} + +/-- Trait implementation: [libcrux_traits::kem::arrayref::{impl core::fmt::Debug for libcrux_traits::kem::arrayref::EncapsError}] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 55:9-55:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl + "core::fmt::Debug"] +def libcrux_traits.kem.arrayref.EncapsError.Insts.CoreFmtDebug : core.fmt.Debug + libcrux_traits.kem.arrayref.EncapsError := { + fmt := libcrux_traits.kem.arrayref.EncapsError.Insts.CoreFmtDebug.fmt +} + +/-- Trait implementation: [libcrux_traits::kem::arrayref::{impl core::fmt::Debug for libcrux_traits::kem::arrayref::DecapsError}] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 68:9-68:14 + Name pattern: [core::fmt::Debug] -/ +@[reducible, rust_trait_impl + "core::fmt::Debug"] +def libcrux_traits.kem.arrayref.DecapsError.Insts.CoreFmtDebug : core.fmt.Debug + libcrux_traits.kem.arrayref.DecapsError := { + fmt := libcrux_traits.kem.arrayref.DecapsError.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::ciphertext::{securedrop_protocol_minimal::ciphertext::Plaintext}::to_bytes]: + Source: 'protocol-minimal/src/ciphertext.rs', lines 91:4-100:5 + Visibility: public -/ +def ciphertext.Plaintext.to_bytes + (self : ciphertext.Plaintext) : Result (alloc.vec.Vec Std.U8) := do + let s ← lift (Array.to_slice self.sender_reply_pubkey_hybrid) + let buf ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 (alloc.vec.Vec.new + Std.U8) s + let s1 ← lift (Array.to_slice self.sender_fetch_key) + let buf1 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 buf s1 + let s2 := alloc.vec.Vec.deref self.msg + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 buf1 s2 + +/-- [securedrop_protocol_minimal::encrypt_decrypt::NR_ID] + Source: 'protocol-minimal/src/encrypt_decrypt.rs', lines 16:0-16:41 -/ +@[global_simps, irreducible] +def encrypt_decrypt.NR_ID : Slice Std.U8 := + Array.to_slice + (Array.make 16#usize [ + 77#u8, 79#u8, 67#u8, 75#u8, 95#u8, 78#u8, 69#u8, 87#u8, 83#u8, 82#u8, + 79#u8, 79#u8, 77#u8, 95#u8, 73#u8, 68#u8 + ]) + +/-- [securedrop_protocol_minimal::primitives::x25519::dh_shared_secret::{impl core::ops::function::FnOnce<(libcrux_curve25519::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::x25519::dh_shared_secret::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 169:17-169:56 -/ +def + primitives.x25519.dh_shared_secret.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + (c : primitives.x25519.dh_shared_secret.closure) + (tupled_args : libcrux_curve25519.Error) : + Result anyhow.Error + := do + let a ← core.fmt.Arguments.from_str (toStr "X25519 DH failed") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::x25519::dh_shared_secret::{impl core::ops::function::FnOnce<(libcrux_curve25519::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::x25519::dh_shared_secret::closure}] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 169:17-169:56 -/ +@[reducible] +def + primitives.x25519.dh_shared_secret.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + : core.ops.function.FnOnce primitives.x25519.dh_shared_secret.closure + libcrux_curve25519.Error anyhow.Error := { + call_once := + primitives.x25519.dh_shared_secret.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::x25519::dh_shared_secret]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 163:0-171:1 + Visibility: public -/ +def primitives.x25519.dh_shared_secret + (public_key : primitives.x25519.DHPublicKey) + (private_scalar : Array Std.U8 32#usize) : + Result (core.result.Result primitives.x25519.DHSharedSecret anyhow.Error) + := do + let shared_secret_bytes := Array.repeat 32#usize 0#u8 + let (r, shared_secret_bytes1) ← + libcrux_curve25519.impl_hacl.ecdh shared_secret_bytes public_key + private_scalar + let r1 ← + core.result.Result.map_err + primitives.x25519.dh_shared_secret.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue _ => + ok (core.result.Result.Ok shared_secret_bytes1) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + primitives.x25519.DHSharedSecret (core.convert.FromSame anyhow.Error) + residual + +/-- [securedrop_protocol_minimal::primitives::x25519::typed]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 124:0-129:1 -/ +def primitives.x25519.typed + (sk : Array Std.U8 32#usize) (pk : Array Std.U8 32#usize) : + Result (core.result.Result (primitives.x25519.DHPrivateKey × + primitives.x25519.DHPublicKey) anyhow.Error) + := do + ok (core.result.Result.Ok (sk, pk)) + +/-- [securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::KeyGenError,), anyhow::Error> for securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 116:17-116:68 -/ +def + primitives.x25519.generate_dh_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleKeyGenErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : primitives.x25519.generate_dh_keypair.closure R + Clause1_Clause1_Clause0_Error) + (tupled_args : libcrux_traits.kem.arrayref.KeyGenError) : + Result anyhow.Error + := do + let a ← core.fmt.Arguments.from_str (toStr "X25519 key generation failed") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::KeyGenError,), anyhow::Error> for securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair::closure}] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 116:17-116:68 -/ +@[reducible] +def + primitives.x25519.generate_dh_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleKeyGenErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (primitives.x25519.generate_dh_keypair.closure R + Clause1_Clause1_Clause0_Error) libcrux_traits.kem.arrayref.KeyGenError + anyhow.Error := { + call_once := + primitives.x25519.generate_dh_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleKeyGenErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 104:0-119:1 + Visibility: public -/ +def primitives.x25519.generate_dh_keypair + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result (primitives.x25519.DHPrivateKey × + primitives.x25519.DHPublicKey) anyhow.Error) × R) + := do + let randomness := Array.repeat 32#usize 0#u8 + let (rng1, randomness1) ← + primitives.provider.rng.fill_bytes rand_coreRngCoreInst + rand_coreCryptoRngInst rng randomness + let public_key := Array.repeat 32#usize 0#u8 + let secret_key := Array.repeat 32#usize 0#u8 + let (r, public_key1, secret_key1) ← + primitives.provider.curve25519.x25519_keygen public_key secret_key + randomness1 + let r1 ← + core.result.Result.map_err + (primitives.x25519.generate_dh_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleKeyGenErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue _ => + let r2 ← primitives.x25519.typed secret_key1 public_key1 + ok (r2, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.x25519.DHPrivateKey × primitives.x25519.DHPublicKey) + (core.convert.FromSame anyhow.Error) residual + ok (r2, rng1) + +/-- [securedrop_protocol_minimal::primitives::x25519::{securedrop_protocol_minimal::primitives::x25519::DHSharedSecret}::into_bytes]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 75:4-77:5 + Visibility: public -/ +def primitives.x25519.DHSharedSecret.into_bytes + (self : primitives.x25519.DHSharedSecret) : + Result (Array Std.U8 32#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::primitives::x25519::{securedrop_protocol_minimal::primitives::x25519::DHPrivateKey}::into_bytes]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 59:4-61:5 + Visibility: public -/ +def primitives.x25519.DHPrivateKey.into_bytes + (self : primitives.x25519.DHPrivateKey) : + Result (Array Std.U8 32#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::primitives::x25519::{securedrop_protocol_minimal::primitives::x25519::DHPublicKey}::into_bytes]: + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 21:4-23:5 + Visibility: public -/ +def primitives.x25519.DHPublicKey.into_bytes + (self : primitives.x25519.DHPublicKey) : Result (Array Std.U8 32#usize) := do + ok self + +/-- [securedrop_protocol_minimal::primitives::xwing::{impl core::convert::From for hpke_rs::HpkePublicKey}::from]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 49:4-51:5 + Visibility: public -/ +def hpke_rs.HpkePublicKey.Insts.CoreConvertFromXWingPublicKey.from + (pk : primitives.xwing.XWingPublicKey) : Result hpke_rs.HpkePublicKey := do + let s ← lift (Array.to_slice pk) + let v ← alloc.slice.Slice.to_vec core.clone.CloneU8 s + hpke_rs.HpkePublicKey.Insts.CoreConvertFromVecU8.from v + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::{impl core::convert::From for hpke_rs::HpkePublicKey}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 48:0-52:1 -/ +@[reducible] +def hpke_rs.HpkePublicKey.Insts.CoreConvertFromXWingPublicKey : + core.convert.From hpke_rs.HpkePublicKey primitives.xwing.XWingPublicKey := { + «from» := hpke_rs.HpkePublicKey.Insts.CoreConvertFromXWingPublicKey.from +} + +/-- [securedrop_protocol_minimal::primitives::xwing::{impl core::clone::Clone for securedrop_protocol_minimal::primitives::xwing::XWingPublicKey}::clone]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 11:16-11:21 + Visibility: public -/ +def primitives.xwing.XWingPublicKey.Insts.CoreCloneClone.clone + (self : primitives.xwing.XWingPublicKey) : + Result primitives.xwing.XWingPublicKey + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self + ok a + +/-- [securedrop_protocol_minimal::primitives::mlkem::{securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey}::as_bytes]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 23:4-25:5 -/ +def primitives.mlkem.MLKEM768PublicKey.as_bytes + (self : primitives.mlkem.MLKEM768PublicKey) : + Result (Array Std.U8 1184#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey}::as_bytes]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 24:4-26:5 -/ +def primitives.dh_akem.DhAkemPublicKey.as_bytes + (self : primitives.dh_akem.DhAkemPublicKey) : + Result (Array Std.U8 32#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessagePublicKey}::as_bytes]: + Source: 'protocol-minimal/src/message.rs', lines 100:4-105:5 + Visibility: public -/ +def message.MessagePublicKey.as_bytes + (self : message.MessagePublicKey) : Result (alloc.vec.Vec Std.U8) := do + let a ← primitives.dh_akem.DhAkemPublicKey.as_bytes self.dhakem + let s ← lift (Array.to_slice a) + let out ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 (alloc.vec.Vec.new + Std.U8) s + let a1 ← primitives.mlkem.MLKEM768PublicKey.as_bytes self.mlkem + let s1 ← lift (Array.to_slice a1) + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out s1 + +/-- [securedrop_protocol_minimal::metadata::encrypt]: + Source: 'protocol-minimal/src/metadata.rs', lines 240:0-267:1 -/ +def metadata.encrypt + (pk_r : metadata.MetadataPublicKey) (m : message.MessagePublicKey) : + Result (core.result.Result metadata.MetadataCiphertext anyhow.Error) + := do + let hpke ← + hpke_rs.Hpke.new + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke_rs.Mode.Base hpke_rs_crypto.types.KemAlgorithm.XWingDraft06 + hpke_rs_crypto.types.KdfAlgorithm.HkdfSha256 + hpke_rs_crypto.types.AeadAlgorithm.Aes256Gcm + let xpk ← primitives.xwing.XWingPublicKey.Insts.CoreCloneClone.clone pk_r + let pk_r_hpke ← + core.convert.IntoFrom.into + hpke_rs.HpkePublicKey.Insts.CoreConvertFromXWingPublicKey xpk + let s ← lift (Array.to_slice (Std.Array.empty Std.U8)) + let s1 ← lift (Array.to_slice (Std.Array.empty Std.U8)) + let v ← message.MessagePublicKey.as_bytes m + let s2 := alloc.vec.Vec.deref v + let (r, _) ← + hpke_rs.Hpke.seal + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke pk_r_hpke s s1 s2 none none none + match r with + | core.result.Result.Ok p => + let (c_vec, cp_vec) := p + let s3 ← alloc.vec.Vec.as_slice Global c_vec + let r1 ← + core.array.TryFromArrayCopySlice.try_from 1120#usize core.marker.CopyU8 + s3 + match r1 with + | core.result.Result.Ok c => + let s4 ← alloc.vec.Vec.as_slice Global cp_vec + let r2 ← + core.array.TryFromArrayCopySlice.try_from 1232#usize core.marker.CopyU8 + s4 + match r2 with + | core.result.Result.Ok cp => ok (core.result.Result.Ok { c, cp }) + | core.result.Result.Err _ => + let a ← + core.fmt.Arguments.from_str (toStr "Unexpected md ciphertext length") + let error ← anyhow.__private.format_err a + let e ← anyhow.__private.must_use error + ok (core.result.Result.Err e) + | core.result.Result.Err _ => + let a ← + core.fmt.Arguments.from_str (toStr + "Unexpected md encapsulated secret length") + let error ← anyhow.__private.format_err a + let e ← anyhow.__private.must_use error + ok (core.result.Result.Err e) + | core.result.Result.Err _ => + let a ← core.fmt.Arguments.from_str (toStr "Metadata encryption failed") + let error ← anyhow.__private.format_err a + let e ← anyhow.__private.must_use error + ok (core.result.Result.Err e) + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{impl core::convert::From for hpke_rs::HpkePublicKey}::from]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 87:4-89:5 + Visibility: public -/ +def hpke_rs.HpkePublicKey.Insts.CoreConvertFromDhAkemPublicKey.from + (pk : primitives.dh_akem.DhAkemPublicKey) : + Result hpke_rs.HpkePublicKey + := do + let s ← lift (Array.to_slice pk) + let v ← alloc.slice.Slice.to_vec core.clone.CloneU8 s + hpke_rs.HpkePublicKey.Insts.CoreConvertFromVecU8.from v + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::{impl core::convert::From for hpke_rs::HpkePublicKey}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 86:0-90:1 -/ +@[reducible] +def hpke_rs.HpkePublicKey.Insts.CoreConvertFromDhAkemPublicKey : + core.convert.From hpke_rs.HpkePublicKey primitives.dh_akem.DhAkemPublicKey + := { + «from» := hpke_rs.HpkePublicKey.Insts.CoreConvertFromDhAkemPublicKey.from +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{impl core::convert::From for hpke_rs::HpkePrivateKey}::from]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 81:4-83:5 + Visibility: public -/ +def hpke_rs.HpkePrivateKey.Insts.CoreConvertFromDhAkemPrivateKey.from + (sk : primitives.dh_akem.DhAkemPrivateKey) : + Result hpke_rs.HpkePrivateKey + := do + let s ← lift (Array.to_slice sk) + let v ← alloc.slice.Slice.to_vec core.clone.CloneU8 s + hpke_rs.HpkePrivateKey.Insts.CoreConvertFromVecU8.from v + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::{impl core::convert::From for hpke_rs::HpkePrivateKey}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 80:0-84:1 -/ +@[reducible] +def hpke_rs.HpkePrivateKey.Insts.CoreConvertFromDhAkemPrivateKey : + core.convert.From hpke_rs.HpkePrivateKey primitives.dh_akem.DhAkemPrivateKey + := { + «from» := hpke_rs.HpkePrivateKey.Insts.CoreConvertFromDhAkemPrivateKey.from +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{impl core::clone::Clone for securedrop_protocol_minimal::primitives::dh_akem::DhAkemPrivateKey}::clone]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 16:16-16:21 + Visibility: public -/ +def primitives.dh_akem.DhAkemPrivateKey.Insts.CoreCloneClone.clone + (self : primitives.dh_akem.DhAkemPrivateKey) : + Result primitives.dh_akem.DhAkemPrivateKey + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self + ok a + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{impl core::clone::Clone for securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey}::clone]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 12:16-12:21 + Visibility: public -/ +def primitives.dh_akem.DhAkemPublicKey.Insts.CoreCloneClone.clone + (self : primitives.dh_akem.DhAkemPublicKey) : + Result primitives.dh_akem.DhAkemPublicKey + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self + ok a + +/-- [securedrop_protocol_minimal::message::auth_enc::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_enc::closure#1}::call_once]: + Source: 'protocol-minimal/src/message.rs', lines 317:17-317:71 -/ +def + message.auth_enc.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : message.auth_enc.closure_1 R Clause1_Clause1_Clause0_Error) + (tupled_args : hpke_rs.HpkeError) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug hpke_rs.HpkeError.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 27#usize [ + 24#u8, 83#u8, 68#u8, 45#u8, 65#u8, 80#u8, 75#u8, 69#u8, 32#u8, 65#u8, + 117#u8, 116#u8, 104#u8, 69#u8, 110#u8, 99#u8, 32#u8, 102#u8, 97#u8, + 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::message::auth_enc::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_enc::closure#1}] + Source: 'protocol-minimal/src/message.rs', lines 317:17-317:71 -/ +@[reducible] +def message.auth_enc.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (message.auth_enc.closure_1 R Clause1_Clause1_Clause0_Error) + hpke_rs.HpkeError anyhow.Error := { + call_once := + message.auth_enc.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::message::auth_enc::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::EncapsError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_enc::closure}::call_once]: + Source: 'protocol-minimal/src/message.rs', lines 297:17-297:76 -/ +def + message.auth_enc.closure.Insts.CoreOpsFunctionFnOnceTupleEncapsErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : message.auth_enc.closure R Clause1_Clause1_Clause0_Error) + (tupled_args : libcrux_traits.kem.arrayref.EncapsError) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug + libcrux_traits.kem.arrayref.EncapsError.Insts.CoreFmtDebug tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 32#usize [ + 29#u8, 77#u8, 76#u8, 45#u8, 75#u8, 69#u8, 77#u8, 32#u8, 101#u8, 110#u8, + 99#u8, 97#u8, 112#u8, 115#u8, 117#u8, 108#u8, 97#u8, 116#u8, 105#u8, + 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, + 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::message::auth_enc::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::EncapsError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_enc::closure}] + Source: 'protocol-minimal/src/message.rs', lines 297:17-297:76 -/ +@[reducible] +def message.auth_enc.closure.Insts.CoreOpsFunctionFnOnceTupleEncapsErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (message.auth_enc.closure R Clause1_Clause1_Clause0_Error) + libcrux_traits.kem.arrayref.EncapsError anyhow.Error := { + call_once := + message.auth_enc.closure.Insts.CoreOpsFunctionFnOnceTupleEncapsErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::message::PSK_ID] + Source: 'protocol-minimal/src/message.rs', lines 47:0-47:36 -/ +@[global_simps, irreducible] +def message.PSK_ID : Slice Std.U8 := + Array.to_slice + (Array.make 10#usize [ + 83#u8, 68#u8, 45#u8, 112#u8, 115#u8, 107#u8, 65#u8, 80#u8, 75#u8, 69#u8 + ]) + +/-- [securedrop_protocol_minimal::message::auth_enc]: + Source: 'protocol-minimal/src/message.rs', lines 282:0-326:1 + Visibility: public -/ +def message.auth_enc + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) (sk : message.MessagePrivateKey) + (pk : message.MessagePublicKey) (m : Slice Std.U8) (ad : Slice Std.U8) + (info : Slice Std.U8) : + Result ((core.result.Result message.MessageCiphertext anyhow.Error) × R) + := do + let hpke ← + hpke_rs.Hpke.new + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke_rs.Mode.AuthPsk hpke_rs_crypto.types.KemAlgorithm.DhKem25519 + hpke_rs_crypto.types.KdfAlgorithm.HkdfSha256 + hpke_rs_crypto.types.AeadAlgorithm.Aes256Gcm + let randomness := Array.repeat 32#usize 0#u8 + let (s, to_slice_mut_back) ← lift (Array.to_slice_mut randomness) + let (rng1, s1) ← rand_coreRngCoreInst.RngInst.fill_bytes rng s + let a ← primitives.mlkem.MLKEM768PublicKey.as_bytes pk.mlkem + let randomness1 := to_slice_mut_back s1 + let r ← + libcrux_traits.kem.owned.Kem.Blanket.encaps + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432 + a randomness1 + let r1 ← + core.result.Result.map_err + (message.auth_enc.closure.Insts.CoreOpsFunctionFnOnceTupleEncapsErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (k2, c2) := val + let dapk ← + primitives.dh_akem.DhAkemPublicKey.Insts.CoreCloneClone.clone pk.dhakem + let pkr1 ← + core.convert.IntoFrom.into + hpke_rs.HpkePublicKey.Insts.CoreConvertFromDhAkemPublicKey dapk + let dapk1 ← + primitives.dh_akem.DhAkemPrivateKey.Insts.CoreCloneClone.clone sk.dhakem + let sks1 ← + core.convert.IntoFrom.into + hpke_rs.HpkePrivateKey.Insts.CoreConvertFromDhAkemPrivateKey dapk1 + let s2 ← lift (Array.to_slice c2) + let full_info ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 (alloc.vec.Vec.new + Std.U8) s2 + let full_info1 ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 full_info info + let s3 := alloc.vec.Vec.deref full_info1 + let s4 ← lift (Array.to_slice k2) + let (r2, _) ← + hpke_rs.Hpke.seal + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke pkr1 s3 ad m (some s4) (some message.PSK_ID) (some sks1) + let r3 ← + core.result.Result.map_err + (message.auth_enc.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r2 () + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r3 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let (c1_vec, cp) := val1 + let s5 ← alloc.vec.Vec.as_slice Global c1_vec + let r4 ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 + s5 + let c1 ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r4 (toStr + "DHKEM(X25519) encapsulation output has unexpected length") + ok (core.result.Result.Ok { c1, cp, c2 }, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r4 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageCiphertext (core.convert.FromSame anyhow.Error) + residual + ok (r4, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageCiphertext (core.convert.FromSame anyhow.Error) residual + ok (r2, rng1) + +/-- [securedrop_protocol_minimal::encrypt_decrypt::encrypt]: + Source: 'protocol-minimal/src/encrypt_decrypt.rs', lines 25:0-71:1 + Visibility: public -/ +def encrypt_decrypt.encrypt + {R : Type} {Sender : Type} {Recipient : Type} {Clause1_Clause1_Clause0_Error + : Type} (rand_coreRngCoreInst : rand_core.RngCore R) (rand_coreCryptoRngInst + : rand_core.CryptoRng R Clause1_Clause1_Clause0_Error) (traitsUserSecretInst + : traits.UserSecret Sender) (traitsUserPublicInst : traits.UserPublic + Recipient) (rng : R) (sender : Sender) (plaintext : ciphertext.Plaintext) + (recipient : Recipient) : + Result (ciphertext.Envelope × R) + := do + let sk_s ← traitsUserSecretInst.message_auth_key sender + let pk_r ← traitsUserPublicInst.message_enc_pk recipient + let dk ← traitsUserPublicInst.fetch_pk recipient + let pk_r_fetch ← primitives.x25519.DHPublicKey.into_bytes dk + let v ← ciphertext.Plaintext.to_bytes plaintext + let s := alloc.vec.Vec.deref v + let s1 ← lift (Array.to_slice pk_r_fetch) + let (r, rng1) ← + message.auth_enc rand_coreRngCoreInst rand_coreCryptoRngInst rng sk_s pk_r + s encrypt_decrypt.NR_ID s1 + let ct_apke ← + core.result.Result.expect anyhow.Error.Insts.CoreFmtDebug r (toStr + "SD-APKE AuthEnc failed") + let (r1, rng2) ← + primitives.x25519.generate_dh_keypair rand_coreRngCoreInst + rand_coreCryptoRngInst rng1 + let (hint_esk, hint_epk) ← + core.result.Result.expect anyhow.Error.Insts.CoreFmtDebug r1 (toStr + "DH Keygen (hint) failed") + let a ← primitives.x25519.DHPrivateKey.into_bytes hint_esk + let r2 ← primitives.x25519.dh_shared_secret dk a + let hint_sharedsecret ← + core.result.Result.expect anyhow.Error.Insts.CoreFmtDebug r2 (toStr + "Failed to generate shared secret") + let mpk ← traitsUserPublicInst.message_metadata_pk recipient + let mpk1 ← traitsUserSecretInst.own_message_auth_pk sender + let r3 ← metadata.encrypt mpk mpk1 + let ct_pke ← + core.result.Result.expect anyhow.Error.Insts.CoreFmtDebug r3 (toStr + "Valid Keybundle should allow metadata seal") + let a1 ← primitives.x25519.DHPublicKey.into_bytes hint_epk + let a2 ← primitives.x25519.DHSharedSecret.into_bytes hint_sharedsecret + ok ({ ct_apke, ct_pke, mgdh_pubkey := a1, mgdh := a2 }, rng2) + +/-- [securedrop_protocol_minimal::encrypt_decrypt::decrypt]: + Source: 'protocol-minimal/src/encrypt_decrypt.rs', lines 74:0-76:1 + Visibility: public -/ +def encrypt_decrypt.decrypt + {U : Type} (traitsUserSecretInst : traits.UserSecret U) (receiver : U) + (envelope : ciphertext.Envelope) : + Result ciphertext.Plaintext + := do + let (p, _) ← + encrypt_decrypt.decrypt_with_sender traitsUserSecretInst receiver envelope + ok p + +/-- [securedrop_protocol_minimal::message::LEN_MLKEM_ENCAPS_RAND] + Source: 'protocol-minimal/src/message.rs', lines 50:0-50:40 -/ +@[global_simps, irreducible] +def message.LEN_MLKEM_ENCAPS_RAND : Std.Usize := 32#usize + +/-- [securedrop_protocol_minimal::primitives::mlkem::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey}::fmt]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 15:9-15:14 + Visibility: public -/ +def primitives.mlkem.MLKEM768PublicKey.Insts.CoreFmtDebug.fmt + (self : primitives.mlkem.MLKEM768PublicKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (core.fmt.DebugShared (Array.Insts.CoreFmtDebug 1184#usize + core.fmt.DebugU8)) self + core.fmt.Formatter.debug_tuple_field1_finish f (toStr "MLKEM768PublicKey") + dyn + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::mlkem::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey}] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 15:9-15:14 -/ +@[reducible] +def primitives.mlkem.MLKEM768PublicKey.Insts.CoreFmtDebug : core.fmt.Debug + primitives.mlkem.MLKEM768PublicKey := { + fmt := primitives.mlkem.MLKEM768PublicKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey}::fmt]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 12:9-12:14 + Visibility: public -/ +def primitives.dh_akem.DhAkemPublicKey.Insts.CoreFmtDebug.fmt + (self : primitives.dh_akem.DhAkemPublicKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (core.fmt.DebugShared (Array.Insts.CoreFmtDebug 32#usize + core.fmt.DebugU8)) self + core.fmt.Formatter.debug_tuple_field1_finish f (toStr "DhAkemPublicKey") dyn + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 12:9-12:14 -/ +@[reducible] +def primitives.dh_akem.DhAkemPublicKey.Insts.CoreFmtDebug : core.fmt.Debug + primitives.dh_akem.DhAkemPublicKey := { + fmt := primitives.dh_akem.DhAkemPublicKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::message::{impl core::fmt::Debug for securedrop_protocol_minimal::message::MessagePublicKey}::fmt]: + Source: 'protocol-minimal/src/message.rs', lines 59:9-59:14 + Visibility: public -/ +def message.MessagePublicKey.Insts.CoreFmtDebug.fmt + (self : message.MessagePublicKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ primitives.dh_akem.DhAkemPublicKey.Insts.CoreFmtDebug self.dhakem + let dyn1 := + Dyn.mk _ (core.fmt.DebugShared + primitives.mlkem.MLKEM768PublicKey.Insts.CoreFmtDebug) self.mlkem + core.fmt.Formatter.debug_struct_field2_finish f (toStr "MessagePublicKey") + (toStr "dhakem") dyn (toStr "mlkem") dyn1 + +/-- Trait implementation: [securedrop_protocol_minimal::message::{impl core::fmt::Debug for securedrop_protocol_minimal::message::MessagePublicKey}] + Source: 'protocol-minimal/src/message.rs', lines 59:9-59:14 -/ +@[reducible] +def message.MessagePublicKey.Insts.CoreFmtDebug : core.fmt.Debug + message.MessagePublicKey := { + fmt := message.MessagePublicKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::primitives::mlkem::{impl core::clone::Clone for securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey}::clone]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 15:16-15:21 + Visibility: public -/ +def primitives.mlkem.MLKEM768PublicKey.Insts.CoreCloneClone.clone + (self : primitives.mlkem.MLKEM768PublicKey) : + Result primitives.mlkem.MLKEM768PublicKey + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self + ok a + +/-- [securedrop_protocol_minimal::message::{impl core::clone::Clone for securedrop_protocol_minimal::message::MessagePublicKey}::clone]: + Source: 'protocol-minimal/src/message.rs', lines 59:16-59:21 + Visibility: public -/ +def message.MessagePublicKey.Insts.CoreCloneClone.clone + (self : message.MessagePublicKey) : Result message.MessagePublicKey := do + let dapk ← + primitives.dh_akem.DhAkemPublicKey.Insts.CoreCloneClone.clone self.dhakem + let mpk ← + primitives.mlkem.MLKEM768PublicKey.Insts.CoreCloneClone.clone self.mlkem + ok { dhakem := dapk, mlkem := mpk } + +/-- Trait implementation: [securedrop_protocol_minimal::message::{impl core::clone::Clone for securedrop_protocol_minimal::message::MessagePublicKey}] + Source: 'protocol-minimal/src/message.rs', lines 59:16-59:21 -/ +@[reducible] +def message.MessagePublicKey.Insts.CoreCloneClone : core.clone.Clone + message.MessagePublicKey := { + clone := message.MessagePublicKey.Insts.CoreCloneClone.clone +} + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageKeyPair}::new]: + Source: 'protocol-minimal/src/message.rs', lines 83:4-85:5 -/ +def message.MessageKeyPair.new + (sk : message.MessagePrivateKey) (pk : message.MessagePublicKey) : + Result message.MessageKeyPair + := do + ok { sk, pk } + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageKeyPair}::public_key]: + Source: 'protocol-minimal/src/message.rs', lines 88:4-90:5 + Visibility: public -/ +def message.MessageKeyPair.public_key + (self : message.MessageKeyPair) : Result message.MessagePublicKey := do + ok self.pk + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageKeyPair}::private_key]: + Source: 'protocol-minimal/src/message.rs', lines 93:4-95:5 + Visibility: public -/ +def message.MessageKeyPair.private_key + (self : message.MessageKeyPair) : Result message.MessagePrivateKey := do + ok self.sk + +/-- [securedrop_protocol_minimal::primitives::mlkem::{securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 27:4-29:5 -/ +def primitives.mlkem.MLKEM768PublicKey.from_bytes + (bytes : Array Std.U8 1184#usize) : + Result primitives.mlkem.MLKEM768PublicKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::primitives::mlkem::MLKEM768_PUBLIC_KEY_LEN] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 9:0-9:48 + Visibility: public -/ +@[global_simps, irreducible] +def primitives.mlkem.MLKEM768_PUBLIC_KEY_LEN : Std.Usize := 1184#usize + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 28:4-30:5 -/ +def primitives.dh_akem.DhAkemPublicKey.from_bytes + (bytes : Array Std.U8 32#usize) : + Result primitives.dh_akem.DhAkemPublicKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::primitives::dh_akem::DH_AKEM_PUBLIC_KEY_LEN] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 5:0-5:90 + Visibility: public -/ +@[global_simps, irreducible] +def primitives.dh_akem.DH_AKEM_PUBLIC_KEY_LEN : Result Std.Usize := + primitives.provider.curve25519.PK_LEN + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessagePublicKey}::from_bytes]: + Source: 'protocol-minimal/src/message.rs', lines 114:4-137:5 + Visibility: public -/ +def message.MessagePublicKey.from_bytes + (bytes : Slice Std.U8) : + Result (core.result.Result message.MessagePublicKey anyhow.Error) + := do + let i := Slice.len bytes + let i1 ← primitives.dh_akem.DH_AKEM_PUBLIC_KEY_LEN + let i2 ← i1 + primitives.mlkem.MLKEM768_PUBLIC_KEY_LEN + if i != i2 + then + let _ ← i1 + primitives.mlkem.MLKEM768_PUBLIC_KEY_LEN + let i3 ← + lift (Std.Usize.wrapping_add i1 primitives.mlkem.MLKEM768_PUBLIC_KEY_LEN) + let i4 := Slice.len bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i3 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i4 + let a2 ← + core.fmt.Arguments.new + (Array.make 53#usize [ + 42#u8, 73#u8, 110#u8, 118#u8, 97#u8, 108#u8, 105#u8, 100#u8, 32#u8, + 77#u8, 101#u8, 115#u8, 115#u8, 97#u8, 103#u8, 101#u8, 80#u8, 117#u8, + 98#u8, 108#u8, 105#u8, 99#u8, 75#u8, 101#u8, 121#u8, 32#u8, 108#u8, + 101#u8, 110#u8, 103#u8, 116#u8, 104#u8, 58#u8, 32#u8, 101#u8, 120#u8, + 112#u8, 101#u8, 99#u8, 116#u8, 101#u8, 100#u8, 32#u8, 192#u8, 6#u8, + 44#u8, 32#u8, 103#u8, 111#u8, 116#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let s ← + core.slice.index.Slice.index + (core.slice.index.SliceIndexRangeToUsizeSlice Std.U8) bytes + { «end» := i1 } + let r ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 s + let dhakem_bytes ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r (toStr + "checked length") + let s1 ← + core.slice.index.Slice.index + (core.slice.index.SliceIndexRangeFromUsizeSlice Std.U8) bytes + { start := i1 } + let r1 ← + core.array.TryFromArrayCopySlice.try_from 1184#usize core.marker.CopyU8 + s1 + let mlkem_bytes ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r1 (toStr + "checked length") + let dapk ← primitives.dh_akem.DhAkemPublicKey.from_bytes dhakem_bytes + let mpk ← primitives.mlkem.MLKEM768PublicKey.from_bytes mlkem_bytes + ok (core.result.Result.Ok { dhakem := dapk, mlkem := mpk }) + +/-- [securedrop_protocol_minimal::message::{impl core::fmt::Debug for securedrop_protocol_minimal::message::MessageCiphertext}::fmt]: + Source: 'protocol-minimal/src/message.rs', lines 158:9-158:14 + Visibility: public -/ +def message.MessageCiphertext.Insts.CoreFmtDebug.fmt + (self : message.MessageCiphertext) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (Array.Insts.CoreFmtDebug 32#usize core.fmt.DebugU8) self.c1 + let dyn1 := Dyn.mk _ (core.fmt.DebugVec core.fmt.DebugU8) self.cp + let dyn2 := + Dyn.mk _ (core.fmt.DebugShared (Array.Insts.CoreFmtDebug 1088#usize + core.fmt.DebugU8)) self.c2 + core.fmt.Formatter.debug_struct_field3_finish f (toStr "MessageCiphertext") + (toStr "c1") dyn (toStr "cp") dyn1 (toStr "c2") dyn2 + +/-- Trait implementation: [securedrop_protocol_minimal::message::{impl core::fmt::Debug for securedrop_protocol_minimal::message::MessageCiphertext}] + Source: 'protocol-minimal/src/message.rs', lines 158:9-158:14 -/ +@[reducible] +def message.MessageCiphertext.Insts.CoreFmtDebug : core.fmt.Debug + message.MessageCiphertext := { + fmt := message.MessageCiphertext.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::message::{impl core::clone::Clone for securedrop_protocol_minimal::message::MessageCiphertext}::clone]: + Source: 'protocol-minimal/src/message.rs', lines 158:16-158:21 + Visibility: public -/ +def message.MessageCiphertext.Insts.CoreCloneClone.clone + (self : message.MessageCiphertext) : Result message.MessageCiphertext := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self.c1 + let v ← alloc.vec.CloneVec.clone core.clone.CloneU8 self.cp + let a1 ← core.array.CloneArray.clone core.clone.CloneU8 self.c2 + ok { c1 := a, cp := v, c2 := a1 } + +/-- Trait implementation: [securedrop_protocol_minimal::message::{impl core::clone::Clone for securedrop_protocol_minimal::message::MessageCiphertext}] + Source: 'protocol-minimal/src/message.rs', lines 158:16-158:21 -/ +@[reducible] +def message.MessageCiphertext.Insts.CoreCloneClone : core.clone.Clone + message.MessageCiphertext := { + clone := message.MessageCiphertext.Insts.CoreCloneClone.clone +} + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageCiphertext}::len]: + Source: 'protocol-minimal/src/message.rs', lines 170:4-172:5 + Visibility: public -/ +def message.MessageCiphertext.len + (self : message.MessageCiphertext) : Result Std.Usize := do + let s ← lift (Array.to_slice self.c1) + let i := Slice.len s + let i1 := alloc.vec.Vec.len self.cp + let i2 ← i + i1 + let s1 ← lift (Array.to_slice self.c2) + let i3 := Slice.len s1 + i2 + i3 + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageCiphertext}::as_bytes]: + Source: 'protocol-minimal/src/message.rs', lines 175:4-181:5 + Visibility: public -/ +def message.MessageCiphertext.as_bytes + (self : message.MessageCiphertext) : Result (alloc.vec.Vec Std.U8) := do + let i ← message.MessageCiphertext.len self + let out := alloc.vec.Vec.with_capacity Std.U8 i + let s ← lift (Array.to_slice self.c1) + let out1 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out s + let s1 ← lift (Array.to_slice self.c2) + let out2 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out1 s1 + let s2 := alloc.vec.Vec.deref self.cp + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out2 s2 + +/-- [securedrop_protocol_minimal::primitives::mlkem::LEN_MLKEM_SHAREDSECRET_ENCAPS] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 12:0-12:61 -/ +@[global_simps, irreducible] +def primitives.mlkem.LEN_MLKEM_SHAREDSECRET_ENCAPS : Std.Usize := 1088#usize + +/-- [securedrop_protocol_minimal::primitives::dh_akem::DH_AKEM_ENCAPS_SECRET_LEN] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 8:0-9:58 -/ +@[global_simps, irreducible] +def primitives.dh_akem.DH_AKEM_ENCAPS_SECRET_LEN : Result Std.Usize := + primitives.provider.curve25519.LEN_DH_SHARE + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageCiphertext}::from_bytes::FIXED] + Source: 'protocol-minimal/src/message.rs', lines 189:8-189:87 -/ +@[global_simps, irreducible] +def message.MessageCiphertext.from_bytes.FIXED : Result Std.Usize := do + let i ← primitives.dh_akem.DH_AKEM_ENCAPS_SECRET_LEN + i + primitives.mlkem.LEN_MLKEM_SHAREDSECRET_ENCAPS + +/-- [securedrop_protocol_minimal::message::{securedrop_protocol_minimal::message::MessageCiphertext}::from_bytes]: + Source: 'protocol-minimal/src/message.rs', lines 188:4-205:5 + Visibility: public -/ +def message.MessageCiphertext.from_bytes + (bytes : Slice Std.U8) : + Result (core.result.Result message.MessageCiphertext anyhow.Error) + := do + let i := Slice.len bytes + let i1 ← message.MessageCiphertext.from_bytes.FIXED + if i < i1 + then + let i2 := Slice.len bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i1 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a2 ← + core.fmt.Arguments.new + (Array.make 58#usize [ + 47#u8, 77#u8, 101#u8, 115#u8, 115#u8, 97#u8, 103#u8, 101#u8, 67#u8, + 105#u8, 112#u8, 104#u8, 101#u8, 114#u8, 116#u8, 101#u8, 120#u8, + 116#u8, 32#u8, 116#u8, 111#u8, 111#u8, 32#u8, 115#u8, 104#u8, 111#u8, + 114#u8, 116#u8, 58#u8, 32#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, + 116#u8, 101#u8, 100#u8, 32#u8, 97#u8, 116#u8, 32#u8, 108#u8, 101#u8, + 97#u8, 115#u8, 116#u8, 32#u8, 192#u8, 6#u8, 44#u8, 32#u8, 103#u8, + 111#u8, 116#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let i2 ← primitives.dh_akem.DH_AKEM_ENCAPS_SECRET_LEN + let (c1, rest) ← core.slice.Slice.split_at bytes i2 + let (c2, cp) ← + core.slice.Slice.split_at rest + primitives.mlkem.LEN_MLKEM_SHAREDSECRET_ENCAPS + let r ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 c1 + let a ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r (toStr + "checked length") + let v ← alloc.slice.Slice.to_vec core.clone.CloneU8 cp + let r1 ← + core.array.TryFromArrayCopySlice.try_from 1088#usize core.marker.CopyU8 + c2 + let a1 ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r1 (toStr + "checked length") + ok (core.result.Result.Ok { c1 := a, cp := v, c2 := a1 }) + +/-- [securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 122:17-122:80 -/ +def + primitives.mlkem.generate_mlkem768_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : primitives.mlkem.generate_mlkem768_keypair.closure R + Clause1_Clause1_Clause0_Error) (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 36#usize [ + 33#u8, 77#u8, 76#u8, 75#u8, 69#u8, 77#u8, 45#u8, 55#u8, 54#u8, 56#u8, + 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 103#u8, 101#u8, 110#u8, 101#u8, + 114#u8, 97#u8, 116#u8, 105#u8, 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, + 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair::closure}] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 122:17-122:80 -/ +@[reducible] +def + primitives.mlkem.generate_mlkem768_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (primitives.mlkem.generate_mlkem768_keypair.closure R + Clause1_Clause1_Clause0_Error) libcrux_kem.Error anyhow.Error := { + call_once := + primitives.mlkem.generate_mlkem768_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::primitives::mlkem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::typed::closure#1}::call_once]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 108:21-108:78 -/ +def + primitives.mlkem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.mlkem.typed.closure_1) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert public key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::mlkem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::typed::closure#1}] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 108:21-108:78 -/ +@[reducible] +def + primitives.mlkem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.mlkem.typed.closure_1 + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.mlkem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::mlkem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::typed::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 102:21-102:79 -/ +def + primitives.mlkem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.mlkem.typed.closure) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert private key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::mlkem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::typed::closure}] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 102:21-102:79 -/ +@[reducible] +def + primitives.mlkem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.mlkem.typed.closure + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.mlkem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::mlkem::{securedrop_protocol_minimal::primitives::mlkem::MLKEM768PrivateKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 37:4-39:5 -/ +def primitives.mlkem.MLKEM768PrivateKey.from_bytes + (bytes : Array Std.U8 2400#usize) : + Result primitives.mlkem.MLKEM768PrivateKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::primitives::mlkem::MLKEM768_PRIVATE_KEY_LEN] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 10:0-10:49 + Visibility: public -/ +@[global_simps, irreducible] +def primitives.mlkem.MLKEM768_PRIVATE_KEY_LEN : Std.Usize := 2400#usize + +/-- [securedrop_protocol_minimal::primitives::mlkem::typed]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 69:0-112:1 -/ +def primitives.mlkem.typed + (sk : libcrux_kem.PrivateKey) (pk : libcrux_kem.PublicKey) : + Result (core.result.Result (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) anyhow.Error) + := do + let private_key_bytes ← libcrux_kem.PrivateKey.encode sk + let public_key_bytes ← libcrux_kem.PublicKey.encode pk + let i := alloc.vec.Vec.len private_key_bytes + if i != primitives.mlkem.MLKEM768_PRIVATE_KEY_LEN + then + let i1 := alloc.vec.Vec.len private_key_bytes + let i2 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i1 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a2 ← + core.fmt.Arguments.new + (Array.make 54#usize [ + 40#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, 116#u8, + 101#u8, 100#u8, 32#u8, 77#u8, 76#u8, 75#u8, 69#u8, 77#u8, 45#u8, + 55#u8, 54#u8, 56#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 115#u8, + 105#u8, 122#u8, 101#u8, 115#u8, 58#u8, 32#u8, 112#u8, 114#u8, 105#u8, + 118#u8, 97#u8, 116#u8, 101#u8, 61#u8, 192#u8, 9#u8, 44#u8, 32#u8, + 112#u8, 117#u8, 98#u8, 108#u8, 105#u8, 99#u8, 61#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let i1 := alloc.vec.Vec.len public_key_bytes + if i1 != primitives.mlkem.MLKEM768_PUBLIC_KEY_LEN + then + let i2 := alloc.vec.Vec.len private_key_bytes + let i3 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i3 + let a2 ← + core.fmt.Arguments.new + (Array.make 54#usize [ + 40#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, + 116#u8, 101#u8, 100#u8, 32#u8, 77#u8, 76#u8, 75#u8, 69#u8, 77#u8, + 45#u8, 55#u8, 54#u8, 56#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, + 115#u8, 105#u8, 122#u8, 101#u8, 115#u8, 58#u8, 32#u8, 112#u8, + 114#u8, 105#u8, 118#u8, 97#u8, 116#u8, 101#u8, 61#u8, 192#u8, 9#u8, + 44#u8, 32#u8, 112#u8, 117#u8, 98#u8, 108#u8, 105#u8, 99#u8, 61#u8, + 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let s ← alloc.vec.Vec.as_slice Global private_key_bytes + let r ← + core.array.TryFromArrayCopySlice.try_from 2400#usize core.marker.CopyU8 + s + let r1 ← + core.result.Result.map_err + primitives.mlkem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let private_key ← primitives.mlkem.MLKEM768PrivateKey.from_bytes val + let s1 ← alloc.vec.Vec.as_slice Global public_key_bytes + let r2 ← + core.array.TryFromArrayCopySlice.try_from 1184#usize + core.marker.CopyU8 s1 + let r3 ← + core.result.Result.map_err + primitives.mlkem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r2 () + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r3 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let public_key ← primitives.mlkem.MLKEM768PublicKey.from_bytes val1 + ok (core.result.Result.Ok (private_key, public_key)) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) (core.convert.FromSame + anyhow.Error) residual + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) (core.convert.FromSame + anyhow.Error) residual + +/-- [securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 115:0-125:1 -/ +def primitives.mlkem.generate_mlkem768_keypair + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) anyhow.Error) × R) + := do + let (r, rng1) ← + libcrux_kem.key_gen rand_coreCryptoRngInst libcrux_kem.Algorithm.MlKem768 + rng + let r1 ← + core.result.Result.map_err + (primitives.mlkem.generate_mlkem768_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + let r2 ← primitives.mlkem.typed sk pk + ok (r2, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) (core.convert.FromSame + anyhow.Error) residual + ok (r2, rng1) + +/-- [securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 147:17-147:78 -/ +def + primitives.dh_akem.generate_dh_akem_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : primitives.dh_akem.generate_dh_akem_keypair.closure R + Clause1_Clause1_Clause0_Error) (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 34#usize [ + 31#u8, 68#u8, 72#u8, 45#u8, 65#u8, 75#u8, 69#u8, 77#u8, 32#u8, 107#u8, + 101#u8, 121#u8, 32#u8, 103#u8, 101#u8, 110#u8, 101#u8, 114#u8, 97#u8, + 116#u8, 105#u8, 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, + 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair::closure}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 147:17-147:78 -/ +@[reducible] +def + primitives.dh_akem.generate_dh_akem_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (primitives.dh_akem.generate_dh_akem_keypair.closure R + Clause1_Clause1_Clause0_Error) libcrux_kem.Error anyhow.Error := { + call_once := + primitives.dh_akem.generate_dh_akem_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::typed::closure#1}::call_once]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 133:21-133:78 -/ +def + primitives.dh_akem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.dh_akem.typed.closure_1) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert public key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::typed::closure#1}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 133:21-133:78 -/ +@[reducible] +def + primitives.dh_akem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.dh_akem.typed.closure_1 + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.dh_akem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::typed::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 127:21-127:79 -/ +def + primitives.dh_akem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.dh_akem.typed.closure) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert private key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::typed::closure}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 127:21-127:79 -/ +@[reducible] +def + primitives.dh_akem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.dh_akem.typed.closure + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.dh_akem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::{securedrop_protocol_minimal::primitives::dh_akem::DhAkemPrivateKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 38:4-40:5 -/ +def primitives.dh_akem.DhAkemPrivateKey.from_bytes + (bytes : Array Std.U8 32#usize) : + Result primitives.dh_akem.DhAkemPrivateKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::primitives::dh_akem::DH_AKEM_PRIVATE_KEY_LEN] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 6:0-6:98 -/ +@[global_simps, irreducible] +def primitives.dh_akem.DH_AKEM_PRIVATE_KEY_LEN : Result Std.Usize := + primitives.provider.curve25519.SK_LEN + +/-- [securedrop_protocol_minimal::primitives::dh_akem::typed]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 94:0-137:1 -/ +def primitives.dh_akem.typed + (sk : libcrux_kem.PrivateKey) (pk : libcrux_kem.PublicKey) : + Result (core.result.Result (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) anyhow.Error) + := do + let private_key_bytes ← libcrux_kem.PrivateKey.encode sk + let public_key_bytes ← libcrux_kem.PublicKey.encode pk + let i := alloc.vec.Vec.len private_key_bytes + let i1 ← primitives.dh_akem.DH_AKEM_PRIVATE_KEY_LEN + if i != i1 + then + let i2 := alloc.vec.Vec.len private_key_bytes + let i3 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i3 + let a2 ← + core.fmt.Arguments.new + (Array.make 52#usize [ + 38#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, 116#u8, + 101#u8, 100#u8, 32#u8, 68#u8, 72#u8, 45#u8, 65#u8, 75#u8, 69#u8, + 77#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 115#u8, 105#u8, 122#u8, + 101#u8, 115#u8, 58#u8, 32#u8, 112#u8, 114#u8, 105#u8, 118#u8, 97#u8, + 116#u8, 101#u8, 61#u8, 192#u8, 9#u8, 44#u8, 32#u8, 112#u8, 117#u8, + 98#u8, 108#u8, 105#u8, 99#u8, 61#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let i2 := alloc.vec.Vec.len public_key_bytes + let i3 ← primitives.dh_akem.DH_AKEM_PUBLIC_KEY_LEN + if i2 != i3 + then + let i4 := alloc.vec.Vec.len private_key_bytes + let i5 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i4 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i5 + let a2 ← + core.fmt.Arguments.new + (Array.make 52#usize [ + 38#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, + 116#u8, 101#u8, 100#u8, 32#u8, 68#u8, 72#u8, 45#u8, 65#u8, 75#u8, + 69#u8, 77#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 115#u8, 105#u8, + 122#u8, 101#u8, 115#u8, 58#u8, 32#u8, 112#u8, 114#u8, 105#u8, + 118#u8, 97#u8, 116#u8, 101#u8, 61#u8, 192#u8, 9#u8, 44#u8, 32#u8, + 112#u8, 117#u8, 98#u8, 108#u8, 105#u8, 99#u8, 61#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let s ← alloc.vec.Vec.as_slice Global private_key_bytes + let r ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 s + let r1 ← + core.result.Result.map_err + primitives.dh_akem.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let private_key ← primitives.dh_akem.DhAkemPrivateKey.from_bytes val + let s1 ← alloc.vec.Vec.as_slice Global public_key_bytes + let r2 ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 + s1 + let r3 ← + core.result.Result.map_err + primitives.dh_akem.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r2 () + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r3 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let public_key ← primitives.dh_akem.DhAkemPublicKey.from_bytes val1 + ok (core.result.Result.Ok (private_key, public_key)) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) (core.convert.FromSame + anyhow.Error) residual + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) (core.convert.FromSame + anyhow.Error) residual + +/-- [securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 140:0-149:1 -/ +def primitives.dh_akem.generate_dh_akem_keypair + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) anyhow.Error) × R) + := do + let (r, rng1) ← + libcrux_kem.key_gen rand_coreCryptoRngInst libcrux_kem.Algorithm.X25519 rng + let r1 ← + core.result.Result.map_err + (primitives.dh_akem.generate_dh_akem_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + let r2 ← primitives.dh_akem.typed sk pk + ok (r2, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) (core.convert.FromSame + anyhow.Error) residual + ok (r2, rng1) + +/-- [securedrop_protocol_minimal::message::keygen]: + Source: 'protocol-minimal/src/message.rs', lines 229:0-242:1 + Visibility: public -/ +def message.keygen + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result message.MessageKeyPair anyhow.Error) × R) + := do + let (r, rng1) ← + primitives.dh_akem.generate_dh_akem_keypair rand_coreRngCoreInst + rand_coreCryptoRngInst rng + let cf ← core.result.Result.Insts.CoreOpsTry.branch r + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk1, pk1) := val + let (r1, rng2) ← + primitives.mlkem.generate_mlkem768_keypair rand_coreRngCoreInst + rand_coreCryptoRngInst rng1 + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let (sk2, pk2) := val1 + ok (core.result.Result.Ok + { + sk := { dhakem := sk1, mlkem := sk2 }, + pk := { dhakem := pk1, mlkem := pk2 } + }, rng2) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageKeyPair (core.convert.FromSame anyhow.Error) residual + ok (r2, rng2) + | core.ops.control_flow.ControlFlow.Break residual => + let r1 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageKeyPair (core.convert.FromSame anyhow.Error) residual + ok (r1, rng1) + +/-- [securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 62:17-62:94 -/ +def + primitives.mlkem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + (c : primitives.mlkem.deterministic_keygen.closure) + (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 50#usize [ + 47#u8, 77#u8, 76#u8, 75#u8, 69#u8, 77#u8, 45#u8, 55#u8, 54#u8, 56#u8, + 32#u8, 100#u8, 101#u8, 116#u8, 101#u8, 114#u8, 109#u8, 105#u8, 110#u8, + 105#u8, 115#u8, 116#u8, 105#u8, 99#u8, 32#u8, 107#u8, 101#u8, 121#u8, + 32#u8, 103#u8, 101#u8, 110#u8, 101#u8, 114#u8, 97#u8, 116#u8, 105#u8, + 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, + 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen::closure}] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 62:17-62:94 -/ +@[reducible] +def + primitives.mlkem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + : core.ops.function.FnOnce primitives.mlkem.deterministic_keygen.closure + libcrux_kem.Error anyhow.Error := { + call_once := + primitives.mlkem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 55:0-65:1 -/ +def primitives.mlkem.deterministic_keygen + (randomness : Array Std.U8 64#usize) : + Result (core.result.Result (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) anyhow.Error) + := do + let s ← lift (Array.to_slice randomness) + let r ← libcrux_kem.key_gen_derand libcrux_kem.Algorithm.MlKem768 s + let r1 ← + core.result.Result.map_err + primitives.mlkem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + primitives.mlkem.typed sk pk + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.mlkem.MLKEM768PrivateKey × + primitives.mlkem.MLKEM768PublicKey) (core.convert.FromSame anyhow.Error) + residual + +/-- [securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 75:17-75:92 -/ +def + primitives.dh_akem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + (c : primitives.dh_akem.deterministic_keygen.closure) + (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 48#usize [ + 45#u8, 68#u8, 72#u8, 45#u8, 65#u8, 75#u8, 69#u8, 77#u8, 32#u8, 100#u8, + 101#u8, 116#u8, 101#u8, 114#u8, 109#u8, 105#u8, 110#u8, 105#u8, 115#u8, + 116#u8, 105#u8, 99#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 103#u8, + 101#u8, 110#u8, 101#u8, 114#u8, 97#u8, 116#u8, 105#u8, 111#u8, 110#u8, + 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, + 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen::closure}] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 75:17-75:92 -/ +@[reducible] +def + primitives.dh_akem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + : core.ops.function.FnOnce primitives.dh_akem.deterministic_keygen.closure + libcrux_kem.Error anyhow.Error := { + call_once := + primitives.dh_akem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::dh_akem::clamp]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 54:0-61:1 -/ +def primitives.dh_akem.clamp + (scalar : Array Std.U8 32#usize) : Result (Array Std.U8 32#usize) := do + let i ← Array.index_usize scalar 0#usize + let i1 ← lift (i &&& 248#u8) + let scalar1 ← Array.update scalar 0#usize i1 + let i2 ← Array.index_usize scalar1 31#usize + let i3 ← lift (i2 &&& 127#u8) + let scalar2 ← Array.update scalar1 31#usize i3 + let i4 ← Array.index_usize scalar2 31#usize + let i5 ← lift (i4 ||| 64#u8) + Array.update scalar2 31#usize i5 + +/-- [securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen]: + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 65:0-78:1 -/ +def primitives.dh_akem.deterministic_keygen + (randomness : Array Std.U8 32#usize) : + Result (core.result.Result (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) anyhow.Error) + := do + let clamped_randomness ← + core.array.CloneArray.clone core.clone.CloneU8 randomness + let clamped_randomness1 ← primitives.dh_akem.clamp clamped_randomness + let s ← lift (Array.to_slice clamped_randomness1) + let r ← libcrux_kem.key_gen_derand libcrux_kem.Algorithm.X25519 s + let r1 ← + core.result.Result.map_err + primitives.dh_akem.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + primitives.dh_akem.typed sk pk + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.dh_akem.DhAkemPrivateKey × + primitives.dh_akem.DhAkemPublicKey) (core.convert.FromSame anyhow.Error) + residual + +/-- [securedrop_protocol_minimal::message::deterministic_keygen]: + Source: 'protocol-minimal/src/message.rs', lines 247:0-263:1 -/ +def message.deterministic_keygen + (dh_seed : Array Std.U8 32#usize) (mlkem_seed : Array Std.U8 64#usize) : + Result (core.result.Result message.MessageKeyPair anyhow.Error) + := do + let r ← primitives.dh_akem.deterministic_keygen dh_seed + let cf ← core.result.Result.Insts.CoreOpsTry.branch r + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk1, pk1) := val + let r1 ← primitives.mlkem.deterministic_keygen mlkem_seed + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let (sk2, pk2) := val1 + ok (core.result.Result.Ok + { + sk := { dhakem := sk1, mlkem := sk2 }, + pk := { dhakem := pk1, mlkem := pk2 } + }) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageKeyPair (core.convert.FromSame anyhow.Error) residual + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + message.MessageKeyPair (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::primitives::mlkem::{securedrop_protocol_minimal::primitives::mlkem::MLKEM768PrivateKey}::as_bytes]: + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 33:4-35:5 -/ +def primitives.mlkem.MLKEM768PrivateKey.as_bytes + (self : primitives.mlkem.MLKEM768PrivateKey) : + Result (Array Std.U8 2400#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::message::auth_dec::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_dec::closure#1}::call_once]: + Source: 'protocol-minimal/src/message.rs', lines 376:13-376:67 -/ +def + message.auth_dec.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once + (c : message.auth_dec.closure_1) (tupled_args : hpke_rs.HpkeError) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug hpke_rs.HpkeError.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 27#usize [ + 24#u8, 83#u8, 68#u8, 45#u8, 65#u8, 80#u8, 75#u8, 69#u8, 32#u8, 65#u8, + 117#u8, 116#u8, 104#u8, 68#u8, 101#u8, 99#u8, 32#u8, 102#u8, 97#u8, + 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::message::auth_dec::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_dec::closure#1}] + Source: 'protocol-minimal/src/message.rs', lines 376:13-376:67 -/ +@[reducible] +def message.auth_dec.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError : + core.ops.function.FnOnce message.auth_dec.closure_1 hpke_rs.HpkeError + anyhow.Error := { + call_once := + message.auth_dec.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once +} + +/-- [securedrop_protocol_minimal::message::auth_dec::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::DecapsError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_dec::closure}::call_once]: + Source: 'protocol-minimal/src/message.rs', lines 356:17-356:76 -/ +def + message.auth_dec.closure.Insts.CoreOpsFunctionFnOnceTupleDecapsErrorError.call_once + (c : message.auth_dec.closure) + (tupled_args : libcrux_traits.kem.arrayref.DecapsError) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug + libcrux_traits.kem.arrayref.DecapsError.Insts.CoreFmtDebug tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 32#usize [ + 29#u8, 77#u8, 76#u8, 45#u8, 75#u8, 69#u8, 77#u8, 32#u8, 100#u8, 101#u8, + 99#u8, 97#u8, 112#u8, 115#u8, 117#u8, 108#u8, 97#u8, 116#u8, 105#u8, + 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, + 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::message::auth_dec::{impl core::ops::function::FnOnce<(libcrux_traits::kem::arrayref::DecapsError,), anyhow::Error> for securedrop_protocol_minimal::message::auth_dec::closure}] + Source: 'protocol-minimal/src/message.rs', lines 356:17-356:76 -/ +@[reducible] +def message.auth_dec.closure.Insts.CoreOpsFunctionFnOnceTupleDecapsErrorError : + core.ops.function.FnOnce message.auth_dec.closure + libcrux_traits.kem.arrayref.DecapsError anyhow.Error := { + call_once := + message.auth_dec.closure.Insts.CoreOpsFunctionFnOnceTupleDecapsErrorError.call_once +} + +/-- [securedrop_protocol_minimal::message::auth_dec]: + Source: 'protocol-minimal/src/message.rs', lines 345:0-377:1 + Visibility: public -/ +def message.auth_dec + (sk : message.MessagePrivateKey) (pk : message.MessagePublicKey) + (ct : message.MessageCiphertext) (ad : Slice Std.U8) (info : Slice Std.U8) : + Result (core.result.Result (alloc.vec.Vec Std.U8) anyhow.Error) + := do + let hpke ← + hpke_rs.Hpke.new + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke_rs.Mode.AuthPsk hpke_rs_crypto.types.KemAlgorithm.DhKem25519 + hpke_rs_crypto.types.KdfAlgorithm.HkdfSha256 + hpke_rs_crypto.types.AeadAlgorithm.Aes256Gcm + let a ← primitives.mlkem.MLKEM768PrivateKey.as_bytes sk.mlkem + let r ← + libcrux_traits.kem.owned.Kem.Blanket.decaps + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432 + ct.c2 a + let r1 ← + core.result.Result.map_err + message.auth_dec.closure.Insts.CoreOpsFunctionFnOnceTupleDecapsErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let dapk ← + primitives.dh_akem.DhAkemPrivateKey.Insts.CoreCloneClone.clone sk.dhakem + let skr1 ← + core.convert.IntoFrom.into + hpke_rs.HpkePrivateKey.Insts.CoreConvertFromDhAkemPrivateKey dapk + let dapk1 ← + primitives.dh_akem.DhAkemPublicKey.Insts.CoreCloneClone.clone pk.dhakem + let pks1 ← + core.convert.IntoFrom.into + hpke_rs.HpkePublicKey.Insts.CoreConvertFromDhAkemPublicKey dapk1 + let s ← lift (Array.to_slice ct.c2) + let full_info ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 (alloc.vec.Vec.new + Std.U8) s + let full_info1 ← + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 full_info info + let s1 ← lift (Array.to_slice ct.c1) + let s2 := alloc.vec.Vec.deref full_info1 + let s3 := alloc.vec.Vec.deref ct.cp + let s4 ← lift (Array.to_slice val) + let r2 ← + hpke_rs.Hpke.open + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke s1 skr1 s2 ad s3 (some s4) (some message.PSK_ID) (some pks1) + core.result.Result.map_err + message.auth_dec.closure_1.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError + r2 () + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (alloc.vec.Vec Std.U8) (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::metadata::LEN_METADATA_CIPHERTEXT] + Source: 'protocol-minimal/src/metadata.rs', lines 34:0-34:55 -/ +@[global_simps, irreducible] +def metadata.LEN_METADATA_CIPHERTEXT : Std.Usize := 1232#usize + +/-- [securedrop_protocol_minimal::primitives::xwing::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::xwing::XWingPublicKey}::fmt]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 11:9-11:14 + Visibility: public -/ +def primitives.xwing.XWingPublicKey.Insts.CoreFmtDebug.fmt + (self : primitives.xwing.XWingPublicKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (core.fmt.DebugShared (Array.Insts.CoreFmtDebug 1216#usize + core.fmt.DebugU8)) self + core.fmt.Formatter.debug_tuple_field1_finish f (toStr "XWingPublicKey") dyn + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::{impl core::fmt::Debug for securedrop_protocol_minimal::primitives::xwing::XWingPublicKey}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 11:9-11:14 -/ +@[reducible] +def primitives.xwing.XWingPublicKey.Insts.CoreFmtDebug : core.fmt.Debug + primitives.xwing.XWingPublicKey := { + fmt := primitives.xwing.XWingPublicKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::metadata::{impl core::fmt::Debug for securedrop_protocol_minimal::metadata::MetadataPublicKey}::fmt]: + Source: 'protocol-minimal/src/metadata.rs', lines 39:9-39:14 + Visibility: public -/ +def metadata.MetadataPublicKey.Insts.CoreFmtDebug.fmt + (self : metadata.MetadataPublicKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (core.fmt.DebugShared + primitives.xwing.XWingPublicKey.Insts.CoreFmtDebug) self + core.fmt.Formatter.debug_tuple_field1_finish f (toStr "MetadataPublicKey") + dyn + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::{impl core::fmt::Debug for securedrop_protocol_minimal::metadata::MetadataPublicKey}] + Source: 'protocol-minimal/src/metadata.rs', lines 39:9-39:14 -/ +@[reducible] +def metadata.MetadataPublicKey.Insts.CoreFmtDebug : core.fmt.Debug + metadata.MetadataPublicKey := { + fmt := metadata.MetadataPublicKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::metadata::{impl core::clone::Clone for securedrop_protocol_minimal::metadata::MetadataPublicKey}::clone]: + Source: 'protocol-minimal/src/metadata.rs', lines 39:16-39:21 + Visibility: public -/ +def metadata.MetadataPublicKey.Insts.CoreCloneClone.clone + (self : metadata.MetadataPublicKey) : Result metadata.MetadataPublicKey := do + let xpk ← primitives.xwing.XWingPublicKey.Insts.CoreCloneClone.clone self + ok xpk + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::{impl core::clone::Clone for securedrop_protocol_minimal::metadata::MetadataPublicKey}] + Source: 'protocol-minimal/src/metadata.rs', lines 39:16-39:21 -/ +@[reducible] +def metadata.MetadataPublicKey.Insts.CoreCloneClone : core.clone.Clone + metadata.MetadataPublicKey := { + clone := metadata.MetadataPublicKey.Insts.CoreCloneClone.clone +} + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataKeyPair}::public_key]: + Source: 'protocol-minimal/src/metadata.rs', lines 55:4-57:5 + Visibility: public -/ +def metadata.MetadataKeyPair.public_key + (self : metadata.MetadataKeyPair) : Result metadata.MetadataPublicKey := do + ok self.pk + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataKeyPair}::private_key]: + Source: 'protocol-minimal/src/metadata.rs', lines 60:4-62:5 + Visibility: public -/ +def metadata.MetadataKeyPair.private_key + (self : metadata.MetadataKeyPair) : Result metadata.MetadataPrivateKey := do + ok self.sk + +/-- [securedrop_protocol_minimal::primitives::xwing::{securedrop_protocol_minimal::primitives::xwing::XWingPrivateKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 37:4-39:5 -/ +def primitives.xwing.XWingPrivateKey.from_bytes + (bytes : Array Std.U8 32#usize) : + Result primitives.xwing.XWingPrivateKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::primitives::xwing::{securedrop_protocol_minimal::primitives::xwing::XWingPublicKey}::from_bytes]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 25:4-27:5 -/ +def primitives.xwing.XWingPublicKey.from_bytes + (bytes : Array Std.U8 1216#usize) : + Result primitives.xwing.XWingPublicKey + := do + ok bytes + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataKeyPair}::from_key_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 65:4-73:5 -/ +def metadata.MetadataKeyPair.from_key_bytes + (sk : Array Std.U8 32#usize) (pk : Array Std.U8 1216#usize) : + Result metadata.MetadataKeyPair + := do + let xpk ← primitives.xwing.XWingPrivateKey.from_bytes sk + let xpk1 ← primitives.xwing.XWingPublicKey.from_bytes pk + ok { sk := xpk, pk := xpk1 } + +/-- [securedrop_protocol_minimal::primitives::xwing::{securedrop_protocol_minimal::primitives::xwing::XWingPrivateKey}::as_bytes]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 32:4-34:5 -/ +def primitives.xwing.XWingPrivateKey.as_bytes + (self : primitives.xwing.XWingPrivateKey) : + Result (Array Std.U8 32#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataKeyPair}::secret_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 76:4-78:5 -/ +def metadata.MetadataKeyPair.secret_bytes + (self : metadata.MetadataKeyPair) : Result (Array Std.U8 32#usize) := do + let xpk := self.sk + primitives.xwing.XWingPrivateKey.as_bytes xpk + +/-- [securedrop_protocol_minimal::primitives::xwing::{securedrop_protocol_minimal::primitives::xwing::XWingPublicKey}::as_bytes]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 20:4-22:5 -/ +def primitives.xwing.XWingPublicKey.as_bytes + (self : primitives.xwing.XWingPublicKey) : + Result (Array Std.U8 1216#usize) + := do + ok self + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataKeyPair}::public_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 81:4-83:5 -/ +def metadata.MetadataKeyPair.public_bytes + (self : metadata.MetadataKeyPair) : Result (Array Std.U8 1216#usize) := do + let xpk := self.pk + primitives.xwing.XWingPublicKey.as_bytes xpk + +/-- [securedrop_protocol_minimal::metadata::{impl core::fmt::Debug for securedrop_protocol_minimal::metadata::MetadataCiphertext}::fmt]: + Source: 'protocol-minimal/src/metadata.rs', lines 89:9-89:14 + Visibility: public -/ +def metadata.MetadataCiphertext.Insts.CoreFmtDebug.fmt + (self : metadata.MetadataCiphertext) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + let dyn := + Dyn.mk _ (Array.Insts.CoreFmtDebug 1120#usize core.fmt.DebugU8) self.c + let dyn1 := + Dyn.mk _ (core.fmt.DebugShared (Array.Insts.CoreFmtDebug 1232#usize + core.fmt.DebugU8)) self.cp + core.fmt.Formatter.debug_struct_field2_finish f (toStr "MetadataCiphertext") + (toStr "c") dyn (toStr "cp") dyn1 + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::{impl core::fmt::Debug for securedrop_protocol_minimal::metadata::MetadataCiphertext}] + Source: 'protocol-minimal/src/metadata.rs', lines 89:9-89:14 -/ +@[reducible] +def metadata.MetadataCiphertext.Insts.CoreFmtDebug : core.fmt.Debug + metadata.MetadataCiphertext := { + fmt := metadata.MetadataCiphertext.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::metadata::{impl core::clone::Clone for securedrop_protocol_minimal::metadata::MetadataCiphertext}::clone]: + Source: 'protocol-minimal/src/metadata.rs', lines 89:16-89:21 + Visibility: public -/ +def metadata.MetadataCiphertext.Insts.CoreCloneClone.clone + (self : metadata.MetadataCiphertext) : + Result metadata.MetadataCiphertext + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self.c + let a1 ← core.array.CloneArray.clone core.clone.CloneU8 self.cp + ok { c := a, cp := a1 } + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::{impl core::clone::Clone for securedrop_protocol_minimal::metadata::MetadataCiphertext}] + Source: 'protocol-minimal/src/metadata.rs', lines 89:16-89:21 -/ +@[reducible] +def metadata.MetadataCiphertext.Insts.CoreCloneClone : core.clone.Clone + metadata.MetadataCiphertext := { + clone := metadata.MetadataCiphertext.Insts.CoreCloneClone.clone +} + +/-- [securedrop_protocol_minimal::primitives::xwing::LEN_XWING_SHAREDSECRET_ENCAPS] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 8:0-8:61 -/ +@[global_simps, irreducible] +def primitives.xwing.LEN_XWING_SHAREDSECRET_ENCAPS : Std.Usize := 1120#usize + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataCiphertext}::len]: + Source: 'protocol-minimal/src/metadata.rs', lines 99:4-103:5 + Visibility: public -/ +def metadata.MetadataCiphertext.len + (self : metadata.MetadataCiphertext) : Result Std.Usize := do + primitives.xwing.LEN_XWING_SHAREDSECRET_ENCAPS + + metadata.LEN_METADATA_CIPHERTEXT + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataCiphertext}::as_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 106:4-111:5 + Visibility: public -/ +def metadata.MetadataCiphertext.as_bytes + (self : metadata.MetadataCiphertext) : Result (alloc.vec.Vec Std.U8) := do + let i ← metadata.MetadataCiphertext.len self + let out := alloc.vec.Vec.with_capacity Std.U8 i + let s ← lift (Array.to_slice self.c) + let out1 ← alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out s + let s1 ← lift (Array.to_slice self.cp) + alloc.vec.Vec.extend_from_slice core.clone.CloneU8 out1 s1 + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataCiphertext}::from_bytes::TOTAL_LEN] + Source: 'protocol-minimal/src/metadata.rs', lines 119:8-119:89 -/ +@[global_simps, irreducible] +def metadata.MetadataCiphertext.from_bytes.TOTAL_LEN : Result Std.Usize := + primitives.xwing.LEN_XWING_SHAREDSECRET_ENCAPS + + metadata.LEN_METADATA_CIPHERTEXT + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataCiphertext}::from_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 118:4-135:5 + Visibility: public -/ +def metadata.MetadataCiphertext.from_bytes + (bytes : Slice Std.U8) : + Result (core.result.Result metadata.MetadataCiphertext anyhow.Error) + := do + let i := Slice.len bytes + let i1 ← metadata.MetadataCiphertext.from_bytes.TOTAL_LEN + if i != i1 + then + let i2 := Slice.len bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i1 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a2 ← + core.fmt.Arguments.new + (Array.make 55#usize [ + 44#u8, 73#u8, 110#u8, 118#u8, 97#u8, 108#u8, 105#u8, 100#u8, 32#u8, + 77#u8, 101#u8, 116#u8, 97#u8, 100#u8, 97#u8, 116#u8, 97#u8, 67#u8, + 105#u8, 112#u8, 104#u8, 101#u8, 114#u8, 116#u8, 101#u8, 120#u8, + 116#u8, 32#u8, 108#u8, 101#u8, 110#u8, 103#u8, 116#u8, 104#u8, 58#u8, + 32#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, 116#u8, 101#u8, 100#u8, + 32#u8, 192#u8, 6#u8, 44#u8, 32#u8, 103#u8, 111#u8, 116#u8, 32#u8, + 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let (c, cp) ← + core.slice.Slice.split_at bytes + primitives.xwing.LEN_XWING_SHAREDSECRET_ENCAPS + let r ← + core.array.TryFromArrayCopySlice.try_from 1120#usize core.marker.CopyU8 c + let a ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r (toStr + "checked length") + let r1 ← + core.array.TryFromArrayCopySlice.try_from 1232#usize core.marker.CopyU8 + cp + let a1 ← + core.result.Result.expect core.fmt.DebugTryFromSliceError r1 (toStr + "checked length") + ok (core.result.Result.Ok { c := a, cp := a1 }) + +/-- [securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 123:17-123:76 -/ +def + primitives.xwing.generate_xwing_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) + (c : primitives.xwing.generate_xwing_keypair.closure R + Clause1_Clause1_Clause0_Error) (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 32#usize [ + 29#u8, 88#u8, 87#u8, 73#u8, 78#u8, 71#u8, 32#u8, 107#u8, 101#u8, + 121#u8, 32#u8, 103#u8, 101#u8, 110#u8, 101#u8, 114#u8, 97#u8, 116#u8, + 105#u8, 111#u8, 110#u8, 32#u8, 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, + 100#u8, 58#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair::closure}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 123:17-123:76 -/ +@[reducible] +def + primitives.xwing.generate_xwing_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) : core.ops.function.FnOnce + (primitives.xwing.generate_xwing_keypair.closure R + Clause1_Clause1_Clause0_Error) libcrux_kem.Error anyhow.Error := { + call_once := + primitives.xwing.generate_xwing_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + rand_coreRngCoreInst rand_coreCryptoRngInst +} + +/-- [securedrop_protocol_minimal::primitives::xwing::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::typed::closure#1}::call_once]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 109:21-109:78 -/ +def + primitives.xwing.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.xwing.typed.closure_1) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert public key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::typed::closure#1}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 109:21-109:78 -/ +@[reducible] +def + primitives.xwing.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.xwing.typed.closure_1 + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.xwing.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::xwing::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::typed::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 103:21-103:79 -/ +def + primitives.xwing.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : primitives.xwing.typed.closure) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let a ← + core.fmt.Arguments.from_str (toStr "Failed to convert private key bytes") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::typed::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::typed::closure}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 103:21-103:79 -/ +@[reducible] +def + primitives.xwing.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce primitives.xwing.typed.closure + core.array.TryFromSliceError anyhow.Error := { + call_once := + primitives.xwing.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::xwing::XWING_PRIVATE_KEY_LEN] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 7:0-7:51 -/ +@[global_simps, irreducible] +def primitives.xwing.XWING_PRIVATE_KEY_LEN : Std.Usize := 32#usize + +/-- [securedrop_protocol_minimal::primitives::xwing::XWING_PUBLIC_KEY_LEN] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 6:0-6:45 + Visibility: public -/ +@[global_simps, irreducible] +def primitives.xwing.XWING_PUBLIC_KEY_LEN : Std.Usize := 1216#usize + +/-- [securedrop_protocol_minimal::primitives::xwing::typed]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 70:0-113:1 -/ +def primitives.xwing.typed + (sk : libcrux_kem.PrivateKey) (pk : libcrux_kem.PublicKey) : + Result (core.result.Result (primitives.xwing.XWingPrivateKey × + primitives.xwing.XWingPublicKey) anyhow.Error) + := do + let private_key_bytes ← libcrux_kem.PrivateKey.encode sk + let public_key_bytes ← libcrux_kem.PublicKey.encode pk + let i := alloc.vec.Vec.len private_key_bytes + if i != primitives.xwing.XWING_PRIVATE_KEY_LEN + then + let i1 := alloc.vec.Vec.len private_key_bytes + let i2 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i1 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a2 ← + core.fmt.Arguments.new + (Array.make 50#usize [ + 36#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, 116#u8, + 101#u8, 100#u8, 32#u8, 88#u8, 87#u8, 73#u8, 78#u8, 71#u8, 32#u8, + 107#u8, 101#u8, 121#u8, 32#u8, 115#u8, 105#u8, 122#u8, 101#u8, + 115#u8, 58#u8, 32#u8, 112#u8, 114#u8, 105#u8, 118#u8, 97#u8, 116#u8, + 101#u8, 61#u8, 192#u8, 9#u8, 44#u8, 32#u8, 112#u8, 117#u8, 98#u8, + 108#u8, 105#u8, 99#u8, 61#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let i1 := alloc.vec.Vec.len public_key_bytes + if i1 != primitives.xwing.XWING_PUBLIC_KEY_LEN + then + let i2 := alloc.vec.Vec.len private_key_bytes + let i3 := alloc.vec.Vec.len public_key_bytes + let a ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i2 + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i3 + let a2 ← + core.fmt.Arguments.new + (Array.make 50#usize [ + 36#u8, 85#u8, 110#u8, 101#u8, 120#u8, 112#u8, 101#u8, 99#u8, + 116#u8, 101#u8, 100#u8, 32#u8, 88#u8, 87#u8, 73#u8, 78#u8, 71#u8, + 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 115#u8, 105#u8, 122#u8, + 101#u8, 115#u8, 58#u8, 32#u8, 112#u8, 114#u8, 105#u8, 118#u8, + 97#u8, 116#u8, 101#u8, 61#u8, 192#u8, 9#u8, 44#u8, 32#u8, 112#u8, + 117#u8, 98#u8, 108#u8, 105#u8, 99#u8, 61#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + let e ← + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + ok (core.result.Result.Err e) + else + let s ← alloc.vec.Vec.as_slice Global private_key_bytes + let r ← + core.array.TryFromArrayCopySlice.try_from 32#usize core.marker.CopyU8 s + let r1 ← + core.result.Result.map_err + primitives.xwing.typed.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let private_key ← primitives.xwing.XWingPrivateKey.from_bytes val + let s1 ← alloc.vec.Vec.as_slice Global public_key_bytes + let r2 ← + core.array.TryFromArrayCopySlice.try_from 1216#usize + core.marker.CopyU8 s1 + let r3 ← + core.result.Result.map_err + primitives.xwing.typed.closure_1.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r2 () + let cf1 ← core.result.Result.Insts.CoreOpsTry.branch r3 + match cf1 with + | core.ops.control_flow.ControlFlow.Continue val1 => + let public_key ← primitives.xwing.XWingPublicKey.from_bytes val1 + ok (core.result.Result.Ok (private_key, public_key)) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.xwing.XWingPrivateKey × + primitives.xwing.XWingPublicKey) (core.convert.FromSame + anyhow.Error) residual + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.xwing.XWingPrivateKey × primitives.xwing.XWingPublicKey) + (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 116:0-126:1 -/ +def primitives.xwing.generate_xwing_keypair + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result (primitives.xwing.XWingPrivateKey × + primitives.xwing.XWingPublicKey) anyhow.Error) × R) + := do + let (r, rng1) ← + libcrux_kem.key_gen rand_coreCryptoRngInst + libcrux_kem.Algorithm.XWingKemDraft06 rng + let r1 ← + core.result.Result.map_err + (primitives.xwing.generate_xwing_keypair.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + rand_coreRngCoreInst rand_coreCryptoRngInst) r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + let r2 ← primitives.xwing.typed sk pk + ok (r2, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r2 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.xwing.XWingPrivateKey × primitives.xwing.XWingPublicKey) + (core.convert.FromSame anyhow.Error) residual + ok (r2, rng1) + +/-- [securedrop_protocol_minimal::metadata::keygen]: + Source: 'protocol-minimal/src/metadata.rs', lines 159:0-165:1 + Visibility: public -/ +def metadata.keygen + {R : Type} {Clause1_Clause1_Clause0_Error : Type} (rand_coreRngCoreInst : + rand_core.RngCore R) (rand_coreCryptoRngInst : rand_core.CryptoRng R + Clause1_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result metadata.MetadataKeyPair anyhow.Error) × R) + := do + let (r, rng1) ← + primitives.xwing.generate_xwing_keypair rand_coreRngCoreInst + rand_coreCryptoRngInst rng + let cf ← core.result.Result.Insts.CoreOpsTry.branch r + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk_s, pk_s) := val + ok (core.result.Result.Ok { sk := sk_s, pk := pk_s }, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r1 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + metadata.MetadataKeyPair (core.convert.FromSame anyhow.Error) residual + ok (r1, rng1) + +/-- [securedrop_protocol_minimal::primitives::xwing::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::deterministic_keygen::closure}::call_once]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 63:17-63:90 -/ +def + primitives.xwing.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + (c : primitives.xwing.deterministic_keygen.closure) + (tupled_args : libcrux_kem.Error) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug libcrux_kem.Error.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 46#usize [ + 43#u8, 88#u8, 87#u8, 73#u8, 78#u8, 71#u8, 32#u8, 100#u8, 101#u8, + 116#u8, 101#u8, 114#u8, 109#u8, 105#u8, 110#u8, 105#u8, 115#u8, 116#u8, + 105#u8, 99#u8, 32#u8, 107#u8, 101#u8, 121#u8, 32#u8, 103#u8, 101#u8, + 110#u8, 101#u8, 114#u8, 97#u8, 116#u8, 105#u8, 111#u8, 110#u8, 32#u8, + 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, + 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::deterministic_keygen::{impl core::ops::function::FnOnce<(libcrux_kem::Error,), anyhow::Error> for securedrop_protocol_minimal::primitives::xwing::deterministic_keygen::closure}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 63:17-63:90 -/ +@[reducible] +def + primitives.xwing.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + : core.ops.function.FnOnce primitives.xwing.deterministic_keygen.closure + libcrux_kem.Error anyhow.Error := { + call_once := + primitives.xwing.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once +} + +/-- [securedrop_protocol_minimal::primitives::xwing::deterministic_keygen]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 56:0-66:1 -/ +def primitives.xwing.deterministic_keygen + (randomness : Array Std.U8 32#usize) : + Result (core.result.Result (primitives.xwing.XWingPrivateKey × + primitives.xwing.XWingPublicKey) anyhow.Error) + := do + let s ← lift (Array.to_slice randomness) + let r ← libcrux_kem.key_gen_derand libcrux_kem.Algorithm.XWingKemDraft06 s + let r1 ← + core.result.Result.map_err + primitives.xwing.deterministic_keygen.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + r () + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, pk) := val + primitives.xwing.typed sk pk + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + (primitives.xwing.XWingPrivateKey × primitives.xwing.XWingPublicKey) + (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::metadata::deterministic_keygen]: + Source: 'protocol-minimal/src/metadata.rs', lines 175:0-182:1 -/ +def metadata.deterministic_keygen + (randomness : Array Std.U8 32#usize) : + Result (core.result.Result metadata.MetadataKeyPair anyhow.Error) + := do + let r ← primitives.xwing.deterministic_keygen randomness + let cf ← core.result.Result.Insts.CoreOpsTry.branch r + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk_s, pk_s) := val + ok (core.result.Result.Ok { sk := sk_s, pk := pk_s }) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + metadata.MetadataKeyPair (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::as_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 186:4-188:5 + Visibility: public -/ +def metadata.MetadataPublicKey.as_bytes + (self : metadata.MetadataPublicKey) : Result (Slice Std.U8) := do + let a ← primitives.xwing.XWingPublicKey.as_bytes self + ok (Array.to_slice a) + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes::closure<'_0>}::call_once]: + Source: 'protocol-minimal/src/metadata.rs', lines 196:71-202:9 -/ +def + metadata.MetadataPublicKey.from_bytes.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once + (c : metadata.MetadataPublicKey.from_bytes.closure) + (tupled_args : core.array.TryFromSliceError) : + Result anyhow.Error + := do + let i := Slice.len c + let a ← + core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay + primitives.xwing.XWING_PUBLIC_KEY_LEN + let a1 ← core.fmt.rt.Argument.new_display Usize.Insts.CoreFmtDisplay i + let a2 ← + core.fmt.Arguments.new + (Array.make 54#usize [ + 43#u8, 73#u8, 110#u8, 118#u8, 97#u8, 108#u8, 105#u8, 100#u8, 32#u8, + 77#u8, 101#u8, 116#u8, 97#u8, 100#u8, 97#u8, 116#u8, 97#u8, 80#u8, + 117#u8, 98#u8, 108#u8, 105#u8, 99#u8, 75#u8, 101#u8, 121#u8, 32#u8, + 108#u8, 101#u8, 110#u8, 103#u8, 116#u8, 104#u8, 58#u8, 32#u8, 101#u8, + 120#u8, 112#u8, 101#u8, 99#u8, 116#u8, 101#u8, 100#u8, 32#u8, 192#u8, + 6#u8, 44#u8, 32#u8, 103#u8, 111#u8, 116#u8, 32#u8, 192#u8, 0#u8 + ]) (Array.make 2#usize [ a, a1 ]) + let s ← alloc.fmt.format a2 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes::{impl core::ops::function::FnOnce<(core::array::TryFromSliceError,), anyhow::Error> for securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes::closure<'_0>}] + Source: 'protocol-minimal/src/metadata.rs', lines 196:71-202:9 -/ +@[reducible] +def + metadata.MetadataPublicKey.from_bytes.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + : core.ops.function.FnOnce metadata.MetadataPublicKey.from_bytes.closure + core.array.TryFromSliceError anyhow.Error := { + call_once := + metadata.MetadataPublicKey.from_bytes.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError.call_once +} + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes]: + Source: 'protocol-minimal/src/metadata.rs', lines 195:4-204:5 + Visibility: public -/ +def metadata.MetadataPublicKey.from_bytes + (bytes : Slice Std.U8) : + Result (core.result.Result metadata.MetadataPublicKey anyhow.Error) + := do + let r ← + core.array.TryFromArrayCopySlice.try_from 1216#usize core.marker.CopyU8 + bytes + let r1 ← + core.result.Result.map_err + metadata.MetadataPublicKey.from_bytes.closure.Insts.CoreOpsFunctionFnOnceTupleTryFromSliceErrorError + r bytes + let cf ← core.result.Result.Insts.CoreOpsTry.branch r1 + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let xpk ← primitives.xwing.XWingPublicKey.from_bytes val + ok (core.result.Result.Ok xpk) + | core.ops.control_flow.ControlFlow.Break residual => + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + metadata.MetadataPublicKey (core.convert.FromSame anyhow.Error) residual + +/-- [securedrop_protocol_minimal::primitives::xwing::{impl core::convert::From for hpke_rs::HpkePrivateKey}::from]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 43:4-45:5 + Visibility: public -/ +def hpke_rs.HpkePrivateKey.Insts.CoreConvertFromXWingPrivateKey.from + (sk : primitives.xwing.XWingPrivateKey) : Result hpke_rs.HpkePrivateKey := do + let s ← lift (Array.to_slice sk) + let v ← alloc.slice.Slice.to_vec core.clone.CloneU8 s + hpke_rs.HpkePrivateKey.Insts.CoreConvertFromVecU8.from v + +/-- Trait implementation: [securedrop_protocol_minimal::primitives::xwing::{impl core::convert::From for hpke_rs::HpkePrivateKey}] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 42:0-46:1 -/ +@[reducible] +def hpke_rs.HpkePrivateKey.Insts.CoreConvertFromXWingPrivateKey : + core.convert.From hpke_rs.HpkePrivateKey primitives.xwing.XWingPrivateKey + := { + «from» := hpke_rs.HpkePrivateKey.Insts.CoreConvertFromXWingPrivateKey.from +} + +/-- [securedrop_protocol_minimal::primitives::xwing::{impl core::clone::Clone for securedrop_protocol_minimal::primitives::xwing::XWingPrivateKey}::clone]: + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 15:16-15:21 + Visibility: public -/ +def primitives.xwing.XWingPrivateKey.Insts.CoreCloneClone.clone + (self : primitives.xwing.XWingPrivateKey) : + Result primitives.xwing.XWingPrivateKey + := do + let a ← core.array.CloneArray.clone core.clone.CloneU8 self + ok a + +/-- [securedrop_protocol_minimal::metadata::decrypt::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::metadata::decrypt::closure}::call_once]: + Source: 'protocol-minimal/src/metadata.rs', lines 286:17-286:73 -/ +def + metadata.decrypt.closure.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once + (c : metadata.decrypt.closure) (tupled_args : hpke_rs.HpkeError) : + Result anyhow.Error + := do + let a ← + core.fmt.rt.Argument.new_debug hpke_rs.HpkeError.Insts.CoreFmtDebug + tupled_args + let a1 ← + core.fmt.Arguments.new + (Array.make 29#usize [ + 26#u8, 83#u8, 68#u8, 45#u8, 80#u8, 75#u8, 69#u8, 32#u8, 100#u8, 101#u8, + 99#u8, 114#u8, 121#u8, 112#u8, 116#u8, 105#u8, 111#u8, 110#u8, 32#u8, + 102#u8, 97#u8, 105#u8, 108#u8, 101#u8, 100#u8, 58#u8, 32#u8, 192#u8, + 0#u8 + ]) (Array.make 1#usize [ a ]) + let s ← alloc.fmt.format a1 + let s1 ← core.hint.must_use s + anyhow.error.Error.msg alloc.string.String.Insts.CoreFmtDisplay + alloc.string.String.Insts.CoreFmtDebug s1 + +/-- Trait implementation: [securedrop_protocol_minimal::metadata::decrypt::{impl core::ops::function::FnOnce<(hpke_rs::HpkeError,), anyhow::Error> for securedrop_protocol_minimal::metadata::decrypt::closure}] + Source: 'protocol-minimal/src/metadata.rs', lines 286:17-286:73 -/ +@[reducible] +def metadata.decrypt.closure.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError : + core.ops.function.FnOnce metadata.decrypt.closure hpke_rs.HpkeError + anyhow.Error := { + call_once := + metadata.decrypt.closure.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError.call_once +} + +/-- [securedrop_protocol_minimal::metadata::decrypt]: + Source: 'protocol-minimal/src/metadata.rs', lines 278:0-287:1 + Visibility: public -/ +def metadata.decrypt + (sk_r : metadata.MetadataPrivateKey) (ct : metadata.MetadataCiphertext) : + Result (core.result.Result (alloc.vec.Vec Std.U8) anyhow.Error) + := do + let hpke ← + hpke_rs.Hpke.new + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke_rs.Mode.Base hpke_rs_crypto.types.KemAlgorithm.XWingDraft06 + hpke_rs_crypto.types.KdfAlgorithm.HkdfSha256 + hpke_rs_crypto.types.AeadAlgorithm.Aes256Gcm + let xpk ← primitives.xwing.XWingPrivateKey.Insts.CoreCloneClone.clone sk_r + let sk_r_hpke ← + core.convert.IntoFrom.into + hpke_rs.HpkePrivateKey.Insts.CoreConvertFromXWingPrivateKey xpk + let s ← lift (Array.to_slice ct.c) + let s1 ← lift (Array.to_slice (Std.Array.empty Std.U8)) + let s2 ← lift (Array.to_slice (Std.Array.empty Std.U8)) + let s3 ← lift (Array.to_slice ct.cp) + let r ← + hpke_rs.Hpke.open + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError + hpke s sk_r_hpke s1 s2 s3 none none none + core.result.Result.map_err + metadata.decrypt.closure.Insts.CoreOpsFunctionFnOnceTupleHpkeErrorError r + () + +/-- [securedrop_protocol_minimal::sign::KEY_LEN_ED25519] + Source: 'protocol-minimal/src/sign.rs', lines 11:0-11:34 -/ +@[global_simps, irreducible] def sign.KEY_LEN_ED25519 : Std.Usize := 32#usize + +/-- [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::JournalistLongTermKey}::fmt]: + Source: 'protocol-minimal/src/sign.rs', lines 35:9-35:14 + Visibility: public -/ +def sign.JournalistLongTermKey.Insts.CoreFmtDebug.fmt + (self : sign.JournalistLongTermKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + core.fmt.Formatter.write_str f (toStr "JournalistLongTermKey") + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:9-35:14 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreFmtDebug : core.fmt.Debug + sign.JournalistLongTermKey := { + fmt := sign.JournalistLongTermKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::JournalistLongTermKey}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 35:16-35:21 + Visibility: public -/ +def sign.JournalistLongTermKey.Insts.CoreCloneClone.clone + (self : sign.JournalistLongTermKey) : Result sign.JournalistLongTermKey := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:16-35:21 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreCloneClone : core.clone.Clone + sign.JournalistLongTermKey := { + clone := sign.JournalistLongTermKey.Insts.CoreCloneClone.clone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:23-35:27 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreMarkerCopy : core.marker.Copy + sign.JournalistLongTermKey := { + cloneInst := sign.JournalistLongTermKey.Insts.CoreCloneClone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::StructuralPartialEq for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:29-35:38 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreMarkerStructuralPartialEq : + core.marker.StructuralPartialEq sign.JournalistLongTermKey := { +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::JournalistLongTermKey}::eq]: + Source: 'protocol-minimal/src/sign.rs', lines 35:29-35:38 + Visibility: public -/ +def sign.JournalistLongTermKey.Insts.CoreCmpPartialEqJournalistLongTermKey.eq + (self : sign.JournalistLongTermKey) (other : sign.JournalistLongTermKey) : + Result Bool + := do + ok true + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:29-35:38 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreCmpPartialEqJournalistLongTermKey : + core.cmp.PartialEq sign.JournalistLongTermKey sign.JournalistLongTermKey := { + eq := + sign.JournalistLongTermKey.Insts.CoreCmpPartialEqJournalistLongTermKey.eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::JournalistLongTermKey}::assert_fields_are_eq]: + Source: 'protocol-minimal/src/sign.rs', lines 35:40-35:42 + Visibility: public -/ +def sign.JournalistLongTermKey.Insts.CoreCmpEq.assert_fields_are_eq + (self : sign.JournalistLongTermKey) : Result Unit := do + ok () + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 35:40-35:42 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.CoreCmpEq : core.cmp.Eq + sign.JournalistLongTermKey := { + partialEqInst := + sign.JournalistLongTermKey.Insts.CoreCmpPartialEqJournalistLongTermKey + assert_fields_are_eq := + sign.JournalistLongTermKey.Insts.CoreCmpEq.assert_fields_are_eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::JournalistEphemeralKey}::fmt]: + Source: 'protocol-minimal/src/sign.rs', lines 39:9-39:14 + Visibility: public -/ +def sign.JournalistEphemeralKey.Insts.CoreFmtDebug.fmt + (self : sign.JournalistEphemeralKey) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + core.fmt.Formatter.write_str f (toStr "JournalistEphemeralKey") + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:9-39:14 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreFmtDebug : core.fmt.Debug + sign.JournalistEphemeralKey := { + fmt := sign.JournalistEphemeralKey.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::JournalistEphemeralKey}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 39:16-39:21 + Visibility: public -/ +def sign.JournalistEphemeralKey.Insts.CoreCloneClone.clone + (self : sign.JournalistEphemeralKey) : + Result sign.JournalistEphemeralKey + := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:16-39:21 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreCloneClone : core.clone.Clone + sign.JournalistEphemeralKey := { + clone := sign.JournalistEphemeralKey.Insts.CoreCloneClone.clone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:23-39:27 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreMarkerCopy : core.marker.Copy + sign.JournalistEphemeralKey := { + cloneInst := sign.JournalistEphemeralKey.Insts.CoreCloneClone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::StructuralPartialEq for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:29-39:38 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreMarkerStructuralPartialEq : + core.marker.StructuralPartialEq sign.JournalistEphemeralKey := { +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::JournalistEphemeralKey}::eq]: + Source: 'protocol-minimal/src/sign.rs', lines 39:29-39:38 + Visibility: public -/ +def sign.JournalistEphemeralKey.Insts.CoreCmpPartialEqJournalistEphemeralKey.eq + (self : sign.JournalistEphemeralKey) (other : sign.JournalistEphemeralKey) : + Result Bool + := do + ok true + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:29-39:38 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreCmpPartialEqJournalistEphemeralKey : + core.cmp.PartialEq sign.JournalistEphemeralKey sign.JournalistEphemeralKey + := { + eq := + sign.JournalistEphemeralKey.Insts.CoreCmpPartialEqJournalistEphemeralKey.eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::JournalistEphemeralKey}::assert_fields_are_eq]: + Source: 'protocol-minimal/src/sign.rs', lines 39:40-39:42 + Visibility: public -/ +def sign.JournalistEphemeralKey.Insts.CoreCmpEq.assert_fields_are_eq + (self : sign.JournalistEphemeralKey) : Result Unit := do + ok () + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 39:40-39:42 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.CoreCmpEq : core.cmp.Eq + sign.JournalistEphemeralKey := { + partialEqInst := + sign.JournalistEphemeralKey.Insts.CoreCmpPartialEqJournalistEphemeralKey + assert_fields_are_eq := + sign.JournalistEphemeralKey.Insts.CoreCmpEq.assert_fields_are_eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::NewsroomOnJournalist}::fmt]: + Source: 'protocol-minimal/src/sign.rs', lines 43:9-43:14 + Visibility: public -/ +def sign.NewsroomOnJournalist.Insts.CoreFmtDebug.fmt + (self : sign.NewsroomOnJournalist) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + core.fmt.Formatter.write_str f (toStr "NewsroomOnJournalist") + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:9-43:14 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreFmtDebug : core.fmt.Debug + sign.NewsroomOnJournalist := { + fmt := sign.NewsroomOnJournalist.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::NewsroomOnJournalist}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 43:16-43:21 + Visibility: public -/ +def sign.NewsroomOnJournalist.Insts.CoreCloneClone.clone + (self : sign.NewsroomOnJournalist) : Result sign.NewsroomOnJournalist := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:16-43:21 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreCloneClone : core.clone.Clone + sign.NewsroomOnJournalist := { + clone := sign.NewsroomOnJournalist.Insts.CoreCloneClone.clone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:23-43:27 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreMarkerCopy : core.marker.Copy + sign.NewsroomOnJournalist := { + cloneInst := sign.NewsroomOnJournalist.Insts.CoreCloneClone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::StructuralPartialEq for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:29-43:38 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreMarkerStructuralPartialEq : + core.marker.StructuralPartialEq sign.NewsroomOnJournalist := { +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::NewsroomOnJournalist}::eq]: + Source: 'protocol-minimal/src/sign.rs', lines 43:29-43:38 + Visibility: public -/ +def sign.NewsroomOnJournalist.Insts.CoreCmpPartialEqNewsroomOnJournalist.eq + (self : sign.NewsroomOnJournalist) (other : sign.NewsroomOnJournalist) : + Result Bool + := do + ok true + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:29-43:38 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreCmpPartialEqNewsroomOnJournalist : + core.cmp.PartialEq sign.NewsroomOnJournalist sign.NewsroomOnJournalist := { + eq := sign.NewsroomOnJournalist.Insts.CoreCmpPartialEqNewsroomOnJournalist.eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::NewsroomOnJournalist}::assert_fields_are_eq]: + Source: 'protocol-minimal/src/sign.rs', lines 43:40-43:42 + Visibility: public -/ +def sign.NewsroomOnJournalist.Insts.CoreCmpEq.assert_fields_are_eq + (self : sign.NewsroomOnJournalist) : Result Unit := do + ok () + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 43:40-43:42 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.CoreCmpEq : core.cmp.Eq + sign.NewsroomOnJournalist := { + partialEqInst := + sign.NewsroomOnJournalist.Insts.CoreCmpPartialEqNewsroomOnJournalist + assert_fields_are_eq := + sign.NewsroomOnJournalist.Insts.CoreCmpEq.assert_fields_are_eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::FpfOnNewsroom}::fmt]: + Source: 'protocol-minimal/src/sign.rs', lines 47:9-47:14 + Visibility: public -/ +def sign.FpfOnNewsroom.Insts.CoreFmtDebug.fmt + (self : sign.FpfOnNewsroom) (f : core.fmt.Formatter) : + Result ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + := do + core.fmt.Formatter.write_str f (toStr "FpfOnNewsroom") + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::fmt::Debug for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:9-47:14 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreFmtDebug : core.fmt.Debug sign.FpfOnNewsroom + := { + fmt := sign.FpfOnNewsroom.Insts.CoreFmtDebug.fmt +} + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::FpfOnNewsroom}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 47:16-47:21 + Visibility: public -/ +def sign.FpfOnNewsroom.Insts.CoreCloneClone.clone + (self : sign.FpfOnNewsroom) : Result sign.FpfOnNewsroom := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:16-47:21 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreCloneClone : core.clone.Clone + sign.FpfOnNewsroom := { + clone := sign.FpfOnNewsroom.Insts.CoreCloneClone.clone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:23-47:27 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreMarkerCopy : core.marker.Copy + sign.FpfOnNewsroom := { + cloneInst := sign.FpfOnNewsroom.Insts.CoreCloneClone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::StructuralPartialEq for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:29-47:38 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreMarkerStructuralPartialEq : + core.marker.StructuralPartialEq sign.FpfOnNewsroom := { +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::FpfOnNewsroom}::eq]: + Source: 'protocol-minimal/src/sign.rs', lines 47:29-47:38 + Visibility: public -/ +def sign.FpfOnNewsroom.Insts.CoreCmpPartialEqFpfOnNewsroom.eq + (self : sign.FpfOnNewsroom) (other : sign.FpfOnNewsroom) : Result Bool := do + ok true + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:29-47:38 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreCmpPartialEqFpfOnNewsroom : core.cmp.PartialEq + sign.FpfOnNewsroom sign.FpfOnNewsroom := { + eq := sign.FpfOnNewsroom.Insts.CoreCmpPartialEqFpfOnNewsroom.eq +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::FpfOnNewsroom}::assert_fields_are_eq]: + Source: 'protocol-minimal/src/sign.rs', lines 47:40-47:42 + Visibility: public -/ +def sign.FpfOnNewsroom.Insts.CoreCmpEq.assert_fields_are_eq + (self : sign.FpfOnNewsroom) : Result Unit := do + ok () + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::Eq for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 47:40-47:42 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.CoreCmpEq : core.cmp.Eq sign.FpfOnNewsroom := { + partialEqInst := sign.FpfOnNewsroom.Insts.CoreCmpPartialEqFpfOnNewsroom + assert_fields_are_eq := + sign.FpfOnNewsroom.Insts.CoreCmpEq.assert_fields_are_eq +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::JournalistLongTermKey}] + Source: 'protocol-minimal/src/sign.rs', lines 60:0-68:1 -/ +@[reducible] +def sign.JournalistLongTermKey.Insts.Securedrop_protocol_minimalSignDomainTag : + sign.DomainTag sign.JournalistLongTermKey := { + tag := + sign.JournalistLongTermKey.Insts.Securedrop_protocol_minimalSignDomainTag.tag +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::JournalistEphemeralKey}] + Source: 'protocol-minimal/src/sign.rs', lines 69:0-74:1 -/ +@[reducible] +def sign.JournalistEphemeralKey.Insts.Securedrop_protocol_minimalSignDomainTag + : sign.DomainTag sign.JournalistEphemeralKey := { + tag := + sign.JournalistEphemeralKey.Insts.Securedrop_protocol_minimalSignDomainTag.tag +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::NewsroomOnJournalist}] + Source: 'protocol-minimal/src/sign.rs', lines 75:0-80:1 -/ +@[reducible] +def sign.NewsroomOnJournalist.Insts.Securedrop_protocol_minimalSignDomainTag : + sign.DomainTag sign.NewsroomOnJournalist := { + tag := + sign.NewsroomOnJournalist.Insts.Securedrop_protocol_minimalSignDomainTag.tag +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::FpfOnNewsroom}] + Source: 'protocol-minimal/src/sign.rs', lines 81:0-86:1 -/ +@[reducible] +def sign.FpfOnNewsroom.Insts.Securedrop_protocol_minimalSignDomainTag : + sign.DomainTag sign.FpfOnNewsroom := { + tag := sign.FpfOnNewsroom.Insts.Securedrop_protocol_minimalSignDomainTag.tag +} + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::Signature}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 103:4-105:5 + Visibility: public -/ +def sign.Signature.Insts.CoreCloneClone.clone + {D : Type} (DomainTagInst : sign.DomainTag D) (self : sign.Signature D) : + Result (sign.Signature D) + := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::Signature}] + Source: 'protocol-minimal/src/sign.rs', lines 102:0-106:1 -/ +@[reducible] +def sign.Signature.Insts.CoreCloneClone {D : Type} (DomainTagInst : + sign.DomainTag D) : core.clone.Clone (sign.Signature D) := { + clone := sign.Signature.Insts.CoreCloneClone.clone DomainTagInst +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::Signature}] + Source: 'protocol-minimal/src/sign.rs', lines 101:0-101:43 -/ +@[reducible] +def sign.Signature.Insts.CoreMarkerCopy {D : Type} (DomainTagInst : + sign.DomainTag D) : core.marker.Copy (sign.Signature D) := { + cloneInst := sign.Signature.Insts.CoreCloneClone DomainTagInst +} + +/-- [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq> for securedrop_protocol_minimal::sign::Signature}::eq]: + Source: 'protocol-minimal/src/sign.rs', lines 117:4-119:5 + Visibility: public -/ +def sign.Signature.Insts.CoreCmpPartialEqSignature.eq + {D : Type} (DomainTagInst : sign.DomainTag D) (self : sign.Signature D) + (other : sign.Signature D) : + Result Bool + := do + core.array.equality.PartialEqArray.eq core.cmp.PartialEqU8 self.bytes + other.bytes + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::cmp::PartialEq> for securedrop_protocol_minimal::sign::Signature}] + Source: 'protocol-minimal/src/sign.rs', lines 116:0-120:1 -/ +@[reducible] +def sign.Signature.Insts.CoreCmpPartialEqSignature {D : Type} (DomainTagInst : + sign.DomainTag D) : core.cmp.PartialEq (sign.Signature D) (sign.Signature D) + := { + eq := sign.Signature.Insts.CoreCmpPartialEqSignature.eq DomainTagInst +} + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::Signature}::from_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 131:4-136:5 + Visibility: public -/ +def sign.Signature.from_bytes + {D : Type} (DomainTagInst : sign.DomainTag D) (bytes : Array Std.U8 64#usize) + : + Result (sign.Signature D) + := do + ok { bytes, _phantom := () } + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::Signature}::as_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 140:4-142:5 + Visibility: public -/ +def sign.Signature.as_bytes + {D : Type} (DomainTagInst : sign.DomainTag D) (self : sign.Signature D) : + Result (Array Std.U8 64#usize) + := do + ok self.bytes + +/-- [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::VerifyingKey}::clone]: + Source: 'protocol-minimal/src/sign.rs', lines 184:15-184:20 + Visibility: public -/ +def sign.VerifyingKey.Insts.CoreCloneClone.clone + (self : sign.VerifyingKey) : Result sign.VerifyingKey := do + ok self + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::clone::Clone for securedrop_protocol_minimal::sign::VerifyingKey}] + Source: 'protocol-minimal/src/sign.rs', lines 184:15-184:20 -/ +@[reducible] +def sign.VerifyingKey.Insts.CoreCloneClone : core.clone.Clone sign.VerifyingKey + := { + clone := sign.VerifyingKey.Insts.CoreCloneClone.clone +} + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{impl core::marker::Copy for securedrop_protocol_minimal::sign::VerifyingKey}] + Source: 'protocol-minimal/src/sign.rs', lines 184:9-184:13 -/ +@[reducible] +def sign.VerifyingKey.Insts.CoreMarkerCopy : core.marker.Copy sign.VerifyingKey + := { + cloneInst := sign.VerifyingKey.Insts.CoreCloneClone +} + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::as_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 194:4-196:5 -/ +def sign.VerifyingKey.as_bytes + (self : sign.VerifyingKey) : Result (Array Std.U8 32#usize) := do + ok self + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::from_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 198:4-200:5 + Visibility: public -/ +def sign.VerifyingKey.from_bytes + (bytes : Array Std.U8 32#usize) : Result sign.VerifyingKey := do + ok bytes + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningSecretKey}::as_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 204:4-206:5 -/ +def sign.SigningSecretKey.as_bytes + (self : sign.SigningSecretKey) : Result (Array Std.U8 32#usize) := do + ok self + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningSecretKey}::from_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 208:4-210:5 -/ +def sign.SigningSecretKey.from_bytes + (bytes : Array Std.U8 32#usize) : Result sign.SigningSecretKey := do + ok bytes + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningKey}::new]: + Source: 'protocol-minimal/src/sign.rs', lines 243:4-249:5 + Visibility: public -/ +def sign.SigningKey.new + {R : Type} {Clause0_Clause1_Clause0_Error : Type} (rand_coreCryptoRngInst : + rand_core.CryptoRng R Clause0_Clause1_Clause0_Error) (rng : R) : + Result ((core.result.Result sign.SigningKey anyhow.Error) × R) + := do + let (r, rng1) ← + primitives.provider.ed25519.keygen rand_coreCryptoRngInst rng + let cf ← core.result.Result.Insts.CoreOpsTry.branch r + match cf with + | core.ops.control_flow.ControlFlow.Continue val => + let (sk, vk) := val + ok (core.result.Result.Ok { vk := vk, sk := sk }, rng1) + | core.ops.control_flow.ControlFlow.Break residual => + let r1 ← + core.result.Result.Insts.CoreOpsTryTraitFromResidualResultInfallible.from_residual + sign.SigningKey (core.convert.FromSame anyhow.Error) residual + ok (r1, rng1) + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningKey}::as_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 268:4-270:5 -/ +def sign.SigningKey.as_bytes + (self : sign.SigningKey) : Result (Array Std.U8 32#usize) := do + sign.SigningSecretKey.as_bytes self.sk + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningKey}::sign]: + Source: 'protocol-minimal/src/sign.rs', lines 257:4-264:5 + Visibility: public -/ +def sign.SigningKey.sign + {D : Type} (DomainTagInst : sign.DomainTag D) (self : sign.SigningKey) + (msg : Slice Std.U8) : + Result (sign.Signature D) + := do + let preimage ← sign.tagged_preimage DomainTagInst msg + let sk ← sign.SigningKey.as_bytes self + let s := alloc.vec.Vec.deref preimage + let bytes ← primitives.provider.ed25519.sign s sk + sign.Signature.from_bytes DomainTagInst bytes + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::SigningKey}::from_seed]: + Source: 'protocol-minimal/src/sign.rs', lines 272:4-279:5 -/ +def sign.SigningKey.from_seed + (seed : Array Std.U8 32#usize) : Result sign.SigningKey := do + let pk := Array.repeat 32#usize 0#u8 + let pk1 ← primitives.provider.ed25519.secret_to_public pk seed + ok { vk := pk1, sk := seed } + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::into_bytes]: + Source: 'protocol-minimal/src/sign.rs', lines 284:4-286:5 + Visibility: public -/ +def sign.VerifyingKey.into_bytes + (self : sign.VerifyingKey) : Result (Array Std.U8 32#usize) := do + ok self + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify::{impl core::ops::function::FnOnce<(anyhow::Error,), anyhow::Error> for securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify::closure}::call_once]: + Source: 'protocol-minimal/src/sign.rs', lines 298:21-298:73 -/ +def + sign.VerifyingKey.verify.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + {D : Type} (DomainTagInst : sign.DomainTag D) + (c : sign.VerifyingKey.verify.closure D) (tupled_args : anyhow.Error) : + Result anyhow.Error + := do + let a ← core.fmt.Arguments.from_str (toStr "Signature verification failed") + let error ← anyhow.__private.format_err a + anyhow.__private.must_use error + +/-- Trait implementation: [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify::{impl core::ops::function::FnOnce<(anyhow::Error,), anyhow::Error> for securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify::closure}] + Source: 'protocol-minimal/src/sign.rs', lines 298:21-298:73 -/ +@[reducible] +def sign.VerifyingKey.verify.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + {D : Type} (DomainTagInst : sign.DomainTag D) : core.ops.function.FnOnce + (sign.VerifyingKey.verify.closure D) anyhow.Error anyhow.Error := { + call_once := + sign.VerifyingKey.verify.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError.call_once + DomainTagInst +} + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify]: + Source: 'protocol-minimal/src/sign.rs', lines 293:4-299:5 + Visibility: public -/ +def sign.VerifyingKey.verify + {D : Type} (DomainTagInst : sign.DomainTag D) (self : sign.VerifyingKey) + (msg : Slice Std.U8) (sig : sign.Signature D) : + Result (core.result.Result Unit anyhow.Error) + := do + let preimage ← sign.tagged_preimage DomainTagInst msg + let sig_bytes ← sign.Signature.as_bytes DomainTagInst sig + let s := alloc.vec.Vec.deref preimage + let a ← sign.VerifyingKey.as_bytes self + let r ← primitives.provider.ed25519.verify s a sig_bytes + core.result.Result.map_err + (sign.VerifyingKey.verify.closure.Insts.CoreOpsFunctionFnOnceTupleErrorError + DomainTagInst) r () + +end securedrop_protocol_minimal diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/FunsExternal_Template.lean b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/FunsExternal_Template.lean new file mode 100644 index 00000000..8e89288b --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/FunsExternal_Template.lean @@ -0,0 +1,785 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [securedrop_protocol_minimal]: external functions. +-- This is a template file: rename it to "FunsExternal.lean" and fill the holes. +import Aeneas +import SecuredropProtocolMinimal.Extraction.Types +open Aeneas Aeneas.Std Result ControlFlow Error +open Std.Do +set_option linter.dupNamespace false +set_option linter.hashCommand false +set_option linter.unusedVariables false + +/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/ +set_option maxHeartbeats 1000000 + +/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/ +set_option maxRecDepth 2048 +open securedrop_protocol_minimal + +/-- [core::convert::{impl core::fmt::Debug for core::convert::Infallible}::fmt]: + Source: '/rustc/library/core/src/convert/mod.rs', lines 942:4-942:60 + Name pattern: [core::convert::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun "core::convert::{core::fmt::Debug}::fmt"] +axiom core.convert.Infallible.Insts.CoreFmtDebug.fmt + : + core.convert.Infallible → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [core::convert::{impl core::fmt::Display for core::convert::Infallible}::fmt]: + Source: '/rustc/library/core/src/convert/mod.rs', lines 949:4-949:60 + Name pattern: [core::convert::{core::fmt::Display}::fmt] + Visibility: public -/ +@[rust_fun + "core::convert::{core::fmt::Display}::fmt"] +axiom core.convert.Infallible.Insts.CoreFmtDisplay.fmt + : + core.convert.Infallible → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [core::hint::must_use]: + Source: '/rustc/library/core/src/hint.rs', lines 613:0-613:39 + Name pattern: [core::hint::must_use] + Visibility: public -/ +@[rust_fun "core::hint::must_use"] +axiom core.hint.must_use {T : Type} : T → Result T + +/-- [core::result::{core::result::Result}::map_err]: + Source: '/rustc/library/core/src/result.rs', lines 962:4-964:53 + Name pattern: [core::result::{core::result::Result<@T, @E>}::map_err] + Visibility: public -/ +@[rust_fun "core::result::{core::result::Result<@T, @E>}::map_err"] +axiom core.result.Result.map_err + {T : Type} {E : Type} {F : Type} {O : Type} (opsfunctionFnOnceOTupleEFInst : + core.ops.function.FnOnce O E F) : + core.result.Result T E → O → Result (core.result.Result T F) + +/-- [alloc::fmt::format]: + Source: '/rustc/library/alloc/src/fmt.rs', lines 649:0-649:52 + Name pattern: [alloc::fmt::format] + Visibility: public -/ +@[rust_fun "alloc::fmt::format"] +axiom alloc.fmt.format : core.fmt.Arguments → Result String + +/-- [alloc::string::{impl core::fmt::Display for alloc::string::String}::fmt]: + Source: '/rustc/library/alloc/src/string.rs', lines 2724:4-2724:60 + Name pattern: [alloc::string::{core::fmt::Display}::fmt] + Visibility: public -/ +@[rust_fun "alloc::string::{core::fmt::Display}::fmt"] +axiom alloc.string.String.Insts.CoreFmtDisplay.fmt + : + String → core.fmt.Formatter → Result ((core.result.Result Unit + core.fmt.Error) × core.fmt.Formatter) + +/-- [alloc::string::{impl core::fmt::Debug for alloc::string::String}::fmt]: + Source: '/rustc/library/alloc/src/string.rs', lines 2732:4-2732:60 + Name pattern: [alloc::string::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun "alloc::string::{core::fmt::Debug}::fmt"] +axiom alloc.string.String.Insts.CoreFmtDebug.fmt + : + String → core.fmt.Formatter → Result ((core.result.Result Unit + core.fmt.Error) × core.fmt.Formatter) + +/-- [alloc::vec::{alloc::vec::Vec}::as_slice]: + Source: '/rustc/library/alloc/src/vec/mod.rs', lines 1854:4-1854:40 + Name pattern: [alloc::vec::{alloc::vec::Vec<@T>}::as_slice] + Visibility: public -/ +@[rust_fun "alloc::vec::{alloc::vec::Vec<@T>}::as_slice"] +axiom alloc.vec.Vec.as_slice + {T : Type} (A : Type) : alloc.vec.Vec T → Result (Slice T) + +/-- [anyhow::error::{anyhow::Error}::msg]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/error.rs', lines 77:4-79:51 + Name pattern: [anyhow::error::{anyhow::Error}::msg] + Visibility: public -/ +@[rust_fun "anyhow::error::{anyhow::Error}::msg"] +axiom anyhow.error.Error.msg + {M : Type} (corefmtDisplayInst : core.fmt.Display M) (corefmtDebugInst : + core.fmt.Debug M) : + M → Result anyhow.Error + +/-- [anyhow::error::{impl core::fmt::Debug for anyhow::Error}::fmt]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/error.rs', lines 708:4-708:64 + Name pattern: [anyhow::error::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun "anyhow::error::{core::fmt::Debug}::fmt"] +axiom anyhow.Error.Insts.CoreFmtDebug.fmt + : + anyhow.Error → core.fmt.Formatter → Result ((core.result.Result Unit + core.fmt.Error) × core.fmt.Formatter) + +/-- [anyhow::__private::format_err]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/lib.rs', lines 684:4-684:47 + Name pattern: [anyhow::__private::format_err] + Visibility: public -/ +@[rust_fun "anyhow::__private::format_err"] +axiom anyhow.__private.format_err : core.fmt.Arguments → Result anyhow.Error + +/-- [anyhow::__private::must_use]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/lib.rs', lines 698:4-698:42 + Name pattern: [anyhow::__private::must_use] + Visibility: public -/ +@[rust_fun "anyhow::__private::must_use"] +axiom anyhow.__private.must_use : anyhow.Error → Result anyhow.Error + +/-- [hpke_rs::{impl core::fmt::Debug for hpke_rs::HpkeError}::fmt]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 158:9-158:14 + Name pattern: [hpke_rs::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun "hpke_rs::{core::fmt::Debug}::fmt"] +axiom hpke_rs.HpkeError.Insts.CoreFmtDebug.fmt + : + hpke_rs.HpkeError → core.fmt.Formatter → Result ((core.result.Result Unit + core.fmt.Error) × core.fmt.Formatter) + +/-- [hpke_rs::{hpke_rs::Hpke}::new]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 495:4-500:13 + Name pattern: [hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::new] + Visibility: public -/ +@[rust_fun + "hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::new"] +axiom hpke_rs.Hpke.new + {Crypto : Type} {Clause0_HpkePrng : Type} + {Clause0_Clause3_Clause1_Clause0_Error : Type} {Clause0_Clause4_Error : Type} + (hpke_rs_cryptoHpkeCryptoInst : hpke_rs_crypto.HpkeCrypto Crypto + Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error Clause0_Clause4_Error) + : + hpke_rs.Mode → hpke_rs_crypto.types.KemAlgorithm → + hpke_rs_crypto.types.KdfAlgorithm → hpke_rs_crypto.types.AeadAlgorithm + → Result (hpke_rs.Hpke Crypto Clause0_HpkePrng + Clause0_Clause3_Clause1_Clause0_Error Clause0_Clause4_Error) + +/-- [hpke_rs::{hpke_rs::Hpke}::seal]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 609:4-618:60 + Name pattern: [hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::seal] + Visibility: public -/ +@[rust_fun + "hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::seal"] +axiom hpke_rs.Hpke.seal + {Crypto : Type} {Clause0_HpkePrng : Type} + {Clause0_Clause3_Clause1_Clause0_Error : Type} {Clause0_Clause4_Error : Type} + (hpke_rs_cryptoHpkeCryptoInst : hpke_rs_crypto.HpkeCrypto Crypto + Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error Clause0_Clause4_Error) + : + hpke_rs.Hpke Crypto Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error + Clause0_Clause4_Error → hpke_rs.HpkePublicKey → Slice Std.U8 → Slice + Std.U8 → Slice Std.U8 → Option (Slice Std.U8) → Option (Slice Std.U8) + → Option hpke_rs.HpkePrivateKey → Result ((core.result.Result + ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec Std.U8)) hpke_rs.HpkeError) × + (hpke_rs.Hpke Crypto Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error + Clause0_Clause4_Error)) + +/-- [hpke_rs::{hpke_rs::Hpke}::open]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 637:4-647:37 + Name pattern: [hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::open] + Visibility: public -/ +@[rust_fun + "hpke_rs::{hpke_rs::Hpke<@Crypto, @Clause0_HpkePrng, @Clause0_Clause3_Clause1_Clause0_Error, @Clause0_Clause4_Error>}::open"] +axiom hpke_rs.Hpke.open + {Crypto : Type} {Clause0_HpkePrng : Type} + {Clause0_Clause3_Clause1_Clause0_Error : Type} {Clause0_Clause4_Error : Type} + (hpke_rs_cryptoHpkeCryptoInst : hpke_rs_crypto.HpkeCrypto Crypto + Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error Clause0_Clause4_Error) + : + hpke_rs.Hpke Crypto Clause0_HpkePrng Clause0_Clause3_Clause1_Clause0_Error + Clause0_Clause4_Error → Slice Std.U8 → hpke_rs.HpkePrivateKey → Slice + Std.U8 → Slice Std.U8 → Slice Std.U8 → Option (Slice Std.U8) → + Option (Slice Std.U8) → Option hpke_rs.HpkePublicKey → Result + (core.result.Result (alloc.vec.Vec Std.U8) hpke_rs.HpkeError) + +/-- [hpke_rs::{impl core::convert::From> for hpke_rs::HpkePrivateKey}::from]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 916:4-916:31 + Name pattern: [hpke_rs::{core::convert::From>}::from] + Visibility: public -/ +@[rust_fun + "hpke_rs::{core::convert::From>}::from"] +axiom hpke_rs.HpkePrivateKey.Insts.CoreConvertFromVecU8.from + : alloc.vec.Vec Std.U8 → Result hpke_rs.HpkePrivateKey + +/-- [hpke_rs::{impl core::convert::From> for hpke_rs::HpkePublicKey}::from]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 967:4-967:31 + Name pattern: [hpke_rs::{core::convert::From>}::from] + Visibility: public -/ +@[rust_fun + "hpke_rs::{core::convert::From>}::from"] +axiom hpke_rs.HpkePublicKey.Insts.CoreConvertFromVecU8.from + : alloc.vec.Vec Std.U8 → Result hpke_rs.HpkePublicKey + +/-- [hpke_rs_crypto::error::{impl core::fmt::Debug for hpke_rs_crypto::error::Error}::fmt]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/error.rs', lines 9:9-9:14 + Name pattern: [hpke_rs_crypto::error::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun + "hpke_rs_crypto::error::{core::fmt::Debug}::fmt"] +axiom hpke_rs_crypto.error.Error.Insts.CoreFmtDebug.fmt + : + hpke_rs_crypto.error.Error → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [hpke_rs_crypto::error::{impl core::fmt::Display for hpke_rs_crypto::error::Error}::fmt]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/error.rs', lines 55:4-55:72 + Name pattern: [hpke_rs_crypto::error::{core::fmt::Display}::fmt] + Visibility: public -/ +@[rust_fun + "hpke_rs_crypto::error::{core::fmt::Display}::fmt"] +axiom hpke_rs_crypto.error.Error.Insts.CoreFmtDisplay.fmt + : + hpke_rs_crypto.error.Error → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [hpke_rs_libcrux::{impl core::fmt::Debug for hpke_rs_libcrux::HpkeLibcrux}::fmt]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 30:9-30:14 + Name pattern: [hpke_rs_libcrux::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{core::fmt::Debug}::fmt"] +axiom hpke_rs_libcrux.HpkeLibcrux.Insts.CoreFmtDebug.fmt + : + hpke_rs_libcrux.HpkeLibcrux → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [hpke_rs_libcrux::{impl zeroize::Zeroize for hpke_rs_libcrux::HpkeLibcruxPrng}::zeroize]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 41:4-41:25 + Name pattern: [hpke_rs_libcrux::{zeroize::Zeroize}::zeroize] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{zeroize::Zeroize}::zeroize"] +axiom hpke_rs_libcrux.HpkeLibcruxPrng.Insts.ZeroizeZeroize.zeroize + : hpke_rs_libcrux.HpkeLibcruxPrng → Result hpke_rs_libcrux.HpkeLibcruxPrng + +/-- [rand_core::{impl rand_core::Rng for R}::fill_bytes]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 84:4-84:44 + Name pattern: [rand_core::{rand_core::Rng<@R>}::fill_bytes] + Visibility: public -/ +@[rust_fun "rand_core::{rand_core::Rng<@R>}::fill_bytes"] +axiom rand_core.Rng.Blanket.fill_bytes + {R : Type} (TryRngRInfallibleInst : rand_core.TryRng R + core.convert.Infallible) : + R → Slice Std.U8 → Result (R × (Slice Std.U8)) + +/-- [rand_core::{impl rand_core::Rng for R}::next_u64]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 77:4-77:33 + Name pattern: [rand_core::{rand_core::Rng<@R>}::next_u64] + Visibility: public -/ +@[rust_fun "rand_core::{rand_core::Rng<@R>}::next_u64"] +axiom rand_core.Rng.Blanket.next_u64 + {R : Type} (TryRngRInfallibleInst : rand_core.TryRng R + core.convert.Infallible) : + R → Result (Std.U64 × R) + +/-- [rand_core::{impl rand_core::Rng for R}::next_u32]: + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 70:4-70:33 + Name pattern: [rand_core::{rand_core::Rng<@R>}::next_u32] + Visibility: public -/ +@[rust_fun "rand_core::{rand_core::Rng<@R>}::next_u32"] +axiom rand_core.Rng.Blanket.next_u32 + {R : Type} (TryRngRInfallibleInst : rand_core.TryRng R + core.convert.Infallible) : + R → Result (Std.U32 × R) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeTestRng for hpke_rs_libcrux::HpkeLibcruxPrng}::seed]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 594:4-594:32 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeTestRng}::seed] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeTestRng}::seed"] +axiom hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError.seed + : + hpke_rs_libcrux.HpkeLibcruxPrng → Slice Std.U8 → Result + hpke_rs_libcrux.HpkeLibcruxPrng + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeTestRng for hpke_rs_libcrux::HpkeLibcruxPrng}::try_fill_test_bytes]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 582:4-582:75 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeTestRng}::try_fill_test_bytes] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeTestRng}::try_fill_test_bytes"] +axiom + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Hpke_rs_cryptoHpkeTestRngError.try_fill_test_bytes + : + hpke_rs_libcrux.HpkeLibcruxPrng → Slice Std.U8 → Result + ((core.result.Result Unit hpke_rs_crypto.error.Error) × + hpke_rs_libcrux.HpkeLibcruxPrng × (Slice Std.U8)) + +/-- [hpke_rs_libcrux::{impl rand_core::TryRng for hpke_rs_libcrux::HpkeLibcruxPrng}::try_fill_bytes]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 563:4-563:75 + Name pattern: [hpke_rs_libcrux::{rand_core::TryRng}::try_fill_bytes] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{rand_core::TryRng}::try_fill_bytes"] +axiom + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_fill_bytes + : + hpke_rs_libcrux.HpkeLibcruxPrng → Slice Std.U8 → Result + ((core.result.Result Unit core.convert.Infallible) × + hpke_rs_libcrux.HpkeLibcruxPrng × (Slice Std.U8)) + +/-- [hpke_rs_libcrux::{impl rand_core::TryRng for hpke_rs_libcrux::HpkeLibcruxPrng}::try_next_u64]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 559:4-559:58 + Name pattern: [hpke_rs_libcrux::{rand_core::TryRng}::try_next_u64] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{rand_core::TryRng}::try_next_u64"] +axiom + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_next_u64 + : + hpke_rs_libcrux.HpkeLibcruxPrng → Result ((core.result.Result Std.U64 + core.convert.Infallible) × hpke_rs_libcrux.HpkeLibcruxPrng) + +/-- [hpke_rs_libcrux::{impl rand_core::TryRng for hpke_rs_libcrux::HpkeLibcruxPrng}::try_next_u32]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 555:4-555:58 + Name pattern: [hpke_rs_libcrux::{rand_core::TryRng}::try_next_u32] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{rand_core::TryRng}::try_next_u32"] +axiom + hpke_rs_libcrux.HpkeLibcruxPrng.Insts.Rand_coreTryRngInfallible.try_next_u32 + : + hpke_rs_libcrux.HpkeLibcruxPrng → Result ((core.result.Result Std.U32 + core.convert.Infallible) × hpke_rs_libcrux.HpkeLibcruxPrng) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::supports_aead]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 393:4-393:61 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_aead] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_aead"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_aead + : + hpke_rs_crypto.types.AeadAlgorithm → Result (core.result.Result Unit + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::supports_kem]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 379:4-379:59 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_kem] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_kem"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_kem + : + hpke_rs_crypto.types.KemAlgorithm → Result (core.result.Result Unit + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::supports_kdf]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 374:4-374:57 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_kdf] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::supports_kdf"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.supports_kdf + : + hpke_rs_crypto.types.KdfAlgorithm → Result (core.result.Result Unit + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::prng]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 356:4-356:31 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::prng] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::prng"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.prng + : Result hpke_rs_libcrux.HpkeLibcruxPrng + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::aead_open]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 311:4-317:31 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::aead_open] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::aead_open"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.aead_open + : + hpke_rs_crypto.types.AeadAlgorithm → Slice Std.U8 → Slice Std.U8 → + Slice Std.U8 → Slice Std.U8 → Result (core.result.Result (alloc.vec.Vec + Std.U8) hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::aead_seal]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 277:4-283:31 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::aead_seal] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::aead_seal"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.aead_seal + : + hpke_rs_crypto.types.AeadAlgorithm → Slice Std.U8 → Slice Std.U8 → + Slice Std.U8 → Slice Std.U8 → Result (core.result.Result (alloc.vec.Vec + Std.U8) hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::dh_validate_sk]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 260:4-260:77 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::dh_validate_sk] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::dh_validate_sk"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.dh_validate_sk + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Result + (core.result.Result (alloc.vec.Vec Std.U8) hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kem_decaps]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 237:4-237:86 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_decaps] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_decaps"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_decaps + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kem_encaps]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 211:4-215:42 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_encaps] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_encaps"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_encaps + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → + hpke_rs_libcrux.HpkeLibcruxPrng → Result ((core.result.Result + ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec Std.U8)) + hpke_rs_crypto.error.Error) × hpke_rs_libcrux.HpkeLibcruxPrng) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kem_key_gen_derand]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 176:4-176:94 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_key_gen_derand] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_key_gen_derand"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_key_gen_derand + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Result + (core.result.Result ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec Std.U8)) + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kem_key_gen]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 130:4-133:42 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_key_gen] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kem_key_gen"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kem_key_gen + : + hpke_rs_crypto.types.KemAlgorithm → hpke_rs_libcrux.HpkeLibcruxPrng → + Result ((core.result.Result ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec + Std.U8)) hpke_rs_crypto.error.Error) × hpke_rs_libcrux.HpkeLibcruxPrng) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::secret_to_public]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 111:4-111:79 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::secret_to_public] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::secret_to_public"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.secret_to_public + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Result + (core.result.Result (alloc.vec.Vec Std.U8) hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::dh]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 72:4-72:76 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::dh] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::dh"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.dh + : + hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kdf_expand]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 59:4-64:31 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kdf_expand] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kdf_expand"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kdf_expand + : + hpke_rs_crypto.types.KdfAlgorithm → Slice Std.U8 → Slice Std.U8 → + Std.Usize → Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::kdf_extract]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 51:4-51:88 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kdf_extract] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::kdf_extract"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.kdf_extract + : + hpke_rs_crypto.types.KdfAlgorithm → Slice Std.U8 → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::{impl hpke_rs_crypto::HpkeCrypto for hpke_rs_libcrux::HpkeLibcrux}::name]: + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 47:4-47:23 + Name pattern: [hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::name] + Visibility: public -/ +@[rust_fun + "hpke_rs_libcrux::{hpke_rs_crypto::HpkeCrypto}::name"] +axiom + hpke_rs_libcrux.HpkeLibcrux.Insts.Hpke_rs_cryptoHpkeCryptoHpkeLibcruxPrngInfallibleError.name + : Result String + +/-- [libcrux_curve25519::impl_hacl::ecdh]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/crates/algorithms/curve25519/src/impl_hacl.rs', lines 13:0-13:94 + Name pattern: [libcrux_curve25519::impl_hacl::ecdh] + Visibility: public -/ +@[rust_fun "libcrux_curve25519::impl_hacl::ecdh"] +axiom libcrux_curve25519.impl_hacl.ecdh + : + Array Std.U8 32#usize → Array Std.U8 32#usize → Array Std.U8 32#usize → + Result ((core.result.Result Unit libcrux_curve25519.Error) × (Array Std.U8 + 32#usize)) + +/-- [libcrux_kem::{impl core::fmt::Debug for libcrux_kem::Error}::fmt]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 116:9-116:14 + Name pattern: [libcrux_kem::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun "libcrux_kem::{core::fmt::Debug}::fmt"] +axiom libcrux_kem.Error.Insts.CoreFmtDebug.fmt + : + libcrux_kem.Error → core.fmt.Formatter → Result ((core.result.Result Unit + core.fmt.Error) × core.fmt.Formatter) + +/-- [libcrux_kem::{libcrux_kem::PrivateKey}::encode]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 399:4-399:35 + Name pattern: [libcrux_kem::{libcrux_kem::PrivateKey}::encode] + Visibility: public -/ +@[rust_fun "libcrux_kem::{libcrux_kem::PrivateKey}::encode"] +axiom libcrux_kem.PrivateKey.encode + : libcrux_kem.PrivateKey → Result (alloc.vec.Vec Std.U8) + +/-- [libcrux_kem::{libcrux_kem::PublicKey}::encode]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 595:4-595:35 + Name pattern: [libcrux_kem::{libcrux_kem::PublicKey}::encode] + Visibility: public -/ +@[rust_fun "libcrux_kem::{libcrux_kem::PublicKey}::encode"] +axiom libcrux_kem.PublicKey.encode + : libcrux_kem.PublicKey → Result (alloc.vec.Vec Std.U8) + +/-- [libcrux_kem::key_gen]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 769:0-769:98 + Name pattern: [libcrux_kem::key_gen] + Visibility: public -/ +@[rust_fun "libcrux_kem::key_gen"] +axiom libcrux_kem.key_gen + {T0 : Type} {Clause0_Clause1_Clause0_Error : Type} (rand_coreCryptoRngInst : + rand_core.CryptoRng T0 Clause0_Clause1_Clause0_Error) : + libcrux_kem.Algorithm → T0 → Result ((core.result.Result + (libcrux_kem.PrivateKey × libcrux_kem.PublicKey) libcrux_kem.Error) × T0) + +/-- [libcrux_kem::key_gen_derand]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 829:0-829:92 + Name pattern: [libcrux_kem::key_gen_derand] + Visibility: public -/ +@[rust_fun "libcrux_kem::key_gen_derand"] +axiom libcrux_kem.key_gen_derand + : + libcrux_kem.Algorithm → Slice Std.U8 → Result (core.result.Result + (libcrux_kem.PrivateKey × libcrux_kem.PublicKey) libcrux_kem.Error) + +/-- [libcrux_ml_kem::mlkem768::{impl libcrux_traits::kem::arrayref::Kem<1184usize, 2400usize, 1088usize, 32usize, 64usize, 32usize> for libcrux_ml_kem::mlkem768::MlKem768}::decaps]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/lib.rs', lines 157:12-161:68 + Name pattern: [libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::decaps] + Visibility: public -/ +@[rust_fun + "libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::decaps"] +axiom + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.decaps + : + Array Std.U8 32#usize → Array Std.U8 1088#usize → Array Std.U8 2400#usize + → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.DecapsError) × (Array Std.U8 32#usize)) + +/-- [libcrux_ml_kem::mlkem768::{impl libcrux_traits::kem::arrayref::Kem<1184usize, 2400usize, 1088usize, 32usize, 64usize, 32usize> for libcrux_ml_kem::mlkem768::MlKem768}::encaps]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/lib.rs', lines 142:12-147:68 + Name pattern: [libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::encaps] + Visibility: public -/ +@[rust_fun + "libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::encaps"] +axiom + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.encaps + : + Array Std.U8 1088#usize → Array Std.U8 32#usize → Array Std.U8 1184#usize + → Array Std.U8 32#usize → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.EncapsError) × (Array Std.U8 1088#usize) × + (Array Std.U8 32#usize)) + +/-- [libcrux_ml_kem::mlkem768::{impl libcrux_traits::kem::arrayref::Kem<1184usize, 2400usize, 1088usize, 32usize, 64usize, 32usize> for libcrux_ml_kem::mlkem768::MlKem768}::keygen]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/lib.rs', lines 130:12-134:68 + Name pattern: [libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::keygen] + Visibility: public -/ +@[rust_fun + "libcrux_ml_kem::mlkem768::{libcrux_traits::kem::arrayref::Kem}::keygen"] +axiom + libcrux_ml_kem.mlkem768.MlKem768.Insts.Libcrux_traitsKemArrayrefKem118424001088326432.keygen + : + Array Std.U8 1184#usize → Array Std.U8 2400#usize → Array Std.U8 64#usize + → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.KeyGenError) × (Array Std.U8 1184#usize) × + (Array Std.U8 2400#usize)) + +/-- [libcrux_traits::kem::arrayref::{impl core::fmt::Debug for libcrux_traits::kem::arrayref::EncapsError}::fmt]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 55:9-55:14 + Name pattern: [libcrux_traits::kem::arrayref::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun + "libcrux_traits::kem::arrayref::{core::fmt::Debug}::fmt"] +axiom libcrux_traits.kem.arrayref.EncapsError.Insts.CoreFmtDebug.fmt + : + libcrux_traits.kem.arrayref.EncapsError → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [libcrux_traits::kem::arrayref::{impl core::fmt::Debug for libcrux_traits::kem::arrayref::DecapsError}::fmt]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 68:9-68:14 + Name pattern: [libcrux_traits::kem::arrayref::{core::fmt::Debug}::fmt] + Visibility: public -/ +@[rust_fun + "libcrux_traits::kem::arrayref::{core::fmt::Debug}::fmt"] +axiom libcrux_traits.kem.arrayref.DecapsError.Insts.CoreFmtDebug.fmt + : + libcrux_traits.kem.arrayref.DecapsError → core.fmt.Formatter → Result + ((core.result.Result Unit core.fmt.Error) × core.fmt.Formatter) + +/-- [libcrux_traits::kem::owned::{impl libcrux_traits::kem::owned::Kem for T}::encaps]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/owned.rs', lines 64:4-67:58 + Name pattern: [libcrux_traits::kem::owned::{libcrux_traits::kem::owned::Kem<@T, @EK_LEN, @DK_LEN, @CT_LEN, @SS_LEN, @RAND_KEYGEN_LEN, @RAND_ENCAPS_LEN>}::encaps] + Visibility: public -/ +@[rust_fun + "libcrux_traits::kem::owned::{libcrux_traits::kem::owned::Kem<@T, @EK_LEN, @DK_LEN, @CT_LEN, @SS_LEN, @RAND_KEYGEN_LEN, @RAND_ENCAPS_LEN>}::encaps"] +axiom libcrux_traits.kem.owned.Kem.Blanket.encaps + {T : Type} {EK_LEN : Std.Usize} {DK_LEN : Std.Usize} {CT_LEN : Std.Usize} + {SS_LEN : Std.Usize} {RAND_KEYGEN_LEN : Std.Usize} {RAND_ENCAPS_LEN : + Std.Usize} (arrayrefKemInst : libcrux_traits.kem.arrayref.Kem T EK_LEN DK_LEN + CT_LEN SS_LEN RAND_KEYGEN_LEN RAND_ENCAPS_LEN) : + Array Std.U8 EK_LEN → Array Std.U8 RAND_ENCAPS_LEN → Result + (core.result.Result ((Array Std.U8 SS_LEN) × (Array Std.U8 CT_LEN)) + libcrux_traits.kem.arrayref.EncapsError) + +/-- [libcrux_traits::kem::owned::{impl libcrux_traits::kem::owned::Kem for T}::decaps]: + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/owned.rs', lines 83:4-83:88 + Name pattern: [libcrux_traits::kem::owned::{libcrux_traits::kem::owned::Kem<@T, @EK_LEN, @DK_LEN, @CT_LEN, @SS_LEN, @RAND_KEYGEN_LEN, @RAND_ENCAPS_LEN>}::decaps] + Visibility: public -/ +@[rust_fun + "libcrux_traits::kem::owned::{libcrux_traits::kem::owned::Kem<@T, @EK_LEN, @DK_LEN, @CT_LEN, @SS_LEN, @RAND_KEYGEN_LEN, @RAND_ENCAPS_LEN>}::decaps"] +axiom libcrux_traits.kem.owned.Kem.Blanket.decaps + {T : Type} {EK_LEN : Std.Usize} {DK_LEN : Std.Usize} {CT_LEN : Std.Usize} + {SS_LEN : Std.Usize} {RAND_KEYGEN_LEN : Std.Usize} {RAND_ENCAPS_LEN : + Std.Usize} (arrayrefKemInst : libcrux_traits.kem.arrayref.Kem T EK_LEN DK_LEN + CT_LEN SS_LEN RAND_KEYGEN_LEN RAND_ENCAPS_LEN) : + Array Std.U8 CT_LEN → Array Std.U8 DK_LEN → Result (core.result.Result + (Array Std.U8 SS_LEN) libcrux_traits.kem.arrayref.DecapsError) + +/-- [securedrop_protocol_minimal::primitives::provider::rng::fill_bytes]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 81:4-86:5 -/ +axiom primitives.provider.rng.fill_bytes + {R : Type} {Clause1_Clause1_Clause0_Error : Type} {N : Std.Usize} + (rand_coreRngCoreInst : rand_core.RngCore R) (rand_coreCryptoRngInst : + rand_core.CryptoRng R Clause1_Clause1_Clause0_Error) : + R → Array Std.U8 N → Result (R × (Array Std.U8 N)) + +/-- [securedrop_protocol_minimal::primitives::provider::curve25519::x25519_keygen]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 22:4-28:5 -/ +axiom primitives.provider.curve25519.x25519_keygen + : + Array Std.U8 32#usize → Array Std.U8 32#usize → Array Std.U8 32#usize → + Result ((core.result.Result Unit libcrux_traits.kem.arrayref.KeyGenError) + × (Array Std.U8 32#usize) × (Array Std.U8 32#usize)) + +/-- [securedrop_protocol_minimal::encrypt_decrypt::decrypt_with_sender]: + Source: 'protocol-minimal/src/encrypt_decrypt.rs', lines 86:0-120:1 + Visibility: public -/ +axiom encrypt_decrypt.decrypt_with_sender + {U : Type} (traitsUserSecretInst : traits.UserSecret U) : + U → ciphertext.Envelope → Result (ciphertext.Plaintext × + message.MessagePublicKey) + +/-- [securedrop_protocol_minimal::primitives::provider::curve25519::PK_LEN] + Source: 'protocol-minimal/src/primitives/provider.rs', lines 10:4-10:64 -/ +axiom primitives.provider.curve25519.PK_LEN : Result Std.Usize + +/-- [securedrop_protocol_minimal::primitives::provider::curve25519::LEN_DH_SHARE] + Source: 'protocol-minimal/src/primitives/provider.rs', lines 13:4-13:70 -/ +axiom primitives.provider.curve25519.LEN_DH_SHARE : Result Std.Usize + +/-- [securedrop_protocol_minimal::primitives::provider::curve25519::SK_LEN] + Source: 'protocol-minimal/src/primitives/provider.rs', lines 7:4-7:64 -/ +axiom primitives.provider.curve25519.SK_LEN : Result Std.Usize + +/-- [securedrop_protocol_minimal::primitives::provider::ed25519::keygen]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 36:4-40:5 -/ +axiom primitives.provider.ed25519.keygen + {R : Type} {Clause0_Clause1_Clause0_Error : Type} (rand_coreCryptoRngInst : + rand_core.CryptoRng R Clause0_Clause1_Clause0_Error) : + R → Result ((core.result.Result ((Array Std.U8 32#usize) × (Array Std.U8 + 32#usize)) anyhow.Error) × R) + +/-- [securedrop_protocol_minimal::primitives::provider::ed25519::sign]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 49:4-51:5 -/ +axiom primitives.provider.ed25519.sign + : Slice Std.U8 → Array Std.U8 32#usize → Result (Array Std.U8 64#usize) + +/-- [securedrop_protocol_minimal::primitives::provider::ed25519::verify]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 60:4-67:5 -/ +axiom primitives.provider.ed25519.verify + : + Slice Std.U8 → Array Std.U8 32#usize → Array Std.U8 64#usize → Result + (core.result.Result Unit anyhow.Error) + +/-- [securedrop_protocol_minimal::primitives::provider::ed25519::secret_to_public]: + Source: 'protocol-minimal/src/primitives/provider.rs', lines 71:4-73:5 -/ +axiom primitives.provider.ed25519.secret_to_public + : + Array Std.U8 32#usize → Array Std.U8 32#usize → Result (Array Std.U8 + 32#usize) + +/-- [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::JournalistLongTermKey}::tag]: + Source: 'protocol-minimal/src/sign.rs', lines 65:4-67:5 + Visibility: public -/ +axiom + sign.JournalistLongTermKey.Insts.Securedrop_protocol_minimalSignDomainTag.tag + : Result (Slice Std.U8) + +/-- [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::JournalistEphemeralKey}::tag]: + Source: 'protocol-minimal/src/sign.rs', lines 71:4-73:5 + Visibility: public -/ +axiom + sign.JournalistEphemeralKey.Insts.Securedrop_protocol_minimalSignDomainTag.tag + : Result (Slice Std.U8) + +/-- [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::NewsroomOnJournalist}::tag]: + Source: 'protocol-minimal/src/sign.rs', lines 77:4-79:5 + Visibility: public -/ +axiom + sign.NewsroomOnJournalist.Insts.Securedrop_protocol_minimalSignDomainTag.tag + : Result (Slice Std.U8) + +/-- [securedrop_protocol_minimal::sign::{impl securedrop_protocol_minimal::sign::DomainTag for securedrop_protocol_minimal::sign::FpfOnNewsroom}::tag]: + Source: 'protocol-minimal/src/sign.rs', lines 83:4-85:5 + Visibility: public -/ +axiom sign.FpfOnNewsroom.Insts.Securedrop_protocol_minimalSignDomainTag.tag + : Result (Slice Std.U8) + +/-- [securedrop_protocol_minimal::sign::tagged_preimage]: + Source: 'protocol-minimal/src/sign.rs', lines 167:0-179:1 -/ +axiom sign.tagged_preimage + {D : Type} (DomainTagInst : sign.DomainTag D) : + Slice Std.U8 → Result (alloc.vec.Vec Std.U8) + diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Types.lean b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Types.lean new file mode 100644 index 00000000..f16317b1 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/Types.lean @@ -0,0 +1,827 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [securedrop_protocol_minimal]: type definitions +import Aeneas +import SecuredropProtocolMinimal.Extraction.TypesExternal +open Aeneas Aeneas.Std Result ControlFlow Error +open Std.Do +set_option linter.dupNamespace false +set_option linter.hashCommand false +set_option linter.unusedVariables false + +/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/ +set_option maxHeartbeats 1000000 + +/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/ +set_option maxRecDepth 2048 + +namespace securedrop_protocol_minimal + +/-- [core::marker::PhantomData] + Source: '/rustc/library/core/src/marker.rs', lines 811:0-811:39 + Name pattern: [core::marker::PhantomData] + Visibility: public -/ +@[reducible, rust_type "core::marker::PhantomData"] +def core.marker.PhantomData (T : Type) := Unit + +/-- [hpke_rs::HpkeError] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 159:0-159:18 + Name pattern: [hpke_rs::HpkeError] + Visibility: public -/ +@[discriminant isize, rust_type "hpke_rs::HpkeError"] +inductive hpke_rs.HpkeError where +| OpenError : hpke_rs.HpkeError +| InvalidConfig : hpke_rs.HpkeError +| InvalidInput : hpke_rs.HpkeError +| UnknownMode : hpke_rs.HpkeError +| InconsistentPsk : hpke_rs.HpkeError +| MissingPsk : hpke_rs.HpkeError +| UnnecessaryPsk : hpke_rs.HpkeError +| InsecurePsk : hpke_rs.HpkeError +| CryptoError : String → hpke_rs.HpkeError +| MessageLimitReached : hpke_rs.HpkeError +| InsufficientRandomness : hpke_rs.HpkeError + +/-- [hpke_rs::Mode] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 256:0-256:13 + Name pattern: [hpke_rs::Mode] + Visibility: public -/ +@[discriminant u8, rust_type "hpke_rs::Mode"] +inductive hpke_rs.Mode where +| Base : hpke_rs.Mode +| Psk : hpke_rs.Mode +| Auth : hpke_rs.Mode +| AuthPsk : hpke_rs.Mode + +/-- Trait declaration: [zeroize::Zeroize] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeroize-1.8.2/src/lib.rs', lines 272:0-272:17 + Name pattern: [zeroize::Zeroize] + Visibility: public -/ +@[rust_trait "zeroize::Zeroize"] +structure zeroize.Zeroize (Self : Type) where + zeroize : Self → Result Self + +/-- Trait declaration: [rand_core::TryRng] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 189:0-189:16 + Name pattern: [rand_core::TryRng] + Visibility: public -/ +@[rust_trait "rand_core::TryRng" (parentClauses := ["coreerrorErrorInst"])] +structure rand_core.TryRng (Self : Type) (Self_Error : Type) where + coreerrorErrorInst : core.error.Error Self_Error + try_next_u32 : Self → Result ((core.result.Result Std.U32 Self_Error) × + Self) + try_next_u64 : Self → Result ((core.result.Result Std.U64 Self_Error) × + Self) + try_fill_bytes : Self → Slice Std.U8 → Result ((core.result.Result Unit + Self_Error) × Self × (Slice Std.U8)) + +/-- Trait declaration: [rand_core::TryCryptoRng] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 249:0-249:30 + Name pattern: [rand_core::TryCryptoRng] + Visibility: public -/ +@[rust_trait "rand_core::TryCryptoRng" (parentClauses := ["TryRngInst"])] +structure rand_core.TryCryptoRng (Self : Type) (Self_Clause0_Error : Type) + where + TryRngInst : rand_core.TryRng Self Self_Clause0_Error + +/-- Trait declaration: [rand_core::Rng] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 49:0-49:41 + Name pattern: [rand_core::Rng] + Visibility: public -/ +@[rust_trait "rand_core::Rng" (parentClauses := ["TryRngSelfInfallibleInst"])] +structure rand_core.Rng (Self : Type) where + TryRngSelfInfallibleInst : rand_core.TryRng Self core.convert.Infallible + next_u32 : Self → Result (Std.U32 × Self) + next_u64 : Self → Result (Std.U64 × Self) + fill_bytes : Self → Slice Std.U8 → Result (Self × (Slice Std.U8)) + +/-- Trait declaration: [rand_core::CryptoRng] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 95:0-95:59 + Name pattern: [rand_core::CryptoRng] + Visibility: public -/ +@[rust_trait "rand_core::CryptoRng" + (parentClauses := ["RngInst", "TryCryptoRngInst"])] +structure rand_core.CryptoRng (Self : Type) (Self_Clause1_Clause0_Error : Type) + where + RngInst : rand_core.Rng Self + TryCryptoRngInst : rand_core.TryCryptoRng Self Self_Clause1_Clause0_Error + +/-- [hpke_rs_crypto::types::KdfAlgorithm] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/types.rs', lines 217:0-217:21 + Name pattern: [hpke_rs_crypto::types::KdfAlgorithm] + Visibility: public -/ +@[discriminant u16 [1,2,3], rust_type "hpke_rs_crypto::types::KdfAlgorithm"] +inductive hpke_rs_crypto.types.KdfAlgorithm where +| HkdfSha256 : hpke_rs_crypto.types.KdfAlgorithm +| HkdfSha384 : hpke_rs_crypto.types.KdfAlgorithm +| HkdfSha512 : hpke_rs_crypto.types.KdfAlgorithm + +/-- [hpke_rs_crypto::types::AeadAlgorithm] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/types.rs', lines 127:0-127:22 + Name pattern: [hpke_rs_crypto::types::AeadAlgorithm] + Visibility: public -/ +@[discriminant u16 [1,2,3,65535], rust_type + "hpke_rs_crypto::types::AeadAlgorithm"] +inductive hpke_rs_crypto.types.AeadAlgorithm where +| Aes128Gcm : hpke_rs_crypto.types.AeadAlgorithm +| Aes256Gcm : hpke_rs_crypto.types.AeadAlgorithm +| ChaCha20Poly1305 : hpke_rs_crypto.types.AeadAlgorithm +| HpkeExport : hpke_rs_crypto.types.AeadAlgorithm + +/-- [hpke_rs_crypto::types::KemAlgorithm] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/types.rs', lines 15:0-15:21 + Name pattern: [hpke_rs_crypto::types::KemAlgorithm] + Visibility: public -/ +@[discriminant u16 [16,17,18,22,32,33,77,25722,65,66], rust_type + "hpke_rs_crypto::types::KemAlgorithm"] +inductive hpke_rs_crypto.types.KemAlgorithm where +| DhKemP256 : hpke_rs_crypto.types.KemAlgorithm +| DhKemP384 : hpke_rs_crypto.types.KemAlgorithm +| DhKemP521 : hpke_rs_crypto.types.KemAlgorithm +| DhKemK256 : hpke_rs_crypto.types.KemAlgorithm +| DhKem25519 : hpke_rs_crypto.types.KemAlgorithm +| DhKem448 : hpke_rs_crypto.types.KemAlgorithm +| XWingDraft06Obsolete : hpke_rs_crypto.types.KemAlgorithm +| XWingDraft06 : hpke_rs_crypto.types.KemAlgorithm +| MlKem768 : hpke_rs_crypto.types.KemAlgorithm +| MlKem1024 : hpke_rs_crypto.types.KemAlgorithm + +/-- Trait declaration: [hpke_rs_crypto::HpkeTestRng] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/lib.rs', lines 150:0-150:21 + Name pattern: [hpke_rs_crypto::HpkeTestRng] + Visibility: public -/ +@[rust_trait "hpke_rs_crypto::HpkeTestRng" + (parentClauses := ["corefmtDebugInst", "corefmtDisplayInst"])] +structure hpke_rs_crypto.HpkeTestRng (Self : Type) (Self_Error : Type) where + corefmtDebugInst : core.fmt.Debug Self_Error + corefmtDisplayInst : core.fmt.Display Self_Error + try_fill_test_bytes : Self → Slice Std.U8 → Result ((core.result.Result + Unit Self_Error) × Self × (Slice Std.U8)) + seed : Self → Slice Std.U8 → Result Self + +/-- [hpke_rs_crypto::error::Error] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/error.rs', lines 10:0-10:14 + Name pattern: [hpke_rs_crypto::error::Error] + Visibility: public -/ +@[discriminant isize, rust_type "hpke_rs_crypto::error::Error"] +inductive hpke_rs_crypto.error.Error where +| HpkeInvalidOutputLength : hpke_rs_crypto.error.Error +| UnknownKdfAlgorithm : hpke_rs_crypto.error.Error +| KemInvalidSecretKey : hpke_rs_crypto.error.Error +| KemInvalidPublicKey : hpke_rs_crypto.error.Error +| KemInvalidCiphertext : hpke_rs_crypto.error.Error +| UnknownKemAlgorithm : hpke_rs_crypto.error.Error +| UnsupportedKemOperation : hpke_rs_crypto.error.Error +| UnknownAeadAlgorithm : hpke_rs_crypto.error.Error +| AeadInvalidNonce : hpke_rs_crypto.error.Error +| AeadOpenError : hpke_rs_crypto.error.Error +| AeadInvalidCiphertext : hpke_rs_crypto.error.Error +| InsufficientRandomness : hpke_rs_crypto.error.Error +| CryptoLibraryError : String → hpke_rs_crypto.error.Error + +/-- Trait declaration: [hpke_rs_crypto::HpkeCrypto] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/traits/src/lib.rs', lines 23:0-23:52 + Name pattern: [hpke_rs_crypto::HpkeCrypto] + Visibility: public -/ +@[rust_trait "hpke_rs_crypto::HpkeCrypto" + (parentClauses := ["corefmtDebugInst", "rand_coreCryptoRngInst", "HpkeTestRngInst", "zeroizeZeroizeInst"])] +structure hpke_rs_crypto.HpkeCrypto (Self : Type) (Self_HpkePrng : Type) + (Self_Clause3_Clause1_Clause0_Error : Type) (Self_Clause4_Error : Type) where + corefmtDebugInst : core.fmt.Debug Self + rand_coreCryptoRngInst : rand_core.CryptoRng Self_HpkePrng + Self_Clause3_Clause1_Clause0_Error + HpkeTestRngInst : hpke_rs_crypto.HpkeTestRng Self_HpkePrng Self_Clause4_Error + zeroizeZeroizeInst : zeroize.Zeroize Self_HpkePrng + «name» : Result String + supports_kdf : hpke_rs_crypto.types.KdfAlgorithm → Result + (core.result.Result Unit hpke_rs_crypto.error.Error) + supports_kem : hpke_rs_crypto.types.KemAlgorithm → Result + (core.result.Result Unit hpke_rs_crypto.error.Error) + supports_aead : hpke_rs_crypto.types.AeadAlgorithm → Result + (core.result.Result Unit hpke_rs_crypto.error.Error) + prng : Result Self_HpkePrng + kdf_extract : hpke_rs_crypto.types.KdfAlgorithm → Slice Std.U8 → Slice + Std.U8 → Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + kdf_expand : hpke_rs_crypto.types.KdfAlgorithm → Slice Std.U8 → Slice + Std.U8 → Std.Usize → Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + dh : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + secret_to_public : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + kem_key_gen : hpke_rs_crypto.types.KemAlgorithm → Self_HpkePrng → Result + ((core.result.Result ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec Std.U8)) + hpke_rs_crypto.error.Error) × Self_HpkePrng) + kem_key_gen_derand : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → + Result (core.result.Result ((alloc.vec.Vec Std.U8) × (alloc.vec.Vec + Std.U8)) hpke_rs_crypto.error.Error) + kem_encaps : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → + Self_HpkePrng → Result ((core.result.Result ((alloc.vec.Vec Std.U8) × + (alloc.vec.Vec Std.U8)) hpke_rs_crypto.error.Error) × Self_HpkePrng) + kem_decaps : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → Slice + Std.U8 → Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + dh_validate_sk : hpke_rs_crypto.types.KemAlgorithm → Slice Std.U8 → + Result (core.result.Result (alloc.vec.Vec Std.U8) + hpke_rs_crypto.error.Error) + aead_seal : hpke_rs_crypto.types.AeadAlgorithm → Slice Std.U8 → Slice + Std.U8 → Slice Std.U8 → Slice Std.U8 → Result (core.result.Result + (alloc.vec.Vec Std.U8) hpke_rs_crypto.error.Error) + aead_open : hpke_rs_crypto.types.AeadAlgorithm → Slice Std.U8 → Slice + Std.U8 → Slice Std.U8 → Slice Std.U8 → Result (core.result.Result + (alloc.vec.Vec Std.U8) hpke_rs_crypto.error.Error) + +/-- [hpke_rs_libcrux::HpkeLibcrux] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 31:0-31:22 + Name pattern: [hpke_rs_libcrux::HpkeLibcrux] + Visibility: public -/ +@[reducible, rust_type "hpke_rs_libcrux::HpkeLibcrux"] +def hpke_rs_libcrux.HpkeLibcrux := Unit + +/-- [libcrux_curve25519::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/crates/algorithms/curve25519/src/lib.rs', lines 22:0-22:16 + Name pattern: [libcrux_curve25519::Error] + Visibility: public -/ +@[reducible, rust_type "libcrux_curve25519::Error"] +def libcrux_curve25519.Error := Unit + +/-- [libcrux_ecdh::hacl::p256::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/hacl/p256.rs', lines 9:0-9:14 + Name pattern: [libcrux_ecdh::hacl::p256::Error] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_ecdh::hacl::p256::Error"] +inductive libcrux_ecdh.hacl.p256.Error where +| InvalidInput : libcrux_ecdh.hacl.p256.Error +| InvalidScalar : libcrux_ecdh.hacl.p256.Error +| InvalidPoint : libcrux_ecdh.hacl.p256.Error +| NoCompressedPoint : libcrux_ecdh.hacl.p256.Error +| NoUnCompressedPoint : libcrux_ecdh.hacl.p256.Error + +/-- [libcrux_ecdh::hacl::curve25519::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/hacl/curve25519.rs', lines 2:0-2:14 + Name pattern: [libcrux_ecdh::hacl::curve25519::Error] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_ecdh::hacl::curve25519::Error"] +inductive libcrux_ecdh.hacl.curve25519.Error where +| InvalidInput : libcrux_ecdh.hacl.curve25519.Error + +/-- [libcrux_ecdh::hacl::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/hacl.rs', lines 16:0-16:14 + Name pattern: [libcrux_ecdh::hacl::Error] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_ecdh::hacl::Error"] +inductive libcrux_ecdh.hacl.Error where +| Curve25519 : libcrux_ecdh.hacl.curve25519.Error → libcrux_ecdh.hacl.Error +| P256 : libcrux_ecdh.hacl.p256.Error → libcrux_ecdh.hacl.Error + +/-- [libcrux_ecdh::LowLevelError] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/ecdh.rs', lines 17:0-17:22 + Name pattern: [libcrux_ecdh::LowLevelError] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_ecdh::LowLevelError"] +inductive libcrux_ecdh.LowLevelError where +| Jasmin : String → libcrux_ecdh.LowLevelError +| Hacl : libcrux_ecdh.hacl.Error → libcrux_ecdh.LowLevelError + +/-- [libcrux_ecdh::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/ecdh.rs', lines 23:0-23:14 + Name pattern: [libcrux_ecdh::Error] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_ecdh::Error"] +inductive libcrux_ecdh.Error where +| InvalidPoint : libcrux_ecdh.Error +| InvalidScalar : libcrux_ecdh.Error +| UnknownAlgorithm : libcrux_ecdh.Error +| KeyGenError : libcrux_ecdh.Error +| Custom : String → libcrux_ecdh.Error +| Wrap : libcrux_ecdh.LowLevelError → libcrux_ecdh.Error + +/-- [libcrux_ecdh::p256_internal::PrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/p256_internal.rs', lines 9:0-9:21 + Name pattern: [libcrux_ecdh::p256_internal::PrivateKey] + Visibility: public -/ +@[reducible, rust_type "libcrux_ecdh::p256_internal::PrivateKey"] +def libcrux_ecdh.p256_internal.PrivateKey := Array Std.U8 32#usize + +/-- [libcrux_ecdh::p256_internal::PublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/p256_internal.rs', lines 19:0-19:20 + Name pattern: [libcrux_ecdh::p256_internal::PublicKey] + Visibility: public -/ +@[reducible, rust_type "libcrux_ecdh::p256_internal::PublicKey"] +def libcrux_ecdh.p256_internal.PublicKey := Array Std.U8 64#usize + +/-- [libcrux_ecdh::x25519::PrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/x25519.rs', lines 9:0-9:21 + Name pattern: [libcrux_ecdh::x25519::PrivateKey] + Visibility: public -/ +@[reducible, rust_type "libcrux_ecdh::x25519::PrivateKey"] +def libcrux_ecdh.x25519.PrivateKey := Array Std.U8 32#usize + +/-- [libcrux_ecdh::x25519::PublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ecdh/src/x25519.rs', lines 19:0-19:20 + Name pattern: [libcrux_ecdh::x25519::PublicKey] + Visibility: public -/ +@[reducible, rust_type "libcrux_ecdh::x25519::PublicKey"] +def libcrux_ecdh.x25519.PublicKey := Array Std.U8 32#usize + +/-- [libcrux_kem::Algorithm] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 103:0-103:18 + Name pattern: [libcrux_kem::Algorithm] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_kem::Algorithm"] +inductive libcrux_kem.Algorithm where +| X25519 : libcrux_kem.Algorithm +| X448 : libcrux_kem.Algorithm +| Secp256r1 : libcrux_kem.Algorithm +| Secp384r1 : libcrux_kem.Algorithm +| Secp521r1 : libcrux_kem.Algorithm +| MlKem512 : libcrux_kem.Algorithm +| MlKem768 : libcrux_kem.Algorithm +| X25519MlKem768Draft00 : libcrux_kem.Algorithm +| XWingKemDraft06 : libcrux_kem.Algorithm +| MlKem1024 : libcrux_kem.Algorithm + +/-- [libcrux_kem::Error] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 117:0-117:14 + Name pattern: [libcrux_kem::Error] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_kem::Error"] +inductive libcrux_kem.Error where +| EcDhError : libcrux_ecdh.Error → libcrux_kem.Error +| KeyGen : libcrux_kem.Error +| Encapsulate : libcrux_kem.Error +| Decapsulate : libcrux_kem.Error +| UnsupportedAlgorithm : libcrux_kem.Error +| InvalidPrivateKey : libcrux_kem.Error +| InvalidPublicKey : libcrux_kem.Error +| InvalidCiphertext : libcrux_kem.Error + +/-- [libcrux_kem::X25519MlKem768Draft00PrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 152:0-152:42 + Name pattern: [libcrux_kem::X25519MlKem768Draft00PrivateKey] + Visibility: public -/ +@[rust_type "libcrux_kem::X25519MlKem768Draft00PrivateKey"] +structure libcrux_kem.X25519MlKem768Draft00PrivateKey where + mlkem : libcrux_ml_kem.types.MlKemPrivateKey 2400#usize + x25519 : libcrux_ecdh.x25519.PrivateKey + +/-- [libcrux_kem::XWingKemDraft06PrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 177:0-177:36 + Name pattern: [libcrux_kem::XWingKemDraft06PrivateKey] + Visibility: public -/ +@[rust_type "libcrux_kem::XWingKemDraft06PrivateKey"] +structure libcrux_kem.XWingKemDraft06PrivateKey where + seed : Array Std.U8 32#usize + +/-- [libcrux_kem::PrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 194:0-194:19 + Name pattern: [libcrux_kem::PrivateKey] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_kem::PrivateKey"] +inductive libcrux_kem.PrivateKey where +| X25519 : libcrux_ecdh.x25519.PrivateKey → libcrux_kem.PrivateKey +| P256 : libcrux_ecdh.p256_internal.PrivateKey → libcrux_kem.PrivateKey +| MlKem512 : + libcrux_ml_kem.types.MlKemPrivateKey 1632#usize → + libcrux_kem.PrivateKey +| MlKem768 : + libcrux_ml_kem.types.MlKemPrivateKey 2400#usize → + libcrux_kem.PrivateKey +| X25519MlKem768Draft00 : + libcrux_kem.X25519MlKem768Draft00PrivateKey → + libcrux_kem.PrivateKey +| XWingKemDraft06 : + libcrux_kem.XWingKemDraft06PrivateKey → + libcrux_kem.PrivateKey +| MlKem1024 : + libcrux_ml_kem.types.MlKemPrivateKey 3168#usize → + libcrux_kem.PrivateKey + +/-- [libcrux_kem::X25519MlKem768Draft00PublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 206:0-206:41 + Name pattern: [libcrux_kem::X25519MlKem768Draft00PublicKey] + Visibility: public -/ +@[rust_type "libcrux_kem::X25519MlKem768Draft00PublicKey"] +structure libcrux_kem.X25519MlKem768Draft00PublicKey where + mlkem : libcrux_ml_kem.types.MlKemPublicKey 1184#usize + x25519 : libcrux_ecdh.x25519.PublicKey + +/-- [libcrux_kem::XWingKemDraft06PublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 237:0-237:35 + Name pattern: [libcrux_kem::XWingKemDraft06PublicKey] + Visibility: public -/ +@[rust_type "libcrux_kem::XWingKemDraft06PublicKey"] +structure libcrux_kem.XWingKemDraft06PublicKey where + pk_m : libcrux_ml_kem.types.MlKemPublicKey 1184#usize + pk_x : libcrux_ecdh.x25519.PublicKey + +/-- [libcrux_kem::PublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-kem/src/kem.rs', lines 269:0-269:18 + Name pattern: [libcrux_kem::PublicKey] + Visibility: public -/ +@[discriminant u8, rust_type "libcrux_kem::PublicKey"] +inductive libcrux_kem.PublicKey where +| X25519 : libcrux_ecdh.x25519.PublicKey → libcrux_kem.PublicKey +| P256 : libcrux_ecdh.p256_internal.PublicKey → libcrux_kem.PublicKey +| MlKem512 : + libcrux_ml_kem.types.MlKemPublicKey 800#usize → + libcrux_kem.PublicKey +| MlKem768 : + libcrux_ml_kem.types.MlKemPublicKey 1184#usize → + libcrux_kem.PublicKey +| X25519MlKem768Draft00 : + libcrux_kem.X25519MlKem768Draft00PublicKey → + libcrux_kem.PublicKey +| XWingKemDraft06 : + libcrux_kem.XWingKemDraft06PublicKey → + libcrux_kem.PublicKey +| MlKem1024 : + libcrux_ml_kem.types.MlKemPublicKey 1568#usize → + libcrux_kem.PublicKey + +/-- [libcrux_traits::kem::arrayref::DecapsError] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 69:0-69:20 + Name pattern: [libcrux_traits::kem::arrayref::DecapsError] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_traits::kem::arrayref::DecapsError"] +inductive libcrux_traits.kem.arrayref.DecapsError where +| InvalidCiphertext : libcrux_traits.kem.arrayref.DecapsError +| InvalidDecapsKey : libcrux_traits.kem.arrayref.DecapsError +| Unknown : libcrux_traits.kem.arrayref.DecapsError + +/-- [libcrux_traits::kem::arrayref::EncapsError] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 56:0-56:20 + Name pattern: [libcrux_traits::kem::arrayref::EncapsError] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_traits::kem::arrayref::EncapsError"] +inductive libcrux_traits.kem.arrayref.EncapsError where +| InvalidEncapsKey : libcrux_traits.kem.arrayref.EncapsError +| InvalidRandomness : libcrux_traits.kem.arrayref.EncapsError +| Unknown : libcrux_traits.kem.arrayref.EncapsError + +/-- [libcrux_traits::kem::arrayref::KeyGenError] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 46:0-46:20 + Name pattern: [libcrux_traits::kem::arrayref::KeyGenError] + Visibility: public -/ +@[discriminant isize, rust_type "libcrux_traits::kem::arrayref::KeyGenError"] +inductive libcrux_traits.kem.arrayref.KeyGenError where +| InvalidRandomness : libcrux_traits.kem.arrayref.KeyGenError +| Unknown : libcrux_traits.kem.arrayref.KeyGenError + +/-- Trait declaration: [libcrux_traits::kem::arrayref::Kem] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/traits/src/kem/arrayref.rs', lines 8:0-15:1 + Name pattern: [libcrux_traits::kem::arrayref::Kem] + Visibility: public -/ +@[rust_trait "libcrux_traits::kem::arrayref::Kem"] +structure libcrux_traits.kem.arrayref.Kem (Self : Type) (EK_LEN : Std.Usize) + (DK_LEN : Std.Usize) (CT_LEN : Std.Usize) (SS_LEN : Std.Usize) + (RAND_KEYGEN_LEN : Std.Usize) (RAND_ENCAPS_LEN : Std.Usize) where + keygen : Array Std.U8 EK_LEN → Array Std.U8 DK_LEN → Array Std.U8 + RAND_KEYGEN_LEN → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.KeyGenError) × (Array Std.U8 EK_LEN) × (Array + Std.U8 DK_LEN)) + encaps : Array Std.U8 CT_LEN → Array Std.U8 SS_LEN → Array Std.U8 EK_LEN + → Array Std.U8 RAND_ENCAPS_LEN → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.EncapsError) × (Array Std.U8 CT_LEN) × (Array + Std.U8 SS_LEN)) + decaps : Array Std.U8 SS_LEN → Array Std.U8 CT_LEN → Array Std.U8 DK_LEN + → Result ((core.result.Result Unit + libcrux_traits.kem.arrayref.DecapsError) × (Array Std.U8 SS_LEN)) + +/-- [libcrux_ml_kem::mlkem768::MlKem768] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/mlkem768.rs', lines 37:0-37:19 + Name pattern: [libcrux_ml_kem::mlkem768::MlKem768] + Visibility: public -/ +@[reducible, rust_type "libcrux_ml_kem::mlkem768::MlKem768"] +def libcrux_ml_kem.mlkem768.MlKem768 := Unit + +/-- Trait declaration: [rand_core::RngCore] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand_core-0.10.1/src/lib.rs', lines 257:0-257:22 + Name pattern: [rand_core::RngCore] + Visibility: public -/ +@[rust_trait "rand_core::RngCore" (parentClauses := ["RngInst"])] +structure rand_core.RngCore (Self : Type) where + RngInst : rand_core.Rng Self + +/-- [securedrop_protocol_minimal::metadata::MetadataCiphertext] + Source: 'protocol-minimal/src/metadata.rs', lines 90:0-95:1 + Visibility: public -/ +structure metadata.MetadataCiphertext where + c : Array Std.U8 1120#usize + cp : Array Std.U8 1232#usize + +/-- [securedrop_protocol_minimal::message::MessageCiphertext] + Source: 'protocol-minimal/src/message.rs', lines 159:0-166:1 + Visibility: public -/ +structure message.MessageCiphertext where + c1 : Array Std.U8 32#usize + cp : alloc.vec.Vec Std.U8 + c2 : Array Std.U8 1088#usize + +/-- [securedrop_protocol_minimal::ciphertext::Envelope] + Source: 'protocol-minimal/src/ciphertext.rs', lines 44:0-58:1 + Visibility: public -/ +structure ciphertext.Envelope where + ct_apke : message.MessageCiphertext + ct_pke : metadata.MetadataCiphertext + mgdh_pubkey : Array Std.U8 32#usize + mgdh : Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::ciphertext::Plaintext] + Source: 'protocol-minimal/src/ciphertext.rs', lines 78:0-85:1 + Visibility: public -/ +structure ciphertext.Plaintext where + sender_reply_pubkey_hybrid : Array Std.U8 1216#usize + sender_fetch_key : Array Std.U8 32#usize + msg : alloc.vec.Vec Std.U8 + +/-- [securedrop_protocol_minimal::primitives::x25519::DHPrivateKey] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 50:0-50:50 + Visibility: public -/ +@[reducible] +def primitives.x25519.DHPrivateKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::primitives::x25519::DHPublicKey] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 17:0-17:48 + Visibility: public -/ +@[reducible] +def primitives.x25519.DHPublicKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::primitives::mlkem::MLKEM768PrivateKey] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 20:0-20:69 -/ +@[reducible] +def primitives.mlkem.MLKEM768PrivateKey := Array Std.U8 2400#usize + +/-- [securedrop_protocol_minimal::primitives::dh_akem::DhAkemPrivateKey] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 17:0-17:66 -/ +@[reducible] +def primitives.dh_akem.DhAkemPrivateKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::message::MessagePrivateKey] + Source: 'protocol-minimal/src/message.rs', lines 70:0-73:1 + Visibility: public -/ +structure message.MessagePrivateKey where + dhakem : primitives.dh_akem.DhAkemPrivateKey + mlkem : primitives.mlkem.MLKEM768PrivateKey + +/-- [securedrop_protocol_minimal::primitives::mlkem::MLKEM768PublicKey] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 16:0-16:67 -/ +@[reducible] +def primitives.mlkem.MLKEM768PublicKey := Array Std.U8 1184#usize + +/-- [securedrop_protocol_minimal::primitives::dh_akem::DhAkemPublicKey] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 13:0-13:64 -/ +@[reducible] +def primitives.dh_akem.DhAkemPublicKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::message::MessagePublicKey] + Source: 'protocol-minimal/src/message.rs', lines 60:0-63:1 + Visibility: public -/ +structure message.MessagePublicKey where + dhakem : primitives.dh_akem.DhAkemPublicKey + mlkem : primitives.mlkem.MLKEM768PublicKey + +/-- [securedrop_protocol_minimal::primitives::xwing::XWingPrivateKey] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 16:0-16:63 -/ +@[reducible] +def primitives.xwing.XWingPrivateKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::metadata::MetadataPrivateKey] + Source: 'protocol-minimal/src/metadata.rs', lines 44:0-44:58 + Visibility: public -/ +@[reducible] +def metadata.MetadataPrivateKey := primitives.xwing.XWingPrivateKey + +/-- [securedrop_protocol_minimal::primitives::xwing::XWingPublicKey] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 12:0-12:61 -/ +@[reducible] +def primitives.xwing.XWingPublicKey := Array Std.U8 1216#usize + +/-- [securedrop_protocol_minimal::metadata::MetadataPublicKey] + Source: 'protocol-minimal/src/metadata.rs', lines 40:0-40:56 + Visibility: public -/ +@[reducible] +def metadata.MetadataPublicKey := primitives.xwing.XWingPublicKey + +/-- [securedrop_protocol_minimal::metadata::MetadataKeyPair] + Source: 'protocol-minimal/src/metadata.rs', lines 48:0-51:1 + Visibility: public -/ +structure metadata.MetadataKeyPair where + sk : metadata.MetadataPrivateKey + pk : metadata.MetadataPublicKey + +/-- [securedrop_protocol_minimal::message::MessageKeyPair] + Source: 'protocol-minimal/src/message.rs', lines 77:0-80:1 + Visibility: public -/ +structure message.MessageKeyPair where + sk : message.MessagePrivateKey + pk : message.MessagePublicKey + +/-- [securedrop_protocol_minimal::keys::MessageKeyBundle] + Source: 'protocol-minimal/src/keys.rs', lines 61:0-64:1 -/ +structure keys.MessageKeyBundle where + apke : message.MessageKeyPair + metadata_kp : metadata.MetadataKeyPair + +/-- Trait declaration: [securedrop_protocol_minimal::traits::UserSecret] + Source: 'protocol-minimal/src/traits.rs', lines 84:0-93:1 + Visibility: public -/ +structure traits.UserSecret (Self : Type) where + num_bundles : Self → Result Std.Usize + fetch_keypair : Self → Result (primitives.x25519.DHPrivateKey × + primitives.x25519.DHPublicKey) + message_auth_key : Self → Result message.MessagePrivateKey + own_message_auth_pk : Self → Result message.MessagePublicKey + build_message : Self → alloc.vec.Vec Std.U8 → Result ciphertext.Plaintext + keybundles : Self → Result (alloc.vec.Vec keys.MessageKeyBundle) + +/-- Trait declaration: [securedrop_protocol_minimal::traits::UserPublic] + Source: 'protocol-minimal/src/traits.rs', lines 29:0-36:1 + Visibility: public -/ +structure traits.UserPublic (Self : Type) where + fetch_pk : Self → Result primitives.x25519.DHPublicKey + message_auth_pk : Self → Result message.MessagePublicKey + message_metadata_pk : Self → Result metadata.MetadataPublicKey + message_enc_pk : Self → Result message.MessagePublicKey + +/-- [securedrop_protocol_minimal::primitives::x25519::dh_shared_secret::closure] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 169:17-169:56 -/ +@[reducible] +def primitives.x25519.dh_shared_secret.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::x25519::DHSharedSecret] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 71:0-71:36 + Visibility: public -/ +@[reducible] +def primitives.x25519.DHSharedSecret := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::primitives::x25519::generate_dh_keypair::closure] + Source: 'protocol-minimal/src/primitives/x25519.rs', lines 116:17-116:68 -/ +@[reducible] +def primitives.x25519.generate_dh_keypair.closure (R : Type) + (Clause1_Clause1_Clause0_Error : Type) := +Unit + +/-- [securedrop_protocol_minimal::message::auth_enc::closure#1] + Source: 'protocol-minimal/src/message.rs', lines 317:17-317:71 -/ +@[reducible] +def message.auth_enc.closure_1 (R : Type) (Clause1_Clause1_Clause0_Error : + Type) := +Unit + +/-- [securedrop_protocol_minimal::message::auth_enc::closure] + Source: 'protocol-minimal/src/message.rs', lines 297:17-297:76 -/ +@[reducible] +def message.auth_enc.closure (R : Type) (Clause1_Clause1_Clause0_Error : Type) + := +Unit + +/-- [securedrop_protocol_minimal::primitives::mlkem::generate_mlkem768_keypair::closure] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 122:17-122:80 -/ +@[reducible] +def primitives.mlkem.generate_mlkem768_keypair.closure (R : Type) + (Clause1_Clause1_Clause0_Error : Type) := +Unit + +/-- [securedrop_protocol_minimal::primitives::mlkem::typed::closure#1] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 108:21-108:78 -/ +@[reducible] +def primitives.mlkem.typed.closure_1 := Unit + +/-- [securedrop_protocol_minimal::primitives::mlkem::typed::closure] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 102:21-102:79 -/ +@[reducible] +def primitives.mlkem.typed.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::dh_akem::generate_dh_akem_keypair::closure] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 147:17-147:78 -/ +@[reducible] +def primitives.dh_akem.generate_dh_akem_keypair.closure (R : Type) + (Clause1_Clause1_Clause0_Error : Type) := +Unit + +/-- [securedrop_protocol_minimal::primitives::dh_akem::typed::closure#1] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 133:21-133:78 -/ +@[reducible] +def primitives.dh_akem.typed.closure_1 := Unit + +/-- [securedrop_protocol_minimal::primitives::dh_akem::typed::closure] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 127:21-127:79 -/ +@[reducible] +def primitives.dh_akem.typed.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::mlkem::deterministic_keygen::closure] + Source: 'protocol-minimal/src/primitives/mlkem.rs', lines 62:17-62:94 -/ +@[reducible] +def primitives.mlkem.deterministic_keygen.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::dh_akem::deterministic_keygen::closure] + Source: 'protocol-minimal/src/primitives/dh_akem.rs', lines 75:17-75:92 -/ +@[reducible] +def primitives.dh_akem.deterministic_keygen.closure := Unit + +/-- [securedrop_protocol_minimal::message::auth_dec::closure#1] + Source: 'protocol-minimal/src/message.rs', lines 376:13-376:67 -/ +@[reducible] +def message.auth_dec.closure_1 := Unit + +/-- [securedrop_protocol_minimal::message::auth_dec::closure] + Source: 'protocol-minimal/src/message.rs', lines 356:17-356:76 -/ +@[reducible] +def message.auth_dec.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::xwing::generate_xwing_keypair::closure] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 123:17-123:76 -/ +@[reducible] +def primitives.xwing.generate_xwing_keypair.closure (R : Type) + (Clause1_Clause1_Clause0_Error : Type) := +Unit + +/-- [securedrop_protocol_minimal::primitives::xwing::typed::closure#1] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 109:21-109:78 -/ +@[reducible] +def primitives.xwing.typed.closure_1 := Unit + +/-- [securedrop_protocol_minimal::primitives::xwing::typed::closure] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 103:21-103:79 -/ +@[reducible] +def primitives.xwing.typed.closure := Unit + +/-- [securedrop_protocol_minimal::primitives::xwing::deterministic_keygen::closure] + Source: 'protocol-minimal/src/primitives/xwing.rs', lines 63:17-63:90 -/ +@[reducible] +def primitives.xwing.deterministic_keygen.closure := Unit + +/-- [securedrop_protocol_minimal::metadata::{securedrop_protocol_minimal::metadata::MetadataPublicKey}::from_bytes::closure] + Source: 'protocol-minimal/src/metadata.rs', lines 196:71-202:9 -/ +@[reducible] +def metadata.MetadataPublicKey.from_bytes.closure := Slice Std.U8 + +/-- [securedrop_protocol_minimal::metadata::decrypt::closure] + Source: 'protocol-minimal/src/metadata.rs', lines 286:17-286:73 -/ +@[reducible] +def metadata.decrypt.closure := Unit + +/-- Trait declaration: [securedrop_protocol_minimal::sign::DomainTag] + Source: 'protocol-minimal/src/sign.rs', lines 29:0-32:1 + Visibility: public -/ +structure sign.DomainTag (Self : Type) where + tag : Result (Slice Std.U8) + +/-- [securedrop_protocol_minimal::sign::JournalistLongTermKey] + Source: 'protocol-minimal/src/sign.rs', lines 36:0-36:33 + Visibility: public -/ +@[reducible] +def sign.JournalistLongTermKey := Unit + +/-- [securedrop_protocol_minimal::sign::JournalistEphemeralKey] + Source: 'protocol-minimal/src/sign.rs', lines 40:0-40:34 + Visibility: public -/ +@[reducible] +def sign.JournalistEphemeralKey := Unit + +/-- [securedrop_protocol_minimal::sign::NewsroomOnJournalist] + Source: 'protocol-minimal/src/sign.rs', lines 44:0-44:32 + Visibility: public -/ +@[reducible] +def sign.NewsroomOnJournalist := Unit + +/-- [securedrop_protocol_minimal::sign::FpfOnNewsroom] + Source: 'protocol-minimal/src/sign.rs', lines 48:0-48:25 + Visibility: public -/ +@[reducible] +def sign.FpfOnNewsroom := Unit + +/-- [securedrop_protocol_minimal::sign::Signature] + Source: 'protocol-minimal/src/sign.rs', lines 94:0-99:1 + Visibility: public -/ +structure sign.Signature (D : Type) where + bytes : Array Std.U8 64#usize + _phantom : core.marker.PhantomData D + +/-- [securedrop_protocol_minimal::sign::VerifyingKey] + Source: 'protocol-minimal/src/sign.rs', lines 185:0-185:47 + Visibility: public -/ +@[reducible] +def sign.VerifyingKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::sign::SigningSecretKey] + Source: 'protocol-minimal/src/sign.rs', lines 189:0-189:58 -/ +@[reducible] +def sign.SigningSecretKey := Array Std.U8 32#usize + +/-- [securedrop_protocol_minimal::sign::SigningKey] + Source: 'protocol-minimal/src/sign.rs', lines 214:0-217:1 + Visibility: public -/ +structure sign.SigningKey where + vk : sign.VerifyingKey + sk : sign.SigningSecretKey + +/-- [securedrop_protocol_minimal::sign::{securedrop_protocol_minimal::sign::VerifyingKey}::verify::closure] + Source: 'protocol-minimal/src/sign.rs', lines 298:21-298:73 -/ +@[reducible] +def sign.VerifyingKey.verify.closure (D : Type) := Unit + +end securedrop_protocol_minimal diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/TypesExternal_Template.lean b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/TypesExternal_Template.lean new file mode 100644 index 00000000..d7aaba26 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/SecuredropProtocolMinimal/Extraction/TypesExternal_Template.lean @@ -0,0 +1,67 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [securedrop_protocol_minimal]: external types. +-- This is a template file: rename it to "TypesExternal.lean" and fill the holes. +import Aeneas +open Aeneas Aeneas.Std Result ControlFlow Error +open Std.Do +set_option linter.dupNamespace false +set_option linter.hashCommand false +set_option linter.unusedVariables false + +/- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/ +set_option maxHeartbeats 1000000 + +/- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/ +set_option maxRecDepth 2048 + +/-- [anyhow::Error] + Source: '/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.103/src/lib.rs', lines 390:0-390:16 + Name pattern: [anyhow::Error] + Visibility: public -/ +@[rust_type "anyhow::Error"] +axiom anyhow.Error : Type + +/-- [hpke_rs::HpkePublicKey] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 214:0-214:24 + Name pattern: [hpke_rs::HpkePublicKey] + Visibility: public -/ +@[rust_type "hpke_rs::HpkePublicKey"] +axiom hpke_rs.HpkePublicKey : Type + +/-- [hpke_rs::HpkePrivateKey] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 231:0-231:25 + Name pattern: [hpke_rs::HpkePrivateKey] + Visibility: public -/ +@[rust_type "hpke_rs::HpkePrivateKey"] +axiom hpke_rs.HpkePrivateKey : Type + +/-- [hpke_rs::Hpke] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/src/lib.rs', lines 460:0-460:45 + Name pattern: [hpke_rs::Hpke] + Visibility: public -/ +@[rust_type "hpke_rs::Hpke"] +axiom hpke_rs.Hpke (Crypto : Type) (Clause0_HpkePrng : Type) + (Clause0_Clause3_Clause1_Clause0_Error : Type) (Clause0_Clause4_Error : Type) + : Type + +/-- [hpke_rs_libcrux::HpkeLibcruxPrng] + Source: '/cargo/git/checkouts/hpke-rs-96cbacf2e1039d85/634caf8/libcrux_provider/src/lib.rs', lines 34:0-34:26 + Name pattern: [hpke_rs_libcrux::HpkeLibcruxPrng] + Visibility: public -/ +@[rust_type "hpke_rs_libcrux::HpkeLibcruxPrng"] +axiom hpke_rs_libcrux.HpkeLibcruxPrng : Type + +/-- [libcrux_ml_kem::types::MlKemPrivateKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/types.rs', lines 5:8-7:9 + Name pattern: [libcrux_ml_kem::types::MlKemPrivateKey] + Visibility: public -/ +@[rust_type "libcrux_ml_kem::types::MlKemPrivateKey"] +axiom libcrux_ml_kem.types.MlKemPrivateKey (SIZE : Std.Usize) : Type + +/-- [libcrux_ml_kem::types::MlKemPublicKey] + Source: '/cargo/git/checkouts/libcrux-b8e0ded9ad9366a7/3cd1843/libcrux-ml-kem/src/types.rs', lines 5:8-7:9 + Name pattern: [libcrux_ml_kem::types::MlKemPublicKey] + Visibility: public -/ +@[rust_type "libcrux_ml_kem::types::MlKemPublicKey"] +axiom libcrux_ml_kem.types.MlKemPublicKey (SIZE : Std.Usize) : Type + diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lakefile.toml b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lakefile.toml new file mode 100644 index 00000000..ef6eb14c --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lakefile.toml @@ -0,0 +1,17 @@ +name = "SecuredropProtocolMinimal" +version = "0.1.0" +defaultTargets = ["SecuredropProtocolMinimal"] + +[[lean_lib]] +name = "SecuredropProtocolMinimal" + +[[require]] +name = "aeneas" +git = "https://github.com/cryspen/aeneas" +rev = "e0a1596" +subDir = "backends/lean" + +[[require]] +name = "Hax" +git = { url = "https://github.com/cryspen/hax-lean" } +rev = "v0.1.0" diff --git a/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lean-toolchain b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lean-toolchain new file mode 100644 index 00000000..635bb953 --- /dev/null +++ b/securedrop-protocol/protocol-minimal/proofs/aeneas-lean/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.30.0-rc2 \ No newline at end of file diff --git a/securedrop-protocol/protocol-minimal/proofs/proverif/hax.py b/securedrop-protocol/protocol-minimal/proofs/proverif/hax.py index ed6e3d80..c5ecd2f8 100644 --- a/securedrop-protocol/protocol-minimal/proofs/proverif/hax.py +++ b/securedrop-protocol/protocol-minimal/proofs/proverif/hax.py @@ -5,6 +5,11 @@ extract-proverif `cargo hax into -i '' proverif` -> extraction/lib.pvl (injects the dev hax-lib via `cargo --config`; restores Cargo.lock) + extract-lean `cargo hax into aeneas-lean` (charon + aeneas) -> a Lean + project under ../aeneas-lean/ for the crypto core. Needs a hax + checkout w/ cryspen/hax#2069 + #2071 (HAX_LEAN_DIR, default ~/hax): + uses its cargo-hax and injects its hax-lib via a temporary + [patch.crates-io] (Cargo.toml/lock restored afterwards). verify-proverif run ProVerif on queries/*.pv, print RESULT lines check-proverif run ProVerif and assert each query's (* EXPECTPV ... END *) block `check-proverif update` regenerates those blocks @@ -31,6 +36,35 @@ QUERIES = os.path.join(HERE, "queries") LIB_SHA = os.path.join(GEN, "lib.pvl.sha256") +# Aeneas/Lean lane. hax's aeneas-lean backend (charon + aeneas) writes a whole Lean +# project under /proofs/aeneas-lean/. Two hax changes are needed and injected at +# extraction time (pending upstream), so the committed manifest stays on crates.io +# hax-lib 0.3.7: +# * cryspen/hax#2069 (cargo-hax): target-side `--cfg hax` so cfg(hax)-gated deps +# (libcrux et al.) compile under charon. +# * cryspen/hax#2071 (hax-lib + cargo-hax): `hax_lib::opaque`/`exclude` emit charon's +# native attributes, so `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]` markers work. +# HAX_LEAN_DIR (default ~/hax) is a hax checkout carrying both: its `target/{release, +# debug}/cargo-hax` is used, and its hax-lib is injected via a temporary +# [patch.crates-io] (charon does not honor hax's `-C` config, so we patch the manifest). +LEAN_DIR = os.path.normpath(os.path.join(CRATE, "proofs", "aeneas-lean")) +WS = os.path.normpath(os.path.join(CRATE, "..")) # workspace root (holds Cargo.toml/lock) +HAX_LEAN_DIR = os.environ.get("HAX_LEAN_DIR", os.path.expanduser("~/hax")) + +# Crypto core to extract, mirroring the ProVerif targets: SD-APKE (message), SD-PKE +# (metadata), Ed25519 domain-separated signing (sign), and envelope encrypt/decrypt. +# charon translates each item's transitive closure; aeneas-hostile helpers inside it +# (the `&'static` domain tags, the trial-decryption loop) carry +# `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]`. `--charon-args` overrides this. +LEAN_START_FROM = [ + "securedrop_protocol_minimal::message", + "securedrop_protocol_minimal::metadata", + "securedrop_protocol_minimal::sign", + "securedrop_protocol_minimal::encrypt_decrypt::encrypt", + "securedrop_protocol_minimal::encrypt_decrypt::decrypt", + "securedrop_protocol_minimal::encrypt_decrypt::decrypt_with_sender", +] + HAX_PROVERIF_DIR = os.environ.get( "HAX_PROVERIF_DIR", os.path.expanduser("~/hax-proverif-backend") ) @@ -149,6 +183,79 @@ def cmd_extract(args): return rc +def _inject_hax_lib_patch(): + """Add a temporary [patch.crates-io] to the workspace manifest pointing hax-lib at + HAX_LEAN_DIR, so charon compiles against the dev hax-lib (charon ignores hax's `-C` + config, so unlike the ProVerif lane we patch the manifest). Returns {path: original} + backups (Cargo.toml + Cargo.lock) for the caller to restore; empty if already patched.""" + lib = os.path.join(HAX_LEAN_DIR, "hax-lib") + entries = ( + 'hax-lib = {{ path = "{0}" }}\n' + 'hax-lib-macros = {{ path = "{0}/macros" }}\n' + 'hax-lib-macros-types = {{ path = "{0}/macros/types" }}\n' + ).format(lib) + ws_toml = os.path.join(WS, "Cargo.toml") + ws_lock = os.path.join(WS, "Cargo.lock") + backups = {p: open(p).read() for p in (ws_toml, ws_lock) if os.path.exists(p)} + text = backups.get(ws_toml, "") + if "hax-lib = { path" in text: + return {} # already patched (e.g. re-entrant); leave as-is + marker = "[patch.crates-io]\n" + text = text.replace(marker, marker + entries, 1) if marker in text \ + else text + "\n" + marker + entries + with open(ws_toml, "w") as f: + f.write(text) + return backups + + +def cmd_extract_lean(args): + """Aeneas/Lean lane: `cargo hax into aeneas-lean` runs charon then aeneas to lift the + Rust into a Lean project under ../aeneas-lean/. Extracts the crypto-core closure + (LEAN_START_FROM); aeneas-hostile helpers are gated opaque via + `#[cfg_attr(hax_backend_lean, hax_lib::opaque)]`. Needs a hax checkout with + cryspen/hax#2069 + #2071 (HAX_LEAN_DIR): its cargo-hax is put on PATH and its hax-lib + injected as a temporary [patch.crates-io] (Cargo.toml/lock restored afterwards).""" + env = dict(os.environ) + # Put HAX_LEAN_DIR's cargo-hax on PATH — the most recently built of release/debug, + # so a stale build in the other profile can't shadow a fresh one. + cands = [os.path.join(HAX_LEAN_DIR, "target", s, "cargo-hax") for s in ("release", "debug")] + cands = [c for c in cands if os.path.exists(c)] + if cands: + newest = max(cands, key=os.path.getmtime) + env["PATH"] = os.path.dirname(newest) + os.pathsep + env.get("PATH", "") + charon = args.charon_args or " ".join("--start-from " + t for t in LEAN_START_FROM) + cmd = ["cargo", "hax", "into", "aeneas-lean"] + if not args.no_lakefile: + # Idempotent: scaffolds lakefile.toml + lean-toolchain, never overwriting edits. + cmd += ["--lakefile"] + # `--flag=value` form: values start with `--` (`--start-from ...`), which the + # space-separated form would mis-parse as new flags. + cmd += ["--charon-args=" + charon] + if args.aeneas_args: + cmd += ["--aeneas-args=" + args.aeneas_args] + backups = _inject_hax_lib_patch() + try: + rc = subprocess.run(cmd, cwd=CRATE, env=env).returncode + finally: + for p, data in backups.items(): + with open(p, "w") as f: + f.write(data) + # Report the .lean files aeneas produced (nested under a Lean-package dir). + leans = sorted( + os.path.relpath(os.path.join(root, f), LEAN_DIR) + for root, _dirs, files in os.walk(LEAN_DIR) + for f in files if f.endswith(".lean") + ) + where = os.path.relpath(LEAN_DIR, HERE) + if leans: + print("\n== aeneas-lean: {} .lean file(s) under {} ==".format(len(leans), where)) + for f in leans: + print(" " + f) + else: + print("\n== aeneas-lean: no .lean produced under {} (see errors above) ==".format(where)) + return rc + + # Names of symbols the extracted model references but that are DEFINED by our # hand-written libs (sd_crypto.pvl, sd_model.pvl). hax can't see those definitions, # so it lists them in missingdecl.pvl; leaving them there would double-declare the @@ -332,6 +439,15 @@ def main(): e.add_argument("--include", help="override the -i target filter") e.set_defaults(func=cmd_extract) + ln = sub.add_parser("extract-lean", + help="cargo hax into aeneas-lean -> Lean project under ../aeneas-lean/") + ln.add_argument("--no-lakefile", action="store_true", + help="don't scaffold lakefile.toml / lean-toolchain in ../aeneas-lean/") + ln.add_argument("--charon-args", + help="override the default crypto-core --start-from set (shell-quoted)") + ln.add_argument("--aeneas-args", help="extra args forwarded to aeneas (shell-quoted)") + ln.set_defaults(func=cmd_extract_lean) + r = sub.add_parser("reconstruct-proverif", help="engine-free: verify the committed lib.pvl snapshot digest") r.set_defaults(func=cmd_reconstruct) diff --git a/securedrop-protocol/protocol-minimal/src/encrypt_decrypt.rs b/securedrop-protocol/protocol-minimal/src/encrypt_decrypt.rs index 3281b320..6373fa52 100644 --- a/securedrop-protocol/protocol-minimal/src/encrypt_decrypt.rs +++ b/securedrop-protocol/protocol-minimal/src/encrypt_decrypt.rs @@ -78,6 +78,11 @@ pub fn decrypt(receiver: &U, envelope: &Envelope) -> Pla /// Decrypt like [`decrypt`], additionally returning the sender's long-term /// SD-APKE public key `pk_S^APKE` recovered from `ct^PKE`. #[cfg_attr(hax, hax_lib::fstar::verification_status(lax))] +// The trial-decryption loop iterates a `Vec<&MessageKeyBundle>`, which aeneas/charon +// can't translate (iterator + nested borrows, AeneasVerif/aeneas#464). This is +// protocol dispatch rather than a crypto primitive, so make it opaque for the Lean +// backend only; F* and normal builds are unaffected. +#[cfg_attr(hax_backend_lean, hax_lib::opaque)] pub fn decrypt_with_sender( receiver: &U, envelope: &Envelope, diff --git a/securedrop-protocol/protocol-minimal/src/sign.rs b/securedrop-protocol/protocol-minimal/src/sign.rs index 41a1b5ab..9165dc1f 100644 --- a/securedrop-protocol/protocol-minimal/src/sign.rs +++ b/securedrop-protocol/protocol-minimal/src/sign.rs @@ -58,21 +58,28 @@ mod sealed_impls { } impl DomainTag for JournalistLongTermKey { + // aeneas/charon can't represent the `&'static [u8]` promoted literal ("no bottoms + // in the value"); the tag is a constant, so make it opaque for the Lean backend + // only. F* and normal builds are unaffected. See AeneasVerif/aeneas#392. + #[cfg_attr(hax_backend_lean, hax_lib::opaque)] fn tag() -> &'static [u8] { b"j-sig-ltk" } } impl DomainTag for JournalistEphemeralKey { + #[cfg_attr(hax_backend_lean, hax_lib::opaque)] fn tag() -> &'static [u8] { b"j-sig-eph" } } impl DomainTag for NewsroomOnJournalist { + #[cfg_attr(hax_backend_lean, hax_lib::opaque)] fn tag() -> &'static [u8] { b"nr-sig" } } impl DomainTag for FpfOnNewsroom { + #[cfg_attr(hax_backend_lean, hax_lib::opaque)] fn tag() -> &'static [u8] { b"fpf-sig-nr" } @@ -154,6 +161,9 @@ impl<'de, D: DomainTag> serde::Deserialize<'de> for Signature { /// Construct the tagged signing preimage: `len(tag) || tag || msg`. #[cfg_attr(hax, hax_lib::fstar::verification_status(lax))] +// Builds the preimage from the opaque `&'static` domain tag with `Vec` ops aeneas +// can't translate; it's domain-separation plumbing, so make it opaque for Lean only. +#[cfg_attr(hax_backend_lean, hax_lib::opaque)] fn tagged_preimage(msg: &[u8]) -> Vec { let tag = D::tag(); #[cfg(not(hax))]