add message definitions
authorMazet Laurent <laurent.mazet@thalesgroup.com>
Tue, 1 Apr 2025 06:32:55 +0000 (08:32 +0200)
committerMazet Laurent <laurent.mazet@thalesgroup.com>
Tue, 1 Apr 2025 06:32:55 +0000 (08:32 +0200)
message.h [new file with mode: 0644]

diff --git a/message.h b/message.h
new file mode 100644 (file)
index 0000000..2604d44
--- /dev/null
+++ b/message.h
@@ -0,0 +1,104 @@
+/*
+  File name        : message.h
+  Projet           : MERLIN
+  Date of creation : 2025/04/03
+  Version          : 1.0
+  Copyright        : Thales SIX
+  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
+
+  Description      : This file contains message definition
+
+  History          :
+  - initial version
+*/
+
+#ifndef __MESSAGE_H__
+#define __MESSAGE_H__
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/**
+   @ingroup MESSAGE
+
+   Clear data type
+*/
+typedef struct {
+    uint8_t channel_id; /**< channel index */
+    uint8_t bypass_len; /**< attached bypass message length */
+    uint8_t bypass_msg[255]; /**< attached bypass message */
+    uint8_t data_len; /**< data length (must be aligned to 16 bytes) */
+    uint8_t data[1472]; /**< data message */
+} CLEAR_DATA_t;
+
+/**
+   @ingroup MESSAGE
+
+   Encrypted data type
+*/
+typedef struct {
+    uint8_t channel_id; /**< channel index */
+    uint8_t bypass_len; /**< attached bypass message length */
+    uint8_t bypass_msg[255]; /**< attached bypass message */
+    uint8_t data_len; /**< data length (must be aligned to 16 bytes) */
+    uint8_t data[1472]; /**< data message */
+    uint8_t iv[12]; /**< initial vector */
+} ENCRYPTED_DATA_t;
+
+/**
+   @ingroup MESSAGE
+
+   PRNG parameter type
+*/
+typedef struct {
+    uint8_t prng_id; /**< algorithm index */
+    uint16_t seq_len; /**< requested PRNG sequence length */
+    uint8_t seed_len; /**< data length (must be aligned to 16 bytes) */
+} PRNG_PARAM_t;
+
+/**
+   @ingroup MESSAGE
+
+   Key type
+*/
+typedef struct {
+    uint16_t key_len; /**< key length */
+    uint8_t key[1495]; /**< raw key */
+} KEY_t;
+
+/**
+   @ingroup MESSAGE
+
+   Channel type
+*/
+typedef struct {
+    uint8_t channel_id; /**< channel index */
+    uint8_t key_id; /**< key index */
+} CHANNEL_t;
+
+/**
+   @ingroup MESSAGE
+
+   Status type
+*/
+typedef struct {
+    uint8_t status; /**< status */
+} STATUS_t;
+
+/**
+   @ingroup MESSAGE
+
+   Raw data type
+*/
+typedef struct {
+    uint16_t data_len; /**< payload length */
+    uint8_t data[1495]; /**< raw payload */
+} RAW_DATA_t;
+
+__END_DECLS
+
+#endif /* __MESSAGE_H__ */
+
+/* vim: set ts=4 sw=4 si et: */