update pdu definitions
authorMazet Laurent <laurent.mazet@thalesgroup.com>
Tue, 27 May 2025 17:19:24 +0000 (19:19 +0200)
committerMazet Laurent <laurent.mazet@thalesgroup.com>
Tue, 27 May 2025 17:19:24 +0000 (19:19 +0200)
def.h
morep.c
pdu_association.c [new file with mode: 0644]
pdu_association.h [new file with mode: 0644]
pdu_channel.c [deleted file]
pdu_channel.h [deleted file]

diff --git a/def.h b/def.h
index a017c88ba208ba70006fec287745649f797c0f32..66438ff376dae700bd4cb0b12cadf8d654017322 100644 (file)
--- a/def.h
+++ b/def.h
@@ -24,7 +24,7 @@
 #define MOREP_PAYLOAD (1496 * 16 - 1)
 #endif
 
-#define AAD_LENGTH 4
+#define AAD_LENGTH 16
 #define IV_LENGTH 12
 #define KEY_LENGTH 32
 #define TAG_LENGTH 16
diff --git a/morep.c b/morep.c
index 7b1e793dea0b49ee86b7b3189a76a4116d7a6b19..a009b61c42bc8469e689f4f0c2d3aa508bd21811 100644 (file)
--- a/morep.c
+++ b/morep.c
@@ -4,8 +4,8 @@
   Copyright Thales 20250319
 */
 
-/* include: def.h morep.h parse.h pdu_bypass.h pdu_channel.h pdu_clear_data.h pdu_encrypted_data.h pdu_key.h pdu_prng_param.h pdu_raw_data.h pdu_status.h verbose.h */
-/* archive: parse.o pdu_bypass.o pdu_channel.o pdu_clear_data.o pdu_encrypted_data.o pdu_key.o pdu_prng_param.o pdu_raw_data.o pdu_status.o */
+/* include: def.h morep.h parse.h pdu_association.h pdu_bypass.h pdu_clear_data.h pdu_encrypted_data.h pdu_key.h pdu_prng_param.h pdu_raw_data.h pdu_status.h verbose.h */
+/* archive: parse.o pdu_association.o pdu_bypass.o pdu_clear_data.o pdu_encrypted_data.o pdu_key.o pdu_prng_param.o pdu_raw_data.o pdu_status.o */
 
 #include <assert.h>
 #include <errno.h>
diff --git a/pdu_association.c b/pdu_association.c
new file mode 100644 (file)
index 0000000..6df75d2
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+  File name        : pdu_association.c
+  Projet           : MERLIN
+  Date of creation : 2025/04/08
+  Version          : 1.0
+  Copyright        : Thales SIX
+  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
+
+  Description      : This file contains functions for association pdu
+
+  History          :
+  - initial version
+*/
+
+#include <stdint.h>
+
+#include "parse.h"
+
+#include "pdu_association.h"
+
+int parse_association (char *line, ASSOCIATION_t *out)
+{
+    BEGIN_PARSE (line)
+    PARSE_INT ("ASSOCID", out->assoc_id)
+    PARSE_INT ("KEYID", out->key_id)
+    END_PARSE ()
+}
+
+int format_association (ASSOCIATION_t *in, char *buffer, int maxlen)
+{
+    BEGIN_FORMAT (buffer, maxlen)
+    FORMAT_INT ("ASSOCID", in->assoc_id)
+    FORMAT_INT ("KEYID", in->key_id)
+    END_FORMAT ()
+}
+
+int serial_association (ASSOCIATION_t *in, uint8_t *buffer, int maxlen)
+{
+    BEGIN_SERIAL (buffer, maxlen)
+    SERIAL_INT ("ASSOCID", in->assoc_id)
+    SERIAL_INT ("KEYID", in->key_id)
+    END_SERIAL ()
+}
+
+int deserial_association (uint8_t *buffer, int len, ASSOCIATION_t *out)
+{
+    BEGIN_DESERIAL (buffer, len)
+    DESERIAL_INT ("ASSOCID", out->assoc_id)
+    DESERIAL_INT ("KEYID", out->key_id)
+    END_DESERIAL ()
+}
+
+int check_association (ASSOCIATION_t *first, ASSOCIATION_t *second, int fields)
+{
+    BEGIN_CHECK (fields)
+    CHECK_INT ("ASSOCID", first->assoc_id, second->assoc_id)
+    CHECK_INT ("KEYID", first->key_id, second->key_id)
+    END_CHECK ()
+}
+
+/* vim: set ts=4 sw=4 si et: */
diff --git a/pdu_association.h b/pdu_association.h
new file mode 100644 (file)
index 0000000..4885d50
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+  File name        : pdu_association.h
+  Projet           : MERLIN
+  Date of creation : 2025/04/08
+  Version          : 1.0
+  Copyright        : Thales SIX
+  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
+
+  Description      : This file contains functions for association pdu
+
+  History          :
+  - initial version
+*/
+
+#ifndef __ASSOCIATION_H__
+#define __ASSOCIATION_H__
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+#include "def.h"
+
+__BEGIN_DECLS
+
+/**
+    @defgroup ASSOCIATION
+    @ingroup MESSAGES
+*/
+
+/**
+   @ingroup ASSOCIATION
+
+   association type
+*/
+typedef struct {
+    uint8_t assoc_id; /**< association index */
+    uint8_t key_id; /**< key index */
+} ASSOCIATION_t;
+
+/**
+   @ingroup ASSOCIATION
+
+   Parse a string containing some association type fields
+
+   @param line string to analyse
+   @param out output structure
+   @return 0 on success
+*/
+int parse_association (char *line, ASSOCIATION_t *out);
+
+/**
+   @ingroup ASSOCIATION
+
+   Format association type fields into a string
+
+   @param in input structure
+   @param buffer output string
+   @param maxlen buffer limit
+   @return 0 on success
+*/
+int format_association (ASSOCIATION_t *in, char *buffer, int maxlen);
+
+/**
+   @ingroup ASSOCIATION
+
+   Serial association type fields into a network stream
+
+   @param in input structure
+   @param buffer network stream
+   @param maxlen buffer limit
+   @return buffer length
+*/
+int serial_association (ASSOCIATION_t *in, uint8_t *buffer, int maxlen);
+
+/**
+   @ingroup ASSOCIATION
+
+   Deserial association type fields from a network stream
+
+   @param buffer network stream
+   @param len buffer length
+   @param out output structure
+   @return 0 on success
+*/
+int deserial_association (uint8_t *buffer, int len, ASSOCIATION_t *out);
+
+/**
+   @ingroup ASSOCIATION
+
+   Check two association structures field by field
+
+   @param first first structure
+   @param second second structure
+   @param fields field mask to be checked
+   @return 0 on success
+*/
+int check_association (ASSOCIATION_t *first, ASSOCIATION_t *second, int fields);
+
+__END_DECLS
+
+#endif /* __ASSOCIATION_H__ */
+
+/* vim: set ts=4 sw=4 si et: */
diff --git a/pdu_channel.c b/pdu_channel.c
deleted file mode 100644 (file)
index 90dd888..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-  File name        : pdu_channel.c
-  Projet           : MERLIN
-  Date of creation : 2025/04/08
-  Version          : 1.0
-  Copyright        : Thales SIX
-  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
-
-  Description      : This file contains functions for channel pdu
-
-  History          :
-  - initial version
-*/
-
-#include <stdint.h>
-
-#include "parse.h"
-
-#include "pdu_channel.h"
-
-int parse_channel (char *line, CHANNEL_t *out)
-{
-    BEGIN_PARSE (line)
-    PARSE_INT ("CHANNELID", out->channel_id)
-    PARSE_INT ("KEYID", out->key_id)
-    END_PARSE ()
-}
-
-int format_channel (CHANNEL_t *in, char *buffer, int maxlen)
-{
-    BEGIN_FORMAT (buffer, maxlen)
-    FORMAT_INT ("CHANNELID", in->channel_id)
-    FORMAT_INT ("KEYID", in->key_id)
-    END_FORMAT ()
-}
-
-int serial_channel (CHANNEL_t *in, uint8_t *buffer, int maxlen)
-{
-    BEGIN_SERIAL (buffer, maxlen)
-    SERIAL_INT ("CHANNELID", in->channel_id)
-    SERIAL_INT ("KEYID", in->key_id)
-    END_SERIAL ()
-}
-
-int deserial_channel (uint8_t *buffer, int len, CHANNEL_t *out)
-{
-    BEGIN_DESERIAL (buffer, len)
-    DESERIAL_INT ("CHANNELID", out->channel_id)
-    DESERIAL_INT ("KEYID", out->key_id)
-    END_DESERIAL ()
-}
-
-int check_channel (CHANNEL_t *first, CHANNEL_t *second, int fields)
-{
-    BEGIN_CHECK (fields)
-    CHECK_INT ("CHANNELID", first->channel_id, second->channel_id)
-    CHECK_INT ("KEYID", first->key_id, second->key_id)
-    END_CHECK ()
-}
-
-/* vim: set ts=4 sw=4 si et: */
diff --git a/pdu_channel.h b/pdu_channel.h
deleted file mode 100644 (file)
index 8153682..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-  File name        : pdu_channel.h
-  Projet           : MERLIN
-  Date of creation : 2025/04/08
-  Version          : 1.0
-  Copyright        : Thales SIX
-  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
-
-  Description      : This file contains functions for channel pdu
-
-  History          :
-  - initial version
-*/
-
-#ifndef __CHANNEL_H__
-#define __CHANNEL_H__
-
-#include <stdint.h>
-#include <sys/cdefs.h>
-
-#include "def.h"
-
-__BEGIN_DECLS
-
-/**
-    @defgroup CHANNEL
-    @ingroup MESSAGES
-*/
-
-/**
-   @ingroup CHANNEL
-
-   Channel type
-*/
-typedef struct {
-    uint8_t channel_id; /**< channel index */
-    uint8_t key_id; /**< key index */
-} CHANNEL_t;
-
-/**
-   @ingroup CHANNEL
-
-   Parse a string containing some channel type fields
-
-   @param line string to analyse
-   @param out output structure
-   @return 0 on success
-*/
-int parse_channel (char *line, CHANNEL_t *out);
-
-/**
-   @ingroup CHANNEL
-
-   Format channel type fields into a string
-
-   @param in input structure
-   @param buffer output string
-   @param maxlen buffer limit
-   @return 0 on success
-*/
-int format_channel (CHANNEL_t *in, char *buffer, int maxlen);
-
-/**
-   @ingroup CHANNEL
-
-   Serial channel type fields into a network stream
-
-   @param in input structure
-   @param buffer network stream
-   @param maxlen buffer limit
-   @return buffer length
-*/
-int serial_channel (CHANNEL_t *in, uint8_t *buffer, int maxlen);
-
-/**
-   @ingroup CHANNEL
-
-   Deserial channel type fields from a network stream
-
-   @param buffer network stream
-   @param len buffer length
-   @param out output structure
-   @return 0 on success
-*/
-int deserial_channel (uint8_t *buffer, int len, CHANNEL_t *out);
-
-/**
-   @ingroup CHANNEL
-
-   Check two channel structures field by field
-
-   @param first first structure
-   @param second second structure
-   @param fields field mask to be checked
-   @return 0 on success
-*/
-int check_channel (CHANNEL_t *first, CHANNEL_t *second, int fields);
-
-__END_DECLS
-
-#endif /* __CHANNEL_H__ */
-
-/* vim: set ts=4 sw=4 si et: */