beaconcrypt 0.3.12__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.github/workflows/go.yml +2 -2
  2. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.github/workflows/release.yml +40 -23
  3. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.github/workflows/rust.yml +2 -0
  4. beaconcrypt-0.4.2/.gitmodules +3 -0
  5. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/Cargo.lock +16 -14
  6. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/Cargo.toml +18 -2
  7. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/PKG-INFO +1 -1
  8. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/README.md +36 -5
  9. beaconcrypt-0.4.2/beaconcrypt.go +425 -0
  10. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/beaconcrypt.pyi +18 -5
  11. beaconcrypt-0.4.2/beaconcrypt_test.go +1370 -0
  12. beaconcrypt-0.4.2/bindings.h +149 -0
  13. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/build.rs +0 -1
  14. beaconcrypt-0.4.2/doc/multi-opening-fixture.md +218 -0
  15. beaconcrypt-0.4.2/doc/persistence.md +87 -0
  16. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/doc/protocol.md +52 -22
  17. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/doc/threat_model.md +7 -1
  18. beaconcrypt-0.4.2/doc/wycheproof.md +55 -0
  19. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/c/main.c +43 -25
  20. beaconcrypt-0.4.2/examples/go/README.md +11 -0
  21. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/go/go.mod +2 -2
  22. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/go/main.go +18 -9
  23. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/python/.gitignore +1 -0
  24. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/python/main.py +20 -9
  25. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/rust/main.rs +36 -23
  26. beaconcrypt-0.4.2/go.mod +7 -0
  27. beaconcrypt-0.4.2/go.sum +4 -0
  28. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/pyproject.toml +2 -4
  29. beaconcrypt-0.4.2/scripts/derive_multi_opening.py +270 -0
  30. beaconcrypt-0.4.2/scripts/generate_kat_vectors.go +321 -0
  31. beaconcrypt-0.4.2/scripts/generate_kat_vectors.py +242 -0
  32. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/scripts/generate_python_stubs.py +0 -1
  33. beaconcrypt-0.4.2/src/beacon.rs +6 -0
  34. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/cbinds.rs +129 -69
  35. beaconcrypt-0.4.2/src/deser.rs +746 -0
  36. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/lib.rs +4 -5
  37. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/pqxdh.rs +247 -144
  38. beaconcrypt-0.4.2/src/pybinds.rs +198 -0
  39. beaconcrypt-0.4.2/src/schema/cryptoframe.capnp +12 -0
  40. beaconcrypt-0.4.2/src/ser.rs +309 -0
  41. beaconcrypt-0.4.2/src/server.rs +80 -0
  42. beaconcrypt-0.4.2/src/shared.rs +1627 -0
  43. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/tests/beacon.rs +4 -3
  44. beaconcrypt-0.4.2/tests/protocol.rs +1463 -0
  45. beaconcrypt-0.4.2/tests/server.rs +240 -0
  46. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/tests/test_encryption.py +69 -50
  47. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/tests/test_registration.py +1 -0
  48. beaconcrypt-0.4.2/tests/test_server_state.py +207 -0
  49. beaconcrypt-0.4.2/tests/wycheproof.rs +475 -0
  50. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/uv.lock +32 -0
  51. beaconcrypt-0.3.12/beaconcrypt.go +0 -279
  52. beaconcrypt-0.3.12/beaconcrypt_test.go +0 -691
  53. beaconcrypt-0.3.12/bindings.h +0 -463
  54. beaconcrypt-0.3.12/examples/go/README.md +0 -6
  55. beaconcrypt-0.3.12/examples/python/uv.lock +0 -176
  56. beaconcrypt-0.3.12/go.mod +0 -3
  57. beaconcrypt-0.3.12/src/beacon.rs +0 -309
  58. beaconcrypt-0.3.12/src/pybinds.rs +0 -130
  59. beaconcrypt-0.3.12/src/schema/cryptoframe.capnp +0 -11
  60. beaconcrypt-0.3.12/src/schema/protogram.capnp +0 -10
  61. beaconcrypt-0.3.12/src/server.rs +0 -286
  62. beaconcrypt-0.3.12/src/shared.rs +0 -1038
  63. beaconcrypt-0.3.12/tests/protocol.rs +0 -362
  64. beaconcrypt-0.3.12/tests/server.rs +0 -44
  65. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.cargo/config.toml +0 -0
  66. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.github/workflows/codeql.yml +0 -0
  67. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.github/workflows/python.yml +0 -0
  68. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/.gitignore +0 -0
  69. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/LICENSE +0 -0
  70. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/clippy.toml +0 -0
  71. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/doc/rationale.md +0 -0
  72. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/c/CMakeLists.txt +0 -0
  73. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/c/README.md +0 -0
  74. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/go/.gitignore +0 -0
  75. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/go/go.sum +0 -0
  76. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/python/README.md +0 -0
  77. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/python/pyproject.toml +0 -0
  78. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/examples/rust/README.md +0 -0
  79. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/rustfmt.toml +0 -0
  80. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/error.rs +0 -0
  81. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/schema/phase1.capnp +0 -0
  82. {beaconcrypt-0.3.12 → beaconcrypt-0.4.2}/src/schema/phase2.capnp +0 -0
@@ -77,14 +77,14 @@ jobs:
77
77
  if: runner.os != 'Windows'
78
78
  env:
79
79
  CGO_ENABLED: 1
80
- run: go test ./...
80
+ run: go test -race ./...
81
81
 
82
82
  - name: Test Go module on Windows
83
83
  if: runner.os == 'Windows'
84
84
  env:
85
85
  CGO_ENABLED: 1
86
86
  CC: gcc
87
- run: go test ./...
87
+ run: go test -race ./...
88
88
 
89
89
  publish:
90
90
  if: startsWith(github.ref, 'refs/tags/')
@@ -1,46 +1,57 @@
1
1
  name: Release
2
2
 
3
3
  on:
4
- push:
5
- tags:
6
- - "v[0-9]*.[0-9]*.[0-9]*"
4
+ push:
7
5
 
8
6
  env:
9
7
  CARGO_TERM_COLOR: always
8
+ CAPNP_VERSION: 1.5.0
10
9
 
11
10
  jobs:
12
- ubuntu-build:
11
+ unix-build:
13
12
  strategy:
14
13
  matrix:
15
- os: [ubuntu-latest, ubuntu-24.04-arm]
14
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel]
16
15
  runs-on: ${{ matrix.os }}
17
16
  permissions:
18
17
  contents: read
19
18
 
20
19
  steps:
21
20
  - uses: actions/checkout@v7
22
- - name: Install cap'n proto
21
+ with:
22
+ submodules: recursive
23
+ - name: Restore cached cap'n proto
24
+ id: cache-capnproto
25
+ uses: actions/cache@v6
26
+ with:
27
+ path: ~/.local/capnproto
28
+ key: capnproto-build-v1-${{ runner.os }}-${{ runner.arch }}-${{ env.CAPNP_VERSION }}
29
+ - name: Build cap'n proto
30
+ if: steps.cache-capnproto.outputs.cache-hit != 'true'
23
31
  run: |
24
- curl -O https://capnproto.org/capnproto-c++-1.5.0.tar.gz
25
- tar zxf capnproto-c++-1.5.0.tar.gz
26
- cd capnproto-c++-1.5.0
27
- ./configure
32
+ curl --fail --location --output "capnproto-c++-${CAPNP_VERSION}.tar.gz" "https://capnproto.org/capnproto-c++-${CAPNP_VERSION}.tar.gz"
33
+ tar zxf "capnproto-c++-${CAPNP_VERSION}.tar.gz"
34
+ cd "capnproto-c++-${CAPNP_VERSION}"
35
+ ./configure --prefix="$HOME/.local/capnproto"
28
36
  make -j4 check
29
- sudo make install
37
+ make install
38
+ - name: Add cap'n proto to PATH
39
+ run: echo "$HOME/.local/capnproto/bin" >> "$GITHUB_PATH"
30
40
  - name: Build
31
41
  run: |
32
42
  rustup component add rust-src --toolchain nightly
33
- cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon,server,pqxdh --crate-type=staticlib
43
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features gobinds --crate-type=staticlib
44
+ mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-gobinds-${{ matrix.os }}.a
45
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon --crate-type=staticlib
46
+ mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-beacon-${{ matrix.os }}.a
34
47
  - name: Run tests
35
48
  run: cargo test --verbose
36
- - name: Rename
37
- run: mv target/release/libbeaconcrypt.a target/release/libbeaconcrypt-${{ matrix.os }}.a
38
49
  - name: Upload release artifact
39
50
  uses: actions/upload-artifact@v7
40
51
  with:
41
52
  name: beaconcrypt-static-${{ matrix.os }}
42
- path: target/release/libbeaconcrypt-${{ matrix.os }}.a
43
- retention-days: 7
53
+ path: target/release/libbeaconcrypt-*.a
54
+ retention-days: 1
44
55
 
45
56
  windows-build:
46
57
  strategy:
@@ -52,6 +63,8 @@ jobs:
52
63
 
53
64
  steps:
54
65
  - uses: actions/checkout@v7
66
+ with:
67
+ submodules: recursive
55
68
  - name: Install cap'n proto
56
69
  run: |
57
70
  curl.exe -O https://capnproto.org/capnproto-c++-win32-1.5.0.zip
@@ -60,20 +73,21 @@ jobs:
60
73
  run: |
61
74
  $env:Path = "$env:Path;$(join-path $pwd '\capnproto-c++-win32-1.5.0\capnproto-tools-win32-1.5.0')"
62
75
  rustup component add rust-src --toolchain nightly-msvc
63
- cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon,server,pqxdh --crate-type=staticlib
76
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features gobinds --crate-type=staticlib
77
+ mv target/release/beaconcrypt.lib target/release/beaconcrypt-gobinds-${{ matrix.os }}.lib
78
+ cargo +nightly rustc --release -Z build-std=std,panic_abort --no-default-features --features beacon --crate-type=staticlib
79
+ mv target/release/beaconcrypt.lib target/release/beaconcrypt-beacon-${{ matrix.os }}.lib
64
80
  ls target/release
65
81
  - name: Run tests
66
82
  run: |
67
83
  $env:Path = "$env:Path;$(join-path $pwd '\capnproto-c++-win32-1.5.0\capnproto-tools-win32-1.5.0')"
68
84
  cargo test --verbose
69
- - name: Rename
70
- run: mv target/release/beaconcrypt.lib target/release/beaconcrypt-${{ matrix.os }}.lib
71
85
  - name: Upload release artifact
72
86
  uses: actions/upload-artifact@v7
73
87
  with:
74
88
  name: beaconcrypt-static-${{ matrix.os }}
75
- path: target/release/beaconcrypt-${{ matrix.os }}.lib
76
- retention-days: 7
89
+ path: target/release/beaconcrypt-*.lib
90
+ retention-days: 1
77
91
 
78
92
  windows-mingw-build:
79
93
  runs-on: windows-latest
@@ -82,6 +96,8 @@ jobs:
82
96
 
83
97
  steps:
84
98
  - uses: actions/checkout@v7
99
+ with:
100
+ submodules: recursive
85
101
  - name: Set up MinGW
86
102
  uses: msys2/setup-msys2@v2
87
103
  with:
@@ -112,10 +128,11 @@ jobs:
112
128
  with:
113
129
  name: beaconcrypt-static-windows-mingw-x86_64
114
130
  path: target/x86_64-pc-windows-gnu/release/libbeaconcrypt-*.a
115
- retention-days: 7
131
+ retention-days: 1
116
132
 
117
133
  release:
118
- needs: [ubuntu-build, windows-build, windows-mingw-build]
134
+ needs: [unix-build, windows-build, windows-mingw-build]
135
+ if: ${{ github.ref_type == 'tag' }}
119
136
  runs-on: ubuntu-latest
120
137
  permissions:
121
138
  contents: write
@@ -18,6 +18,8 @@ jobs:
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v7
21
+ with:
22
+ submodules: recursive
21
23
  - name: Install cap'n proto
22
24
  run: sudo apt update && sudo apt install capnproto
23
25
  - name: Build
@@ -0,0 +1,3 @@
1
+ [submodule "wycheproof"]
2
+ path = wycheproof
3
+ url = https://github.com/C2SP/wycheproof.git
@@ -78,13 +78,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
78
78
 
79
79
  [[package]]
80
80
  name = "beaconcrypt"
81
- version = "0.3.12"
81
+ version = "0.4.2"
82
82
  dependencies = [
83
83
  "capnp",
84
84
  "capnpc",
85
85
  "cbindgen",
86
86
  "libsodium-rs",
87
87
  "pyo3",
88
+ "serde",
89
+ "serde_json",
88
90
  "zeroize",
89
91
  ]
90
92
 
@@ -145,9 +147,9 @@ dependencies = [
145
147
 
146
148
  [[package]]
147
149
  name = "cc"
148
- version = "1.3.0"
150
+ version = "1.4.0"
149
151
  source = "registry+https://github.com/rust-lang/crates.io-index"
150
- checksum = "c89588d05638b5b4594a3348a2d6c20277e43a7f5c5202b05cc56888475a47b8"
152
+ checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"
151
153
  dependencies = [
152
154
  "find-msvc-tools",
153
155
  "shlex",
@@ -161,9 +163,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
161
163
 
162
164
  [[package]]
163
165
  name = "clap"
164
- version = "4.6.3"
166
+ version = "4.6.4"
165
167
  source = "registry+https://github.com/rust-lang/crates.io-index"
166
- checksum = "0fb99565819980999fb7b4a1796046a5c949e6d4ff132cf5fadf5a641e20d776"
168
+ checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7"
167
169
  dependencies = [
168
170
  "clap_builder",
169
171
  ]
@@ -379,15 +381,15 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
379
381
 
380
382
  [[package]]
381
383
  name = "libc"
382
- version = "0.2.188"
384
+ version = "0.2.189"
383
385
  source = "registry+https://github.com/rust-lang/crates.io-index"
384
- checksum = "22053b6a34f84abc97f9129e61334f40174659a1b9bd18c970b83db6a9a6348b"
386
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
385
387
 
386
388
  [[package]]
387
389
  name = "libflate"
388
- version = "2.3.0"
390
+ version = "2.3.1"
389
391
  source = "registry+https://github.com/rust-lang/crates.io-index"
390
- checksum = "cd96e993e5f3368b0cb8497dae6c860c22af8ff18388c61c6c0b86c58d86b5df"
392
+ checksum = "a4da9b700e758e57152a1fd1c52cbdc5727c1aa6d8743dc1acda917398f1d76c"
391
393
  dependencies = [
392
394
  "adler32",
393
395
  "crc32fast",
@@ -645,7 +647,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
645
647
  dependencies = [
646
648
  "proc-macro2",
647
649
  "quote",
648
- "syn 3.0.2",
650
+ "syn 3.0.3",
649
651
  ]
650
652
 
651
653
  [[package]]
@@ -701,9 +703,9 @@ dependencies = [
701
703
 
702
704
  [[package]]
703
705
  name = "syn"
704
- version = "3.0.2"
706
+ version = "3.0.3"
705
707
  source = "registry+https://github.com/rust-lang/crates.io-index"
706
- checksum = "a207d6d6a2b7fc470b80443726053f18a2481b7e1eee970597051596567987a3"
708
+ checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
707
709
  dependencies = [
708
710
  "proc-macro2",
709
711
  "quote",
@@ -786,9 +788,9 @@ dependencies = [
786
788
 
787
789
  [[package]]
788
790
  name = "toml_parser"
789
- version = "1.1.2+spec-1.1.0"
791
+ version = "1.1.3+spec-1.1.0"
790
792
  source = "registry+https://github.com/rust-lang/crates.io-index"
791
- checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
793
+ checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
792
794
  dependencies = [
793
795
  "winnow 1.0.4",
794
796
  ]
@@ -1,12 +1,21 @@
1
1
  [package]
2
2
  name = "beaconcrypt"
3
- version = "0.3.12"
3
+ version = "0.4.2"
4
4
  edition = "2024"
5
5
  license-file = "LICENSE"
6
6
  readme = "README.md"
7
7
  description = "Cryptographic transport for C2 channels"
8
8
  rust-version = "1.96"
9
9
  repository = "https://github.com/0xd6cb6d73/beaconcrypt"
10
+ exclude = [
11
+ "wycheproof/**",
12
+ "!wycheproof/testvectors_v1/chacha20_poly1305_test.json",
13
+ "!wycheproof/testvectors_v1/ed25519_test.json",
14
+ "!wycheproof/testvectors_v1/hkdf_sha512_test.json",
15
+ "!wycheproof/testvectors_v1/mlkem_768_encaps_test.json",
16
+ "!wycheproof/testvectors_v1/mlkem_768_test.json",
17
+ "!wycheproof/testvectors_v1/x25519_test.json",
18
+ ]
10
19
 
11
20
  [lib]
12
21
  name = "beaconcrypt"
@@ -32,6 +41,11 @@ name = "server"
32
41
  path = "tests/server.rs"
33
42
  required-features = ["pqxdh", "beacon", "server"]
34
43
 
44
+ [[test]]
45
+ name = "wycheproof"
46
+ path = "tests/wycheproof.rs"
47
+ required-features = ["pqxdh"]
48
+
35
49
  [build-dependencies]
36
50
  capnpc = "0.26"
37
51
  cbindgen = "0.29"
@@ -41,10 +55,12 @@ capnp = "0.26"
41
55
  libsodium-rs = "0.2"
42
56
  zeroize = "1.9"
43
57
  pyo3 = { version = "0.29.0", features = ["abi3-py311", "experimental-inspect"], optional = true }
58
+ serde = { version = "1", features = ["derive"], optional = true }
59
+ serde_json = { version = "1", optional = true }
44
60
 
45
61
  [features]
46
62
  default = ["beacon", "server", "pqxdh"]
47
- server = ["pqxdh"]
63
+ server = ["pqxdh", "dep:serde", "dep:serde_json"]
48
64
  beacon = ["pqxdh"]
49
65
  pqxdh = []
50
66
  gobinds = ["cbinds"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beaconcrypt
3
- Version: 0.3.12
3
+ Version: 0.4.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -48,7 +48,7 @@ I don't use rust a lot, so the code is probably fairly naive. It provides both a
48
48
 
49
49
  The reference implementation expects that all beacons are compiled with the server's public key, and that beaconcrypt is initialized with it.
50
50
 
51
- The server is currently not very usable as it doesn't support saving the state of any individual beacon. This means that if your server goes down, you will not be able to communicate with any previously-registered beacons anymore. The server doesn't support being initialized with an Ed25519 seed (32 random bytes). Users wishing to use the server in practical cases should use this interface to ensure their server keeps its identity across reboots.
51
+ The server is currently not very usable as it doesn't support saving the state of any individual beacon. This means that if your server goes down, you will not be able to communicate with any previously-registered beacons anymore. The server does support being initialized with an Ed25519 seed (32 random bytes). Users wishing to use the server in practical cases should use this interface to ensure their server keeps its identity across reboots.
52
52
 
53
53
  ## Building
54
54
  You will need [Capn'Proto](https://capnproto.org/install.html) (just the binaries) and a recent version of rust for every build.
@@ -66,18 +66,49 @@ uv run pytest tests
66
66
 
67
67
  The `-a` flag is required after rebuilding the Rust static library because Go's build cache does not detect changes to libraries linked through cgo. `-count=1` also prevents reuse of a cached successful test result.
68
68
 
69
+ ### Reproducing known-answer test vectors
70
+
71
+ The fixed cryptographic values used by the Rust known-answer tests can be
72
+ reproduced independently with Python and Go. Run both generators from the
73
+ repository root:
74
+
75
+ ```bash
76
+ uv run python scripts/generate_kat_vectors.py
77
+ go run scripts/generate_kat_vectors.go
78
+ ```
79
+
80
+ The Python generator uses PyCryptodome. The Go generator uses the Go team's
81
+ crypto packages from `golang.org/x/crypto`. Their output should be identical;
82
+ any difference indicates that the vectors or one of the generators has
83
+ diverged.
84
+
85
+ ### Wycheproof
86
+
87
+ The test suite includes pinned [C2SP Wycheproof](https://github.com/C2SP/wycheproof)
88
+ vectors for X25519, Ed25519, ChaCha20-Poly1305-IETF, HKDF-SHA-512 and
89
+ ML-KEM-768. After cloning, initialize the vector submodule before running the
90
+ normal test suite:
91
+
92
+ ```bash
93
+ git submodule update --init --recursive
94
+ cargo test
95
+ ```
96
+
97
+ See [the Wycheproof test documentation](doc/wycheproof.md) for the coverage
98
+ matrix, result semantics and update procedure.
99
+
69
100
  ## Usage
70
- The reference implementation is a library that can currently be used either from rust, through C FFI, go and python bindings. The C interface is currently not tested.
101
+ The reference implementation is a library that can currently be used either from rust, through C FFI, go and python bindings. The C interface is currently only tested through the go bindings. Note that 0-length messages are explicitly disallowed by the reference implementation, as my feeling is that such messages have no purpose except testing parser edge cases. The library also doesn't handle chnking of any kind and will try to process entire messages at once in memory. It is expected that the caller should handle chunking itself if that is required.
71
102
 
72
103
  From Rust, usage is mostly just instantiating `CryptoProvider` objects. See the [example](examples/rust/main.rs) for usage.
73
104
 
74
105
  From python, you can just use the wheels published to pypi, see the [example](examples/python/main.py) for usage.
75
106
 
76
- There are two C interfaces at the moment. When using the legacy interface (without the `beaconcrypt` prefix) the library creates a global `CryptoProvider` object, whose methods are wrapped by the various functions in the interface. When using this interace, the caller is responsible for the buffers passed into the library. Assume the library does not do any copies, except for initialization functions, and never frees the buffers it is passed.
77
-
78
- Using the [newer](src/cbinds.rs) C interface which emulate the class interface, the caller is responsible for providing a valid state object to every function. See the [example](examples/c/main.c) for usage.
107
+ The [C interface](src/cbinds.rs) emulates the class interface, the caller is responsible for providing a valid state object to every function. See the [example](examples/c/main.c) for usage.
79
108
 
80
109
  Go is unfortunately the worst off as the bindings use cgo and therefore building your binary requires being able to link to a version of the library built with the `gobinds` feature. See the [example](examples/go/main.go) for usage.
81
110
 
82
111
  # Copyright
83
112
  This work is dedicated to the public domain.
113
+
114
+ The C and go bindings, as well as most tests and the GH action code were generated by an LLM. This includes the KAT generation scripts, the ChaCha20-Poly1305 invisible salamanders implementation and its associated documentation.