From 7ca855410d36607858a694781a1a8c55fd8374d2 Mon Sep 17 00:00:00 2001 From: CPunch Date: Sun, 8 May 2022 01:45:36 -0500 Subject: [PATCH] Box: added LAIKA_BOX_DATA_INDX & LAIKA_BOX_UNLOCKED_INDX macros - they represent the indx in the constant list the box's unlocked & data pointers will be --- lib/include/lbox.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/include/lbox.h b/lib/include/lbox.h index 76433e6..8b4475e 100644 --- a/lib/include/lbox.h +++ b/lib/include/lbox.h @@ -9,6 +9,8 @@ #include "lsodium.h" #define LAIKA_BOX_HEAPSIZE 256 +#define LAIKA_BOX_UNLOCKED_INDX 0 +#define LAIKA_BOX_DATA_INDX 1 /* Laika Box: Laika Boxes are obfuscated storage mediums where data is only in memory for a very short amount of time. @@ -35,8 +37,8 @@ struct sLaikaB_box { [2] - key (uint8_t) \ [3] - working data (uint8_t) \ */ \ - LAIKA_MAKE_VM_IAB(OP_LOADCONST, 0, 0), \ - LAIKA_MAKE_VM_IAB(OP_LOADCONST, 1, 1), \ + LAIKA_MAKE_VM_IAB(OP_LOADCONST, 0, LAIKA_BOX_UNLOCKED_INDX), \ + LAIKA_MAKE_VM_IAB(OP_LOADCONST, 1, LAIKA_BOX_DATA_INDX), \ LAIKA_MAKE_VM_IAB(OP_PUSHLIT, 2, _key), \ /* LOOP_START */ \ LAIKA_MAKE_VM_IAB(OP_READ, 3, 1), /* load data into working data */ \ @@ -53,8 +55,8 @@ LAIKA_FORCEINLINE void* laikaB_unlock(struct sLaikaB_box *box, void *data) { struct sLaikaV_vm vm = { /* boxes have 2 reserved constants, [0] for the output, [1] for the input */ .constList = { - LAIKA_MAKE_VM_PTR(box->unlockedData), - LAIKA_MAKE_VM_PTR(data), + [LAIKA_BOX_UNLOCKED_INDX] = LAIKA_MAKE_VM_PTR(box->unlockedData), + [LAIKA_BOX_DATA_INDX] = LAIKA_MAKE_VM_PTR(data), }, .code = {0}, .stack = {0},