summaryrefslogtreecommitdiff
path: root/lib/dtls-sw.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2019-10-20 18:49:41 +0300
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2019-10-24 17:23:49 +0300
commitcad80e6184135ea65f6f46a9abf9c1534486deab (patch)
tree902725a128204593fdb209ca9563fa7deb6edb7a /lib/dtls-sw.c
parente4a7db34259295ebb32a0255215471323948efbb (diff)
downloadgnutls-cad80e6184135ea65f6f46a9abf9c1534486deab.tar.gz
lib: drop gnutls_uint64 usage as sequence number
GnuTLS is depending already on uint64_t being a properly defined type. So there is no need to have a special byte-array type for 8-byte integers. Use uint64_t instead, thus simplifying a code quite heavily. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'lib/dtls-sw.c')
-rw-r--r--lib/dtls-sw.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/dtls-sw.c b/lib/dtls-sw.c
index f0fc5a6ef5..2511fb34a2 100644
--- a/lib/dtls-sw.c
+++ b/lib/dtls-sw.c
@@ -40,20 +40,6 @@
#define DTLS_EMPTY_BITMAP (0xFFFFFFFFFFFFFFFFULL)
-/* We expect the compiler to be able to spot that this is a byteswapping
- * load, and emit instructions like 'movbe' on x86_64 where appropriate.
-*/
-#define LOAD_UINT64(out, ubytes) \
- out = (((uint64_t)ubytes[0] << 56) | \
- ((uint64_t)ubytes[1] << 48) | \
- ((uint64_t)ubytes[2] << 40) | \
- ((uint64_t)ubytes[3] << 32) | \
- ((uint64_t)ubytes[4] << 24) | \
- ((uint64_t)ubytes[5] << 16) | \
- ((uint64_t)ubytes[6] << 8) | \
- ((uint64_t)ubytes[7] << 0) )
-
-
void _dtls_reset_window(struct record_parameters_st *rp)
{
rp->dtls_sw_have_recv = 0;
@@ -63,12 +49,8 @@ void _dtls_reset_window(struct record_parameters_st *rp)
* packet is detected it returns a negative value (but no sensible error code).
* Otherwise zero.
*/
-int _dtls_record_check(struct record_parameters_st *rp, const gnutls_uint64 * _seq)
+int _dtls_record_check(struct record_parameters_st *rp, uint64_t seq_num)
{
- uint64_t seq_num = 0;
-
- LOAD_UINT64(seq_num, _seq->i);
-
if ((seq_num >> DTLS_EPOCH_SHIFT) != rp->epoch) {
return gnutls_assert_val(-1);
}