reordering files in directory
authorMazet Laurent <laurent.mazet@thalesgroup.com>
Wed, 7 May 2025 13:57:47 +0000 (15:57 +0200)
committerMazet Laurent <laurent.mazet@thalesgroup.com>
Wed, 7 May 2025 14:08:51 +0000 (16:08 +0200)
40 files changed:
README.md
cryptomod.c
morep_simulator.c [deleted file]
morep_valid.c
script-bypass-si.eth [deleted file]
script-bypass.eth [deleted file]
script-control-si.eth [deleted file]
script-control.eth [deleted file]
script-cross_crypto-error.eth [deleted file]
script-cross_crypto.eth [deleted file]
script-cross_crypto_b2r-si.eth [deleted file]
script-cross_crypto_r2b-si.eth [deleted file]
script-lo.eth [deleted file]
script-local_crypto-si.eth [deleted file]
script-local_crypto.eth [deleted file]
script-prng-si.eth [deleted file]
script-prng.eth [deleted file]
script-provisioning-si.eth [deleted file]
script-provisioning.eth [deleted file]
script-rx.eth [deleted file]
script-tx.eth [deleted file]
simulator.c [new file with mode: 0644]
simulator/script-simulator.sh
test/script-bypass-si.eth [new file with mode: 0644]
test/script-bypass.eth [new file with mode: 0644]
test/script-control-si.eth [new file with mode: 0644]
test/script-control.eth [new file with mode: 0644]
test/script-cross_crypto-error.eth [new file with mode: 0644]
test/script-cross_crypto.eth [new file with mode: 0644]
test/script-cross_crypto_b2r-si.eth [new file with mode: 0644]
test/script-cross_crypto_r2b-si.eth [new file with mode: 0644]
test/script-lo.eth [new file with mode: 0644]
test/script-local_crypto-si.eth [new file with mode: 0644]
test/script-local_crypto.eth [new file with mode: 0644]
test/script-prng-si.eth [new file with mode: 0644]
test/script-prng.eth [new file with mode: 0644]
test/script-provisioning-si.eth [new file with mode: 0644]
test/script-provisioning.eth [new file with mode: 0644]
test/script-rx.eth [new file with mode: 0644]
test/script-tx.eth [new file with mode: 0644]

index ae56948c3a5d74357650bde0658387a74b10fd7e..de1d8e2f95544abeaccfa3c21b9da8a1093e0558 100644 (file)
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ With a simple set of macros and functions, the library eases the implementation
 ### Usage
 
 ```bash
-./morep_simulator.exe \
+./simulator.exe \
     -l script-cross_crypto.log -V 3 \
     -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 \
     script-cross_crypto.eth 
index a726369df30bcc20cdebf7eb581b09af50de92f0..de3551a3616fc77af8091352d9b0284138909358 100644 (file)
@@ -12,7 +12,7 @@
   - initial version
 */
 
-/* depend: morep_simulator.exe */
+/* depend: simulator.exe */
 /* cflags: */
 /* linker: core.o function.o morep.o parse.o pdu_channel.o pdu_encrypted_data.o pdu_prng_param.o pdu_status.o pdu_clear_data.o pdu_key.o pdu_raw_data.o task.o */
 
@@ -628,24 +628,24 @@ int main (int argc, char **argv)
 /* test: cryptomod.exe -v | grep 'morep verbose level not specified' */
 /* test: cryptomod.exe -V | grep 'cryptomod verbose level not specified' */
 
-/* test: cryptomod.exe -V 3 -l script-cross_crypto_r2b-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-cross_crypto_r2b-si.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0819 -r lo://00:00:00:00:00:00/0829 script-cross_crypto_r2b-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
-/* test: cryptomod.exe -V 3 -l script-cross_crypto_b2r-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-cross_crypto_b2r-si.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0839 -r lo://00:00:00:00:00:00/0809 script-cross_crypto_b2r-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-cross_crypto_r2b-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-cross_crypto_r2b-si.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0819 -r lo://00:00:00:00:00:00/0829 test/script-cross_crypto_r2b-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-cross_crypto_b2r-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-cross_crypto_b2r-si.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0839 -r lo://00:00:00:00:00:00/0809 test/script-cross_crypto_b2r-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-local_crypto_black-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-local_crypto_black-si.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/083a -r lo://00:00:00:00:00:00/082a script-local_crypto-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-local_crypto_black-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-local_crypto_black-si.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/083a -r lo://00:00:00:00:00:00/082a test/script-local_crypto-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-local_crypto_red-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-local_crypto_red-si.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/081a -r lo://00:00:00:00:00:00/080a script-local_crypto-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-local_crypto_red-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-local_crypto_red-si.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/081a -r lo://00:00:00:00:00:00/080a test/script-local_crypto-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-provisioning-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-provisioning-si.log -s PROVISIONING -t lo://00:00:00:00:00:00/081b -r lo://00:00:00:00:00:00/080b script-provisioning-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-provisioning-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-provisioning-si.log -s PROVISIONING -t lo://00:00:00:00:00:00/081b -r lo://00:00:00:00:00:00/080b test/script-provisioning-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-prng_black-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-prng_black-si.log -s PRNG -t lo://00:00:00:00:00:00/083c -r lo://00:00:00:00:00:00/082c script-prng-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-prng_black-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-prng_black-si.log -s PRNG -t lo://00:00:00:00:00:00/083c -r lo://00:00:00:00:00:00/082c test/script-prng-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-prng_red-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-prng_red-si.log -s PRNG -t lo://00:00:00:00:00:00/081c -r lo://00:00:00:00:00:00/080c script-prng-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-prng_red-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-prng_red-si.log -s PRNG -t lo://00:00:00:00:00:00/081c -r lo://00:00:00:00:00:00/080c test/script-prng-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-bypass_b2r-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-bypass_b2r-si.log -s BYPASS -t lo://00:00:00:00:00:00/083d -r lo://00:00:00:00:00:00/080d script-bypass-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-bypass_b2r-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-bypass_b2r-si.log -s BYPASS -t lo://00:00:00:00:00:00/083d -r lo://00:00:00:00:00:00/080d test/script-bypass-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-bypass_r2b-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-bypass_r2b-si.log -s BYPASS -t lo://00:00:00:00:00:00/081d -r lo://00:00:00:00:00:00/082d script-bypass-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-bypass_r2b-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-bypass_r2b-si.log -s BYPASS -t lo://00:00:00:00:00:00/081d -r lo://00:00:00:00:00:00/082d test/script-bypass-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
 
-/* test: cryptomod.exe -V 3 -l script-control-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-control-si.log -s CONTROL -t lo://00:00:00:00:00:00/081e -r lo://00:00:00:00:00:00/080e script-control-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
-/* test: cryptomod.exe -V 3 -l script-control-cm.log & pid=$!; sleep 1; ./morep_simulator.exe -l script-control-si.log -s CONTROL -t lo://00:00:00:00:00:00/081e -r lo://00:00:00:00:00:00/080e script-control-si.eth; sleep 1;kill -TERM $pid 2>&1 | grep "No such process" */
+/* test: cryptomod.exe -V 3 -l script-control-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-control-si.log -s CONTROL -t lo://00:00:00:00:00:00/081e -r lo://00:00:00:00:00:00/080e test/script-control-si.eth; rc=$?; sleep 1; kill -TERM $pid; test $rc -eq 0 */
+/* test: cryptomod.exe -V 3 -l script-control-cm.log & pid=$!; sleep 1; ./simulator.exe -l script-control-si.log -s CONTROL -t lo://00:00:00:00:00:00/081e -r lo://00:00:00:00:00:00/080e test/script-control-si.eth; sleep 1;kill -TERM $pid 2>&1 | grep "No such process" */
 
 /* vim: set ts=4 sw=4 si et: */
diff --git a/morep_simulator.c b/morep_simulator.c
deleted file mode 100644 (file)
index fa9eabd..0000000
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
-  File name        : morep_simulator.c
-  Projet           : MERLIN
-  Date of creation : 2025/04/09
-  Version          : 1.0
-  Copyright        : Thales SIX
-  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
-
-  Description      : MOREP simulator
-
-  History          :
-  - initial version
-*/
-
-/* depend: */
-/* cflags: */
-/* linker: morep.o parse.o pdu_channel.o pdu_encrypted_data.o pdu_prng_param.o pdu_status.o pdu_clear_data.o pdu_key.o pdu_raw_data.o */
-
-#include <errno.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "def.h"
-#include "morep.h"
-#include "parse.h"
-#include "pdu_channel.h"
-#include "pdu_clear_data.h"
-#include "pdu_encrypted_data.h"
-#include "pdu_key.h"
-#include "pdu_prng_param.h"
-#include "pdu_raw_data.h"
-#include "pdu_status.h"
-#include "simulator.h"
-#include "verbose.h"
-
-char *progname = NULL;
-
-int stop = 0;
-
-DECLARE_VERBOSE_LEVEL (morep, INFO);
-DECLARE_VERBOSE_LEVEL (simul, INFO);
-
-#define BUFMAX 4096
-
-/* definition of all messages */
-message_t message_list[] = {
-
-    /* Cross cryptographic service */
-    {"ENCRYPT_CROSS_ASYNC", cross_crypto_e, 0x00, clear_data_e},
-    {"ENCRYPTED_CROSS_ASYNC", cross_crypto_e, 0x01, encrypted_data_e},
-    {"DECRYPT_CROSS_ASYNC", cross_crypto_e, 0x02, encrypted_data_e},
-    {"DECRYPTED_CROSS_ASYNC", cross_crypto_e, 0x03, clear_data_e},
-
-    /* Local cryptographic service */
-    {"ENCRYPT_LOCAL_REQ", local_crypto_e, 0x00, clear_data_e},
-    {"ENCRYPTED_LOCAL_RESP", local_crypto_e, 0x01, encrypted_data_e},
-    {"DECRYPT_LOCAL_REQ", local_crypto_e, 0x02, encrypted_data_e},
-    {"DECRYPTED_LOCAL_RESP", local_crypto_e, 0x03, clear_data_e},
-
-    /* Provisioning service */
-    {"LOAD_KEY_REQ", provisioning_e, 0x00, key_e},
-    {"LOAD_KEY_RESP", provisioning_e, 0x01, status_e},
-    {"UNLOAD_KEY_REQ", provisioning_e, 0x02, key_e},
-    {"UNLOAD_KEY_RESP", provisioning_e, 0x03, status_e},
-    {"ERASE_KEY_REQ", provisioning_e, 0x04, key_e},
-    {"ERASE_KEY_RESP", provisioning_e, 0x05, status_e},
-    {"ASSOCIATE_CHANNEL_REQ", provisioning_e, 0x06, channel_e},
-    {"ASSOCIATE_CHANNEL_RESP", provisioning_e, 0x07, status_e},
-    {"DISSOCIATE_CHANNEL_REQ", provisioning_e, 0x08, channel_e},
-    {"DISSOCIATE_CHANNEL_RESP", provisioning_e, 0x09, status_e},
-
-    /* Bypass service */
-    {"BYPASS_CROSS_ASYNC", bypass_e, 0x00, raw_data_e},
-    {"BYPASSED_CROSS_ASYNC", bypass_e, 0x01, raw_data_e},
-
-    /* PRNG service */
-    {"RANDOM_REQ", prng_e, 0x00, prng_param_e},
-    {"RANDOM_RESP", prng_e, 0x01, raw_data_e},
-
-    /* Control service */
-    {"STATUS_REQ", control_e, 0x00, nopdu_e},
-    {"STATUS_RESP", control_e, 0x01, status_e},
-    {"AUTHENTICATION_REQ", control_e, 0x02, raw_data_e},
-    {"AUTHENTICATION_RESP", control_e, 0x03, raw_data_e},
-    {"REBOOT_REQ", control_e, 0x04, nopdu_e},
-    {"REBOOT_RESP", control_e, 0x05, status_e},
-    {"ZEROIZE_REQ", control_e, 0x06, nopdu_e},
-    {"ZEROIZE_RESP", control_e, 0x07, status_e},
-    {"LOCK_CRYPTO_REQ", control_e, 0xFE, nopdu_e},
-    {"LOCK_CRYPTO_RESP", control_e, 0xFF, status_e},
-
-    /* End of list */
-    {"", noserv_e, 0x00, undef_pdu_e}
-};
-
-/* list of communcation chanels */
-#define MAXCOMMS 32
-comm_t comm_list[MAXCOMMS] = {0};
-
-/* definition of all services */
-service_t service_list[] = {
-    {"CROSS_CRYPTO_BLACK", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
-    {"CROSS_CRYPTO_RED", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
-    {"CROSS_CRYPTO", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
-    {"LOCAL_CRYPTO_BLACK", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
-    {"LOCAL_CRYPTO_RED", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
-    {"LOCAL_CRYPTO", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
-    {"PROVISIONING_RED", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
-    {"PROVISIONING", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
-    {"PRNG_BLACK", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
-    {"PRNG_RED", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
-    {"PRNG", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
-    {"BYPASS_BLACK", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
-    {"BYPASS_RED", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
-    {"BYPASS", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
-    {"CONTROL_RED", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
-    {"CONTROL", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
-    {"", noserv_e, {-1, 0, "0000"}, {-1, 1, "0000"}}
-};
-
-/* signal handler */
-void sig_handler (int sig)
-{
-    switch (sig) {
-    case SIGINT:
-        //stop = 1;
-        exit (0);
-        break;
-    case SIGTERM:
-        exit (0);
-        break;
-    }
-}
-
-/* read a file */
-char *read_stream (FILE *sd, int *plen)
-{
-    VERBOSE (simul, TRACE, PRINTF ("read_stream\n"));
-
-    /* read and store */
-    char *buffer = NULL;
-    size_t size = 0;
-    int blocklen = 0;
-    int length = 0;
-    do {
-        size += BUFMAX + (size == 0);
-        buffer = (char *) realloc (buffer, size);
-        memset (buffer + size - BUFMAX - 1, 0, BUFMAX + 1);
-        blocklen = fread (buffer + size - BUFMAX - 1, 1, BUFMAX, sd);
-        length += blocklen;
-    } while (blocklen > 0);
-
-    /* check size */
-    VERBOSE (simul, DEBUG, PRINTF ("read length: %d\n", length));
-    if (length == 0) {
-        free (buffer);
-        buffer = NULL;
-    }
-
-    if (plen) {
-        *plen = length;
-    }
-
-    return buffer;
-}
-
-/* main function */
-int main (int argc, char **argv)
-{
-    char *filename = NULL;
-    char *logname = NULL;
-    char *servname = NULL;
-    char *tmp = NULL;
-    char *url = NULL;
-    int mode = -1;
-    int nbcomms = 0;
-
-    /* get basename */
-    char *ptr = progname = argv[0];
-    while (*ptr) {
-        if ((*ptr == '/') || (*ptr == '\\')) {
-           progname = ptr + 1;
-        }
-        ptr++;
-    }
-
-    /* process argument */
-    while (argc-- > 1) {
-        char *arg = *(++argv);
-        if (arg[0] != '-') {
-            filename = arg;
-            continue;
-        }
-        char c = arg[1];
-        switch (c) {
-        case 'l':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: log file not specified\n", progname));
-                return 1;
-            }
-            logname = arg;
-            break;
-        case 'r':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: receiver url not specified\n", progname));
-                return 1;
-            }
-            url = arg;
-            mode = 0;
-            break;
-        case 's':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: service not specified\n", progname));
-                return 1;
-            }
-            servname = arg;
-            break;
-        case 't':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: transmitter url not specified\n", progname));
-                return 1;
-            }
-            url = arg;
-            mode = 1;
-            break;
-        case 'v':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: morep verbose level not specified\n", progname));
-                return 1;
-            }
-            CHANGE_VERBOSE_LEVEL (morep, atoi (arg));
-            break;
-        case 'V':
-            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
-            if (arg == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("%s: simulator verbose level not specified\n", progname));
-                return 1;
-            }
-            CHANGE_VERBOSE_LEVEL (simul, atoi (arg));
-            break;
-        case 'h':
-        default:
-            printf ("usage: %s [-h] [-l log] [-r url] [-s serv] [-t url] [-v level] [-V level] [file]\n", progname);
-            return (c != 'h');
-        }
-
-        /* init communication channel */
-        if (mode != -1) {
-            if (nbcomms < MAXCOMMS) {
-                int morep = MOREP_Connect (url);
-                if (morep >= 0) {
-                    (comm_list + nbcomms)->morep = morep;
-                    (comm_list + nbcomms)->mode = mode;
-                    (comm_list + nbcomms)->etype = strrchr (url, '/') + 1;
-                    for (int i = 0; (service_list + i)->service_id != noserv_e; i++) {
-                        service_t *s = service_list + i;
-                        if (s && servname && (strcmp (s->name, servname) == 0)) {
-                            memcpy ((mode == 0) ? &(s->rx) : &(s->tx), comm_list + nbcomms, sizeof (comm_t));
-                            break;
-                        }
-                    }
-                    nbcomms++;
-                } else {
-                    VERBOSE (simul, ERROR, PRINTF ("can't connect on url '%s'\n", url));
-                    return -1;
-                }
-            } else {
-                VERBOSE (simul, ERROR, PRINTF ("no more communication channel avaliable (%d)\n", nbcomms));
-                return -1;
-            }
-            mode = -1;
-        }
-    }
-
-    /* checks */
-    if (nbcomms == 0) {
-        VERBOSE (simul, ERROR, PRINTF ("no communication channel\n"));
-        return -1;
-    }
-
-    /* open script file */
-    FILE *fid = stdin;
-    if (filename != NULL) {
-        fid = fopen (filename, "r");
-        if (fid == NULL) {
-            VERBOSE (simul, ERROR, PRINTF ("can't open script file '%s' for reading\n", filename));
-            return -1;
-        }
-    }
-    char *script = read_stream (fid, NULL);
-    if (fid != stdin) {
-        fclose (fid);
-    }
-    if (script == NULL) {
-        VERBOSE (simul, ERROR, PRINTF ("no script read\n"));
-        return -1;
-    }
-
-    /* open log file */
-    FILE *log = NULL;
-    if (logname != NULL) {
-        if (strcmp (logname, "-") == 0) {
-            log = stdout;
-        } else {
-            log = fopen (logname, "w");
-            if (log == NULL) {
-                VERBOSE (simul, ERROR, PRINTF ("can't open log file '%s' for writing\n", logname));
-                return -1;
-            }
-        }
-    }
-
-    /* signals */
-    signal(SIGINT, sig_handler);
-    signal(SIGTERM, sig_handler);
-
-    /* main loop */
-    int rc = 0;
-    ptr = script;
-    while (*ptr != '\0') {
-
-        /* read line */
-        char *line = ptr;
-        TEST_CHARS (ptr, "\n\r", 1);
-        *ptr++ = '\0';
-
-        /* skip space, avoid empty line and comments */
-        TEST_CHARS (line, " \t", 0);
-        if ((*line == '\0') || (*line == '#')) {
-            continue;
-        }
-
-        /* special keywords */
-        if (strncmp (line, "SLEEP", 5) == 0) {
-            int duration = atoi (line + 5);
-            VERBOSE (simul, INFO, PRINTF ("sleep %dms\n", duration));
-            usleep (duration * 1000);
-            continue;
-        }
-
-        /* analyse line */
-        mode = (*line == 'R') ? 0 : (*line == 'T') ? 1 : -1;
-        if (mode == -1) {
-            VERBOSE (simul, WARNING, PRINTF ("unrecognize line '%s'\n", line));
-            continue;
-        }
-        int offset = 1;
-
-        /* skip space */
-        tmp = line + offset;
-        TEST_CHARS (tmp, " \t:", 0);
-        offset = tmp - line;
-
-        comm_t *comm = NULL;
-        service_t *serv = NULL;
-        /* find MOREP by service name */
-        for (int i = 0; ((service_list + i)->service_id != noserv_e) && (serv == NULL); i++) {
-            service_t *s = service_list + i;
-            VERBOSE (simul, TRACE, PRINTF ("test %c[%s]\n", *line, s->name));
-            if (strncmp (line + offset, s->name, strlen (s->name)) == 0) {
-                comm = (mode == 0) ? &(s->rx) : &(s->tx);
-                serv = s;
-                offset += strlen (s->name);
-            }
-        }
-        /* find MOREP by ethertype */
-        for (int j = 0; (j < nbcomms) && (comm == NULL); j++) {
-            comm_t *c = comm_list + j;
-            VERBOSE (simul, TRACE, PRINTF ("test %c[%s]\n", (c->mode == 0) ? 'R' : 'T', c->etype));
-            if ((strncmp (line + offset, c->etype, strlen (c->etype)) == 0) && (c->mode == mode)) {
-                comm = c;
-                for (int i = 0; ((service_list + i)->service_id != noserv_e) && (serv == NULL); i++) {
-                    service_t *s = service_list + i;
-                    c = (mode == 0) ? &(s->rx) : &(s->tx);
-                    if (strncmp (c->etype, comm->etype, strlen (comm->etype)) == 0) {
-                        serv = s;
-                    }
-                }
-                offset += strlen (c->etype);
-            }
-        }
-        /* check media and service */
-        if ((comm == NULL) || (serv == NULL)) {
-            VERBOSE (simul, TRACE, PRINTF ("no morep found '%s'\n", line));
-            continue;
-        }
-        VERBOSE (simul, DEBUG, PRINTF ("select %c[%s]\n", (comm->mode == 0) ? 'R' : 'T', serv->name));
-
-        /* skip space */
-        tmp = line + offset;
-        TEST_CHARS (tmp, " \t", 0);
-        offset = tmp - line;
-
-        message_t *msg = NULL;
-        /* get message type by name */
-        for (int i = 0; ((message_list + i)->service_id != noserv_e) && (msg == NULL); i++) {
-            message_t *m = message_list + i;
-            VERBOSE (simul, TRACE, PRINTF ("test %s\n", m->name));
-            if (strncmp (line + offset, m->name, strlen (m->name)) == 0) {
-                msg = m;
-                offset += strlen (m->name);
-            }
-        }
-        /* get message type by id */
-        if (msg == NULL) {
-            if (strncmp (line + offset, "MSG", 3) != 0) {
-                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
-                continue;
-            }
-            tmp = line + offset + 3;
-            TEST_CHARS (tmp, " \t=", 0);
-            uint8_t msgtype = strtol (tmp, &tmp, 0);
-            offset = tmp - line;
-            if ((*tmp != ' ') && (*tmp != '\t')) {
-                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
-                continue;
-            }
-            /* find message */
-            for (int i = 0; ((message_list + i)->service_id != noserv_e) && (msg == NULL); i++) {
-                message_t *m = message_list + i;
-                if ((m->service_id == serv->service_id) && (m->msgtype == msgtype)) {
-                    msg = m;
-                }
-            }
-            /* avoid null pointer */
-            if (msg == NULL) {
-                VERBOSE (simul, WARNING, PRINTF ("can't find msgtype %d for service %s\n", msgtype, serv->name));
-                continue;
-            }
-
-        }
-
-        /* check message and service */
-        if (serv->service_id != msg->service_id) {
-            VERBOSE (simul, WARNING, PRINTF ("message %s is not allowed for service %s (line '%s')\n", msg->name, serv->name, line));
-            continue;
-        }
-        VERBOSE (simul, DEBUG, PRINTF ("%s message %s\n", (comm->mode == 0) ? "waiting" : "sending", msg->name));
-
-        CHANNEL_t pdu_channel = {0};
-        CLEAR_DATA_t pdu_clear_data = {0};
-        ENCRYPTED_DATA_t pdu_encrypted_data = {0};
-        KEY_t pdu_key = {0};
-        PRNG_PARAM_t pdu_prng_param = {0};
-        RAW_DATA_t pdu_raw_data = {0};
-        STATUS_t pdu_status = {0};
-
-        int seqnum = -1;
-        int len = 0;
-        pdu_t pdu;
-        if (mode == 1) { /* transmit */
-
-            /* parse message */
-            pdu = msg->pdu;
-            switch (pdu) {
-            case nopdu_e:
-                break;
-            case channel_e:
-                parse_channel (line + offset, &pdu_channel);
-                break;
-            case clear_data_e:
-                parse_clear_data (line + offset, &pdu_clear_data);
-                break;
-            case encrypted_data_e:
-                parse_encrypted_data (line + offset, &pdu_encrypted_data);
-                break;
-            case key_e:
-                parse_key (line + offset, &pdu_key);
-                break;
-            case prng_param_e:
-                parse_prng_param (line + offset, &pdu_prng_param);
-                break;
-            case raw_data_e:
-                parse_raw_data (line + offset, &pdu_raw_data);
-                break;
-            case status_e:
-                parse_status (line + offset, &pdu_status);
-                break;
-            default:
-                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
-                continue;
-            }
-
-            /* send message */
-            uint8_t payload[MOREP_PAYLOAD] = {0};
-            switch (pdu) {
-            case channel_e:
-                len = serial_channel (&pdu_channel, payload, sizeof (payload));
-                break;
-            case clear_data_e:
-                len = serial_clear_data (&pdu_clear_data, payload, sizeof (payload));
-                break;
-            case encrypted_data_e:
-                len = serial_encrypted_data (&pdu_encrypted_data, payload, sizeof (payload));
-                break;
-            case key_e:
-                len = serial_key (&pdu_key, payload, sizeof (payload));
-                break;
-            case prng_param_e:
-                len = serial_prng_param (&pdu_prng_param, payload, sizeof (payload));
-                break;
-            case raw_data_e:
-                len = serial_raw_data (&pdu_raw_data, payload, sizeof (payload));
-                break;
-            case status_e:
-                len = serial_status (&pdu_status, payload, sizeof (payload));
-                break;
-            default:
-                len = 0;
-            }
-            seqnum = MOREP_Send (comm->morep, msg->msgtype, payload, len);
-            VERBOSE (simul, INFO, PRINTF ("T:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name));
-
-        } else { /* receive */
-            message_t *exp_msg = msg;
-
-            uint8_t msgtype = 0;
-            uint8_t payload[MOREP_PAYLOAD] = {0};
-            seqnum = MOREP_Receive (comm->morep, &msgtype, payload, &len);
-
-            /* check msg/pdu type */
-            pdu = undef_pdu_e;
-            msg = NULL;
-            for (int i = 0; ((message_list + i)->service_id) && (pdu == undef_pdu_e); i++) {
-                message_t *m = message_list + i;
-                if ((m->service_id == serv->service_id) && (m->msgtype == msgtype)) {
-                    pdu = m->pdu;
-                    msg = m;
-                }
-            }
-            /* check msg type */
-            if (msg == NULL) {
-                VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] message type is not allowed for this service\n", serv->name, comm->etype, seqnum, msgtype, len, pdu));
-                continue;
-            }
-            if (exp_msg->msgtype != msg->msgtype) {
-                VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] expected message type %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, exp_msg->name));
-                continue;
-            }
-            VERBOSE (simul, INFO, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name));
-
-            /* deserialize message */
-            switch (pdu) {
-            case nopdu_e:
-                break;
-            case channel_e:
-                deserial_channel (payload, len, &pdu_channel);
-                break;
-            case clear_data_e:
-                deserial_clear_data (payload, len, &pdu_clear_data);
-                break;
-            case encrypted_data_e:
-                deserial_encrypted_data (payload, len, &pdu_encrypted_data);
-                break;
-            case key_e:
-                deserial_key (payload, len, &pdu_key);
-                break;
-            case prng_param_e:
-                deserial_prng_param (payload, len, &pdu_prng_param);
-                break;
-            case raw_data_e:
-                deserial_raw_data (payload, len, &pdu_raw_data);
-                break;
-            case status_e:
-                deserial_status (payload, len, &pdu_status);
-                break;
-            default:
-                VERBOSE (simul, WARNING, PRINTF ("can't deserialize message %s\n", msg->name));
-                continue;
-            }
-
-            /* check received pdu */
-            if (pdu == channel_e) {
-                CHANNEL_t exp_pdu_channel = {0};
-                int check_fields = parse_channel (line + offset, &exp_pdu_channel);
-                check_channel (&pdu_channel, &exp_pdu_channel, check_fields);
-            } else if (pdu == clear_data_e) {
-                CLEAR_DATA_t exp_pdu_clear_data = {0};
-                int check_fields = parse_clear_data (line + offset, &exp_pdu_clear_data);
-                check_clear_data (&pdu_clear_data, &exp_pdu_clear_data, check_fields);
-            } else if (pdu == encrypted_data_e) {
-                ENCRYPTED_DATA_t exp_pdu_encrypted_data = {0};
-                int check_fields = parse_encrypted_data (line + offset, &exp_pdu_encrypted_data);
-                check_encrypted_data (&pdu_encrypted_data, &exp_pdu_encrypted_data, check_fields);
-            } else if (pdu == key_e) {
-                KEY_t exp_pdu_key = {0};
-                int check_fields = parse_key (line + offset, &exp_pdu_key);
-                check_key (&pdu_key, &exp_pdu_key, check_fields);
-            } else if (pdu == prng_param_e) {
-                PRNG_PARAM_t exp_pdu_prng_param = {0};
-                int check_fields = parse_prng_param (line + offset, &exp_pdu_prng_param);
-                check_prng_param (&pdu_prng_param, &exp_pdu_prng_param, check_fields);
-            } else if (pdu == raw_data_e) {
-                RAW_DATA_t exp_pdu_raw_data = {0};
-                int check_fields = parse_raw_data (line + offset, &exp_pdu_raw_data);
-                check_raw_data (&pdu_raw_data, &exp_pdu_raw_data, check_fields);
-            } else if (pdu == status_e) {
-                STATUS_t exp_pdu_status = {0};
-                int check_fields = parse_status (line + offset, &exp_pdu_status);
-                check_status (&pdu_status, &exp_pdu_status, check_fields);
-            }
-
-        }
-
-        /* log message */
-        if (log) {
-            fprintf (log, "%c:%s[%s] [SEG=%d MSG=%d LEN=%d PDU=%d] %s", (mode == 0) ? 'R' : 'T',
-                     serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name);
-            char buffer[MOREP_PAYLOAD * 3 + 256] = {0};
-            switch (pdu) {
-            case nopdu_e:
-                break;
-            case channel_e:
-                format_channel (&pdu_channel, buffer, sizeof (buffer));
-                break;
-            case clear_data_e:
-                format_clear_data (&pdu_clear_data, buffer, sizeof (buffer));
-                break;
-            case encrypted_data_e:
-                format_encrypted_data (&pdu_encrypted_data, buffer, sizeof (buffer));
-                break;
-            case key_e:
-                format_key (&pdu_key, buffer, sizeof (buffer));
-                break;
-            case prng_param_e:
-                format_prng_param (&pdu_prng_param, buffer, sizeof (buffer));
-                break;
-            case raw_data_e:
-                format_raw_data (&pdu_raw_data, buffer, sizeof (buffer));
-                break;
-            case status_e:
-                format_status (&pdu_status, buffer, sizeof (buffer));
-                break;
-            default:
-                snprintf (buffer, sizeof (buffer), "unknown payload");
-            }
-            fprintf (log, "%s\n", buffer);
-        }
-    }
-
-    /* cleaning */
-    free (script);
-    while (nbcomms) {
-        MOREP_Close (--nbcomms);
-    }
-    if ((log) && (log != stdout)) {
-        fclose (log);
-    }
-
-    return rc + GET_VERBOSE_ERRORS (morep) + GET_VERBOSE_ERRORS (simul);
-}
-
-/* test: morep_simulator.exe -h | grep usage */
-/* test: morep_simulator.exe -l | grep 'log file not specified' */
-/* test: morep_simulator.exe -r | grep 'url not specified' */
-/* test: morep_simulator.exe -s | grep 'service not specified' */
-/* test: morep_simulator.exe -t | grep 'url not specified' */
-/* test: morep_simulator.exe -v | grep 'morep verbose level not specified' */
-/* test: morep_simulator.exe -V | grep 'simulator verbose level not specified' */
-/* test: morep_simulator.exe -l - -t lo://00:00:00:00:00:00/0809 -v 4 script-lo.eth */
-/* test: morep_simulator.exe -l script-cross_crypto-error.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-cross_crypto-error.eth -V 3; test $? -ne 0 */
-/* test: morep_simulator.exe -l script-cross_crypto-error.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-cross_crypto-error.eth -V 3 | grep WARNING */
-/* test: morep_simulator.exe -l script-cross_crypto.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-cross_crypto.eth -V 3 */
-/* test: morep_simulator.exe -l script-local_crypto.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-local_crypto.eth -V 3 */
-/* test: morep_simulator.exe -l script-provisioning.log -s PROVISIONING -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-provisioning.eth -V 3 */
-/* test: morep_simulator.exe -l script-prng.log -s PRNG -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-prng.eth -V 3 */
-/* test: morep_simulator.exe -l script-bypass.log -s BYPASS -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-bypass.eth -V 3 */
-/* test: morep_simulator.exe -l script-control.log -s CONTROL -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-control.eth -v 3 -V 3 */
-
-/* vim: set ts=4 sw=4 si et: */
index 40602cdacb8826d29ad6b10944c3d3ab04bbb824..87d4f15b2a9ca5f9ed8057e1a2df526fcfe5cd9e 100644 (file)
@@ -353,7 +353,7 @@ int main (int argc, char **argv)
 /* test: morep_valid.exe -r 2>&1 | grep 'url not specified' */
 /* test: morep_valid.exe -t 2>&1 | grep 'url not specified' */
 /* test: morep_valid.exe -l 2>&1 | grep 'log file not specified' */
-/* test: morep_valid.exe -l - -t lo://00:00:00:00:00:00/0808 -v 4 script-lo.eth */
-/* test: morep_valid.exe -l script.log -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 script-lo.eth */
+/* test: morep_valid.exe -l - -t lo://00:00:00:00:00:00/0808 -v 4 test/script-lo.eth */
+/* test: morep_valid.exe -l script.log -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-lo.eth */
 
 /* vim: set ts=4 sw=4 si et: */
diff --git a/script-bypass-si.eth b/script-bypass-si.eth
deleted file mode 100644 (file)
index 58ae363..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Bypass test script
-
-SLEEP 500
-
-T:BYPASS BYPASS_CROSS_ASYNC DATA=@simulator/plaintext.txt
-R:BYPASS BYPASSED_CROSS_ASYNC DATA=@simulator/plaintext.txt
diff --git a/script-bypass.eth b/script-bypass.eth
deleted file mode 100644 (file)
index 322635d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Bypass test script
-
-T:BYPASS BYPASS_CROSS_ASYNC DATA=@script-bypass.eth
-R:BYPASS BYPASS_CROSS_ASYNC DATA=@script-bypass.eth
-
-T:BYPASS BYPASSED_CROSS_ASYNC DATA=@script-bypass.eth
-R:BYPASS BYPASSED_CROSS_ASYNC
diff --git a/script-control-si.eth b/script-control-si.eth
deleted file mode 100644 (file)
index bf3ce5f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# Provisioning test script
-
-SLEEP 500
-
-# initializing state
-T:CONTROL STATUS_REQ
-R:CONTROL STATUS_RESP STATUS=3
-
-T:CONTROL AUTHENTICATION_REQ DATA="Wrong\ passphrase"
-R:CONTROL AUTHENTICATION_RESP DATA="Not\ authenticated"
-
-T:CONTROL AUTHENTICATION_REQ DATA="Secret\ passphrase"
-R:CONTROL AUTHENTICATION_RESP DATA="Authenticated"
-
-# ready state
-T:CONTROL STATUS_REQ
-R:CONTROL STATUS_RESP STATUS=4
-
-T:CONTROL REBOOT_REQ
-R:CONTROL REBOOT_RESP STATUS=0
-
-SLEEP 1000
-
-# initializing state
-T:CONTROL STATUS_REQ
-R:CONTROL STATUS_RESP STATUS=3
-
-T:CONTROL AUTHENTICATION_REQ DATA="Secret\ passphrase"
-R:CONTROL AUTHENTICATION_RESP DATA="Authenticated"
-
-# ready state
-T:CONTROL STATUS_REQ
-R:CONTROL STATUS_RESP STATUS=4
-
-T:CONTROL ZEROIZE_REQ
-R:CONTROL ZEROIZE_RESP STATUS=0
-
-T:CONTROL LOCK_CRYPTO_REQ
-R:CONTROL LOCK_CRYPTO_RESP STATUS=0
diff --git a/script-control.eth b/script-control.eth
deleted file mode 100644 (file)
index 0c3fd65..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# Provisioning test script
-
-T:CONTROL STATUS_REQ
-R:CONTROL STATUS_REQ
-
-T:CONTROL STATUS_RESP STATUS=4
-R:CONTROL STATUS_RESP STATUS=4
-
-T:CONTROL AUTHENTICATION_REQ DATA="This\ is\ an\ authentication\ phrase"
-R:CONTROL AUTHENTICATION_REQ DATA="This\ is\ an\ authentication\ phrase"
-
-T:CONTROL AUTHENTICATION_RESP DATA="Authentication\ completed"
-R:CONTROL AUTHENTICATION_RESP
-
-T:CONTROL REBOOT_REQ
-R:CONTROL REBOOT_REQ
-
-T:CONTROL REBOOT_RESP STATUS=0
-R:CONTROL REBOOT_RESP
-
-T:CONTROL ZEROIZE_REQ
-R:CONTROL ZEROIZE_REQ
-
-T:CONTROL ZEROIZE_RESP STATUS=0xFF
-R:CONTROL ZEROIZE_RESP
-
-T:CONTROL LOCK_CRYPTO_REQ
-R:CONTROL LOCK_CRYPTO_REQ
-
-T:CONTROL LOCK_CRYPTO_RESP STATUS=0
-R:CONTROL LOCK_CRYPTO_RESP
diff --git a/script-cross_crypto-error.eth b/script-cross_crypto-error.eth
deleted file mode 100644 (file)
index 777b845..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Cross crypto test script
-
-T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=3 BYPASS=11:22:33
-
-T:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=9 BYPASSLEN=1 BYPASS=55 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC
-
-T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=5 BYPASSLEN=0 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO DECRYPT_CROSS_ASYNC DATA=@script-cross_crypto.eth
-
-T:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=0 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@script-cross_crypto.eth
-R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=9
diff --git a/script-cross_crypto.eth b/script-cross_crypto.eth
deleted file mode 100644 (file)
index 57a10bb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Cross crypto test script
-
-T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44
-
-T:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=9 BYPASSLEN=1 BYPASS=55 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC BYPASSLEN=1 BYPASS=55
-
-T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=5 BYPASSLEN=0 DATA=@script-local_crypto.eth
-R:CROSS_CRYPTO DECRYPT_CROSS_ASYNC DATA=@script-local_crypto.eth
-
-T:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=0 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@script-cross_crypto.eth
-R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC DATA=@script-cross_crypto.eth CHANNELID=0
diff --git a/script-cross_crypto_b2r-si.eth b/script-cross_crypto_b2r-si.eth
deleted file mode 100644 (file)
index 82ad0da..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# Cross crypto test script
-
-SLEEP 500
-
-T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=1 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
-
-R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=1 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
-
diff --git a/script-cross_crypto_r2b-si.eth b/script-cross_crypto_r2b-si.eth
deleted file mode 100644 (file)
index ab22531..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Cross crypto test script
-
-SLEEP 500
-
-T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
-
-R:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=2 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
diff --git a/script-lo.eth b/script-lo.eth
deleted file mode 100644 (file)
index 3c85640..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# Test script
-
-T0808 MSG=42 DATA="Hello_world"
-R0808 MSG=42 DATA="Hello_world"
-
-SLEEP 1000
-
-T0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
-R0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
-
-T0808 MSG=10 DATA=@script-lo.eth
-R0808 MSG=10 DATA=@script-lo.eth
-
-T0808 MSG=15 DATA="123456789\ 12345"
-R0808 MSG=15 DATA="123456789\ 12345" DATALEN=15
-
-T0808 MSG=15 DATA="12\456789\ 12345"
-R0808 MSG=15 DATA="12\456789\ 12345" DATALEN=15
-
-T0808 MSG=15 DATA="12\ 456789\ 12345"
-R0808 MSG=15 DATA="12\ 456789\ 12345" DATALEN=15
-
-T0808 MSG=10 DATA="123456789\"
-R0808 MSG=10 DATA="123456789\" DATALEN=10
diff --git a/script-local_crypto-si.eth b/script-local_crypto-si.eth
deleted file mode 100644 (file)
index 47270c7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Local crypto test script
-
-SLEEP 500
-
-T:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
-
-R:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP CHANNELID=2 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
-
-T:LOCAL_CRYPTO DECRYPT_LOCAL_REQ CHANNELID=3 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=2 BYPASS=55:66 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
-
-R:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP CHANNELID=3 BYPASSLEN=2 BYPASS=55:66 DATA=@simulator/plaintext.txt
diff --git a/script-local_crypto.eth b/script-local_crypto.eth
deleted file mode 100644 (file)
index 380e69b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Local crypto test script
-
-T:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ CHANNELID=2 BYPASSLEN=3 BYPASS=11:22:33 DATA=@script-cross_crypto.eth
-R:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ
-
-T:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP CHANNELID=9 BYPASSLEN=0 DATA=@script-local_crypto.eth
-R:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP
-
-T:LOCAL_CRYPTO DECRYPT_LOCAL_REQ CHANNELID=5 BYPASSLEN=0 DATA=@script-local_crypto.eth
-R:LOCAL_CRYPTO DECRYPT_LOCAL_REQ
-
-T:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP CHANNELID=0 BYPASSLEN=3 BYPASS=22:33:44 DATA=@script-cross_crypto.eth
-R:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP
diff --git a/script-prng-si.eth b/script-prng-si.eth
deleted file mode 100644 (file)
index 438793f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# PRNG test script
-
-SLEEP 500
-
-T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=8 SEED=01:02:03:04
-R:PRNG RANDOM_RESP
-
-T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=8 SEED=01:02
-R:PRNG RANDOM_RESP
diff --git a/script-prng.eth b/script-prng.eth
deleted file mode 100644 (file)
index 61b61fd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# PRNG test script
-
-T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=64 SEED=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
-R:PRNG RANDOM_REQ PRNGID=0 SEQLEN=64 SEED=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
-
-T:PRNG RANDOM_RESP DATA=@script-prng.eth
-R:PRNG RANDOM_RESP
diff --git a/script-provisioning-si.eth b/script-provisioning-si.eth
deleted file mode 100644 (file)
index 4a0abfa..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Provisioning test script
-
-SLEEP 500
-
-T:PROVISIONING LOAD_KEY_REQ KEYID=0 KEY=01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10
-R:PROVISIONING LOAD_KEY_RESP STATUS=0
-
-T:PROVISIONING LOAD_KEY_REQ KEYID=1 KEY=11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f:10
-R:PROVISIONING LOAD_KEY_RESP STATUS=0
-
-T:PROVISIONING UNLOAD_KEY_REQ KEYID=2
-R:PROVISIONING UNLOAD_KEY_RESP STATUS=255
-
-T:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=21:22:23:24:25:26:27:28:29:2a:2b:2c:2d:2e:2f:10
-R:PROVISIONING LOAD_KEY_RESP STATUS=0
-
-T:PROVISIONING UNLOAD_KEY_REQ KEYID=2
-R:PROVISIONING UNLOAD_KEY_RESP STATUS=0
-
-T:PROVISIONING ERASE_KEY_REQ KEYID=255
-R:PROVISIONING ERASE_KEY_RESP STATUS=0
-
-T:PROVISIONING LOAD_KEY_REQ KEYID=1 KEY=11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f:10
-R:PROVISIONING LOAD_KEY_RESP STATUS=0
-
-T:PROVISIONING UNLOAD_KEY_REQ KEYID=0
-R:PROVISIONING UNLOAD_KEY_RESP STATUS=255
-
-T:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=1
-R:PROVISIONING ASSOCIATE_CHANNEL_RESP STATUS=0
-
-T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
-R:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=0
-
-T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
-R:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=255
diff --git a/script-provisioning.eth b/script-provisioning.eth
deleted file mode 100644 (file)
index 848d04a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# Provisioning test script
-
-T:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
-R:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
-
-T:PROVISIONING LOAD_KEY_RESP STATUS=0
-R:PROVISIONING LOAD_KEY_RESP
-
-T:PROVISIONING UNLOAD_KEY_REQ KEYID=42
-R:PROVISIONING UNLOAD_KEY_REQ
-
-T:PROVISIONING UNLOAD_KEY_RESP STATUS=0xFF
-R:PROVISIONING UNLOAD_KEY_RESP
-
-T:PROVISIONING ERASE_KEY_REQ KEYID=255
-R:PROVISIONING ERASE_KEY_REQ
-
-T:PROVISIONING ERASE_KEY_RESP STATUS=0
-R:PROVISIONING ERASE_KEY_RESP
-
-T:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=2
-R:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=2
-
-T:PROVISIONING ASSOCIATE_CHANNEL_RESP STATUS=0
-R:PROVISIONING ASSOCIATE_CHANNEL_RESP
-
-T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
-R:PROVISIONING DISSOCIATE_CHANNEL_REQ
-
-T:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=0
-R:PROVISIONING DISSOCIATE_CHANNEL_RESP
diff --git a/script-rx.eth b/script-rx.eth
deleted file mode 100644 (file)
index 271be01..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Test script
-
-R0808 MSG=42 DATA="Hello_world"
-T0809 MSG=43 DATA="Bye"
-
-SLEEP 1000
-
-R0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
-T0809 MSG=25 DATA=48:65:6c:6c:6f
-
-R0808 MSG=10 DATA=@makefile
-T0809 MSG=11 DATA="OK"
diff --git a/script-tx.eth b/script-tx.eth
deleted file mode 100644 (file)
index 919bb0f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Test script
-
-T0808 MSG=42 DATA="Hello_world"
-R0809 MSG=43 DATA="Bye"
-
-SLEEP 1000
-
-T0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
-R0809 MSG=25 DATA=48:65:6c:6c:6f
-
-T0808 MSG=10 DATA=@makefile
-R0809 MSG=11 DATA="OK"
diff --git a/simulator.c b/simulator.c
new file mode 100644 (file)
index 0000000..99fdd88
--- /dev/null
@@ -0,0 +1,679 @@
+/*
+  File name        : simulator.c
+  Projet           : MERLIN
+  Date of creation : 2025/04/09
+  Version          : 1.0
+  Copyright        : Thales SIX
+  Author           : Laurent Mazet <laurent.mazet@thalesgroup.com>
+
+  Description      : MOREP simulator
+
+  History          :
+  - initial version
+*/
+
+/* depend: */
+/* cflags: */
+/* linker: morep.o parse.o pdu_channel.o pdu_encrypted_data.o pdu_prng_param.o pdu_status.o pdu_clear_data.o pdu_key.o pdu_raw_data.o */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "def.h"
+#include "morep.h"
+#include "parse.h"
+#include "pdu_channel.h"
+#include "pdu_clear_data.h"
+#include "pdu_encrypted_data.h"
+#include "pdu_key.h"
+#include "pdu_prng_param.h"
+#include "pdu_raw_data.h"
+#include "pdu_status.h"
+#include "simulator.h"
+#include "verbose.h"
+
+char *progname = NULL;
+
+int stop = 0;
+
+DECLARE_VERBOSE_LEVEL (morep, INFO);
+DECLARE_VERBOSE_LEVEL (simul, INFO);
+
+#define BUFMAX 4096
+
+/* definition of all messages */
+message_t message_list[] = {
+
+    /* Cross cryptographic service */
+    {"ENCRYPT_CROSS_ASYNC", cross_crypto_e, 0x00, clear_data_e},
+    {"ENCRYPTED_CROSS_ASYNC", cross_crypto_e, 0x01, encrypted_data_e},
+    {"DECRYPT_CROSS_ASYNC", cross_crypto_e, 0x02, encrypted_data_e},
+    {"DECRYPTED_CROSS_ASYNC", cross_crypto_e, 0x03, clear_data_e},
+
+    /* Local cryptographic service */
+    {"ENCRYPT_LOCAL_REQ", local_crypto_e, 0x00, clear_data_e},
+    {"ENCRYPTED_LOCAL_RESP", local_crypto_e, 0x01, encrypted_data_e},
+    {"DECRYPT_LOCAL_REQ", local_crypto_e, 0x02, encrypted_data_e},
+    {"DECRYPTED_LOCAL_RESP", local_crypto_e, 0x03, clear_data_e},
+
+    /* Provisioning service */
+    {"LOAD_KEY_REQ", provisioning_e, 0x00, key_e},
+    {"LOAD_KEY_RESP", provisioning_e, 0x01, status_e},
+    {"UNLOAD_KEY_REQ", provisioning_e, 0x02, key_e},
+    {"UNLOAD_KEY_RESP", provisioning_e, 0x03, status_e},
+    {"ERASE_KEY_REQ", provisioning_e, 0x04, key_e},
+    {"ERASE_KEY_RESP", provisioning_e, 0x05, status_e},
+    {"ASSOCIATE_CHANNEL_REQ", provisioning_e, 0x06, channel_e},
+    {"ASSOCIATE_CHANNEL_RESP", provisioning_e, 0x07, status_e},
+    {"DISSOCIATE_CHANNEL_REQ", provisioning_e, 0x08, channel_e},
+    {"DISSOCIATE_CHANNEL_RESP", provisioning_e, 0x09, status_e},
+
+    /* Bypass service */
+    {"BYPASS_CROSS_ASYNC", bypass_e, 0x00, raw_data_e},
+    {"BYPASSED_CROSS_ASYNC", bypass_e, 0x01, raw_data_e},
+
+    /* PRNG service */
+    {"RANDOM_REQ", prng_e, 0x00, prng_param_e},
+    {"RANDOM_RESP", prng_e, 0x01, raw_data_e},
+
+    /* Control service */
+    {"STATUS_REQ", control_e, 0x00, nopdu_e},
+    {"STATUS_RESP", control_e, 0x01, status_e},
+    {"AUTHENTICATION_REQ", control_e, 0x02, raw_data_e},
+    {"AUTHENTICATION_RESP", control_e, 0x03, raw_data_e},
+    {"REBOOT_REQ", control_e, 0x04, nopdu_e},
+    {"REBOOT_RESP", control_e, 0x05, status_e},
+    {"ZEROIZE_REQ", control_e, 0x06, nopdu_e},
+    {"ZEROIZE_RESP", control_e, 0x07, status_e},
+    {"LOCK_CRYPTO_REQ", control_e, 0xFE, nopdu_e},
+    {"LOCK_CRYPTO_RESP", control_e, 0xFF, status_e},
+
+    /* End of list */
+    {"", noserv_e, 0x00, undef_pdu_e}
+};
+
+/* list of communcation chanels */
+#define MAXCOMMS 32
+comm_t comm_list[MAXCOMMS] = {0};
+
+/* definition of all services */
+service_t service_list[] = {
+    {"CROSS_CRYPTO_BLACK", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
+    {"CROSS_CRYPTO_RED", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
+    {"CROSS_CRYPTO", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
+    {"LOCAL_CRYPTO_BLACK", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
+    {"LOCAL_CRYPTO_RED", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
+    {"LOCAL_CRYPTO", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
+    {"PROVISIONING_RED", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
+    {"PROVISIONING", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
+    {"PRNG_BLACK", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
+    {"PRNG_RED", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
+    {"PRNG", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
+    {"BYPASS_BLACK", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
+    {"BYPASS_RED", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
+    {"BYPASS", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
+    {"CONTROL_RED", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
+    {"CONTROL", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
+    {"", noserv_e, {-1, 0, "0000"}, {-1, 1, "0000"}}
+};
+
+/* signal handler */
+void sig_handler (int sig)
+{
+    switch (sig) {
+    case SIGINT:
+        //stop = 1;
+        exit (0);
+        break;
+    case SIGTERM:
+        exit (0);
+        break;
+    }
+}
+
+/* read a file */
+char *read_stream (FILE *sd, int *plen)
+{
+    VERBOSE (simul, TRACE, PRINTF ("read_stream\n"));
+
+    /* read and store */
+    char *buffer = NULL;
+    size_t size = 0;
+    int blocklen = 0;
+    int length = 0;
+    do {
+        size += BUFMAX + (size == 0);
+        buffer = (char *) realloc (buffer, size);
+        memset (buffer + size - BUFMAX - 1, 0, BUFMAX + 1);
+        blocklen = fread (buffer + size - BUFMAX - 1, 1, BUFMAX, sd);
+        length += blocklen;
+    } while (blocklen > 0);
+
+    /* check size */
+    VERBOSE (simul, DEBUG, PRINTF ("read length: %d\n", length));
+    if (length == 0) {
+        free (buffer);
+        buffer = NULL;
+    }
+
+    if (plen) {
+        *plen = length;
+    }
+
+    return buffer;
+}
+
+/* main function */
+int main (int argc, char **argv)
+{
+    char *filename = NULL;
+    char *logname = NULL;
+    char *servname = NULL;
+    char *tmp = NULL;
+    char *url = NULL;
+    int mode = -1;
+    int nbcomms = 0;
+
+    /* get basename */
+    char *ptr = progname = argv[0];
+    while (*ptr) {
+        if ((*ptr == '/') || (*ptr == '\\')) {
+           progname = ptr + 1;
+        }
+        ptr++;
+    }
+
+    /* process argument */
+    while (argc-- > 1) {
+        char *arg = *(++argv);
+        if (arg[0] != '-') {
+            filename = arg;
+            continue;
+        }
+        char c = arg[1];
+        switch (c) {
+        case 'l':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: log file not specified\n", progname));
+                return 1;
+            }
+            logname = arg;
+            break;
+        case 'r':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: receiver url not specified\n", progname));
+                return 1;
+            }
+            url = arg;
+            mode = 0;
+            break;
+        case 's':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: service not specified\n", progname));
+                return 1;
+            }
+            servname = arg;
+            break;
+        case 't':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: transmitter url not specified\n", progname));
+                return 1;
+            }
+            url = arg;
+            mode = 1;
+            break;
+        case 'v':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: morep verbose level not specified\n", progname));
+                return 1;
+            }
+            CHANGE_VERBOSE_LEVEL (morep, atoi (arg));
+            break;
+        case 'V':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("%s: simulator verbose level not specified\n", progname));
+                return 1;
+            }
+            CHANGE_VERBOSE_LEVEL (simul, atoi (arg));
+            break;
+        case 'h':
+        default:
+            printf ("usage: %s [-h] [-l log] [-r url] [-s serv] [-t url] [-v level] [-V level] [file]\n", progname);
+            return (c != 'h');
+        }
+
+        /* init communication channel */
+        if (mode != -1) {
+            if (nbcomms < MAXCOMMS) {
+                int morep = MOREP_Connect (url);
+                if (morep >= 0) {
+                    (comm_list + nbcomms)->morep = morep;
+                    (comm_list + nbcomms)->mode = mode;
+                    (comm_list + nbcomms)->etype = strrchr (url, '/') + 1;
+                    for (int i = 0; (service_list + i)->service_id != noserv_e; i++) {
+                        service_t *s = service_list + i;
+                        if (s && servname && (strcmp (s->name, servname) == 0)) {
+                            memcpy ((mode == 0) ? &(s->rx) : &(s->tx), comm_list + nbcomms, sizeof (comm_t));
+                            break;
+                        }
+                    }
+                    nbcomms++;
+                } else {
+                    VERBOSE (simul, ERROR, PRINTF ("can't connect on url '%s'\n", url));
+                    return -1;
+                }
+            } else {
+                VERBOSE (simul, ERROR, PRINTF ("no more communication channel avaliable (%d)\n", nbcomms));
+                return -1;
+            }
+            mode = -1;
+        }
+    }
+
+    /* checks */
+    if (nbcomms == 0) {
+        VERBOSE (simul, ERROR, PRINTF ("no communication channel\n"));
+        return -1;
+    }
+
+    /* open script file */
+    FILE *fid = stdin;
+    if (filename != NULL) {
+        fid = fopen (filename, "r");
+        if (fid == NULL) {
+            VERBOSE (simul, ERROR, PRINTF ("can't open script file '%s' for reading\n", filename));
+            return -1;
+        }
+    }
+    char *script = read_stream (fid, NULL);
+    if (fid != stdin) {
+        fclose (fid);
+    }
+    if (script == NULL) {
+        VERBOSE (simul, ERROR, PRINTF ("no script read\n"));
+        return -1;
+    }
+
+    /* open log file */
+    FILE *log = NULL;
+    if (logname != NULL) {
+        if (strcmp (logname, "-") == 0) {
+            log = stdout;
+        } else {
+            log = fopen (logname, "w");
+            if (log == NULL) {
+                VERBOSE (simul, ERROR, PRINTF ("can't open log file '%s' for writing\n", logname));
+                return -1;
+            }
+        }
+    }
+
+    /* signals */
+    signal(SIGINT, sig_handler);
+    signal(SIGTERM, sig_handler);
+
+    /* main loop */
+    int rc = 0;
+    ptr = script;
+    while (*ptr != '\0') {
+
+        /* read line */
+        char *line = ptr;
+        TEST_CHARS (ptr, "\n\r", 1);
+        *ptr++ = '\0';
+
+        /* skip space, avoid empty line and comments */
+        TEST_CHARS (line, " \t", 0);
+        if ((*line == '\0') || (*line == '#')) {
+            continue;
+        }
+
+        /* special keywords */
+        if (strncmp (line, "SLEEP", 5) == 0) {
+            int duration = atoi (line + 5);
+            VERBOSE (simul, INFO, PRINTF ("sleep %dms\n", duration));
+            usleep (duration * 1000);
+            continue;
+        }
+
+        /* analyse line */
+        mode = (*line == 'R') ? 0 : (*line == 'T') ? 1 : -1;
+        if (mode == -1) {
+            VERBOSE (simul, WARNING, PRINTF ("unrecognize line '%s'\n", line));
+            continue;
+        }
+        int offset = 1;
+
+        /* skip space */
+        tmp = line + offset;
+        TEST_CHARS (tmp, " \t:", 0);
+        offset = tmp - line;
+
+        comm_t *comm = NULL;
+        service_t *serv = NULL;
+        /* find MOREP by service name */
+        for (int i = 0; ((service_list + i)->service_id != noserv_e) && (serv == NULL); i++) {
+            service_t *s = service_list + i;
+            VERBOSE (simul, TRACE, PRINTF ("test %c[%s]\n", *line, s->name));
+            if (strncmp (line + offset, s->name, strlen (s->name)) == 0) {
+                comm = (mode == 0) ? &(s->rx) : &(s->tx);
+                serv = s;
+                offset += strlen (s->name);
+            }
+        }
+        /* find MOREP by ethertype */
+        for (int j = 0; (j < nbcomms) && (comm == NULL); j++) {
+            comm_t *c = comm_list + j;
+            VERBOSE (simul, TRACE, PRINTF ("test %c[%s]\n", (c->mode == 0) ? 'R' : 'T', c->etype));
+            if ((strncmp (line + offset, c->etype, strlen (c->etype)) == 0) && (c->mode == mode)) {
+                comm = c;
+                for (int i = 0; ((service_list + i)->service_id != noserv_e) && (serv == NULL); i++) {
+                    service_t *s = service_list + i;
+                    c = (mode == 0) ? &(s->rx) : &(s->tx);
+                    if (strncmp (c->etype, comm->etype, strlen (comm->etype)) == 0) {
+                        serv = s;
+                    }
+                }
+                offset += strlen (c->etype);
+            }
+        }
+        /* check media and service */
+        if ((comm == NULL) || (serv == NULL)) {
+            VERBOSE (simul, TRACE, PRINTF ("no morep found '%s'\n", line));
+            continue;
+        }
+        VERBOSE (simul, DEBUG, PRINTF ("select %c[%s]\n", (comm->mode == 0) ? 'R' : 'T', serv->name));
+
+        /* skip space */
+        tmp = line + offset;
+        TEST_CHARS (tmp, " \t", 0);
+        offset = tmp - line;
+
+        message_t *msg = NULL;
+        /* get message type by name */
+        for (int i = 0; ((message_list + i)->service_id != noserv_e) && (msg == NULL); i++) {
+            message_t *m = message_list + i;
+            VERBOSE (simul, TRACE, PRINTF ("test %s\n", m->name));
+            if (strncmp (line + offset, m->name, strlen (m->name)) == 0) {
+                msg = m;
+                offset += strlen (m->name);
+            }
+        }
+        /* get message type by id */
+        if (msg == NULL) {
+            if (strncmp (line + offset, "MSG", 3) != 0) {
+                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
+                continue;
+            }
+            tmp = line + offset + 3;
+            TEST_CHARS (tmp, " \t=", 0);
+            uint8_t msgtype = strtol (tmp, &tmp, 0);
+            offset = tmp - line;
+            if ((*tmp != ' ') && (*tmp != '\t')) {
+                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
+                continue;
+            }
+            /* find message */
+            for (int i = 0; ((message_list + i)->service_id != noserv_e) && (msg == NULL); i++) {
+                message_t *m = message_list + i;
+                if ((m->service_id == serv->service_id) && (m->msgtype == msgtype)) {
+                    msg = m;
+                }
+            }
+            /* avoid null pointer */
+            if (msg == NULL) {
+                VERBOSE (simul, WARNING, PRINTF ("can't find msgtype %d for service %s\n", msgtype, serv->name));
+                continue;
+            }
+
+        }
+
+        /* check message and service */
+        if (serv->service_id != msg->service_id) {
+            VERBOSE (simul, WARNING, PRINTF ("message %s is not allowed for service %s (line '%s')\n", msg->name, serv->name, line));
+            continue;
+        }
+        VERBOSE (simul, DEBUG, PRINTF ("%s message %s\n", (comm->mode == 0) ? "waiting" : "sending", msg->name));
+
+        CHANNEL_t pdu_channel = {0};
+        CLEAR_DATA_t pdu_clear_data = {0};
+        ENCRYPTED_DATA_t pdu_encrypted_data = {0};
+        KEY_t pdu_key = {0};
+        PRNG_PARAM_t pdu_prng_param = {0};
+        RAW_DATA_t pdu_raw_data = {0};
+        STATUS_t pdu_status = {0};
+
+        int seqnum = -1;
+        int len = 0;
+        pdu_t pdu;
+        if (mode == 1) { /* transmit */
+
+            /* parse message */
+            pdu = msg->pdu;
+            switch (pdu) {
+            case nopdu_e:
+                break;
+            case channel_e:
+                parse_channel (line + offset, &pdu_channel);
+                break;
+            case clear_data_e:
+                parse_clear_data (line + offset, &pdu_clear_data);
+                break;
+            case encrypted_data_e:
+                parse_encrypted_data (line + offset, &pdu_encrypted_data);
+                break;
+            case key_e:
+                parse_key (line + offset, &pdu_key);
+                break;
+            case prng_param_e:
+                parse_prng_param (line + offset, &pdu_prng_param);
+                break;
+            case raw_data_e:
+                parse_raw_data (line + offset, &pdu_raw_data);
+                break;
+            case status_e:
+                parse_status (line + offset, &pdu_status);
+                break;
+            default:
+                VERBOSE (simul, WARNING, PRINTF ("can't parse line '%s' (%d)\n", line, offset));
+                continue;
+            }
+
+            /* send message */
+            uint8_t payload[MOREP_PAYLOAD] = {0};
+            switch (pdu) {
+            case channel_e:
+                len = serial_channel (&pdu_channel, payload, sizeof (payload));
+                break;
+            case clear_data_e:
+                len = serial_clear_data (&pdu_clear_data, payload, sizeof (payload));
+                break;
+            case encrypted_data_e:
+                len = serial_encrypted_data (&pdu_encrypted_data, payload, sizeof (payload));
+                break;
+            case key_e:
+                len = serial_key (&pdu_key, payload, sizeof (payload));
+                break;
+            case prng_param_e:
+                len = serial_prng_param (&pdu_prng_param, payload, sizeof (payload));
+                break;
+            case raw_data_e:
+                len = serial_raw_data (&pdu_raw_data, payload, sizeof (payload));
+                break;
+            case status_e:
+                len = serial_status (&pdu_status, payload, sizeof (payload));
+                break;
+            default:
+                len = 0;
+            }
+            seqnum = MOREP_Send (comm->morep, msg->msgtype, payload, len);
+            VERBOSE (simul, INFO, PRINTF ("T:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name));
+
+        } else { /* receive */
+            message_t *exp_msg = msg;
+
+            uint8_t msgtype = 0;
+            uint8_t payload[MOREP_PAYLOAD] = {0};
+            seqnum = MOREP_Receive (comm->morep, &msgtype, payload, &len);
+
+            /* check msg/pdu type */
+            pdu = undef_pdu_e;
+            msg = NULL;
+            for (int i = 0; ((message_list + i)->service_id) && (pdu == undef_pdu_e); i++) {
+                message_t *m = message_list + i;
+                if ((m->service_id == serv->service_id) && (m->msgtype == msgtype)) {
+                    pdu = m->pdu;
+                    msg = m;
+                }
+            }
+            /* check msg type */
+            if (msg == NULL) {
+                VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] message type is not allowed for this service\n", serv->name, comm->etype, seqnum, msgtype, len, pdu));
+                continue;
+            }
+            if (exp_msg->msgtype != msg->msgtype) {
+                VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] expected message type %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, exp_msg->name));
+                continue;
+            }
+            VERBOSE (simul, INFO, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name));
+
+            /* deserialize message */
+            switch (pdu) {
+            case nopdu_e:
+                break;
+            case channel_e:
+                deserial_channel (payload, len, &pdu_channel);
+                break;
+            case clear_data_e:
+                deserial_clear_data (payload, len, &pdu_clear_data);
+                break;
+            case encrypted_data_e:
+                deserial_encrypted_data (payload, len, &pdu_encrypted_data);
+                break;
+            case key_e:
+                deserial_key (payload, len, &pdu_key);
+                break;
+            case prng_param_e:
+                deserial_prng_param (payload, len, &pdu_prng_param);
+                break;
+            case raw_data_e:
+                deserial_raw_data (payload, len, &pdu_raw_data);
+                break;
+            case status_e:
+                deserial_status (payload, len, &pdu_status);
+                break;
+            default:
+                VERBOSE (simul, WARNING, PRINTF ("can't deserialize message %s\n", msg->name));
+                continue;
+            }
+
+            /* check received pdu */
+            if (pdu == channel_e) {
+                CHANNEL_t exp_pdu_channel = {0};
+                int check_fields = parse_channel (line + offset, &exp_pdu_channel);
+                check_channel (&pdu_channel, &exp_pdu_channel, check_fields);
+            } else if (pdu == clear_data_e) {
+                CLEAR_DATA_t exp_pdu_clear_data = {0};
+                int check_fields = parse_clear_data (line + offset, &exp_pdu_clear_data);
+                check_clear_data (&pdu_clear_data, &exp_pdu_clear_data, check_fields);
+            } else if (pdu == encrypted_data_e) {
+                ENCRYPTED_DATA_t exp_pdu_encrypted_data = {0};
+                int check_fields = parse_encrypted_data (line + offset, &exp_pdu_encrypted_data);
+                check_encrypted_data (&pdu_encrypted_data, &exp_pdu_encrypted_data, check_fields);
+            } else if (pdu == key_e) {
+                KEY_t exp_pdu_key = {0};
+                int check_fields = parse_key (line + offset, &exp_pdu_key);
+                check_key (&pdu_key, &exp_pdu_key, check_fields);
+            } else if (pdu == prng_param_e) {
+                PRNG_PARAM_t exp_pdu_prng_param = {0};
+                int check_fields = parse_prng_param (line + offset, &exp_pdu_prng_param);
+                check_prng_param (&pdu_prng_param, &exp_pdu_prng_param, check_fields);
+            } else if (pdu == raw_data_e) {
+                RAW_DATA_t exp_pdu_raw_data = {0};
+                int check_fields = parse_raw_data (line + offset, &exp_pdu_raw_data);
+                check_raw_data (&pdu_raw_data, &exp_pdu_raw_data, check_fields);
+            } else if (pdu == status_e) {
+                STATUS_t exp_pdu_status = {0};
+                int check_fields = parse_status (line + offset, &exp_pdu_status);
+                check_status (&pdu_status, &exp_pdu_status, check_fields);
+            }
+
+        }
+
+        /* log message */
+        if (log) {
+            fprintf (log, "%c:%s[%s] [SEG=%d MSG=%d LEN=%d PDU=%d] %s", (mode == 0) ? 'R' : 'T',
+                     serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, msg->name);
+            char buffer[MOREP_PAYLOAD * 3 + 256] = {0};
+            switch (pdu) {
+            case nopdu_e:
+                break;
+            case channel_e:
+                format_channel (&pdu_channel, buffer, sizeof (buffer));
+                break;
+            case clear_data_e:
+                format_clear_data (&pdu_clear_data, buffer, sizeof (buffer));
+                break;
+            case encrypted_data_e:
+                format_encrypted_data (&pdu_encrypted_data, buffer, sizeof (buffer));
+                break;
+            case key_e:
+                format_key (&pdu_key, buffer, sizeof (buffer));
+                break;
+            case prng_param_e:
+                format_prng_param (&pdu_prng_param, buffer, sizeof (buffer));
+                break;
+            case raw_data_e:
+                format_raw_data (&pdu_raw_data, buffer, sizeof (buffer));
+                break;
+            case status_e:
+                format_status (&pdu_status, buffer, sizeof (buffer));
+                break;
+            default:
+                snprintf (buffer, sizeof (buffer), "unknown payload");
+            }
+            fprintf (log, "%s\n", buffer);
+        }
+    }
+
+    /* cleaning */
+    free (script);
+    while (nbcomms) {
+        MOREP_Close (--nbcomms);
+    }
+    if ((log) && (log != stdout)) {
+        fclose (log);
+    }
+
+    return rc + GET_VERBOSE_ERRORS (morep) + GET_VERBOSE_ERRORS (simul);
+}
+
+/* test: simulator.exe -h | grep usage */
+/* test: simulator.exe -l | grep 'log file not specified' */
+/* test: simulator.exe -r | grep 'url not specified' */
+/* test: simulator.exe -s | grep 'service not specified' */
+/* test: simulator.exe -t | grep 'url not specified' */
+/* test: simulator.exe -v | grep 'morep verbose level not specified' */
+/* test: simulator.exe -V | grep 'simulator verbose level not specified' */
+/* test: simulator.exe -l - -t lo://00:00:00:00:00:00/0809 -v 4 test/script-lo.eth */
+/* test: simulator.exe -l script-cross_crypto-error.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-cross_crypto-error.eth -V 3; test $? -ne 0 */
+/* test: simulator.exe -l script-cross_crypto-error.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-cross_crypto-error.eth -V 3 | grep WARNING */
+/* test: simulator.exe -l script-cross_crypto.log -s CROSS_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-cross_crypto.eth -V 3 */
+/* test: simulator.exe -l script-local_crypto.log -s LOCAL_CRYPTO -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-local_crypto.eth -V 3 */
+/* test: simulator.exe -l script-provisioning.log -s PROVISIONING -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-provisioning.eth -V 3 */
+/* test: simulator.exe -l script-prng.log -s PRNG -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-prng.eth -V 3 */
+/* test: simulator.exe -l script-bypass.log -s BYPASS -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-bypass.eth -V 3 */
+/* test: simulator.exe -l script-control.log -s CONTROL -t lo://00:00:00:00:00:00/0808 -r lo://00:00:00:00:00:00/0808 test/script-control.eth -v 3 -V 3 */
+
+/* vim: set ts=4 sw=4 si et: */
index b8ede404f720ace5f8582384a89bd10afbbe2566..151c47c17eed497ca9390115f80756c724fd9a53 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-[ "$SIMULATOR" ] || SIMULATOR=./morep_simulator.exe
+[ "$SIMULATOR" ] || SIMULATOR=./simulator.exe
 
 ETH_RADIORED=enp0s4://52:54:00:12:34:57
 ETH_SECRED=enp0s4://52:54:00:12:34:59
diff --git a/test/script-bypass-si.eth b/test/script-bypass-si.eth
new file mode 100644 (file)
index 0000000..58ae363
--- /dev/null
@@ -0,0 +1,6 @@
+# Bypass test script
+
+SLEEP 500
+
+T:BYPASS BYPASS_CROSS_ASYNC DATA=@simulator/plaintext.txt
+R:BYPASS BYPASSED_CROSS_ASYNC DATA=@simulator/plaintext.txt
diff --git a/test/script-bypass.eth b/test/script-bypass.eth
new file mode 100644 (file)
index 0000000..b402fa8
--- /dev/null
@@ -0,0 +1,7 @@
+# Bypass test script
+
+T:BYPASS BYPASS_CROSS_ASYNC DATA=@test/script-bypass.eth
+R:BYPASS BYPASS_CROSS_ASYNC DATA=@test/script-bypass.eth
+
+T:BYPASS BYPASSED_CROSS_ASYNC DATA=@test/script-bypass.eth
+R:BYPASS BYPASSED_CROSS_ASYNC
diff --git a/test/script-control-si.eth b/test/script-control-si.eth
new file mode 100644 (file)
index 0000000..bf3ce5f
--- /dev/null
@@ -0,0 +1,39 @@
+# Provisioning test script
+
+SLEEP 500
+
+# initializing state
+T:CONTROL STATUS_REQ
+R:CONTROL STATUS_RESP STATUS=3
+
+T:CONTROL AUTHENTICATION_REQ DATA="Wrong\ passphrase"
+R:CONTROL AUTHENTICATION_RESP DATA="Not\ authenticated"
+
+T:CONTROL AUTHENTICATION_REQ DATA="Secret\ passphrase"
+R:CONTROL AUTHENTICATION_RESP DATA="Authenticated"
+
+# ready state
+T:CONTROL STATUS_REQ
+R:CONTROL STATUS_RESP STATUS=4
+
+T:CONTROL REBOOT_REQ
+R:CONTROL REBOOT_RESP STATUS=0
+
+SLEEP 1000
+
+# initializing state
+T:CONTROL STATUS_REQ
+R:CONTROL STATUS_RESP STATUS=3
+
+T:CONTROL AUTHENTICATION_REQ DATA="Secret\ passphrase"
+R:CONTROL AUTHENTICATION_RESP DATA="Authenticated"
+
+# ready state
+T:CONTROL STATUS_REQ
+R:CONTROL STATUS_RESP STATUS=4
+
+T:CONTROL ZEROIZE_REQ
+R:CONTROL ZEROIZE_RESP STATUS=0
+
+T:CONTROL LOCK_CRYPTO_REQ
+R:CONTROL LOCK_CRYPTO_RESP STATUS=0
diff --git a/test/script-control.eth b/test/script-control.eth
new file mode 100644 (file)
index 0000000..0c3fd65
--- /dev/null
@@ -0,0 +1,31 @@
+# Provisioning test script
+
+T:CONTROL STATUS_REQ
+R:CONTROL STATUS_REQ
+
+T:CONTROL STATUS_RESP STATUS=4
+R:CONTROL STATUS_RESP STATUS=4
+
+T:CONTROL AUTHENTICATION_REQ DATA="This\ is\ an\ authentication\ phrase"
+R:CONTROL AUTHENTICATION_REQ DATA="This\ is\ an\ authentication\ phrase"
+
+T:CONTROL AUTHENTICATION_RESP DATA="Authentication\ completed"
+R:CONTROL AUTHENTICATION_RESP
+
+T:CONTROL REBOOT_REQ
+R:CONTROL REBOOT_REQ
+
+T:CONTROL REBOOT_RESP STATUS=0
+R:CONTROL REBOOT_RESP
+
+T:CONTROL ZEROIZE_REQ
+R:CONTROL ZEROIZE_REQ
+
+T:CONTROL ZEROIZE_RESP STATUS=0xFF
+R:CONTROL ZEROIZE_RESP
+
+T:CONTROL LOCK_CRYPTO_REQ
+R:CONTROL LOCK_CRYPTO_REQ
+
+T:CONTROL LOCK_CRYPTO_RESP STATUS=0
+R:CONTROL LOCK_CRYPTO_RESP
diff --git a/test/script-cross_crypto-error.eth b/test/script-cross_crypto-error.eth
new file mode 100644 (file)
index 0000000..81ee39d
--- /dev/null
@@ -0,0 +1,13 @@
+# Cross crypto test script
+
+T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=3 BYPASS=11:22:33
+
+T:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=9 BYPASSLEN=1 BYPASS=55 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC
+
+T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=5 BYPASSLEN=0 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO DECRYPT_CROSS_ASYNC DATA=@test/script-cross_crypto.eth
+
+T:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=0 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@test/script-cross_crypto.eth
+R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=9
diff --git a/test/script-cross_crypto.eth b/test/script-cross_crypto.eth
new file mode 100644 (file)
index 0000000..dd7ce18
--- /dev/null
@@ -0,0 +1,13 @@
+# Cross crypto test script
+
+T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44
+
+T:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=9 BYPASSLEN=1 BYPASS=55 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC BYPASSLEN=1 BYPASS=55
+
+T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=5 BYPASSLEN=0 DATA=@test/script-local_crypto.eth
+R:CROSS_CRYPTO DECRYPT_CROSS_ASYNC DATA=@test/script-local_crypto.eth
+
+T:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=0 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@test/script-cross_crypto.eth
+R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC DATA=@test/script-cross_crypto.eth CHANNELID=0
diff --git a/test/script-cross_crypto_b2r-si.eth b/test/script-cross_crypto_b2r-si.eth
new file mode 100644 (file)
index 0000000..82ad0da
--- /dev/null
@@ -0,0 +1,8 @@
+# Cross crypto test script
+
+SLEEP 500
+
+T:CROSS_CRYPTO DECRYPT_CROSS_ASYNC CHANNELID=1 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
+
+R:CROSS_CRYPTO DECRYPTED_CROSS_ASYNC CHANNELID=1 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
+
diff --git a/test/script-cross_crypto_r2b-si.eth b/test/script-cross_crypto_r2b-si.eth
new file mode 100644 (file)
index 0000000..ab22531
--- /dev/null
@@ -0,0 +1,7 @@
+# Cross crypto test script
+
+SLEEP 500
+
+T:CROSS_CRYPTO ENCRYPT_CROSS_ASYNC CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
+
+R:CROSS_CRYPTO ENCRYPTED_CROSS_ASYNC CHANNELID=2 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
diff --git a/test/script-lo.eth b/test/script-lo.eth
new file mode 100644 (file)
index 0000000..86c7684
--- /dev/null
@@ -0,0 +1,24 @@
+# Test script
+
+T0808 MSG=42 DATA="Hello_world"
+R0808 MSG=42 DATA="Hello_world"
+
+SLEEP 1000
+
+T0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
+R0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
+
+T0808 MSG=10 DATA=@test/script-lo.eth
+R0808 MSG=10 DATA=@test/script-lo.eth
+
+T0808 MSG=15 DATA="123456789\ 12345"
+R0808 MSG=15 DATA="123456789\ 12345" DATALEN=15
+
+T0808 MSG=15 DATA="12\456789\ 12345"
+R0808 MSG=15 DATA="12\456789\ 12345" DATALEN=15
+
+T0808 MSG=15 DATA="12\ 456789\ 12345"
+R0808 MSG=15 DATA="12\ 456789\ 12345" DATALEN=15
+
+T0808 MSG=10 DATA="123456789\"
+R0808 MSG=10 DATA="123456789\" DATALEN=10
diff --git a/test/script-local_crypto-si.eth b/test/script-local_crypto-si.eth
new file mode 100644 (file)
index 0000000..47270c7
--- /dev/null
@@ -0,0 +1,11 @@
+# Local crypto test script
+
+SLEEP 500
+
+T:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ CHANNELID=2 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=@simulator/plaintext.txt
+
+R:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP CHANNELID=2 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=4 BYPASS=11:22:33:44 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
+
+T:LOCAL_CRYPTO DECRYPT_LOCAL_REQ CHANNELID=3 IV=00:67:c6:69:98:73:51:ff:5c:4a:ec:29 BYPASSLEN=2 BYPASS=55:66 DATA=4c:08:b4:0c:f5:53:38:8f:2f:3f:81:09:64:08:aa:06:ea:53:22:96:28:6a:8d:44:65:13:ea:49:fb:1c:3f:8c:39:29:98:4c:74:12:b4:49:f9:17:38:8f:35:39:8f:40:6e:00:e6:0c:f4:1a:25:d1:7c:1a:89:45:6c:02:a8:1d:fd:00:20:8a:39:6a:81:48:78:0e:ab:1c:eb:53:34:8a:35:39:81:46:64:47:a5:06:f6:17:38:92:39:24:98:5c:6d:49:e6:2d:ed:1a:22:df:28:2f:81:59:75:14:e6:0c:f4:1a:25:df:2f:23:98:09:61:0a:a3:1d:b8:19:24:8c:28:25:cc:44:6f:0b:a3:1a:ec:1a:34:df:2f:25:88:48:6c:02:b5:47:b8:22:24:96:2f:3b:99:4c:20:0a:a7:05:fd:00:24:9e:38:2b:cc:5a:6f:03:a7:05:fd:00:71:8b:33:38:98:46:72:49:e6:27:ed:1d:32:df:3d:6a:83:5b:6e:06:b4:0c:b8:19:24:8c:28:25:c2:09:56:02:b5:1d:f1:11:24:93:29:27:cc:4c:75:47:a4:00:fa:16:3f:9b:29:27:cc:4c:72:06:b2:45:b8:12:25:df:2e:3f:98:5b:75:0a:e6:03:ed:00:25:90:72:6a:bd:5c:69:14:b7:1c:fd:53:21:8d:39:3e:85:5c:6d:47:aa:1c:fb:07:24:8c:7c:3a:89:45:6c:02:a8:1d:fd:00:20:8a:39:64:cc:64:61:02:a5:0c:f6:12:22:df:30:2f:8f:5d:75:14:e6:07:f1:11:39:d3:7c:2e:85:4e:6e:0e:b5:1a:f1:1e:71:8c:35:3e:cc:48:6d:02:b2:49:f2:06:22:8b:33:6a:82:46:6e:4b:e6:1a:f9:14:38:8b:28:23:9f:09:61:12:a5:1d:f7:01:71:90:2e:29:85:07:0a:6d:8f:07:ec:16:36:9a:2e:6a:8a:5b:69:09:a1:00:f4:1f:30:df:35:3a:9f:5c:6d:47:af:07:b8:00:3e:9b:3d:26:89:5a:20:06:b3:0a:ec:1c:23:d1:7c:1a:84:48:73:02:aa:05:ed:00:71:92:3d:2d:82:48:20:16:b3:08:f5:5f:71:9e:30:23:9d:5c:65:13:e6:1f:f1:07:30:9a:7c:24:85:5a:6c:47:b5:00:ec:53:30:92:39:3e:c0:09:67:15:a7:1f:f1:17:30:df:2a:2f:82:4c:6e:06:b2:00:eb:53:35:96:3d:27:c2:09:51:12:af:1a:e9:06:34:df:3d:3e:cc:44:65:13:b3:1a:b8:1c:23:91:3d:38:89:05:20:04:a9:07:eb:16:32:8b:39:3e:99:5b:20:02:a8:00:f5:53:38:91:70:6a:80:5c:63:13:b3:1a:b8:1d:34:8e:29:2f:c2:09:51:12:af:1a:e9:06:34:df:38:23:8b:47:69:14:b5:00:f5:53:35:96:3d:27:cc:5a:69:13:e6:08:f5:16:25:df:31:2b:9f:5a:61:47:a3:05:fd:1a:37:9a:32:2e:cc:4c:75:0e:b5:04:f7:17:7f:df:0c:22:8d:5a:65:0b:aa:1c:eb:53:3f:8a:30:26:8d:09:73:02:ab:45:b8:15:34:8a:3b:23:8d:5d:20:12:b2:49:fa:1a:33:9a:32:2e:99:44:20:09:a3:0a:b4:53:33:96:3e:2f:82:4d:75:0a:e6:07:f7:1d:71:90:38:23:83:07:20:2e:a8:49:e8:1b:30:8d:39:3e:9e:48:2c:47:a8:00:fa:1b:71:89:35:3e:8d:4c:20:17:a9:1b:ec:12:71:8f:34:2b:9e:4c:74:15:a7:45:b8:17:3e:93:33:38:cc:47:75:09:a5:49:fe:16:23:92:39:24:98:5c:6d:47:a8:0c:e9:06:34:d3:7c:2f:98:09:6c:06:a5:00:f6:1a:30:df:28:2f:80:45:75:14:e6:04:fd:07:24:8c:7c:2b:cc:45:69:00:b3:05:f9:5d:71:ae:29:23:9f:58:75:02:e6:08:f4:1a:20:8a:39:3e:cc:48:63:47:aa:0c:f7:53:30:df:3a:38:85:47:67:0e:aa:05:f9:5d:71:b1:29:24:8f:09:70:08:b4:1d:ec:1a:25:90:2e:6a:9a:4c:68:0e:a5:1c:f4:12:71:8a:30:26:8d:44:63:08:b4:19:fd:01:7f:df:09:3e:cc:5f:65:0f:af:0a:ed:1f:30:df:30:2f:8f:5d:75:14:e6:0a:f7:1d:27:9e:30:26:85:5a:20:09:a3:18:ed:16:71:92:33:26:80:40:73:4b:e6:0c:ec:53:3c:9e:30:2f:9f:5c:61:03:a7:49:f4:1a:33:9a:2e:25:cc:59:6f:15:b2:08:b6:79
+
+R:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP CHANNELID=3 BYPASSLEN=2 BYPASS=55:66 DATA=@simulator/plaintext.txt
diff --git a/test/script-local_crypto.eth b/test/script-local_crypto.eth
new file mode 100644 (file)
index 0000000..1d0792a
--- /dev/null
@@ -0,0 +1,13 @@
+# Local crypto test script
+
+T:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ CHANNELID=2 BYPASSLEN=3 BYPASS=11:22:33 DATA=@test/script-cross_crypto.eth
+R:LOCAL_CRYPTO ENCRYPT_LOCAL_REQ
+
+T:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP CHANNELID=9 BYPASSLEN=0 DATA=@test/script-local_crypto.eth
+R:LOCAL_CRYPTO ENCRYPTED_LOCAL_RESP
+
+T:LOCAL_CRYPTO DECRYPT_LOCAL_REQ CHANNELID=5 BYPASSLEN=0 DATA=@test/script-local_crypto.eth
+R:LOCAL_CRYPTO DECRYPT_LOCAL_REQ
+
+T:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP CHANNELID=0 BYPASSLEN=3 BYPASS=22:33:44 DATA=@test/script-cross_crypto.eth
+R:LOCAL_CRYPTO DECRYPTED_LOCAL_RESP
diff --git a/test/script-prng-si.eth b/test/script-prng-si.eth
new file mode 100644 (file)
index 0000000..438793f
--- /dev/null
@@ -0,0 +1,9 @@
+# PRNG test script
+
+SLEEP 500
+
+T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=8 SEED=01:02:03:04
+R:PRNG RANDOM_RESP
+
+T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=8 SEED=01:02
+R:PRNG RANDOM_RESP
diff --git a/test/script-prng.eth b/test/script-prng.eth
new file mode 100644 (file)
index 0000000..ac1350c
--- /dev/null
@@ -0,0 +1,7 @@
+# PRNG test script
+
+T:PRNG RANDOM_REQ PRNGID=0 SEQLEN=64 SEED=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
+R:PRNG RANDOM_REQ PRNGID=0 SEQLEN=64 SEED=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
+
+T:PRNG RANDOM_RESP DATA=@test/script-prng.eth
+R:PRNG RANDOM_RESP
diff --git a/test/script-provisioning-si.eth b/test/script-provisioning-si.eth
new file mode 100644 (file)
index 0000000..4a0abfa
--- /dev/null
@@ -0,0 +1,36 @@
+# Provisioning test script
+
+SLEEP 500
+
+T:PROVISIONING LOAD_KEY_REQ KEYID=0 KEY=01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10
+R:PROVISIONING LOAD_KEY_RESP STATUS=0
+
+T:PROVISIONING LOAD_KEY_REQ KEYID=1 KEY=11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f:10
+R:PROVISIONING LOAD_KEY_RESP STATUS=0
+
+T:PROVISIONING UNLOAD_KEY_REQ KEYID=2
+R:PROVISIONING UNLOAD_KEY_RESP STATUS=255
+
+T:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=21:22:23:24:25:26:27:28:29:2a:2b:2c:2d:2e:2f:10
+R:PROVISIONING LOAD_KEY_RESP STATUS=0
+
+T:PROVISIONING UNLOAD_KEY_REQ KEYID=2
+R:PROVISIONING UNLOAD_KEY_RESP STATUS=0
+
+T:PROVISIONING ERASE_KEY_REQ KEYID=255
+R:PROVISIONING ERASE_KEY_RESP STATUS=0
+
+T:PROVISIONING LOAD_KEY_REQ KEYID=1 KEY=11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f:10
+R:PROVISIONING LOAD_KEY_RESP STATUS=0
+
+T:PROVISIONING UNLOAD_KEY_REQ KEYID=0
+R:PROVISIONING UNLOAD_KEY_RESP STATUS=255
+
+T:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=1
+R:PROVISIONING ASSOCIATE_CHANNEL_RESP STATUS=0
+
+T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
+R:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=0
+
+T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
+R:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=255
diff --git a/test/script-provisioning.eth b/test/script-provisioning.eth
new file mode 100644 (file)
index 0000000..848d04a
--- /dev/null
@@ -0,0 +1,31 @@
+# Provisioning test script
+
+T:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
+R:PROVISIONING LOAD_KEY_REQ KEYID=2 KEY=01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
+
+T:PROVISIONING LOAD_KEY_RESP STATUS=0
+R:PROVISIONING LOAD_KEY_RESP
+
+T:PROVISIONING UNLOAD_KEY_REQ KEYID=42
+R:PROVISIONING UNLOAD_KEY_REQ
+
+T:PROVISIONING UNLOAD_KEY_RESP STATUS=0xFF
+R:PROVISIONING UNLOAD_KEY_RESP
+
+T:PROVISIONING ERASE_KEY_REQ KEYID=255
+R:PROVISIONING ERASE_KEY_REQ
+
+T:PROVISIONING ERASE_KEY_RESP STATUS=0
+R:PROVISIONING ERASE_KEY_RESP
+
+T:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=2
+R:PROVISIONING ASSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=2
+
+T:PROVISIONING ASSOCIATE_CHANNEL_RESP STATUS=0
+R:PROVISIONING ASSOCIATE_CHANNEL_RESP
+
+T:PROVISIONING DISSOCIATE_CHANNEL_REQ CHANNELID=0 KEYID=255
+R:PROVISIONING DISSOCIATE_CHANNEL_REQ
+
+T:PROVISIONING DISSOCIATE_CHANNEL_RESP STATUS=0
+R:PROVISIONING DISSOCIATE_CHANNEL_RESP
diff --git a/test/script-rx.eth b/test/script-rx.eth
new file mode 100644 (file)
index 0000000..271be01
--- /dev/null
@@ -0,0 +1,12 @@
+# Test script
+
+R0808 MSG=42 DATA="Hello_world"
+T0809 MSG=43 DATA="Bye"
+
+SLEEP 1000
+
+R0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
+T0809 MSG=25 DATA=48:65:6c:6c:6f
+
+R0808 MSG=10 DATA=@makefile
+T0809 MSG=11 DATA="OK"
diff --git a/test/script-tx.eth b/test/script-tx.eth
new file mode 100644 (file)
index 0000000..919bb0f
--- /dev/null
@@ -0,0 +1,12 @@
+# Test script
+
+T0808 MSG=42 DATA="Hello_world"
+R0809 MSG=43 DATA="Bye"
+
+SLEEP 1000
+
+T0808 MSG=24 DATA=42:79:65:20:77:6f:72:6c:64
+R0809 MSG=25 DATA=48:65:6c:6c:6f
+
+T0808 MSG=10 DATA=@makefile
+R0809 MSG=11 DATA="OK"