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"
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 =
33 
34  // ----------------------------------------------------------------------
35  // Component construction and destruction
36  // ----------------------------------------------------------------------
37 
39  explicit AesGcmEncryptor(const char* const compName
40  );
41 
44 
45  AesGcmEncryptor(const AesGcmEncryptor&) = delete;
46  AesGcmEncryptor& operator=(const AesGcmEncryptor&) = delete;
47  AesGcmEncryptor(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 
97 
99  U8 m_aadVcId;
100 
102  U16 m_aadSaIndex;
103 };
104 
105 } // namespace Ccsds
106 
107 } // namespace Svc
108 
109 #endif
AesGcmEncryptor(const char *const compName)
Construct AesGcmEncryptor object.
PlatformSizeType FwSizeType
The size of the serial representation.
Status of an SDLS (Space Data Link Security) encryption/decryption request.
~AesGcmEncryptor()
Destroy AesGcmEncryptor object.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
static constexpr FwSizeType MAX_OUTPUT_SIZE
Largest output frame the downstream chain carries: the TM data field less the 2-byte SA index...
AesGcmEncryptor & operator=(const AesGcmEncryptor &)=delete
The size of the serial representation.