diff options
| author | Ian Moffett <ian@osmora.org> | 2024-09-26 14:49:15 -0400 | 
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2024-09-26 14:49:15 -0400 | 
| commit | c336d2f8a3560a8179650859983d33e3e1103ff0 (patch) | |
| tree | 5da6edad9e22685857b5dc6029e0075d7416c364 | |
| parent | e394dc73ee6266f744e37f268d6279d462af7d1f (diff) | |
lib: net: Add message frame structure
Signed-off-by: Ian Moffett <ian@osmora.org>
| -rw-r--r-- | lib/include/net/stpsession.h | 19 | 
1 files changed, 19 insertions, 0 deletions
| 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,10 +30,18 @@  #ifndef STP_SESSION_H_  #define STP_SESSION_H_ +#include <crypto/aes.h>  #include <stdint.h>  #include <defs.h>  /* + * 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)   * payload along with some optional padding. If the 'U' @@ -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_ */ | 
