From c336d2f8a3560a8179650859983d33e3e1103ff0 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 26 Sep 2024 14:49:15 -0400 Subject: lib: net: Add message frame structure Signed-off-by: Ian Moffett --- lib/include/net/stpsession.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib') diff --git a/lib/include/net/stpsession.h b/lib/include/net/stpsession.h index 1b22e1b..351be26 100644 --- a/lib/include/net/stpsession.h +++ b/lib/include/net/stpsession.h @@ -30,9 +30,17 @@ #ifndef STP_SESSION_H_ #define STP_SESSION_H_ +#include #include #include +/* + * 2^12 (4096) bytes is a common page size on + * modern systems, this could lead to potential + * optimizations. + */ +#define MESSAGE_SIZE (1 << 12) + /* * The Session Request is sent from the client to the * server and contains a HOP (hash, options, pubkey) @@ -72,4 +80,15 @@ struct session_request { uint8_t pad[8]; } PACKED; +/* + * OSTP Message Frame containing an IV, AES + * GCM tag, payload length and payload + * with encrypted data. + */ +struct msg_frame { + uint8_t iv[AES_IV_SIZE]; + uint8_t tag[AES_GCM_TAG_SIZE]; + uint16_t len; + uint8_t payload[MESSAGE_SIZE]; +}; #endif /* STP_SESSION_H_ */ -- cgit v1.2.3