Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
189b9c5
Develop scalar x86-64 Triple DES and verify S-box circuits
reaperhulk Oct 1, 2026
9cfdab1
Develop Triple DES composition proofs and Rust integration
reaperhulk Oct 1, 2026
7c1b860
Prove Triple DES S-box contributions, spill frames and constant time
reaperhulk Oct 1, 2026
9e72e47
Prove complete scalar DES Feistel rounds on x86-64
reaperhulk Oct 1, 2026
e3e8180
Prove DES round advancement and its memory frame
reaperhulk Oct 1, 2026
c52a399
Prove sixteen-round scalar DES loops in both key orders
reaperhulk Oct 1, 2026
c6ac55f
Prove Triple DES block loading, pass setup and register saves
reaperhulk Oct 1, 2026
2a17ed5
Prove complete scalar DES passes with setup and final half swap
reaperhulk Oct 1, 2026
85305cd
Prove three-pass EDE composition and scalar DES output packing
reaperhulk Oct 1, 2026
97a3c35
Prove complete x86-64 Triple DES blocks with buffer and register frames
reaperhulk Oct 1, 2026
95547a8
Verify Triple DES block APIs against shared contracts
reaperhulk Oct 1, 2026
638dc02
Verify complete x86-64 Triple DES ECB wrappers and block calls
reaperhulk Oct 1, 2026
2e81a64
Verify x86-64 Triple DES key expansion and register all five artifacts
reaperhulk Oct 1, 2026
a0f0ff6
Emit audited x86-64 Triple DES assembly and refresh algorithm support
reaperhulk Oct 1, 2026
df9ed8d
Format the separate benchmark crate module list
reaperhulk Oct 1, 2026
1b4b508
Rerun PR checks against the updated main base
reaperhulk Oct 1, 2026
cfc436b
Expose allocation-free in-place Triple DES ECB operations
reaperhulk Oct 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ yours to keep:

<td>✅</td>

<td>❌</td>
<td>✅</td>

<td>❌</td>

Expand Down
2 changes: 2 additions & 0 deletions bench/benches/primitives/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mod sha224;
mod sha256;
mod sha3;
mod sha512;
mod triple_des_ecb;
mod x25519;
mod x448;

Expand Down Expand Up @@ -212,6 +213,7 @@ const BENCHES: &[Bench] = &[
(pbkdf2_sha512::USES, pbkdf2_sha512::bench),
(poly1305::USES, poly1305::bench),
(rc2_cbc::USES, rc2_cbc::bench),
(triple_des_ecb::USES, triple_des_ecb::bench),
(scrypt::USES, scrypt::bench),
(sha1::USES, sha1::bench),
(sha224::USES, sha224::bench),
Expand Down
63 changes: 63 additions & 0 deletions bench/benches/primitives/triple_des_ecb.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//! Triple DES ECB, including key expansion and in-place encryption/decryption.

use criterion::Criterion;

/// The library modules whose code these benchmarks run.
pub const USES: &[&str] = &["triple_des_ecb", "triple_des"];

#[cfg(target_arch = "x86_64")]
pub fn bench(c: &mut Criterion) {
use std::hint::black_box;

use criterion::{BenchmarkId, Throughput};
use openssl::nid::Nid;
use openssl::symm::{Cipher, Crypter, Mode};
use verified_garbage::triple_des_ecb::TripleDesEcb;

use crate::{OPENSSL, SIZES, VG};

let key: Vec<_> = (0..24).map(|i| (17 * i + 3) as u8).collect();
for (key_len, cipher) in [
(16, Cipher::from_nid(Nid::DES_EDE_ECB).unwrap()),
(24, Cipher::des_ede3_ecb()),
] {
for (operation, encrypt, mode) in [
("encrypt", true, Mode::Encrypt),
("decrypt", false, Mode::Decrypt),
] {
let mut group = c.benchmark_group(format!("3des-ecb-{operation}-{key_len}"));
for size in SIZES {
group.throughput(Throughput::Bytes(size as u64));
let data = vec![0x5a; size];
let mut buffer = vec![0; size];
group.bench_function(BenchmarkId::new(VG, size), |b| {
b.iter(|| {
let ctx = TripleDesEcb::new(black_box(&key[..key_len])).unwrap();
buffer.copy_from_slice(black_box(&data));
if encrypt {
ctx.encrypt(black_box(&mut buffer)).unwrap();
} else {
ctx.decrypt(black_box(&mut buffer)).unwrap();
}
black_box(&buffer);
})
});
let mut output = vec![0; size + 8];
group.bench_function(BenchmarkId::new(OPENSSL, size), |b| {
b.iter(|| {
let mut ctx =
Crypter::new(cipher, mode, black_box(&key[..key_len]), None).unwrap();
ctx.pad(false);
let n = ctx.update(black_box(&data), &mut output).unwrap();
let n = n + ctx.finalize(&mut output[n..]).unwrap();
black_box(&output[..n]);
})
});
}
group.finish();
}
}
}

#[cfg(not(target_arch = "x86_64"))]
pub fn bench(_: &mut Criterion) {}
56 changes: 56 additions & 0 deletions lean/VerifiedGarbage/Artifacts/TripleDes/X86_64.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import VerifiedGarbage.Proof.TripleDes.X86_64.VerifiedBlock
import VerifiedGarbage.Proof.TripleDes.X86_64.Key.Verified
import VerifiedGarbage.Proof.TripleDes.X86_64.Ecb.Verified

namespace VG.Artifacts.TripleDes.X86_64

def artifacts : List Artifact := [
{ Spec.TripleDes.expandKeyApi with
target := X86_64.target
doc := Spec.TripleDes.expandKeyApi.doc
(notes := ["Baseline x86-64 scalar key expansion with fixed permutations and public round-count branches."])
code := Impl.TripleDes.X86_64.Key.expandKey
contract := Spec.TripleDes.expandKeyContract X86_64.abi
stack := 0
verified := Proof.TripleDes.X86_64.Key.verified
spSafe := Code.all_of_allInstrs (by lit_decide) },
{ Spec.TripleDes.encryptBlockApi with
target := X86_64.target
doc := Spec.TripleDes.encryptBlockApi.doc
(notes := ["Baseline x86-64 scalar Boolean S-box circuits; IP and FP shared across all three DES passes."])
code := Impl.TripleDes.X86_64.encryptBlock
contract := Spec.TripleDes.encryptBlockContract X86_64.abi
stack := 0
verified := Proof.TripleDes.X86_64.encrypt_verified
spSafe := Code.all_of_allInstrs (by lit_decide) },
{ Spec.TripleDes.decryptBlockApi with
target := X86_64.target
doc := Spec.TripleDes.decryptBlockApi.doc
(notes := ["Baseline x86-64 scalar Boolean S-box circuits with reverse EDE key order."])
code := Impl.TripleDes.X86_64.decryptBlock
contract := Spec.TripleDes.decryptBlockContract X86_64.abi
stack := 0
verified := Proof.TripleDes.X86_64.decrypt_verified
spSafe := Code.all_of_allInstrs (by lit_decide) },
{ Spec.TripleDes.ecbEncryptApi with
target := X86_64.target
doc := Spec.TripleDes.ecbEncryptApi.doc
(notes := ["Baseline x86-64, calling the verified Triple DES block primitive for each complete block."])
code := Impl.TripleDes.X86_64.Ecb.encrypt
contract := Spec.TripleDes.ecbEncryptContract X86_64.abi 8
stack := 8
ofSig := ⟨_, _, _, by unfold Spec.TripleDes.ecbEncryptContract Spec.TripleDes.ecbContract; rfl⟩
verified := Proof.TripleDes.X86_64.Ecb.encrypt_verified
spSafe := Code.all_of_allInstrs (by lit_decide) },
{ Spec.TripleDes.ecbDecryptApi with
target := X86_64.target
doc := Spec.TripleDes.ecbDecryptApi.doc
(notes := ["Baseline x86-64, calling the verified Triple DES block primitive for each complete block."])
code := Impl.TripleDes.X86_64.Ecb.decrypt
contract := Spec.TripleDes.ecbDecryptContract X86_64.abi 8
stack := 8
ofSig := ⟨_, _, _, by unfold Spec.TripleDes.ecbDecryptContract Spec.TripleDes.ecbContract; rfl⟩
verified := Proof.TripleDes.X86_64.Ecb.decrypt_verified
spSafe := Code.all_of_allInstrs (by lit_decide) }]

end VG.Artifacts.TripleDes.X86_64
Loading
Loading