* https://www.openssl.org/source/license.html
*/
+#include <assert.h>
#include "packet_locl.h"
#define DEFAULT_BUF_SIZE 256
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
+ /* Internal API, so should not fail */
+ assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
{
unsigned char *lenchars;
- /* Sanity check */
+ /* Internal API, so should not fail */
+ assert(buf != NULL);
if (buf == NULL)
return 0;
int WPACKET_set_flags(WPACKET *pkt, unsigned int flags)
{
+ /* Internal API, so should not fail */
+ assert(pkt->subs != NULL);
if (pkt->subs == NULL)
return 0;
int WPACKET_close(WPACKET *pkt)
{
+ /*
+ * Internal API, so should not fail - but we do negative testing of this
+ * so no assert (otherwise the tests fail)
+ */
if (pkt->subs == NULL || pkt->subs->parent == NULL)
return 0;
{
int ret;
+ /*
+ * Internal API, so should not fail - but we do negative testing of this
+ * so no assert (otherwise the tests fail)
+ */
if (pkt->subs == NULL || pkt->subs->parent != NULL)
return 0;
WPACKET_SUB *sub;
unsigned char *lenchars;
+ /* Internal API, so should not fail */
+ assert(pkt->subs != NULL);
if (pkt->subs == NULL)
return 0;
{
unsigned char *data;
+ /* Internal API, so should not fail */
+ assert(size <= sizeof(unsigned int));
if (size > sizeof(unsigned int)
|| !WPACKET_allocate_bytes(pkt, size, &data))
return 0;
WPACKET_SUB *sub;
size_t lenbytes;
+ /* Internal API, so should not fail */
+ assert(pkt->subs != NULL);
if (pkt->subs == NULL)
return 0;
int WPACKET_get_total_written(WPACKET *pkt, size_t *written)
{
+ /* Internal API, so should not fail */
+ assert(written != NULL);
if (written == NULL)
return 0;
int WPACKET_get_length(WPACKET *pkt, size_t *len)
{
+ /* Internal API, so should not fail */
+ assert(pkt->subs != NULL && len != NULL);
if (pkt->subs == NULL || len == NULL)
return 0;