mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-26 00:41:08 +00:00
30b8f4efc8
The CBE repository contained a lot of Genode-specific code despite the fact that the CBE core logic is not bound to Genode in any way. Therefore the Genode-specific CBE code is moved to the 'gems' repository to form part of Genode mainline. The remaining CBE code becomes a port in Genode instead of being invoked as sub-repository. The commit combines the following work steps: * add all files removed from CBE repository * add CBE port files * make all CBE libs and targets build again * make all CBE run scripts succeed again * make all CBE recipes build again * make CBE autopilot succeed again * let CBE autopilot use 'libsparcrypto' contrib dir and Genode build dir instead of '.ci' dir in CBE contrib dir (remove '.ci' dir from CBE repo) * let CBE autopilot always check for all ports * make CBE autopilot directly executable * fix license headers in all Genode CBE files * remove unused VFS replay component * remove unused CBE test * remove unused external crypto * remove unused files in run dir * remove unused external trust anchor * add cbe_tester test to autopilot list * get rid of directories 'include/cbe_*' and 'include/utils' Fixes #3937
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
/*
|
|
* \brief Integration of the Consistent Block Encrypter (CBE)
|
|
* \author Martin Stein
|
|
* \author Josef Soentgen
|
|
* \date 2020-11-10
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2020 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _CBE_SPARK_OBJECT_H_
|
|
#define _CBE_SPARK_OBJECT_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/stdint.h>
|
|
#include <base/output.h>
|
|
#include <base/log.h>
|
|
|
|
namespace Cbe {
|
|
|
|
/**
|
|
* Opaque object that contains the space needed to store a SPARK record.
|
|
*
|
|
* \param BYTES size of the SPARK record in bytes
|
|
*/
|
|
template <Genode::uint32_t BYTES>
|
|
struct Spark_object
|
|
{
|
|
/**
|
|
* Exception type
|
|
*/
|
|
struct Object_size_mismatch { };
|
|
|
|
static constexpr Genode::uint32_t bytes() { return BYTES; }
|
|
|
|
long _space[(BYTES + sizeof(long) - 1)/sizeof(long)] { };
|
|
};
|
|
|
|
template <typename T>
|
|
static inline void assert_valid_object_size()
|
|
{
|
|
if (object_size(*(T *)nullptr) > T::bytes()) {
|
|
Genode::error("need ", object_size(*(T *)nullptr),
|
|
" bytes, got ", T::bytes(), " bytes");
|
|
throw typename T::Object_size_mismatch();
|
|
}
|
|
}
|
|
|
|
template <typename T>
|
|
static inline void assert_same_object_size()
|
|
{
|
|
if (object_size(*(T *)nullptr) != T::bytes()) {
|
|
Genode::error("need ", object_size(*(T *)nullptr),
|
|
" bytes, got ", T::bytes(), " bytes");
|
|
throw typename T::Object_size_mismatch();
|
|
}
|
|
}
|
|
|
|
} /* namespace Cbe */
|
|
|
|
#endif /* _CBE_SPARK_OBJECT_H_ */
|