Commit 9f8820cc by Martin Schläffer Committed by Sebastian Renner

ascon update

parent d43acb73
...@@ -5,8 +5,7 @@ enable_testing() ...@@ -5,8 +5,7 @@ enable_testing()
# set the default version, algorithms, implementations, tests, flags, defs # set the default version, algorithms, implementations, tests, flags, defs
set(DEFAULT_VERSIONS v12) set(DEFAULT_VERSIONS v12)
set(DEFAULT_ALGS ascon128 ascon128a ascon80pq asconhash asconxof) set(DEFAULT_ALGS ascon128 ascon128a ascon80pq asconhash asconxof)
set(DEFAULT_IMPLS ref opt64 opt64_lowsize bi32 bi32_lowsize bi32_lowreg bi16 bi8 set(DEFAULT_IMPLS ref opt64 opt64_lowsize bi32 bi32_lowsize bi32_lowreg bi16 bi8)
opt64_2shares opt64_3shares bi32_2shares bi32_3shares)
set(DEFAULT_TESTS genkat getcycles) set(DEFAULT_TESTS genkat getcycles)
set(DEFAULT_REL_FLAGS -std=c99 -O2 -fomit-frame-pointer -march=native -mtune=native) set(DEFAULT_REL_FLAGS -std=c99 -O2 -fomit-frame-pointer -march=native -mtune=native)
set(DEFAULT_DBG_FLAGS -std=c99 -O2 -Wall -Wextra -Wshadow) set(DEFAULT_DBG_FLAGS -std=c99 -O2 -Wall -Wextra -Wshadow)
......
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
void process_data(state_t* s, uint8_t* out, const uint8_t* in, uint64_t len, void process_data(state_t* s, uint8_t* out, const uint8_t* in, uint64_t len,
uint8_t mode) { uint8_t mode) {
word_t tmp0, tmp1; word_t tmp0, tmp1;
uint64_t t0, t1;
uint64_t i;
while (len >= ASCON_RATE) { while (len >= ASCON_RATE) {
tmp0 = LOAD64(in); tmp0 = LOAD64(in);
......
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
void process_data(state_t* s, uint8_t* out, const uint8_t* in, uint64_t len, void process_data(state_t* s, uint8_t* out, const uint8_t* in, uint64_t len,
uint8_t mode) { uint8_t mode) {
word_t tmp0, tmp1; word_t tmp0, tmp1;
uint64_t t0, t1;
uint64_t i;
while (len >= ASCON_RATE) { while (len >= ASCON_RATE) {
tmp0 = LOAD64(in); tmp0 = LOAD64(in);
......
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen, ...@@ -40,8 +40,11 @@ void ascon_core(state_t* s, uint8_t* out, const uint8_t* in, uint64_t tlen,
PB(s); PB(s);
} }
XOR(s->x4, WORD_T(1)); XOR(s->x4, WORD_T(1));
printstate("process associated data", s);
/* process plaintext/ciphertext */ /* process plaintext/ciphertext */
process_data(s, out, in, tlen, mode); process_data(s, out, in, tlen, mode);
if (mode == ASCON_ENC) printstate("process plaintext", s);
if (mode == ASCON_DEC) printstate("process ciphertext", s);
/* finalization */ /* finalization */
if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) { if (CRYPTO_KEYBYTES == 16 && ASCON_RATE == 8) {
XOR(s->x1, K1); XOR(s->x1, K1);
......
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -22,14 +22,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) { ...@@ -13,14 +13,23 @@ void P(state_t* s, uint8_t rounds) {
#else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */ #else /* !ASCON_INLINE_PERM && !ASCON_SINGLE_PERM */
void P12(state_t* s) { P12ROUNDS(s); } void P12(state_t* s) {
printstate(" permutation input", s);
P12ROUNDS(s);
}
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 16 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 16
void P8(state_t* s) { P8ROUNDS(s); } void P8(state_t* s) {
printstate(" permutation input", s);
P8ROUNDS(s);
}
#endif #endif
#if defined(CRYPTO_ABYTES) && ASCON_RATE == 8 #if defined(CRYPTO_ABYTES) && ASCON_RATE == 8
void P6(state_t* s) { P6ROUNDS(s); } void P6(state_t* s) {
printstate(" permutation input", s);
P6ROUNDS(s);
}
#endif #endif
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment