Like le16/le32, add support for conversion to le24.
Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
a[2] = val & 0xff;
}
+static inline u32 WPA_GET_LE24(const u8 *a)
+{
+ return (a[2] << 16) | (a[1] << 8) | a[0];
+}
+
+static inline void WPA_PUT_LE24(u8 *a, u32 val)
+{
+ a[2] = (val >> 16) & 0xff;
+ a[1] = (val >> 8) & 0xff;
+ a[0] = val & 0xff;
+}
+
static inline u32 WPA_GET_BE32(const u8 *a)
{
return ((u32) a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3];
WPA_PUT_LE16(pos, data);
}
+static inline void wpabuf_put_le24(struct wpabuf *buf, u32 data)
+{
+ u8 *pos = (u8 *) wpabuf_put(buf, 3);
+ WPA_PUT_LE24(pos, data);
+}
+
static inline void wpabuf_put_le32(struct wpabuf *buf, u32 data)
{
u8 *pos = (u8 *) wpabuf_put(buf, 4);