diff options
Diffstat (limited to 'third_party/srtp/crypto/replay/rdb.c')
-rw-r--r-- | third_party/srtp/crypto/replay/rdb.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/third_party/srtp/crypto/replay/rdb.c b/third_party/srtp/crypto/replay/rdb.c index c826912a..c84222fd 100644 --- a/third_party/srtp/crypto/replay/rdb.c +++ b/third_party/srtp/crypto/replay/rdb.c @@ -44,6 +44,10 @@ */ +#ifdef HAVE_CONFIG_H + #include <config.h> +#endif + #include "rdb.h" @@ -70,18 +74,18 @@ rdb_init(rdb_t *rdb) { */ err_status_t -rdb_check(const rdb_t *rdb, uint32_t index) { +rdb_check(const rdb_t *rdb, uint32_t p_index) { /* if the index appears after (or at very end of) the window, its good */ - if (index >= rdb->window_start + rdb_bits_in_bitmask) + if (p_index >= rdb->window_start + rdb_bits_in_bitmask) return err_status_ok; /* if the index appears before the window, its bad */ - if (index < rdb->window_start) + if (p_index < rdb->window_start) return err_status_replay_old; /* otherwise, the index appears within the window, so check the bitmask */ - if (v128_get_bit(&rdb->bitmask, (index - rdb->window_start)) == 1) + if (v128_get_bit(&rdb->bitmask, (p_index - rdb->window_start)) == 1) return err_status_replay_fail; /* otherwise, the index is okay */ @@ -98,15 +102,15 @@ rdb_check(const rdb_t *rdb, uint32_t index) { */ err_status_t -rdb_add_index(rdb_t *rdb, uint32_t index) { +rdb_add_index(rdb_t *rdb, uint32_t p_index) { int delta; - /* here we *assume* that index > rdb->window_start */ + /* here we *assume* that p_index > rdb->window_start */ - delta = (index - rdb->window_start); + delta = (p_index - rdb->window_start); if (delta < rdb_bits_in_bitmask) { - /* if the index is within the window, set the appropriate bit */ + /* if the p_index is within the window, set the appropriate bit */ v128_set_bit(&rdb->bitmask, delta); } else { |