Move crypto.hpp to llarp/

pull/137/head
Michael 6 years ago
parent c064893947
commit 451bbedfaf
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -1,83 +0,0 @@
#ifndef LLARP_CRYPTO_HPP
#define LLARP_CRYPTO_HPP
#include <llarp/crypto.h>
#include <llarp/mem.h>
#include <llarp/threadpool.h>
#include <llarp/aligned.hpp>
#include <llarp/router_id.hpp>
namespace llarp
{
const byte_t*
seckey_topublic(const byte_t* secret);
const byte_t*
pq_keypair_to_public(const byte_t* keypair);
const byte_t*
pq_keypair_to_secret(const byte_t* keypair);
using SharedSecret = AlignedBuffer< SHAREDKEYSIZE >;
using KeyExchangeNonce = AlignedBuffer< 32 >;
struct PubKey final : public AlignedBuffer< PUBKEYSIZE >
{
PubKey() : AlignedBuffer< PUBKEYSIZE >(){};
PubKey(const byte_t* ptr) : AlignedBuffer< PUBKEYSIZE >(ptr){};
std::string
ToString() const;
bool
FromString(const std::string& str);
friend std::ostream&
operator<<(std::ostream& out, const PubKey& k)
{
return out << k.ToString();
}
operator RouterID() const
{
return RouterID(data());
}
PubKey&
operator=(const byte_t* ptr)
{
memcpy(data(), ptr, size());
return *this;
}
};
struct SecretKey final : public AlignedBuffer< SECKEYSIZE >
{
friend std::ostream&
operator<<(std::ostream& out, const SecretKey&)
{
// make sure we never print out secret keys
return out << "[secretkey]";
}
SecretKey&
operator=(const byte_t* ptr)
{
memcpy(data(), ptr, size());
return *this;
}
};
using ShortHash = AlignedBuffer< SHORTHASHSIZE >;
using Signature = AlignedBuffer< SIGSIZE >;
using TunnelNonce = AlignedBuffer< TUNNONCESIZE >;
using SymmNonce = AlignedBuffer< NONCESIZE >;
using SymmKey = AlignedBuffer< 32 >;
using PQCipherBlock = AlignedBuffer< PQ_CIPHERTEXTSIZE + 1 >;
using PQPubKey = AlignedBuffer< PQ_PUBKEYSIZE >;
using PQKeyPair = AlignedBuffer< PQ_KEYPAIRSIZE >;
} // namespace llarp
#endif

@ -2,7 +2,7 @@
#define LLARP_DHT_H_
#include <llarp/buffer.h>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/router_contact.hpp>
/**

@ -1,7 +1,7 @@
#ifndef LLARP_EXIT_ENDPOINT_HPP
#define LLARP_EXIT_ENDPOINT_HPP
#include <llarp/time.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/path.hpp>
#include <llarp/ip.hpp>

@ -1,7 +1,7 @@
#ifndef LLARP_XI_HPP
#define LLARP_XI_HPP
#include <crypto.hpp>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <llarp/net.hpp>
#include <iostream>
#include <llarp/bits.hpp>

@ -3,7 +3,7 @@
#include <unordered_map>
#include <llarp/threading.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/net.hpp>
#include <llarp/ev.h>
#include <llarp/link/session.hpp>

@ -1,7 +1,7 @@
#ifndef LLARP_LINK_SESSION_HPP
#define LLARP_LINK_SESSION_HPP
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/net.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/types.hpp>

@ -3,7 +3,7 @@
#include <llarp/routing/message.hpp>
#include <llarp/exit/policy.hpp>
#include <vector>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
namespace llarp
{

@ -1,7 +1,7 @@
#ifndef LLARP_MESSAGES_PATH_TRANSFER_HPP
#define LLARP_MESSAGES_PATH_TRANSFER_HPP
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted.hpp>
#include <llarp/routing/message.hpp>
#include <llarp/service/protocol.hpp>

@ -2,7 +2,7 @@
#define LLARP_MESSAGES_RELAY_HPP
#include <llarp/link_message.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted.hpp>
#include <llarp/path_types.hpp>
#include <vector>

@ -1,6 +1,6 @@
#ifndef LLARP_RELAY_COMMIT_HPP
#define LLARP_RELAY_COMMIT_HPP
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted_ack.hpp>
#include <llarp/encrypted_frame.hpp>
#include <llarp/link_message.hpp>

@ -2,7 +2,7 @@
#define LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP
#include <llarp/routing/message.hpp>
#include <llarp/encrypted.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <vector>
namespace llarp

@ -2,7 +2,7 @@
#define LLARP_PATH_HPP
#include <llarp/time.hpp>
#include <llarp/aligned.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/dht.hpp>
#include <llarp/messages/relay.hpp>
#include <llarp/messages/relay_commit.hpp>

@ -4,7 +4,7 @@
#include <llarp/ev.h>
#include <string>
#include <functional>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
namespace llarp
{

@ -1,7 +1,7 @@
#ifndef LLARP_SERVICE_IDENTITY_HPP
#define LLARP_SERVICE_IDENTITY_HPP
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/service/Info.hpp>
#include <llarp/service/IntroSet.hpp>
#include <llarp/service/types.hpp>

@ -1,7 +1,7 @@
#ifndef LLARP_SERVICE_INFO_HPP
#define LLARP_SERVICE_INFO_HPP
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/service/types.hpp>
namespace llarp

@ -1,7 +1,7 @@
#ifndef LLARP_SERVICE_INTRO_HPP
#define LLARP_SERVICE_INTRO_HPP
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/path_types.hpp>
#include <iostream>

@ -3,7 +3,7 @@
#include <llarp/time.hpp>
#include <iostream>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/pow.hpp>
#include <llarp/service/Info.hpp>
#include <llarp/service/Intro.hpp>

@ -1,7 +1,7 @@
#ifndef LLARP_SERVICE_HANDLER_HPP
#define LLARP_SERVICE_HANDLER_HPP
#include <llarp/aligned.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/service/IntroSet.hpp>
#include <llarp/path_types.hpp>

@ -2,7 +2,7 @@
#define LLARP_SERVICE_PROTOCOL_HPP
#include <llarp/time.hpp>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted.hpp>
#include <llarp/dht/message.hpp>
#include <llarp/routing/message.hpp>

@ -1,7 +1,7 @@
#include <abyss/client.hpp>
#include <abyss/http.hpp>
#include <llarp/logger.hpp>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <buffer.hpp>
namespace abyss

@ -1,15 +1,15 @@
#ifndef LLARP_AI_HPP
#define LLARP_AI_HPP
#include <crypto.hpp>
#include <llarp/bencode.hpp>
#include <llarp/crypto.h>
#include <llarp/mem.h>
#include <llarp/net.h>
#include <stdbool.h>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <string>
#include <vector>
#include <stdbool.h>
/**
* address_info.hpp

@ -1,4 +1,4 @@
#include <llarp/crypto.hpp>
#include <crypto.hpp>
namespace llarp
{

@ -1 +1,83 @@
#include <llarp/crypto.hpp>
#ifndef LLARP_CRYPTO_HPP
#define LLARP_CRYPTO_HPP
#include <llarp/crypto.h>
#include <llarp/mem.h>
#include <llarp/threadpool.h>
#include <llarp/aligned.hpp>
#include <llarp/router_id.hpp>
namespace llarp
{
const byte_t*
seckey_topublic(const byte_t* secret);
const byte_t*
pq_keypair_to_public(const byte_t* keypair);
const byte_t*
pq_keypair_to_secret(const byte_t* keypair);
using SharedSecret = AlignedBuffer< SHAREDKEYSIZE >;
using KeyExchangeNonce = AlignedBuffer< 32 >;
struct PubKey final : public AlignedBuffer< PUBKEYSIZE >
{
PubKey() : AlignedBuffer< PUBKEYSIZE >(){};
PubKey(const byte_t* ptr) : AlignedBuffer< PUBKEYSIZE >(ptr){};
std::string
ToString() const;
bool
FromString(const std::string& str);
friend std::ostream&
operator<<(std::ostream& out, const PubKey& k)
{
return out << k.ToString();
}
operator RouterID() const
{
return RouterID(data());
}
PubKey&
operator=(const byte_t* ptr)
{
memcpy(data(), ptr, size());
return *this;
}
};
struct SecretKey final : public AlignedBuffer< SECKEYSIZE >
{
friend std::ostream&
operator<<(std::ostream& out, const SecretKey&)
{
// make sure we never print out secret keys
return out << "[secretkey]";
}
SecretKey&
operator=(const byte_t* ptr)
{
memcpy(data(), ptr, size());
return *this;
}
};
using ShortHash = AlignedBuffer< SHORTHASHSIZE >;
using Signature = AlignedBuffer< SIGSIZE >;
using TunnelNonce = AlignedBuffer< TUNNONCESIZE >;
using SymmNonce = AlignedBuffer< NONCESIZE >;
using SymmKey = AlignedBuffer< 32 >;
using PQCipherBlock = AlignedBuffer< PQ_CIPHERTEXTSIZE + 1 >;
using PQPubKey = AlignedBuffer< PQ_PUBKEYSIZE >;
using PQKeyPair = AlignedBuffer< PQ_KEYPAIRSIZE >;
} // namespace llarp
#endif

@ -4,7 +4,7 @@
#include <sodium/crypto_sign.h>
#include <sodium/crypto_scalarmult.h>
#include <sodium/crypto_stream_xchacha20.h>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include "mem.hpp"
extern "C"

@ -1,4 +1,4 @@
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted_frame.hpp>
#include "logger.hpp"
#include "mem.hpp"

@ -3,7 +3,7 @@
#include <llarp/router_contact.hpp>
#include <fstream>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <unordered_map>
#include "buffer.hpp"
#include "encode.hpp"

@ -1,5 +1,5 @@
#include <crypto.hpp>
#include <llarp/bencode.hpp>
#include <llarp/crypto.hpp>
#include <llarp/net.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/time.hpp>

@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <llarp/encrypted_frame.hpp>
#include <llarp/messages/relay_commit.hpp>

@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include <llarp/crypto.hpp>
#include <crypto.hpp>
#include <iostream>
namespace llarp

Loading…
Cancel
Save