summaryrefslogtreecommitdiff
path: root/tests/dtls-sliding-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dtls-sliding-window.c')
-rw-r--r--tests/dtls-sliding-window.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/tests/dtls-sliding-window.c b/tests/dtls-sliding-window.c
index 1ad15296cd..c6a5e3d554 100644
--- a/tests/dtls-sliding-window.c
+++ b/tests/dtls-sliding-window.c
@@ -36,7 +36,7 @@
struct record_parameters_st {
uint64_t dtls_sw_bits;
- uint64_t dtls_sw_start;
+ uint64_t dtls_sw_next;
unsigned dtls_sw_have_recv;
unsigned epoch;
};
@@ -75,8 +75,8 @@ static void uint64_set(uint64* t, uint64_t v)
#define RESET_WINDOW \
memset(&state, 0, sizeof(state))
-#define SET_WINDOW_START(x) \
- state.dtls_sw_start = ((x)&DTLS_SEQ_NUM_MASK)
+#define SET_WINDOW_NEXT(x) \
+ state.dtls_sw_next = (((x)&DTLS_SEQ_NUM_MASK))
#define SET_WINDOW_LAST_RECV(x) \
uint64_set(&t, BSWAP64(x)); \
@@ -88,7 +88,7 @@ static void check_dtls_window_uninit_0(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
uint64_set(&t, 0);
@@ -125,7 +125,7 @@ static void check_dtls_window_12(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(1);
uint64_set(&t, BSWAP64(2));
@@ -139,7 +139,7 @@ static void check_dtls_window_19(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(1);
uint64_set(&t, BSWAP64(9));
@@ -154,7 +154,7 @@ static void check_dtls_window_skip1(void **glob_state)
unsigned i;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(1);
for (i=2;i<256;i+=2) {
@@ -170,7 +170,7 @@ static void check_dtls_window_skip3(void **glob_state)
unsigned i;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(1);
for (i=5;i<256;i+=2) {
@@ -185,7 +185,7 @@ static void check_dtls_window_21(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(2);
uint64_set(&t, BSWAP64(1));
@@ -199,7 +199,7 @@ static void check_dtls_window_91(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(9);
uint64_set(&t, BSWAP64(1));
@@ -213,7 +213,7 @@ static void check_dtls_window_large_21(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT);
+ SET_WINDOW_NEXT(LARGE_INT);
SET_WINDOW_LAST_RECV(LARGE_INT+2);
uint64_set(&t, BSWAP64(LARGE_INT+1));
@@ -227,7 +227,7 @@ static void check_dtls_window_large_12(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT);
+ SET_WINDOW_NEXT(LARGE_INT);
SET_WINDOW_LAST_RECV(LARGE_INT+1);
uint64_set(&t, BSWAP64(LARGE_INT+2));
@@ -241,7 +241,7 @@ static void check_dtls_window_large_91(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT);
+ SET_WINDOW_NEXT(LARGE_INT);
SET_WINDOW_LAST_RECV(LARGE_INT+9);
uint64_set(&t, BSWAP64(LARGE_INT+1));
@@ -255,7 +255,7 @@ static void check_dtls_window_large_19(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT);
+ SET_WINDOW_NEXT(LARGE_INT);
SET_WINDOW_LAST_RECV(LARGE_INT+1);
uint64_set(&t, BSWAP64(LARGE_INT+9));
@@ -269,7 +269,7 @@ static void check_dtls_window_very_large_12(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(INT_OVER_32_BITS);
+ SET_WINDOW_NEXT(INT_OVER_32_BITS);
SET_WINDOW_LAST_RECV(INT_OVER_32_BITS+1);
uint64_set(&t, BSWAP64(INT_OVER_32_BITS+2));
@@ -283,7 +283,7 @@ static void check_dtls_window_very_large_91(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(INT_OVER_32_BITS);
+ SET_WINDOW_NEXT(INT_OVER_32_BITS);
SET_WINDOW_LAST_RECV(INT_OVER_32_BITS+9);
uint64_set(&t, BSWAP64(INT_OVER_32_BITS+1));
@@ -297,7 +297,7 @@ static void check_dtls_window_very_large_19(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(INT_OVER_32_BITS);
+ SET_WINDOW_NEXT(INT_OVER_32_BITS);
SET_WINDOW_LAST_RECV(INT_OVER_32_BITS+1);
uint64_set(&t, BSWAP64(INT_OVER_32_BITS+9));
@@ -311,12 +311,12 @@ static void check_dtls_window_outside(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(0);
+ SET_WINDOW_NEXT(0);
SET_WINDOW_LAST_RECV(1);
uint64_set(&t, BSWAP64(1+64));
- assert_int_equal(_dtls_record_check(&state, &t), -2);
+ assert_int_equal(_dtls_record_check(&state, &t), 0);
}
static void check_dtls_window_large_outside(void **glob_state)
@@ -325,12 +325,12 @@ static void check_dtls_window_large_outside(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT);
+ SET_WINDOW_NEXT(LARGE_INT);
SET_WINDOW_LAST_RECV(LARGE_INT+1);
uint64_set(&t, BSWAP64(LARGE_INT+1+64));
- assert_int_equal(_dtls_record_check(&state, &t), -2);
+ assert_int_equal(_dtls_record_check(&state, &t), 0);
}
static void check_dtls_window_very_large_outside(void **glob_state)
@@ -339,12 +339,12 @@ static void check_dtls_window_very_large_outside(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(INT_OVER_32_BITS);
+ SET_WINDOW_NEXT(INT_OVER_32_BITS);
SET_WINDOW_LAST_RECV(INT_OVER_32_BITS+1);
uint64_set(&t, BSWAP64(INT_OVER_32_BITS+1+64));
- assert_int_equal(_dtls_record_check(&state, &t), -2);
+ assert_int_equal(_dtls_record_check(&state, &t), 0);
}
static void check_dtls_window_dup1(void **glob_state)
@@ -353,7 +353,7 @@ static void check_dtls_window_dup1(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT-1);
+ SET_WINDOW_NEXT(LARGE_INT-1);
SET_WINDOW_LAST_RECV(LARGE_INT);
uint64_set(&t, BSWAP64(LARGE_INT));
@@ -366,7 +366,7 @@ static void check_dtls_window_dup1(void **glob_state)
assert_int_equal(_dtls_record_check(&state, &t), 0);
uint64_set(&t, BSWAP64(LARGE_INT+1));
- assert_int_equal(_dtls_record_check(&state, &t), -2);
+ assert_int_equal(_dtls_record_check(&state, &t), -3);
}
static void check_dtls_window_dup2(void **glob_state)
@@ -375,7 +375,7 @@ static void check_dtls_window_dup2(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT-1);
+ SET_WINDOW_NEXT(LARGE_INT-1);
SET_WINDOW_LAST_RECV(LARGE_INT);
uint64_set(&t, BSWAP64(LARGE_INT));
@@ -397,7 +397,7 @@ static void check_dtls_window_dup3(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT-1);
+ SET_WINDOW_NEXT(LARGE_INT-1);
SET_WINDOW_LAST_RECV(LARGE_INT);
uint64_set(&t, BSWAP64(LARGE_INT));
@@ -425,7 +425,7 @@ static void check_dtls_window_out_of_order(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT-1);
+ SET_WINDOW_NEXT(LARGE_INT-1);
SET_WINDOW_LAST_RECV(LARGE_INT);
uint64_set(&t, BSWAP64(LARGE_INT));
@@ -465,7 +465,7 @@ static void check_dtls_window_epoch_higher(void **glob_state)
uint64 t;
RESET_WINDOW;
- SET_WINDOW_START(LARGE_INT-1);
+ SET_WINDOW_NEXT(LARGE_INT-1);
SET_WINDOW_LAST_RECV(LARGE_INT);
uint64_set(&t, BSWAP64(LARGE_INT));
@@ -484,7 +484,7 @@ static void check_dtls_window_epoch_lower(void **glob_state)
uint64_set(&t, BSWAP64(0x1000000000000LL));
state.epoch = 1;
- SET_WINDOW_START(0x1000000000000LL);
+ SET_WINDOW_NEXT(0x1000000000000LL);
SET_WINDOW_LAST_RECV((0x1000000000000LL) + 1);
uint64_set(&t, BSWAP64(2 | 0x1000000000000LL));