F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
AesGcmEncryptor.hpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title AesGcmEncryptor.hpp
3
// \author cadena and claradavisb
4
// \brief hpp file for AesGcmEncryptor component implementation class
5
// ======================================================================
6
7
#ifndef Svc_Ccsds_AesGcmEncryptor_HPP
8
#define Svc_Ccsds_AesGcmEncryptor_HPP
9
10
#include "Svc/Ccsds/AesGcmEncryptor/AesGcmEncryptorComponentAc.hpp"
11
#include "
Svc/Ccsds/Types/FppConstantsAc.hpp
"
12
#include "
Svc/Ccsds/Types/TMHeaderSerializableAc.hpp
"
13
#include "
Svc/Ccsds/Types/TMTrailerSerializableAc.hpp
"
14
#include "
Svc/Ccsds/Utils/SdlsAuthMask.hpp
"
15
16
#include <openssl/evp.h>
17
18
namespace
Svc
{
19
20
namespace
Ccsds {
21
22
class
AesGcmEncryptor
final :
public
AesGcmEncryptorComponentBase {
24
enum class
BufferOwnershipState {
25
NOT_OWNED,
26
OWNED,
27
};
28
29
public
:
31
static
constexpr
FwSizeType
MAX_OUTPUT_SIZE
=
32
ComCfg::TmFrameFixedSize
-
TMHeader::SERIALIZED_SIZE
-
TMTrailer::SERIALIZED_SIZE
-
sizeof
(U16);
33
34
// ----------------------------------------------------------------------
35
// Component construction and destruction
36
// ----------------------------------------------------------------------
37
39
explicit
AesGcmEncryptor
(
const
char
*
const
compName
40
);
41
43
~AesGcmEncryptor
();
44
45
AesGcmEncryptor
(
const
AesGcmEncryptor
&) =
delete
;
46
AesGcmEncryptor
&
operator=
(
const
AesGcmEncryptor
&) =
delete
;
47
AesGcmEncryptor
(
AesGcmEncryptor
&&) =
delete
;
48
AesGcmEncryptor
&
operator=
(
AesGcmEncryptor
&&) =
delete
;
49
50
private
:
51
// ----------------------------------------------------------------------
52
// Handler implementations for typed input ports
53
// ----------------------------------------------------------------------
54
58
void
encryptIn_handler(
FwIndexType
portNum,
59
U16 securityAssociationIndex,
60
Fw::Buffer
& data,
61
const
ComCfg::FrameContext
& context)
override
;
62
66
void
encryptReturnIn_handler(
FwIndexType
portNum,
67
Fw::Buffer
& data,
68
const
ComCfg::FrameContext
& context)
override
;
69
70
// ----------------------------------------------------------------------
71
// Helpers
72
// ----------------------------------------------------------------------
73
75
void
failFrame(
Fw::Buffer
& data,
const
ComCfg::FrameContext
& context,
Svc::Ccsds::SdlsStatus
status);
76
77
private
:
78
// ----------------------------------------------------------------------
79
// Member variables
80
// ----------------------------------------------------------------------
81
84
U8
m_outBuf[
ComCfg::TmFrameFixedSize
];
85
87
BufferOwnershipState m_bufferState;
88
90
EVP_CIPHER* m_cipher;
91
93
EVP_CIPHER_CTX* m_ctx;
94
96
Svc::Ccsds::Utils::SdlsTmAuthMask
m_aad;
97
99
U8
m_aadVcId;
100
102
U16 m_aadSaIndex;
103
};
104
105
}
// namespace Ccsds
106
107
}
// namespace Svc
108
109
#endif
Svc::Ccsds::AesGcmEncryptor::AesGcmEncryptor
AesGcmEncryptor(const char *const compName)
Construct AesGcmEncryptor object.
Definition:
AesGcmEncryptor.cpp:32
Svc::Ccsds::AesGcmEncryptor
Definition:
AesGcmEncryptor.hpp:22
FwSizeType
PlatformSizeType FwSizeType
Definition:
FwSizeTypeAliasAc.h:15
Svc::Ccsds::TMHeader::SERIALIZED_SIZE
The size of the serial representation.
Definition:
TMHeaderSerializableAc.hpp:32
FppConstantsAc.hpp
Svc::Ccsds::SdlsStatus
Status of an SDLS (Space Data Link Security) encryption/decryption request.
Definition:
SdlsStatusEnumAc.hpp:20
TMTrailerSerializableAc.hpp
ComCfg::TmFrameFixedSize
Definition:
FppConstantsAc.hpp:278
Svc::Ccsds::AesGcmEncryptor::~AesGcmEncryptor
~AesGcmEncryptor()
Destroy AesGcmEncryptor object.
Definition:
AesGcmEncryptor.cpp:52
SdlsAuthMask.hpp
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.h:54
TMHeaderSerializableAc.hpp
FwIndexType
PlatformIndexType FwIndexType
Definition:
FwIndexTypeAliasAc.h:15
ComCfg::FrameContext
Type used to pass context info between components during framing/deframing.
Definition:
FrameContextSerializableAc.hpp:22
Svc
RateGroupDivider component implementation.
Definition:
ActiveRateGroupCfg.hpp:18
Svc::Ccsds::Utils::SdlsTmAuthMask
Definition:
SdlsAuthMask.hpp:50
Svc::Ccsds::AesGcmEncryptor::MAX_OUTPUT_SIZE
static constexpr FwSizeType MAX_OUTPUT_SIZE
Largest output frame the downstream chain carries: the TM data field less the 2-byte SA index...
Definition:
AesGcmEncryptor.hpp:31
Svc::Ccsds::AesGcmEncryptor::operator=
AesGcmEncryptor & operator=(const AesGcmEncryptor &)=delete
Fw::Buffer
Definition:
Buffer.hpp:53
Svc::Ccsds::TMTrailer::SERIALIZED_SIZE
The size of the serial representation.
Definition:
TMTrailerSerializableAc.hpp:32
Svc
Ccsds
AesGcmEncryptor
AesGcmEncryptor.hpp
Generated by
1.8.14