/*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-#include "e_os.h"
+#include "internal/cryptlib.h"
#include "packet_locl.h"
+#include <openssl/sslerr.h>
#define DEFAULT_BUF_SIZE 256
pkt->curr = 0;
pkt->written = 0;
- pkt->subs = OPENSSL_zalloc(sizeof(*pkt->subs));
- if (pkt->subs == NULL)
+ if ((pkt->subs = OPENSSL_zalloc(sizeof(*pkt->subs))) == NULL) {
+ SSLerr(SSL_F_WPACKET_INTERN_INIT_LEN, ERR_R_MALLOC_FAILURE);
return 0;
+ }
if (lenbytes == 0)
return 1;
if (!ossl_assert(pkt->subs != NULL))
return 0;
- sub = OPENSSL_zalloc(sizeof(*sub));
- if (sub == NULL)
+ if ((sub = OPENSSL_zalloc(sizeof(*sub))) == NULL) {
+ SSLerr(SSL_F_WPACKET_START_SUB_PACKET_LEN__, ERR_R_MALLOC_FAILURE);
return 0;
+ }
sub->parent = pkt->subs;
pkt->subs = sub;