Commit b3be3b7d authored by Luker's avatar Luker

ECC & KDF negotiation

parent 6333baec
......@@ -227,7 +227,6 @@ SET(HEADERS src/Fenrir/v1/API/Report.hpp
src/Fenrir/v1/data/Conn0.hpp
src/Fenrir/v1/data/Conn0.ipp
src/Fenrir/v1/data/Device_ID.hpp
src/Fenrir/v1/data/Error_Correction.hpp
src/Fenrir/v1/data/IP.hpp
src/Fenrir/v1/data/packet/Packet.hpp
src/Fenrir/v1/data/packet/Stream.hpp
......@@ -268,6 +267,8 @@ SET(HEADERS src/Fenrir/v1/API/Report.hpp
src/Fenrir/v1/rate/Rate.hpp
src/Fenrir/v1/rate/Rate.ipp
src/Fenrir/v1/rate/RR-RR.hpp
src/Fenrir/v1/recover/Error_Correction.hpp
src/Fenrir/v1/recover/ECC_NULL.hpp
src/Fenrir/v1/resolve/DNSSEC.hpp
src/Fenrir/v1/resolve/DNSSEC.ipp
src/Fenrir/v1/resolve/Resolver.hpp
......
......@@ -25,6 +25,7 @@
#include "Fenrir/v1/crypto/Crypto.hpp"
#include "Fenrir/v1/data/Conn0_Type.hpp"
#include "Fenrir/v1/data/Device_ID.hpp"
#include "Fenrir/v1/recover/Error_Correction.hpp"
#include "Fenrir/v1/data/packet/Packet.hpp"
#include "Fenrir/v1/data/Storage_t.hpp"
#include "Fenrir/v1/service/Service_ID.hpp"
......@@ -117,7 +118,9 @@ public:
struct data *const w;
Span_Overlay<Crypto::Encryption::ID> _supported_crypt;
Span_Overlay<Crypto::Hmac::ID> _supported_hmac;
Span_Overlay<Recover::ECC::ID> _supported_ecc;
Span_Overlay<Crypto::Key::ID> _supported_key;
Span_Overlay<Crypto::KDF::ID> _supported_kdf;
Conn0_C_INIT() = delete;
Conn0_C_INIT (const Conn0_C_INIT&) = default;
......@@ -129,14 +132,16 @@ public:
Conn0_C_INIT (const gsl::span<uint8_t> raw); // received pkt
Conn0_C_INIT (gsl::span<uint8_t> raw, // sent pkt
Random *const rnd, const Crypto::Key::Serial key_id,
const std::vector<Crypto::Encryption::ID>&supported_crypt,
const std::vector<Crypto::Encryption::ID> &supported_crypt,
const std::vector<Crypto::Hmac::ID> &supported_hmac,
const std::vector<Crypto::Key::ID> &supported_key);
const std::vector<Recover::ECC::ID> &supported_ecc,
const std::vector<Crypto::Key::ID> &supported_key,
const std::vector<Crypto::KDF::ID> &supported_kdf);
static constexpr uint16_t min_size();
private:
static constexpr uint16_t supported_offset = sizeof(struct data);
static constexpr uint16_t min_data_len = supported_offset +
3 * sizeof(uint16_t);
5 * sizeof(uint16_t);
};
......@@ -152,7 +157,9 @@ public:
Conn0_Type _type;
Crypto::Encryption::ID _selected_crypt;
Crypto::Hmac::ID _selected_hmac;
Recover::ECC::ID _selected_ecc;
Crypto::Key::ID _selected_key;
Crypto::KDF::ID _selected_kdf;
int64_t _timestamp;
};
struct data const *const r;
......@@ -172,7 +179,9 @@ public:
Conn0_S_COOKIE ( gsl::span<uint8_t> raw, // send pkt
const Crypto::Encryption::ID selected_crypt,
const Crypto::Hmac::ID selected_hmac,
const Recover::ECC::ID selected_ecc,
const Crypto::Key::ID selected_key,
const Crypto::KDF::ID selected_kdf,
const int64_t timestamp,
const std::vector<Crypto::Auth::ID>&supported_auth,
const uint16_t signature_length);
......@@ -200,7 +209,9 @@ public:
Crypto::Key::Serial _key_id;
Crypto::Encryption::ID _selected_crypt;
Crypto::Hmac::ID _selected_hmac;
Recover::ECC::ID _selected_ecc;
Crypto::Key::ID _selected_key;
Crypto::KDF::ID _selected_kdf;
int64_t _timestamp;
Nonce _nonce;
};
......@@ -221,7 +232,9 @@ public:
const Crypto::Key::Serial pubkey_id,
const Crypto::Encryption::ID selected_crypt,
const Crypto::Hmac::ID selected_hmac,
const Recover::ECC::ID selected_ecc,
const Crypto::Key::ID selected_key,
const Crypto::KDF::ID selected_kdf,
const int64_t timestamp,
Random *const rnd, // for the Nonce
const uint16_t cookie_len,
......
......@@ -78,14 +78,28 @@ Conn0_C_INIT::Conn0_C_INIT (const gsl::span<uint8_t> raw)
raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size())))),
_supported_ecc (Span_Overlay<Recover::ECC::ID>::mk_overlay(
raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size())))),
_supported_key (Span_Overlay<Crypto::Key::ID>::mk_overlay(
raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size()))))
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size() +
_supported_ecc.raw_size())))),
_supported_kdf (Span_Overlay<Crypto::KDF::ID>::mk_overlay(
raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size() +
_supported_ecc.raw_size() +
_supported_key.raw_size()))))
{
if (_raw.size() < min_data_len || !_supported_crypt ||
!_supported_hmac || !_supported_key) {
!_supported_hmac || !_supported_ecc ||
!_supported_key || !_supported_kdf) {
w->_version = Fenrir_Version (0);
return;
}
......@@ -95,7 +109,9 @@ Conn0_C_INIT::Conn0_C_INIT (gsl::span<uint8_t> raw,
Random *const rnd, const Crypto::Key::Serial key_id,
const std::vector<Crypto::Encryption::ID>&supported_crypt,
const std::vector<Crypto::Hmac::ID> &supported_hmac,
const std::vector<Crypto::Key::ID> &supported_key)
const std::vector<Recover::ECC::ID> &supported_ecc,
const std::vector<Crypto::Key::ID> &supported_key,
const std::vector<Crypto::KDF::ID> &supported_kdf)
: Conn0 (raw, Conn0_Type::C_INIT, Fenrir_Version (1)),
r (reinterpret_cast<struct data*>(_raw.data())),
w (reinterpret_cast<struct data*>(_raw.data())),
......@@ -106,15 +122,31 @@ Conn0_C_INIT::Conn0_C_INIT (gsl::span<uint8_t> raw,
supported_offset +
_supported_crypt.raw_size())),
supported_hmac)),
_supported_key (Span_Overlay<Crypto::Key::ID>::mk_overlay(
_supported_ecc (Span_Overlay<Recover::ECC::ID>::mk_overlay(
_raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size())),
supported_key))
supported_ecc)),
_supported_key (Span_Overlay<Crypto::Key::ID>::mk_overlay(
_raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size() +
_supported_ecc.raw_size())),
supported_key)),
_supported_kdf (Span_Overlay<Crypto::KDF::ID>::mk_overlay(
_raw.subspan (static_cast<ssize_t> (
supported_offset +
_supported_crypt.raw_size() +
_supported_hmac.raw_size() +
_supported_ecc.raw_size() +
_supported_key.raw_size())),
supported_kdf))
{
if (_raw.size() < min_data_len || !_supported_crypt ||
!_supported_hmac || !_supported_key) {
!_supported_hmac || !_supported_ecc ||
!_supported_key || !_supported_kdf) {
w->_version = Fenrir_Version (0);
return;
}
......@@ -125,7 +157,7 @@ Conn0_C_INIT::Conn0_C_INIT (gsl::span<uint8_t> raw,
constexpr uint16_t Conn0_C_INIT::min_size()
{
return Conn0::min_size() + sizeof(Crypto::Key::Serial) + sizeof(Nonce) +
sizeof(uint16_t) * 3;
sizeof(uint16_t) * 5;
}
/////////////////
......@@ -158,7 +190,9 @@ Conn0_S_COOKIE::Conn0_S_COOKIE (gsl::span<uint8_t> raw)
Conn0_S_COOKIE::Conn0_S_COOKIE (gsl::span<uint8_t> raw,
const Crypto::Encryption::ID selected_crypt,
const Crypto::Hmac::ID selected_hmac,
const Recover::ECC::ID selected_ecc,
const Crypto::Key::ID selected_key,
const Crypto::KDF::ID selected_kdf,
const int64_t timestamp,
const std::vector<Crypto::Auth::ID> &supported_auth,
const uint16_t signature_length)
......@@ -183,7 +217,9 @@ Conn0_S_COOKIE::Conn0_S_COOKIE (gsl::span<uint8_t> raw,
}
w->_selected_crypt = selected_crypt;
w->_selected_hmac = selected_hmac;
w->_selected_ecc = selected_ecc;
w->_selected_key = selected_key;
w->_selected_kdf = selected_kdf;
w->_timestamp = timestamp;
}
......@@ -238,7 +274,9 @@ Conn0_C_COOKIE::Conn0_C_COOKIE (gsl::span<uint8_t> raw,
const Crypto::Key::Serial pubkey_id,
const Crypto::Encryption::ID selected_crypt,
const Crypto::Hmac::ID selected_hmac,
const Recover::ECC::ID selected_ecc,
const Crypto::Key::ID selected_key,
const Crypto::KDF::ID selected_kdf,
const int64_t timestamp,
Random *const rnd,
const uint16_t cookie_len,
......@@ -270,7 +308,9 @@ Conn0_C_COOKIE::Conn0_C_COOKIE (gsl::span<uint8_t> raw,
w->_key_id = pubkey_id;
w->_selected_crypt = selected_crypt;
w->_selected_hmac = selected_hmac;
w->_selected_ecc = selected_ecc;
w->_selected_key = selected_key;
w->_selected_kdf = selected_kdf;
w->_timestamp = timestamp;
w->_nonce = rnd->uniform<Nonce>();
}
......
......@@ -22,7 +22,7 @@
#include "Fenrir/v1/common.hpp"
#include "Fenrir/v1/data/control/Control.hpp"
#include "Fenrir/v1/data/Error_Correction.hpp"
#include "Fenrir/v1/recover/Error_Correction.hpp"
#include "Fenrir/v1/data/IP.hpp"
#include "Fenrir/v1/data/packet/Packet.hpp"
#include "Fenrir/v1/data/Storage.hpp"
......@@ -164,23 +164,30 @@ private:
std::vector<std::pair<Stream_ID, Stream_Track_Out>> _streams_out;
Stream_ID _last_out;
std::unique_ptr<Crypto::Encryption> _enc_send;
std::unique_ptr<Crypto::Hmac> _hmac_send;
std::unique_ptr<Crypto::Encryption> _enc_recv;
std::unique_ptr<Crypto::Hmac> _hmac_recv;
std::unique_ptr<Recover::ECC> _ecc;
std::shared_ptr<Crypto::Encryption> _enc_send;
std::shared_ptr<Crypto::Hmac> _hmac_send;
std::shared_ptr<Recover::ECC> _ecc_send;
std::shared_ptr<Crypto::Encryption> _enc_recv;
std::shared_ptr<Crypto::Hmac> _hmac_recv;
std::shared_ptr<Recover::ECC> _ecc_recv;
Connection (const Role role, const User_ID user,
Event::Loop *const loop,
Handler *const _handler,
const Stream_ID read_control_stream,
const Stream_ID write_control_stream,
const Conn_ID read, const Conn_ID write,
const Counter control_window_start,
const Packet::Alignment_Byte read_al,
const Packet::Alignment_Byte write_al,
const uint8_t max_read_padding,
const uint8_t max_write_padding);
Event::Loop *const loop,
Handler *const _handler,
const Stream_ID read_control_stream,
const Stream_ID write_control_stream,
const Conn_ID read, const Conn_ID write,
const Counter control_window_start,
const Packet::Alignment_Byte read_al,
const Packet::Alignment_Byte write_al,
const uint8_t max_read_padding,
const uint8_t max_write_padding,
std::shared_ptr<Crypto::Encryption> enc_send,
std::shared_ptr<Crypto::Hmac> hmac_send,
std::shared_ptr<Recover::ECC> ecc_send,
std::shared_ptr<Crypto::Encryption> enc_recv,
std::shared_ptr<Crypto::Hmac> hmac_recv,
std::shared_ptr<Recover::ECC> ecc_recv);
void parse_rel_control();
void parse_unrel_control();
void parse_control (const std::vector<uint8_t> &data);
......
......@@ -76,7 +76,13 @@ FENRIR_INLINE Connection::Connection (const Role role, const User_ID user,
const Packet::Alignment_Byte read_al,
const Packet::Alignment_Byte write_al,
const uint8_t max_read_padding,
const uint8_t max_write_padding)
const uint8_t max_write_padding,
std::shared_ptr<Crypto::Encryption> enc_send,
std::shared_ptr<Crypto::Hmac> hmac_send,
std::shared_ptr<Recover::ECC> ecc_send,
std::shared_ptr<Crypto::Encryption> enc_recv,
std::shared_ptr<Crypto::Hmac> hmac_recv,
std::shared_ptr<Recover::ECC> ecc_recv)
: _read_connection_id (read), _write_connection_id (write),
_user_id (user),
_rel_read_control_stream (read_control_stream),
......@@ -92,7 +98,13 @@ FENRIR_INLINE Connection::Connection (const Role role, const User_ID user,
_read_al (read_al), _write_al (write_al),
_max_read_padding (max_read_padding),
_max_write_padding (max_write_padding),
_role (role), _loop (loop), _handler (handler)
_role (role), _loop (loop), _handler (handler),
_enc_send (std::move(enc_send)),
_hmac_send (std::move(hmac_send)),
_ecc_send (std::move(ecc_send)),
_enc_recv (std::move(enc_recv)),
_hmac_recv (std::move(hmac_recv)),
_ecc_recv (std::move(ecc_recv))
{
_max_write_padding = 8;
auto rel_st_in = std::make_shared<Storage_Raw> ();
......@@ -275,7 +287,8 @@ FENRIR_INLINE Impl::Error Connection::del_stream_in (const Stream_ID id)
FENRIR_INLINE void Connection::recv (Packet &pkt)
{
gsl::span<uint8_t> raw_pkt;
if (_ecc->correct (pkt.data_no_id(), raw_pkt) == Recover::ECC::Result::ERR){
if (_ecc_recv->correct (pkt.data_no_id(), raw_pkt)
== Recover::ECC::Result::ERR) {
return;
}
if (!_hmac_recv->is_valid (raw_pkt, raw_pkt))
......@@ -365,9 +378,11 @@ FENRIR_INLINE std::unique_ptr<Packet> Connection::update_source (
const size_t total_size = PKT_MINLEN + msg_size + total_overhead();
auto activation_pkt = std::make_unique<Packet> (
std::vector<uint8_t> (total_size, 0));
// HACK: using the random header to offset stream (later overwritten)
activation_pkt->set_header (_write_connection_id,
static_cast<uint8_t> (_enc_send->bytes_header() +
_enc_send->bytes_header()),
_hmac_send->bytes_header() +
_ecc_send->bytes_header()),
&_rnd);
// use reserve_data (size) on the unrel_control_stream
// TODO: we should be able to do this stateless. easy enough:
......@@ -392,11 +407,13 @@ FENRIR_INLINE std::unique_ptr<Packet> Connection::update_source (
_incoming.rbegin()->_activation.begin());
activation_pkt->set_header (_write_connection_id, 0, &_rnd);
// FIXME: wrong start/end of encrypt section
gsl::span<uint8_t> sec_data {activation_pkt->raw};
if (_enc_send->encrypt (activation_pkt->raw) != Error::NONE)
return nullptr;
if (_hmac_send->add_hmac (activation_pkt->raw) != Error::NONE)
return nullptr;
if (_ecc->add_ecc (activation_pkt->raw) != Error::NONE)
if (_ecc_send->add_ecc (activation_pkt->raw) != Error::NONE)
return nullptr;
return activation_pkt;
}
......@@ -521,7 +538,7 @@ FENRIR_INLINE type_safe::optional<std::tuple<Link_ID,
FENRIR_INLINE uint32_t Connection::total_overhead() const
{
return _enc_send->bytes_overhead() + _hmac_send->bytes_overhead() +
_ecc->get_overhead();
_ecc_send->bytes_overhead();
}
FENRIR_INLINE uint32_t Connection::mtu (const Link_ID from, const Link_ID to)
......@@ -558,7 +575,7 @@ FENRIR_INLINE Error Connection::add_data (Packet_NN pkt, const uint32_t mtu)
std::unique_lock<std::mutex> lock (_mtx);
auto bytes_left = mtu - (_enc_send->bytes_overhead() +
_hmac_send->bytes_overhead() +
_ecc->get_overhead());
_ecc_send->bytes_overhead());
// get first stream after "_last_out"
auto it = std::lower_bound (_streams_out.begin(), _streams_out.end(),
_last_out,
......@@ -613,6 +630,7 @@ FENRIR_INLINE Error Connection::add_security (Packet_NN pkt)
uint8_t *start = pkt.modify().get()->raw.data() + sizeof(Conn_ID);
uint8_t *end = start + pkt.modify().get()->raw.size();
auto enc_span = gsl::span<uint8_t> (start, end);
// FIXME: wrong start/end of encrypt/hmac section
auto err = _enc_send->encrypt (enc_span);
if (err != Impl::Error::NONE)
return err;
......@@ -621,7 +639,7 @@ FENRIR_INLINE Error Connection::add_security (Packet_NN pkt)
err = _hmac_send->add_hmac (span);
if (err != Impl::Error::NONE)
return err;
err = _ecc->add_ecc (pkt.modify().get()->raw);
err = _ecc_send->add_ecc (pkt.modify().get()->raw);
if (err != Impl::Error::NONE)
return err;
return Error::WRONG_INPUT;
......
......@@ -107,8 +107,14 @@ private:
Resolve::AS_list _auth_servers;
std::unique_ptr<Packet> _pkt; // last packet, used for signatures
std::shared_ptr<Crypto::Key> _client_key;
std::shared_ptr<Crypto::Encryption> _enc;
std::shared_ptr<Crypto::Hmac> _hmac;
std::shared_ptr<Crypto::Encryption> _enc_read;
std::shared_ptr<Crypto::Hmac> _hmac_read;
std::shared_ptr<Recover::ECC> _ecc_read;
std::shared_ptr<Crypto::Encryption> _enc_write;
std::shared_ptr<Crypto::Hmac> _hmac_write;
std::shared_ptr<Recover::ECC> _ecc_write;
// TODO: provide KDF *and* deterministic rng for user
//std::shared_ptr<Crypto::KDF> _kdf;
state_client (Resolve::AS_list &list, uint16_t auth_srv_idx,
uint16_t key_idx,
......@@ -117,7 +123,9 @@ private:
_auth_server_idx (auth_srv_idx), _key_idx (key_idx),
_auth_servers (std::move(list)),
_pkt (std::move(pkt)),
_client_key (nullptr), _enc (nullptr), _hmac (nullptr)
_client_key (nullptr), _enc_read (nullptr), _hmac_read (nullptr),
_ecc_read (nullptr), _enc_write (nullptr), _hmac_write (nullptr),
_ecc_write (nullptr)
{}
};
std::vector<std::pair<Handshake::ID, state_client>> _client_active;
......
This diff is collapsed.
......@@ -23,7 +23,7 @@
#include "Fenrir/v1/common.hpp"
#include "Fenrir/v1/auth/Auth.hpp"
#include "Fenrir/v1/crypto/Crypto.hpp"
#include "Fenrir/v1/data/Error_Correction.hpp"
#include "Fenrir/v1/recover/Error_Correction.hpp"
#include "Fenrir/v1/db/Db.hpp"
#include "Fenrir/v1/util/Shared_Lock.hpp"
#include "Fenrir/v1/plugin/Lib.hpp"
......
......@@ -23,7 +23,7 @@
#include "Fenrir/v1/auth/Auth.hpp"
#include "Fenrir/v1/common.hpp"
#include "Fenrir/v1/crypto/Crypto.hpp"
#include "Fenrir/v1/data/Error_Correction.hpp"
#include "Fenrir/v1/recover/Error_Correction.hpp"
#include "Fenrir/v1/util/Shared_Lock.hpp"
#include "Fenrir/v1/plugin/Lib.hpp"
#include "Fenrir/v1/plugin/Loader.hpp"
......
......@@ -26,6 +26,7 @@
#include "Fenrir/v1/crypto/Sodium.hpp"
#include "Fenrir/v1/db/Db_Fake.hpp"
#include "Fenrir/v1/plugin/Lib.hpp"
#include "Fenrir/v1/recover/ECC_NULL.hpp"
#include "Fenrir/v1/resolve/DNSSEC.hpp"
#include <memory>
#include <vector>
......@@ -144,7 +145,12 @@ FENRIR_INLINE std::shared_ptr<Dynamic> Lib::get_shared_native (
}
break;
case Dynamic_Type::ECC:
return nullptr; // no default algorithm yet
switch (id) {
case 1:
ret = std::make_shared<Recover::ECC_NULL>();
ret->_self = ret;
}
break;
}
return ret;
}
......
......@@ -44,7 +44,7 @@ constexpr uint32_t NATIVE_HMAC = 1;
constexpr uint32_t NATIVE_AUTH = 1;
constexpr uint32_t NATIVE_RATE = 0;
constexpr uint32_t NATIVE_RESOLV = 1;
constexpr uint32_t NATIVE_ECC = 0;
constexpr uint32_t NATIVE_ECC = 1;
constexpr uint32_t NATIVE_FEC = 0;
......
/*
* Copyright (c) 2017, Luca Fulchir<luca@fulchir.it>, All rights reserved.
*
* This file is part of libFenrir.
*
* libFenrir is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* libFenrir is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* and a copy of the GNU Lesser General Public License
* along with libFenrir. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Fenrir/v1/recover/Error_Correction.hpp"
namespace Fenrir__v1 {
namespace Impl {
namespace Event {
class Plugin_Timer;
} // namespace Event
namespace Recover {
class FENRIR_LOCAL ECC_NULL final : public ECC
{
public:
ECC_NULL()
: ECC (nullptr, nullptr, nullptr, nullptr) {}
ECC_NULL (const ECC_NULL&) = default;
ECC_NULL& operator= (const ECC_NULL&) = default;
ECC_NULL (ECC_NULL &&) = default;
ECC_NULL& operator= (ECC_NULL &&) = default;
~ECC_NULL() {}
void parse_event (std::shared_ptr<Event::Plugin_Timer> ev) override
{
FENRIR_UNUSED (ev);
return;
}
bool init (const gsl::span<uint8_t, 64> random) override
{
FENRIR_UNUSED (random);
return true;
}
ECC::ID get_id() const override
{ return ECC::ID {1}; }
uint16_t bytes_header() const override
{ return 0; }
uint16_t bytes_footer() const override
{ return 0; }
uint16_t bytes_overhead() const override
{ return 0; }
Result correct (const gsl::span<uint8_t> raw,
gsl::span<uint8_t> &raw_no_ecc_header) override
{
raw_no_ecc_header = raw;
return Result::OK;
}
Impl::Error add_ecc (gsl::span<uint8_t> raw) override
{
FENRIR_UNUSED (raw);
return Impl::Error::NONE;
}
};
} // namespace Recover
} // namespace Impl
} // namespace Fenrir__v1
......@@ -21,10 +21,10 @@
#pragma once
#include "Fenrir/v1/common.hpp"
#include "Fenrir/v1/data/packet/Stream.hpp"
#include "Fenrir/v1/plugin/Dynamic.hpp"
#include <gsl/span>
#include <vector>
#include <type_safe/strong_typedef.hpp>
namespace Fenrir__v1 {
namespace Impl {
......@@ -58,10 +58,11 @@ public:
ECC& operator= (ECC &&) = default;
virtual ~ECC () {}
virtual bool init (const std::vector<uint8_t> &pref_raw) = 0;
virtual std::vector<uint8_t> get_preferences() = 0;
virtual bool init (const gsl::span<uint8_t, 64> random) = 0;
virtual ECC::ID get_id() const = 0;
virtual uint16_t get_overhead() const = 0;
virtual uint16_t bytes_header() const = 0;
virtual uint16_t bytes_footer() const = 0;
virtual uint16_t bytes_overhead() const = 0;
virtual Result correct (const gsl::span<uint8_t> raw,
gsl::span<uint8_t> &raw_no_ecc_header) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment