X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..e5b61a8dec3586f96d25bd3ef454176526ff0f69:/symm/mars.c diff --git a/symm/mars.c b/symm/mars.c index 6f73b42..4c7b302 100644 --- a/symm/mars.c +++ b/symm/mars.c @@ -35,7 +35,6 @@ #include "blkc.h" #include "gcipher.h" #include "mars.h" -#include "mars-tab.h" #include "paranoia.h" /*----- Global variables --------------------------------------------------*/ @@ -44,10 +43,10 @@ const octet mars_keysz[] = { KSZ_RANGE, MARS_KEYSZ, 0, 56, 4 }; /*----- Useful tables -----------------------------------------------------*/ -static const uint32 s[512] = MARS_S; -#define s0 (s + 0) -#define s1 (s + 256) -#define bb (s + 265) +extern const uint32 mars_s[512]; +#define s0 (mars_s + 0) +#define s1 (mars_s + 256) +#define bb (mars_s + 265) /*----- Main code ---------------------------------------------------------*/ @@ -100,7 +99,7 @@ void mars_init(mars_ctx *k, const void *buf, size_t sz) x = t[14]; for (ii = 0; ii < 4; ii++) { for (i = 0; i < 15; i++) { - x = t[i] + s[x & 511u]; + x = t[i] + mars_s[x & 511u]; t[i] = x = ROL32(x, 9); } } @@ -171,7 +170,7 @@ void mars_init(mars_ctx *k, const void *buf, size_t sz) uint32 kx = *k++, ky = *k++; \ y = a + kx; \ a = ROL32(a, 13); z = a * ky; z = ROL32(z, 5); \ - x = s[y & 511u] ^ z; y = ROL32(y, z); \ + x = mars_s[y & 511u] ^ z; y = ROL32(y, z); \ z = ROL32(z, 5); x ^= z; x = ROL32(x, z); \ } while (0) @@ -179,7 +178,7 @@ void mars_init(mars_ctx *k, const void *buf, size_t sz) uint32 ky = *--k, kx = *--k; \ z = a * ky; \ a = ROR32(a, 13); y = a + kx; z = ROL32(z, 5); \ - x = s[y & 511u] ^ z; y = ROL32(y, z); \ + x = mars_s[y & 511u] ^ z; y = ROL32(y, z); \ z = ROL32(z, 5); x ^= z; x = ROL32(x, z); \ } while (0)