lokinet/test/crypto/mock_crypto.hpp

84 lines
2.7 KiB
C++
Raw Normal View History

2019-01-26 12:33:34 +00:00
#ifndef TEST_LLARP_CRYPTO_MOCK_CRYPTO
#define TEST_LLARP_CRYPTO_MOCK_CRYPTO
#include <crypto/crypto.hpp>
#include <gmock/gmock.h>
namespace llarp
{
namespace test
{
struct MockCrypto final : public Crypto
{
MOCK_METHOD3(xchacha20,
2019-01-28 19:39:17 +00:00
bool(const llarp_buffer_t &, const SharedSecret &,
2019-01-26 12:33:34 +00:00
const TunnelNonce &));
MOCK_METHOD4(xchacha20_alt,
2019-01-28 19:39:17 +00:00
bool(const llarp_buffer_t &, const llarp_buffer_t &,
const SharedSecret &, const byte_t *));
2019-01-26 12:33:34 +00:00
MOCK_METHOD4(dh_client,
bool(SharedSecret &, const PubKey &, const SecretKey &,
const TunnelNonce &));
MOCK_METHOD4(dh_server,
bool(SharedSecret &, const PubKey &, const SecretKey &,
const TunnelNonce &));
MOCK_METHOD4(transport_dh_client,
bool(SharedSecret &, const PubKey &, const SecretKey &,
const TunnelNonce &));
MOCK_METHOD4(transport_dh_server,
bool(SharedSecret &, const PubKey &, const SecretKey &,
const TunnelNonce &));
2019-01-28 19:39:17 +00:00
MOCK_METHOD2(hash, bool(byte_t *, const llarp_buffer_t &));
2019-01-26 12:33:34 +00:00
2019-01-28 19:39:17 +00:00
MOCK_METHOD2(shorthash, bool(ShortHash &, const llarp_buffer_t &));
2019-01-26 12:33:34 +00:00
2019-01-28 19:39:17 +00:00
MOCK_METHOD3(hmac,
bool(byte_t *, const llarp_buffer_t &,
const SharedSecret &));
2019-01-26 12:33:34 +00:00
MOCK_METHOD4(derive_subkey, bool(PubKey &, const PubKey &, uint64_t, const AlignedBuffer<32> *));
2020-01-27 21:30:41 +00:00
MOCK_METHOD4(derive_subkey_private,
bool(PrivateKey &, const SecretKey &, uint64_t, const AlignedBuffer<32> *));
2020-01-27 21:30:41 +00:00
MOCK_METHOD(bool, sign, (Signature &, const SecretKey &, const llarp_buffer_t &));
MOCK_METHOD(bool, sign, (Signature &, const PrivateKey &, const llarp_buffer_t &));
2019-01-26 12:33:34 +00:00
MOCK_METHOD3(verify,
2019-01-28 19:39:17 +00:00
bool(const PubKey &, const llarp_buffer_t &,
const Signature &));
2019-01-26 12:33:34 +00:00
MOCK_METHOD2(seed_to_secretkey,
bool(llarp::SecretKey &, const llarp::IdentitySecret &));
2019-01-28 19:39:17 +00:00
MOCK_METHOD1(randomize, void(const llarp_buffer_t &));
2019-01-26 12:33:34 +00:00
2019-05-28 19:45:09 +00:00
MOCK_METHOD2(randbytes, void(byte_t *, size_t));
2019-01-26 12:33:34 +00:00
MOCK_METHOD1(identity_keygen, void(SecretKey &));
MOCK_METHOD1(encryption_keygen, void(SecretKey &));
MOCK_METHOD1(pqe_keygen, void(PQKeyPair &));
MOCK_METHOD3(pqe_decrypt,
bool(const PQCipherBlock &, SharedSecret &, const byte_t *));
MOCK_METHOD3(pqe_encrypt,
bool(PQCipherBlock &, SharedSecret &, const PQPubKey &));
2019-11-27 01:40:55 +00:00
2020-01-27 21:30:41 +00:00
MOCK_METHOD1(check_identity_privkey, bool(const SecretKey &));
2019-01-26 12:33:34 +00:00
};
} // namespace test
} // namespace llarp
#endif