diff --git a/src/crypto_aead.h b/src/crypto_aead.h
index 19b6b853e44f403da2c75d66c233c1c8f5504c06..53ec4a7a5fdb76097fcfa8703fb571f66cea16c3 100644
--- a/src/crypto_aead.h
+++ b/src/crypto_aead.h
@@ -1,12 +1,12 @@
-int crypto_aead_encrypt(unsigned char* c, unsigned int* clen,
- const unsigned char* m, unsigned int mlen,
- const unsigned char* ad, unsigned int adlen,
+int crypto_aead_encrypt(unsigned char* c, unsigned long long* clen,
+ const unsigned char* m, unsigned long long mlen,
+ const unsigned char* ad, unsigned long long adlen,
const unsigned char* nsec, const unsigned char* npub,
const unsigned char* k);
-int crypto_aead_decrypt(unsigned char* m, unsigned int* mlen,
+int crypto_aead_decrypt(unsigned char* m, unsigned long long* mlen,
unsigned char* nsec, const unsigned char* c,
- unsigned int clen, const unsigned char* ad,
- unsigned int adlen, const unsigned char* npub,
+ unsigned long long clen, const unsigned char* ad,
+ unsigned long long adlen, const unsigned char* npub,
const unsigned char* k);
diff --git a/src/encrypt.c b/src/encrypt.c
index 4356c16ae8e5b39cee57609ed9007ebee561a0a0..74d09fad9ff67eafdbc24343abfe959f1c36987b 100644
--- a/src/encrypt.c
+++ b/src/encrypt.c
@@ -19,9 +19,9 @@
#endif
// Spook encryption.
-int crypto_aead_encrypt(unsigned char* c, unsigned int* clen,
- const unsigned char* m, unsigned int mlen,
- const unsigned char* ad, unsigned int adlen,
+int crypto_aead_encrypt(unsigned char* c, unsigned long long* clen,
+ const unsigned char* m, unsigned long long mlen,
+ const unsigned char* ad, unsigned long long adlen,
const unsigned char* nsec UNUSED,
const unsigned char* npub, const unsigned char* k) {
unsigned char p[P_NBYTES];
@@ -32,10 +32,10 @@ int crypto_aead_encrypt(unsigned char* c, unsigned int* clen,
}
// Spook encryption.
-int crypto_aead_decrypt(unsigned char* m, unsigned int* mlen,
+int crypto_aead_decrypt(unsigned char* m, unsigned long long* mlen,
unsigned char* nsec UNUSED, const unsigned char* c,
- unsigned int clen, const unsigned char* ad,
- unsigned int adlen, const unsigned char* npub,
+ unsigned long long clen, const unsigned char* ad,
+ unsigned long long adlen, const unsigned char* npub,
const unsigned char* k) {
unsigned char p[P_NBYTES];
const unsigned char* k_priv;
diff --git a/src/s1p.c b/src/s1p.c
index 6d4f780503e9bc48fcda24ff643b2c1919fa36c0..54b8b7027118ae9daa4fdf21efa2c9899d017986 100644
--- a/src/s1p.c
+++ b/src/s1p.c
@@ -40,19 +40,19 @@ typedef enum {
static void compress_block(unsigned char *state, unsigned char *out,
const unsigned char *d, compress_mode mode,
- unsigned int offset, unsigned int n);
+ unsigned long long offset, unsigned long long n);
-static unsigned int compress_data(shadow_state state,
+static unsigned long long compress_data(shadow_state state,
unsigned char *out,
const unsigned char *d,
- unsigned int dlen,
+ unsigned long long dlen,
compress_mode mode);
static void init_sponge_state(shadow_state state,
const unsigned char *k, const unsigned char *p,
const unsigned char *n);
static void xor_bytes(unsigned char* dest, const unsigned char* src1,
- const unsigned char* src2, unsigned int n);
+ const unsigned char* src2, unsigned long long n);
void init_keys(const unsigned char **k, unsigned char p[P_NBYTES],
const unsigned char *k_glob) {
@@ -80,9 +80,9 @@ static void init_sponge_state(shadow_state state,
shadow(state);
}
-void s1p_encrypt(unsigned char *c, unsigned int *clen,
- const unsigned char *ad, unsigned int adlen,
- const unsigned char *m, unsigned int mlen,
+void s1p_encrypt(unsigned char *c, unsigned long long *clen,
+ const unsigned char *ad, unsigned long long adlen,
+ const unsigned char *m, unsigned long long mlen,
const unsigned char *k, const unsigned char *p,
const unsigned char *n) {
// permutation state
@@ -93,7 +93,7 @@ void s1p_encrypt(unsigned char *c, unsigned int *clen,
compress_data(state, NULL, ad, adlen, AD);
// compress message
- unsigned int c_bytes = 0;
+ unsigned long long c_bytes = 0;
if (mlen > 0) {
state[RATE_BUNDLES][0] ^= 0x01;
c_bytes = compress_data(state, c, m, mlen, PLAINTEXT);
@@ -106,9 +106,9 @@ void s1p_encrypt(unsigned char *c, unsigned int *clen,
*clen = c_bytes + CLYDE128_NBYTES;
}
-int s1p_decrypt(unsigned char *m, unsigned int *mlen,
- const unsigned char *ad, unsigned int adlen,
- const unsigned char *c, unsigned int clen,
+int s1p_decrypt(unsigned char *m, unsigned long long *mlen,
+ const unsigned char *ad, unsigned long long adlen,
+ const unsigned char *c, unsigned long long clen,
const unsigned char *k, const unsigned char *p,
const unsigned char *n) {
// permutation state
@@ -119,7 +119,7 @@ int s1p_decrypt(unsigned char *m, unsigned int *mlen,
compress_data(state, NULL, ad, adlen, AD);
// compress message
- unsigned int m_bytes = 0;
+ unsigned long long m_bytes = 0;
if (clen > CLYDE128_NBYTES) {
state[RATE_BUNDLES][0] ^= 0x01;
m_bytes = compress_data(state, m, c, clen - CLYDE128_NBYTES, CIPHERTEXT);
@@ -151,7 +151,7 @@ int s1p_decrypt(unsigned char *m, unsigned int *mlen,
// Only the XOR operation is performed, not XORing of padding constants.
static void compress_block(unsigned char *state, unsigned char *out,
const unsigned char *d, compress_mode mode,
- unsigned int offset, unsigned int n) {
+ unsigned long long offset, unsigned long long n) {
if (mode == CIPHERTEXT) {
xor_bytes(out + offset, state, d + offset, n);
memcpy(state, d + offset, n);
@@ -167,12 +167,12 @@ static void compress_block(unsigned char *state, unsigned char *out,
// Input data buffer is d with length dlen.
// Output is written into buffer out if mode is PLAINTEXT or CIPHERTEXT.
// Padding is handled if needed.
-static unsigned int compress_data(shadow_state state,
+static unsigned long long compress_data(shadow_state state,
unsigned char *out,
const unsigned char *d,
- unsigned int dlen,
+ unsigned long long dlen,
compress_mode mode) {
- unsigned int i;
+ unsigned long long i;
for (i = 0; i < dlen / RATE_BYTES; i++) {
compress_block((uint8_t *)state, out, d, mode, i * RATE_BYTES, RATE_BYTES);
shadow(state);
@@ -189,8 +189,8 @@ static unsigned int compress_data(shadow_state state,
// XOR buffers src1 and src2 into buffer dest (all buffers contain n bytes).
void xor_bytes(unsigned char* dest, const unsigned char* src1,
- const unsigned char* src2, unsigned int n) {
- for ( unsigned int i = 0; i < n; i++) {
+ const unsigned char* src2, unsigned long long n) {
+ for ( unsigned long long i = 0; i < n; i++) {
dest[i] = src1[i] ^ src2[i];
}
}
diff --git a/src/s1p.h b/src/s1p.h
index 17030bb4aae6da969cb5fe81ad6050fb92b41b81..314f86a2de334976d095ed80ecc814fce547303b 100644
--- a/src/s1p.h
+++ b/src/s1p.h
@@ -29,15 +29,15 @@
// Size of the P parameter
#define P_NBYTES 16
-void s1p_encrypt(unsigned char *c, unsigned int *clen,
- const unsigned char *ad, unsigned int adlen,
- const unsigned char *m, unsigned int mlen,
+void s1p_encrypt(unsigned char *c, unsigned long long *clen,
+ const unsigned char *ad, unsigned long long adlen,
+ const unsigned char *m, unsigned long long mlen,
const unsigned char *k, const unsigned char *p,
const unsigned char *n);
-int s1p_decrypt(unsigned char *m, unsigned int *mlen,
- const unsigned char *ad, unsigned int adlen,
- const unsigned char *c, unsigned int clen,
+int s1p_decrypt(unsigned char *m, unsigned long long *mlen,
+ const unsigned char *ad, unsigned long long adlen,
+ const unsigned char *c, unsigned long long clen,
const unsigned char *k, const unsigned char *p,
const unsigned char *n);