Commit 1a73d20a7f for strongswan.org

commit 1a73d20a7fd9a847c3f45c9ed53ede3aa0569337
Author: Tobias Brunner <tobias@strongswan.org>
Date:   Wed Oct 21 12:44:47 2026 +0200

    byteorder: Add helper to read 16 bits without byte order change from an unaligned address

    Also make the args for the sibling functions const.

diff --git a/src/libstrongswan/utils/utils/byteorder.h b/src/libstrongswan/utils/utils/byteorder.h
index a0c81e14c6..20840fc85e 100644
--- a/src/libstrongswan/utils/utils/byteorder.h
+++ b/src/libstrongswan/utils/utils/byteorder.h
@@ -246,13 +246,27 @@ static inline void htoule32(void *p, uint32_t v)
 	memcpy(p, &v, sizeof(v));
 }

+/**
+ * Read a 16-bit value from an unaligned address without byte order conversion.
+ *
+ * @param p			unaligned address to read value from
+ * @return			value
+ */
+static inline uint16_t uread16(const void *p)
+{
+	uint16_t ret;
+
+	memcpy(&ret, p, sizeof(ret));
+	return ret;
+}
+
 /**
  * Read a 32-bit value from an unaligned address without byte order conversion.
  *
  * @param p			unaligned address to read value from
- * @return			host order value
+ * @return			value
  */
-static inline uint32_t uread32(void *p)
+static inline uint32_t uread32(const void *p)
 {
 	uint32_t ret;

@@ -264,9 +278,9 @@ static inline uint32_t uread32(void *p)
  * Read a 64-bit value from an unaligned address without byte order conversion.
  *
  * @param p			unaligned address to read value from
- * @return			host order value
+ * @return			value
  */
-static inline uint64_t uread64(void *p)
+static inline uint64_t uread64(const void *p)
 {
 	uint64_t ret;