Fix IP fragmentation checks for big-endian CPUs

This commit is contained in:
Sergey Lyubka committed 2024-10-04 16:18:33 +01:00
1 parent 5af2de635e
commit 93dd7a85f6
6 files changed
+61 -55

No files matched your search

+1 -9
View File
@@ -7,6 +7,7 @@
#include "tls_chacha20.h"
#include "tls_uecc.h"
#include "tls_x25519.h"
#include "util.h"
#if MG_TLS == MG_TLS_BUILTIN
@@ -90,15 +91,6 @@ struct tls_data {
struct tls_enc enc;
};
#define MG_LOAD_BE16(p) ((uint16_t) ((MG_U8P(p)[0] << 8U) | MG_U8P(p)[1]))
#define MG_LOAD_BE24(p) \
((uint32_t) ((MG_U8P(p)[0] << 16U) | (MG_U8P(p)[1] << 8U) | MG_U8P(p)[2]))
#define MG_STORE_BE16(p, n) \
do { \
MG_U8P(p)[0] = ((n) >> 8U) & 255; \
MG_U8P(p)[1] = (n) &255; \
} while (0)
#define TLS_RECHDR_SIZE 5 // 1 byte type, 2 bytes version, 2 bytes length
#define TLS_MSGHDR_SIZE 4 // 1 byte type, 3 bytes length