#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
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>
--- /dev/null
+/*
+ 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: */
--- /dev/null
+/*
+ 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: */
+++ /dev/null
-/*
- 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: */
+++ /dev/null
-/*
- 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: */