return 1;
}
+/* Same as PACKET_get_net_2() but for a size_t */
+__owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data)
+{
+ unsigned int i;
+ int ret;
+
+ ret = PACKET_get_net_2(pkt, &i);
+ if (ret)
+ *data = (size_t)i;
+
+ return ret;
+}
+
/*
* Peek ahead at 3 bytes in network order from |pkt| and store the value in
* |*data|
return 1;
}
+/* Same as PACKET_get_net_3() but for a size_t */
+__owur static ossl_inline int PACKET_get_net_3_len(PACKET *pkt, size_t *data)
+{
+ unsigned long i;
+ int ret;
+
+ ret = PACKET_get_net_3(pkt, &i);
+ if (ret)
+ *data = (size_t)i;
+
+ return ret;
+}
+
/*
* Peek ahead at 4 bytes in network order from |pkt| and store the value in
* |*data|
return 1;
}
+/* Same as PACKET_get_net_4() but for a size_t */
+__owur static ossl_inline int PACKET_get_net_4_len(PACKET *pkt, size_t *data)
+{
+ unsigned long i;
+ int ret;
+
+ ret = PACKET_get_net_4(pkt, &i);
+ if (ret)
+ *data = (size_t)i;
+
+ return ret;
+}
+
/* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
__owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
unsigned int *data)
return 1;
}
+/* Same as PACKET_get_1() but for a size_t */
+__owur static ossl_inline int PACKET_get_1_len(PACKET *pkt, size_t *data)
+{
+ unsigned int i;
+ int ret;
+
+ ret = PACKET_get_1(pkt, &i);
+ if (ret)
+ *data = (size_t)i;
+
+ return ret;
+}
+
/*
* Peek ahead at 4 bytes in reverse network order from |pkt| and store the value
* in |*data|
* maximum size will be. If this function is used, then it should be immediately
* followed by a WPACKET_allocate_bytes() call before any other WPACKET
* functions are called (unless the write to the allocated bytes is abandoned).
- *
+ *
* For example: If we are generating a signature, then the size of that
* signature may not be known in advance. We can use WPACKET_reserve_bytes() to
* handle this:
#define WPACKET_put_bytes_u24(pkt, val) \
WPACKET_put_bytes__((pkt), (val), 3)
#define WPACKET_put_bytes_u32(pkt, val) \
- WPACKET_sub_allocate_bytes__((pkt), (val), 4)
+ WPACKET_put_bytes__((pkt), (val), 4)
/* Set a maximum size that we will not allow the WPACKET to grow beyond */
int WPACKET_set_max_size(WPACKET *pkt, size_t maxsize);