mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
parent
bb904b9166
commit
f4da21252b
@ -43,15 +43,12 @@ Crypto::Key_directory &Crypto::_lookup_key_dir(uint32_t key_id)
|
||||
}
|
||||
|
||||
|
||||
Crypto::Crypto(Vfs::Env &env,
|
||||
Xml_node const &crypto,
|
||||
Signal_context_capability sigh)
|
||||
Crypto::Crypto(Vfs::Env &env, Xml_node const &crypto)
|
||||
:
|
||||
_env { env },
|
||||
_path { crypto.attribute_value("path", String<32>()) },
|
||||
_add_key_handle { vfs_open_wo(env, { _path.string(), "/add_key" }) },
|
||||
_remove_key_handle { vfs_open_wo(env, { _path.string(), "/remove_key" }) },
|
||||
_vfs_io_response_handler { sigh }
|
||||
_env { env },
|
||||
_path { crypto.attribute_value("path", String<32>()) },
|
||||
_add_key_handle { vfs_open_wo(env, { _path.string(), "/add_key" }) },
|
||||
_remove_key_handle { vfs_open_wo(env, { _path.string(), "/remove_key" }) }
|
||||
{ }
|
||||
|
||||
|
||||
@ -89,8 +86,6 @@ Crypto::Result Crypto::add_key(Key const &key)
|
||||
_env, { _path.string(), "/keys/", key.id.value, "/decrypt" });
|
||||
|
||||
key_dir.key_id = key.id.value;
|
||||
key_dir.encrypt_handle->handler(&_vfs_io_response_handler);
|
||||
key_dir.decrypt_handle->handler(&_vfs_io_response_handler);
|
||||
return Result::SUCCEEDED;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ class Crypto
|
||||
Genode::String<32> const _path;
|
||||
Vfs::Vfs_handle &_add_key_handle;
|
||||
Vfs::Vfs_handle &_remove_key_handle;
|
||||
Vfs_io_response_handler _vfs_io_response_handler;
|
||||
Key_directory _key_dirs[2] { { }, { } };
|
||||
Job _job { };
|
||||
|
||||
@ -92,9 +91,7 @@ class Crypto
|
||||
|
||||
public:
|
||||
|
||||
Crypto(Vfs::Env &env,
|
||||
Genode::Xml_node const &crypto,
|
||||
Genode::Signal_context_capability sigh);
|
||||
Crypto(Vfs::Env &env, Genode::Xml_node const &crypto);
|
||||
|
||||
bool request_acceptable() const;
|
||||
|
||||
|
@ -571,7 +571,6 @@ class Vfs_block_io : public Block_io
|
||||
|
||||
String<32> const _path;
|
||||
Vfs::Env &_vfs_env;
|
||||
Vfs_io_response_handler _vfs_io_response_handler;
|
||||
Vfs::Vfs_handle &_vfs_handle { *_init_vfs_handle(_vfs_env, _path) };
|
||||
Constructible<Vfs_block_io_job> _job { };
|
||||
|
||||
@ -600,18 +599,13 @@ class Vfs_block_io : public Block_io
|
||||
|
||||
public:
|
||||
|
||||
Vfs_block_io(Vfs::Env &vfs_env,
|
||||
Xml_node const &block_io,
|
||||
Signal_context_capability sigh)
|
||||
Vfs_block_io(Vfs::Env &vfs_env,
|
||||
Xml_node const &block_io)
|
||||
:
|
||||
_path { block_io.attribute_value(
|
||||
"path", String<32> { "" } ) },
|
||||
|
||||
_vfs_env { vfs_env },
|
||||
_vfs_io_response_handler { sigh }
|
||||
{
|
||||
_vfs_handle.handler(&_vfs_io_response_handler);
|
||||
}
|
||||
_path { block_io.attribute_value(
|
||||
"path", String<32> { "" } ) },
|
||||
_vfs_env { vfs_env }
|
||||
{ }
|
||||
|
||||
|
||||
/**************
|
||||
@ -1602,7 +1596,7 @@ class Command_pool {
|
||||
};
|
||||
|
||||
|
||||
class Main
|
||||
class Main : Vfs::Env::User
|
||||
{
|
||||
private:
|
||||
|
||||
@ -1610,7 +1604,7 @@ class Main
|
||||
Attached_rom_dataspace _config_rom { _env, "config" };
|
||||
Verbose_node _verbose_node { _config_rom.xml() };
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
Vfs::Simple_env _vfs_env { _env, _heap, _config_rom.xml().sub_node("vfs") };
|
||||
Vfs::Simple_env _vfs_env { _env, _heap, _config_rom.xml().sub_node("vfs"), *this };
|
||||
Signal_handler<Main> _sigh { _env.ep(), *this, &Main::_execute };
|
||||
Block_io &_blk_io { _init_blk_io(_config_rom.xml(), _heap, _env, _vfs_env, _sigh) };
|
||||
Io_buffer _blk_buf { };
|
||||
@ -1620,12 +1614,11 @@ class Main
|
||||
Cbe_dump::Library _cbe_dump { };
|
||||
Cbe_init::Library _cbe_init { };
|
||||
Benchmark _benchmark { _env };
|
||||
Trust_anchor _trust_anchor { _vfs_env, _config_rom.xml().sub_node("trust-anchor"), _sigh };
|
||||
Trust_anchor _trust_anchor { _vfs_env, _config_rom.xml().sub_node("trust-anchor") };
|
||||
Crypto_plain_buffer _crypto_plain_buf { };
|
||||
Crypto_cipher_buffer _crypto_cipher_buf { };
|
||||
Crypto _crypto { _vfs_env,
|
||||
_config_rom.xml().sub_node("crypto"),
|
||||
_sigh };
|
||||
_config_rom.xml().sub_node("crypto") };
|
||||
|
||||
Block_io &_init_blk_io(Xml_node const &config,
|
||||
Heap &heap,
|
||||
@ -1640,13 +1633,17 @@ class Main
|
||||
}
|
||||
if (block_io.attribute("type").has_value("vfs")) {
|
||||
return *new (heap)
|
||||
Vfs_block_io {
|
||||
vfs_env, block_io, sigh };
|
||||
Vfs_block_io { vfs_env, block_io };
|
||||
}
|
||||
class Malformed_attribute { };
|
||||
throw Malformed_attribute { };
|
||||
}
|
||||
|
||||
/**
|
||||
* Vfs::Env::User interface
|
||||
*/
|
||||
void wakeup_vfs_user() override { _sigh.local_submit(); }
|
||||
|
||||
template <typename MODULE>
|
||||
void _handle_pending_blk_io_requests_of_module(MODULE &module,
|
||||
Module_type module_type,
|
||||
|
@ -297,20 +297,12 @@ void Trust_anchor::_execute_read_operation(Vfs_handle &file,
|
||||
}
|
||||
|
||||
|
||||
Trust_anchor::Trust_anchor(Vfs::Env &vfs_env,
|
||||
Xml_node const &xml_node,
|
||||
Signal_context_capability sigh)
|
||||
Trust_anchor::Trust_anchor(Vfs::Env &vfs_env,
|
||||
Xml_node const &xml_node)
|
||||
:
|
||||
_vfs_env { vfs_env },
|
||||
_handler { sigh },
|
||||
_path { xml_node.attribute_value("path", String<128>()) }
|
||||
{
|
||||
_initialize_file.handler(&_handler);
|
||||
_hashsum_file.handler(&_handler);
|
||||
_generate_key_file.handler(&_handler);
|
||||
_encrypt_file.handler(&_handler);
|
||||
_decrypt_file.handler(&_handler);
|
||||
}
|
||||
{ }
|
||||
|
||||
|
||||
bool Trust_anchor::request_acceptable() const
|
||||
|
@ -51,7 +51,6 @@ class Trust_anchor
|
||||
|
||||
Vfs::Env &_vfs_env;
|
||||
char _read_buf[64];
|
||||
Vfs_io_response_handler _handler;
|
||||
Genode::String<128> const _path;
|
||||
Genode::String<128> const _decrypt_path { _path, "/decrypt" };
|
||||
Vfs::Vfs_handle &_decrypt_file { vfs_open_rw(_vfs_env, { _decrypt_path }) };
|
||||
@ -85,8 +84,7 @@ class Trust_anchor
|
||||
public:
|
||||
|
||||
Trust_anchor(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node const &xml_node,
|
||||
Genode::Signal_context_capability sigh);
|
||||
Genode::Xml_node const &xml_node);
|
||||
|
||||
bool request_acceptable() const;
|
||||
|
||||
|
@ -18,25 +18,6 @@ using namespace Genode;
|
||||
using namespace Vfs;
|
||||
|
||||
|
||||
/*****************************
|
||||
** Vfs_io_response_handler **
|
||||
*****************************/
|
||||
|
||||
Vfs_io_response_handler::Vfs_io_response_handler(Genode::Signal_context_capability sigh)
|
||||
:
|
||||
_sigh(sigh)
|
||||
{ }
|
||||
|
||||
|
||||
void Vfs_io_response_handler::read_ready_response() { }
|
||||
|
||||
|
||||
void Vfs_io_response_handler::io_progress_response()
|
||||
{
|
||||
Signal_transmitter(_sigh).submit();
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
** Global functions **
|
||||
**********************/
|
||||
|
@ -18,26 +18,6 @@
|
||||
#include <vfs/vfs_handle.h>
|
||||
#include <vfs/simple_env.h>
|
||||
|
||||
class Vfs_io_response_handler : public Vfs::Io_response_handler
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Signal_context_capability const _sigh;
|
||||
|
||||
public:
|
||||
|
||||
Vfs_io_response_handler(Genode::Signal_context_capability sigh);
|
||||
|
||||
|
||||
/******************************
|
||||
** Vfs::Io_response_handler **
|
||||
******************************/
|
||||
|
||||
void read_ready_response() override;
|
||||
|
||||
void io_progress_response() override;
|
||||
};
|
||||
|
||||
|
||||
Vfs::Vfs_handle &vfs_open(Vfs::Env &vfs_env,
|
||||
Genode::String<128> path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user