mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-14 23:07:24 +00:00
- tests/ (114 host cases over production sources), the CI workflow (ASan/UBSan on PRs and master pushes) and REGRESSION_TEST_PLAN.md are tracked - .gitignore grouped and deduplicated (173 -> 96 lines, same ignored set)
19 lines
627 B
C++
19 lines
627 B
C++
#include <mesh/Utils.h>
|
|
#include "hash_capture.h"
|
|
#include <stdexcept>
|
|
|
|
namespace test_support {
|
|
std::vector<uint8_t> hash_input;
|
|
size_t hash_output_size = 0;
|
|
}
|
|
|
|
// Tests inspect Packet's hash preimage, NOT SHA-256 correctness. Deterministic
|
|
// marker output must never be mistaken for a digest or used in firmware builds.
|
|
void mesh::Utils::sha256(uint8_t *hash, size_t size, const uint8_t *msg, int len)
|
|
{
|
|
if (len < 0 || size != MAX_HASH_SIZE) throw std::runtime_error("unexpected hash call");
|
|
test_support::hash_input.assign(msg, msg + len);
|
|
test_support::hash_output_size = size;
|
|
memset(hash, 0xA5, size);
|
|
}
|