Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a1d3c0d
crypto fixtures: key pairs are made by from_secret, public keys by fr…
Nov 23, 2026
491a565
crypto fixtures: the missing memory resource's case is named by from_key
Nov 23, 2026
f2f0fae
crypto fixtures: the boxes and crypto_kx in their namespaces by purpose
Nov 23, 2026
da5be7f
crypto fixtures and guidelines: tags are compared with constant_time_…
Nov 23, 2026
a675a38
hash: the MAC pages and examples call constant_time_equal
Nov 23, 2026
13b749e
crypto guidelines: erase_secret is a root name and its header needs n…
Nov 23, 2026
efc2625
crypto fixtures: signatures are typed values
Nov 23, 2026
3371f5c
crypto: libs/crypto at task 1.2's fix round 1
Nov 23, 2026
179c727
crypto: libs/crypto at task 1.3 and its fix round 1 (the pointer)
Nov 23, 2026
a7fb036
crypto fixtures: Ed25519ph's streaming signer is prehashed_signer
Nov 23, 2026
22478a2
crypto: libs/crypto at task 1.4's fix round 1 (the pointer)
Nov 23, 2026
29a3439
crypto fixtures: X25519 agrees with typed keys
Nov 23, 2026
f5790a6
crypto: libs/crypto with the X25519 fix round
Nov 23, 2026
7d38ca5
crypto fixtures and guidelines: crypto's public names are spelled out
Nov 23, 2026
502d9e4
crypto guidelines: the AEAD rules say nonce and associated data
Nov 23, 2026
5ec30fa
crypto: libs/crypto with X4's fix round 1
Nov 23, 2026
a871ec5
crypto fixtures: crypto_kx and the boxes on typed X25519 keys
Nov 23, 2026
ca9c292
crypto: libs/crypto with the X25519 refusals of crypto_kx and the boxes
Nov 23, 2026
1c20ad1
crypto: libs/crypto with Ed25519's typed conversion to X25519
Nov 23, 2026
b822545
crypto: libs/crypto with 2.3's fix round 1
Nov 23, 2026
9f0142b
crypto: libs/crypto with the three key pair concepts and 3.1's fix ro…
Nov 23, 2026
cdf4551
crypto fixtures: secret boxes are secret_key_encryption's and seal wi…
Nov 23, 2026
a47d977
crypto: libs/crypto with 3.2's fix round 1
Nov 23, 2026
376fe4a
crypto: libs/crypto with Task 3.3 and its fix round 1
Nov 23, 2026
4840e57
crypto: point libs/crypto at the throwing-getRandomValues fix (Task X1)
Nov 23, 2026
c5da5cf
crypto: libs/crypto with Task X1's lint fix
Nov 23, 2026
01bbc86
crypto: libs/crypto with Task X1's fix round 1
Nov 24, 2026
f6c2394
crypto: point libs/crypto at libsodium drawing through crypto's entro…
Nov 24, 2026
1916bc2
crypto: libs/crypto with Task X1b's lint fix
Nov 24, 2026
9c7bfc4
crypto: libs/crypto with Task X1b's fix round 1
Nov 24, 2026
dbc7aa2
crypto: libs/crypto with Task X1b's fix round 1 lint fix
Nov 24, 2026
8e38358
crypto fixtures and guidelines: basic_chacha20_poly1305 and secp256k1…
Nov 24, 2026
7039928
crypto: libs/crypto with Task X5's lint fix
Nov 24, 2026
f558dd8
crypto: libs/crypto with Task X5's fix round 1
Nov 24, 2026
5ea3fd3
crypto: libs/crypto with Task X5's fix round 2
Nov 24, 2026
e4f6857
guidelines: crypto's chapter names its factories by their input and d…
Nov 24, 2026
addb2e4
guidelines: crypto's values are typed, checked by concepts and made b…
Nov 24, 2026
732ff2b
crypto: libs/crypto with Task 4.1's fix round 1
Nov 24, 2026
586b869
crypto: libs/hash with origin/main merged into its uniform-types branch
Nov 24, 2026
7149072
crypto: the Emscripten fixture of a heavy operation without threads n…
Nov 24, 2026
a16fe3f
guidelines: crypto's present-tense rules name public_key_combine, gen…
Nov 24, 2026
0ab0ace
crypto: libs/crypto with Task 4.2's fix round 1
Nov 24, 2026
0db2708
crypto: libs/crypto with Task 4.2's fix round 2
Nov 24, 2026
e468797
Merge remote-tracking branch 'origin/main' into crypto/uniform-types
Nov 24, 2026
4ba0cc5
libs/crypto, libs/hash: the gitlinks at the merges of crypto's unifor…
Nov 24, 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 AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ for web developers and for AI developers (`CODING-GUIDELINES.md` chapter 16).
| beast | HTTP and WebSocket applications using native/WASIp3 sockets, browser WebSocket/fetch, WASI host HTTP or supplied streams | native, emscripten, wasip2, wasip3, by backend | a submodule at `libs/beast`; all 53 upstream applications remain in its compatibility matrix |
| cobalt | Boost.Cobalt coroutine applications with shipped Wasm adaptations and optional corrected SSL | native, emscripten, wasip2, wasip3, by capability | a submodule at `libs/cobalt`; see its feature and application matrices for variants |
| config | webcpp's configuration, which every library includes first: the target, exceptions and webcpp's version, as Boost.Config is Boost's; webcpp's own | native, wasip2, wasip3, emscripten | a submodule at `libs/config` |
| crypto | AES-GCM, the AES block cipher, random_device, a constant-time equal and secp256k1 over C libraries built from source (BearSSL, OpenSSL, libsecp256k1, ctaes), webcpp's own | native, wasip2, wasip3, emscripten (OpenSSL not on emscripten); its own lane c-suites | a submodule at libs/crypto |
| crypto | AES-GCM, the AES block cipher, random_device, constant_time_equal and secp256k1 over C libraries built from source (BearSSL, OpenSSL, libsecp256k1, ctaes), webcpp's own | native, wasip2, wasip3, emscripten (OpenSSL not on emscripten); its own lane c-suites | a submodule at libs/crypto |
| xactor | a deterministic actor system, webcpp's own | native, wasip2, wasip3 (`xactor_asio` native only) | a submodule at `libs/xactor`; the model for every port |
| xstate | a port of XState 5.33.2's state machines and actors; depends on xactor and Boost.JSON | native, wasip2, wasip3; its oracle lane | a submodule at `libs/xstate`; the first user of the shared oracle (`CODING-GUIDELINES.md` chapter 12) |
| pratt | a Pratt parser engine, generic through concepts, with a calculator built on it, webcpp's own | native, emscripten, wasip2, wasip3 | a submodule at `libs/pratt`; born with the allocation rule (`CODING-GUIDELINES.md` chapter 4) |
Expand Down
227 changes: 140 additions & 87 deletions CODING-GUIDELINES.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/crypto
Submodule crypto updated 537 files
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
targets: emscripten
build: fails
# tag::messages[]
contains: webcpp::crypto: ciphers::aead takes an AEAD family: families::chacha20_poly1305, families::chacha20_poly1305_original, families::xchacha20_poly1305, families::secretbox_xsalsa20poly1305 or families::secretbox_xchacha20poly1305.
contains: webcpp::crypto: ciphers::basic_chacha20_poly1305 takes an AEAD family: families::chacha20_poly1305, families::chacha20_poly1305_original or families::xchacha20_poly1305.
# end::messages[]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

// A program for Emscripten that gives ciphers::aead a family that is no AEAD's, AES-GCM's.
// A program for Emscripten that gives ciphers::basic_chacha20_poly1305 a family that is no AEAD's,
// AES-GCM's.
#include <webcpp/crypto/backends/sodium.hpp>
#include <webcpp/crypto/ciphers/aead.hpp>

Expand All @@ -13,7 +14,8 @@

int main() {
namespace crypto = webcpp::crypto;
using aead = crypto::ciphers::aead<crypto::families::gcm, crypto::backends::sodium>;
using cipher =
crypto::ciphers::basic_chacha20_poly1305<crypto::families::gcm, crypto::backends::sodium>;
std::array<std::uint8_t, 32> const key{};
return aead::make(key) ? 0 : 1;
return cipher::from_key(key) ? 0 : 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main() {
0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89,
};
std::array<std::uint8_t, 16> block = plain;
auto aes = webcpp::crypto::ciphers::aes256<>::make(key);
auto aes = webcpp::crypto::ciphers::aes256<>::from_key(key);
bool const ok =
aes && aes->encrypt(block) && block == expected && aes->decrypt(block) && block == plain;
auto const name = webcpp::crypto::ciphers::aes256<>::backend_type::name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

int main() {
std::array<std::uint8_t, 32> const key{};
return webcpp::crypto::ciphers::aes256<>::make(key) ? 0 : 1;
return webcpp::crypto::ciphers::aes256<>::from_key(key) ? 0 : 1;
}
2 changes: 1 addition & 1 deletion tools/test/fixtures/crypto_jamfiles/block/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main() {
0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89,
};
std::array<std::uint8_t, 16> block = plain;
auto aes = webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::ctaes>::make(key);
auto aes = webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::ctaes>::from_key(key);
bool const ok =
aes && aes->encrypt(block) && block == expected && aes->decrypt(block) && block == plain;
std::printf("ctaes aes256 %s\n", ok ? "ok" : "FAILED");
Expand Down
19 changes: 10 additions & 9 deletions tools/test/fixtures/crypto_jamfiles/both_bearssl_named/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

// Seals one zero block under AES-256-GCM on BearSSL, named in the type where OpenSSL, linked
// too, is the default natively, and checks it against the GCM specification's test case 14 (key,
// IV and plaintext all zero), then opens it again, and prints the backend that ran. The zero key
// and IV are the test vector's: a real program draws its key from random_device and never reuses
// an IV under it.
// nonce and plaintext all zero), then opens it again, and prints the backend that ran. The zero key
// and nonce are the test vector's: a real program draws its key from random_device and never reuses
// a nonce under it.
#include <webcpp/crypto/backends/bearssl.hpp>
#include <webcpp/crypto/ciphers/aes.hpp>
#include <webcpp/crypto/ciphers/gcm.hpp>
#include <webcpp/crypto/equal.hpp>
#include <webcpp/crypto/constant_time_equal.hpp>

#include <array>
#include <cstdint>
Expand All @@ -25,7 +25,7 @@ using aead_type = crypto::ciphers::gcm<crypto::ciphers::aes256<crypto::backends:

int main() {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 12> const iv{};
std::array<std::uint8_t, 12> const nonce{};
std::array<std::uint8_t, 16> data{};
std::array<std::uint8_t, 16> const cipher{
0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e,
Expand All @@ -35,14 +35,15 @@ int main() {
0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0,
0x26, 0x5b, 0x98, 0xb5, 0xd4, 0x8a, 0xb9, 0x19,
};
auto aead = aead_type::make(key);
auto aead = aead_type::from_key(key);
if (!aead) {
return 1;
}
auto const tag = aead->seal(iv, {}, data);
bool const sealed = tag && data == cipher && webcpp::crypto::equal(*tag, expected_tag);
auto const tag = aead->seal(nonce, {}, data);
bool const sealed =
tag && data == cipher && webcpp::crypto::constant_time_equal(*tag, expected_tag);
bool const opened =
aead->open(iv, {}, data, expected_tag) && data == std::array<std::uint8_t, 16>{};
aead->open(nonce, {}, data, expected_tag) && data == std::array<std::uint8_t, 16>{};
auto const name = aead_type::backend_type::name;
std::printf("aes256_gcm %s backend=%.*s\n", sealed && opened ? "ok" : "FAILED",
static_cast<int>(name.size()), name.data());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,38 @@

// As test/messages/box_default_not_linked, on Emscripten.

#include <webcpp/crypto/ciphers/secretbox.hpp>
#include <webcpp/crypto/hybrid/box.hpp>
#include <webcpp/crypto/hybrid/sealed_box.hpp>
#include <webcpp/crypto/curves/x25519.hpp>
#include <webcpp/crypto/public_key_encryption/box.hpp>
#include <webcpp/crypto/public_key_encryption/sealed_box.hpp>
#include <webcpp/crypto/secret_key_encryption/secretbox.hpp>

#include <array>
#include <cstdint>

int main() {
namespace crypto = webcpp::crypto;
namespace {

namespace crypto = webcpp::crypto;

/**
* Calls each, the key pair and the peer's public key parameters: making them would call X25519's
* engine, whose own refusal is not the one under test.
*/
bool called(crypto::curves::x25519::keypair const& own_keypair,
crypto::curves::x25519::public_key const& peer_public_key) {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 48> sealed{};
return crypto::ciphers::secretbox<>::make(key) &&
crypto::ciphers::secretbox_xchacha20poly1305<>::make(key) &&
crypto::hybrid::box::make(key, key) &&
crypto::hybrid::box_xchacha20poly1305::make(key, key) &&
crypto::hybrid::sealed_box::seal(key, {}, sealed)
? 0
: 1;
return crypto::secret_key_encryption::secretbox<>::from_key(key) &&
crypto::secret_key_encryption::secretbox_xchacha20poly1305<>::from_key(key) &&
crypto::public_key_encryption::box::from_keys(own_keypair, peer_public_key) &&
crypto::public_key_encryption::box_xchacha20poly1305::from_keys(own_keypair,
peer_public_key) &&
crypto::public_key_encryption::sealed_box::seal(peer_public_key, {}, sealed);
}

} // namespace

// The function is compiled, which is the test; it is never run.
int main() {
static_cast<void>(&called);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@

// As test/messages/box_not_a_family, on Emscripten.

#include <webcpp/crypto/hybrid/box.hpp>

#include <array>
#include <cstdint>
#include <webcpp/crypto/curves/x25519.hpp>
#include <webcpp/crypto/public_key_encryption/box.hpp>

namespace {

/** A type that names no family, and so has no default backend. */
struct not_a_family {};

/**
* Makes the box from a key pair and a peer's public key, which are parameters: making them would
* call X25519's engine.
*/
bool made(webcpp::crypto::curves::x25519::keypair const& own_keypair,
webcpp::crypto::curves::x25519::public_key const& peer_public_key) {
using box = webcpp::crypto::public_key_encryption::basic_box<not_a_family>;
return box::from_keys(own_keypair, peer_public_key).has_value();
}

} // namespace

// The function is compiled, which is the test; it is never run.
int main() {
std::array<std::uint8_t, 32> const key{};
return webcpp::crypto::hybrid::basic_box<not_a_family>::make(key, key) ? 0 : 1;
static_cast<void>(&made);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
targets: emscripten
build: fails
# tag::messages[]
contains: webcpp::crypto: hybrid::basic_box takes a box family: families::box_xsalsa20poly1305 or families::box_xchacha20poly1305.
contains: webcpp::crypto: public_key_encryption::basic_box takes a box family: families::box_xsalsa20poly1305 or families::box_xchacha20poly1305.
# end::messages[]
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

// Seals NaCl's message from Alice to Bob in the XChaCha20 box on the default backend,
// checks the tag and the ciphertext's first bytes against those libsodium's own test suite
// does not print and an independent implementation computed, opens it with Bob's keys, and
// prints the backend that ran. The keys and nonce are NaCl's test's.
#include <webcpp/crypto/equal.hpp>
#include <webcpp/crypto/hybrid/box.hpp>
// does not print and an independent implementation computed, opens it with Bob's keys, each an
// X25519 key pair and the peer's public key, and prints the backend that ran. The keys and nonce
// are NaCl's test's.
#include <webcpp/crypto/constant_time_equal.hpp>
#include <webcpp/crypto/curves/x25519.hpp>
#include <webcpp/crypto/public_key_encryption/box.hpp>

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -37,7 +39,7 @@ std::array<std::uint8_t, Size> from_hex(std::string_view hex) {
} // namespace

int main() {
using box = webcpp::crypto::hybrid::box_xchacha20poly1305;
using box = webcpp::crypto::public_key_encryption::box_xchacha20poly1305;
auto const alice_secret =
from_hex<32>("77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a");
auto const alice_public =
Expand All @@ -46,7 +48,7 @@ int main() {
from_hex<32>("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb");
auto const bob_public =
from_hex<32>("de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f");
auto const iv = from_hex<24>("69696ee955b62b73cd62bda875fc73d68219e0036b7a0b37");
auto const nonce = from_hex<24>("69696ee955b62b73cd62bda875fc73d68219e0036b7a0b37");
auto const plaintext = from_hex<131>(
"be075fc53c81f2d5cf141316ebeb0c7b5228c52a4c62cbd44b66849b64244ffce5ecbaaf33bd751a1ac7"
"28d45e6c61296cdc3c01233561f41db66cce314adb310e3be8250c46f06dceea3a7fa1348057e2f6556a"
Expand All @@ -55,14 +57,23 @@ int main() {
auto const expected_tag = from_hex<16>("0b4ff00742f3c1aa99a6321e3883b03c");
auto const expected_head = from_hex<8>("ef2c6061b7bcec0c");
auto data = plaintext;
auto alice = box::make(alice_secret, bob_public);
auto bob = box::make(bob_secret, alice_public);
namespace x25519 = webcpp::crypto::curves::x25519;
auto const alice_pair = x25519::keypair::from_secret(alice_secret);
auto const bob_pair = x25519::keypair::from_secret(bob_secret);
auto const alice_key = x25519::public_key::from_bytes(alice_public);
auto const bob_key = x25519::public_key::from_bytes(bob_public);
bool ok = false;
if (!alice_pair || !bob_pair || !alice_key || !bob_key) {
std::printf("box_xchacha20poly1305 FAILED\n");
return 1;
}
auto alice = box::from_keys(*alice_pair, *bob_key);
auto bob = box::from_keys(*bob_pair, *alice_key);
if (alice && bob) {
auto const sealed = alice->seal(iv, data);
ok = sealed && webcpp::crypto::equal(*sealed, expected_tag) &&
auto const sealed = alice->seal(nonce, data);
ok = sealed && webcpp::crypto::constant_time_equal(*sealed, expected_tag) &&
std::equal(expected_head.begin(), expected_head.end(), data.begin()) &&
bob->open(iv, data, *sealed) && data == plaintext;
bob->open(nonce, data, *sealed) && data == plaintext;
}
auto const name = box::backend_type::name;
std::printf("box_xchacha20poly1305 %s backend=%.*s\n", ok ? "ok" : "FAILED",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

// Seals NaCl's box (libsodium's test/default/box.c) from Alice to Bob on the default
// backend, checks the tag and the ciphertext's first bytes against box.exp, opens it with Bob's
// keys (box2.c), and prints the backend that ran. The keys and nonce are the test's: a real
// program draws its secret key from random_device, and a nonce at random for every message.
#include <webcpp/crypto/equal.hpp>
#include <webcpp/crypto/hybrid/box.hpp>
// keys (box2.c), each an X25519 key pair and the peer's public key, and prints the backend that
// ran. The keys and nonce are the test's: a real program draws its key pair with generate(), and
// a nonce at random for every message.
#include <webcpp/crypto/constant_time_equal.hpp>
#include <webcpp/crypto/curves/x25519.hpp>
#include <webcpp/crypto/public_key_encryption/box.hpp>

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -37,7 +39,7 @@ std::array<std::uint8_t, Size> from_hex(std::string_view hex) {
} // namespace

int main() {
using webcpp::crypto::hybrid::box;
using webcpp::crypto::public_key_encryption::box;
auto const alice_secret =
from_hex<32>("77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a");
auto const alice_public =
Expand All @@ -46,7 +48,7 @@ int main() {
from_hex<32>("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb");
auto const bob_public =
from_hex<32>("de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f");
auto const iv = from_hex<24>("69696ee955b62b73cd62bda875fc73d68219e0036b7a0b37");
auto const nonce = from_hex<24>("69696ee955b62b73cd62bda875fc73d68219e0036b7a0b37");
auto const plaintext = from_hex<131>(
"be075fc53c81f2d5cf141316ebeb0c7b5228c52a4c62cbd44b66849b64244ffce5ecbaaf33bd751a1ac7"
"28d45e6c61296cdc3c01233561f41db66cce314adb310e3be8250c46f06dceea3a7fa1348057e2f6556a"
Expand All @@ -55,14 +57,23 @@ int main() {
auto const expected_tag = from_hex<16>("f3ffc7703f9400e52a7dfb4b3d3305d9");
auto const expected_head = from_hex<8>("8e993b9f48681273");
auto data = plaintext;
auto alice = box::make(alice_secret, bob_public);
auto bob = box::make(bob_secret, alice_public);
namespace x25519 = webcpp::crypto::curves::x25519;
auto const alice_pair = x25519::keypair::from_secret(alice_secret);
auto const bob_pair = x25519::keypair::from_secret(bob_secret);
auto const alice_key = x25519::public_key::from_bytes(alice_public);
auto const bob_key = x25519::public_key::from_bytes(bob_public);
bool ok = false;
if (!alice_pair || !bob_pair || !alice_key || !bob_key) {
std::printf("box FAILED\n");
return 1;
}
auto alice = box::from_keys(*alice_pair, *bob_key);
auto bob = box::from_keys(*bob_pair, *alice_key);
if (alice && bob) {
auto const sealed = alice->seal(iv, data);
ok = sealed && webcpp::crypto::equal(*sealed, expected_tag) &&
auto const sealed = alice->seal(nonce, data);
ok = sealed && webcpp::crypto::constant_time_equal(*sealed, expected_tag) &&
std::equal(expected_head.begin(), expected_head.end(), data.begin()) &&
bob->open(iv, data, *sealed) && data == plaintext;
bob->open(nonce, data, *sealed) && data == plaintext;
}
auto const name = box::backend_type::name;
std::printf("box %s backend=%.*s\n", ok ? "ok" : "FAILED", static_cast<int>(name.size()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
int main() {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 16> block{};
auto aes = webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::ctaes>::make(key);
auto aes = webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::ctaes>::from_key(key);
return aes && aes->encrypt(block) ? 0 : 1;
}
6 changes: 3 additions & 3 deletions tools/test/fixtures/crypto_jamfiles/canary_missing/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

int main() {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 12> const iv{};
std::array<std::uint8_t, 12> const nonce{};
std::array<std::uint8_t, 16> data{};
auto aead = webcpp::crypto::ciphers::gcm<
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::make(key);
return aead && aead->seal(iv, {}, data) ? 0 : 1;
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::from_key(key);
return aead && aead->seal(nonce, {}, data) ? 0 : 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

int main() {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 12> const iv{};
std::array<std::uint8_t, 12> const nonce{};
std::array<std::uint8_t, 16> data{};
auto aead = webcpp::crypto::ciphers::gcm<
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::make(key);
return aead && aead->seal(iv, {}, data) ? 0 : 1;
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::from_key(key);
return aead && aead->seal(nonce, {}, data) ? 0 : 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

int main() {
std::array<std::uint8_t, 32> const key{};
std::array<std::uint8_t, 12> const iv{};
std::array<std::uint8_t, 12> const nonce{};
std::array<std::uint8_t, 16> data{};
auto aead = webcpp::crypto::ciphers::gcm<
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::make(key);
return aead && aead->seal(iv, {}, data) ? 0 : 1;
webcpp::crypto::ciphers::aes256<webcpp::crypto::backends::bearssl>>::from_key(key);
return aead && aead->seal(nonce, {}, data) ? 0 : 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ int main() {
secret.fill(0x42);
std::array<std::uint8_t, 32> const message{};
std::array<std::uint8_t, 32> const aux{};
auto key = webcpp::crypto::curves::secp256k1::keypair::make(secret);
auto key = webcpp::crypto::curves::secp256k1::keypair::from_secret(secret);
return key && key->sign(webcpp::crypto::schnorr, message, aux) ? 0 : 1;
}
Loading
Loading