feat(crypto,archive): implement VL-007 built-in hashes and VL-006 archive creation/gzip/tar fallback
This commit is contained in:
1 parent
b50131f52e
commit
22c8538754
19 files changed
+3326
-133
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Crypto/Crypto.hpp>
|
||||
#include <Void/Crypto/Types.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
namespace Void::Crypto::Detail
|
||||
{
|
||||
void builtin_secure_wipe(std::span<std::byte> buffer) noexcept;
|
||||
|
||||
[[nodiscard]] bool
|
||||
builtin_constant_time_equal(std::span<const std::byte> lhs,
|
||||
std::span<const std::byte> rhs) noexcept;
|
||||
|
||||
class BuiltinHasher
|
||||
{
|
||||
public:
|
||||
|
||||
BuiltinHasher() noexcept = default;
|
||||
~BuiltinHasher() noexcept;
|
||||
|
||||
BuiltinHasher(BuiltinHasher&& other) noexcept;
|
||||
BuiltinHasher& operator=(BuiltinHasher&& other) noexcept;
|
||||
BuiltinHasher(const BuiltinHasher&) = delete;
|
||||
BuiltinHasher& operator=(const BuiltinHasher&) = delete;
|
||||
|
||||
[[nodiscard]] bool init(HashAlgorithm algorithm) noexcept;
|
||||
void update(std::span<const std::byte> data) noexcept;
|
||||
[[nodiscard]] Digest finalize();
|
||||
|
||||
private:
|
||||
|
||||
struct State;
|
||||
State* m_state{nullptr};
|
||||
void destroy() noexcept;
|
||||
};
|
||||
|
||||
void builtin_hmac_sha256(std::span<const std::byte> secret_key,
|
||||
std::span<const std::byte> message,
|
||||
std::span<std::byte> output_32) noexcept;
|
||||
|
||||
void builtin_hkdf_sha256(std::span<const std::byte> secret_input,
|
||||
std::span<const std::byte> salt,
|
||||
std::span<const std::byte> context,
|
||||
std::span<std::byte> secret_output) noexcept;
|
||||
|
||||
} // namespace Void::Crypto::Detail
|
||||
Reference in new issue
Block a user