Merge pull request #1483 from dgarske/winvs

Fixes for unused `heap` warnings
This commit is contained in:
toddouska
2018-04-06 09:01:49 -07:00
committed by GitHub
3 changed files with 37 additions and 23 deletions

56
src/tls.c Normal file → Executable file
View File

@@ -919,6 +919,8 @@ static TLSX* TLSX_New(TLSX_Type type, void* data, void* heap)
{ {
TLSX* extension = (TLSX*)XMALLOC(sizeof(TLSX), heap, DYNAMIC_TYPE_TLSX); TLSX* extension = (TLSX*)XMALLOC(sizeof(TLSX), heap, DYNAMIC_TYPE_TLSX);
(void)heap;
if (extension) { if (extension) {
extension->type = type; extension->type = type;
extension->data = data; extension->data = data;
@@ -2886,6 +2888,8 @@ static int TLSX_SupportedCurve_New(SupportedCurve** curve, word16 name,
if (curve == NULL) if (curve == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
(void)heap;
*curve = (SupportedCurve*)XMALLOC(sizeof(SupportedCurve), heap, *curve = (SupportedCurve*)XMALLOC(sizeof(SupportedCurve), heap,
DYNAMIC_TYPE_TLSX); DYNAMIC_TYPE_TLSX);
if (*curve == NULL) if (*curve == NULL)
@@ -2902,6 +2906,8 @@ static int TLSX_PointFormat_New(PointFormat** point, byte format, void* heap)
if (point == NULL) if (point == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
(void)heap;
*point = (PointFormat*)XMALLOC(sizeof(PointFormat), heap, *point = (PointFormat*)XMALLOC(sizeof(PointFormat), heap,
DYNAMIC_TYPE_TLSX); DYNAMIC_TYPE_TLSX);
if (*point == NULL) if (*point == NULL)
@@ -4393,7 +4399,7 @@ int TLSX_ValidateQSHScheme(TLSX** extensions, word16 theirs) {
for (format = (QSHScheme*)extension->data; format; format = format->next) { for (format = (QSHScheme*)extension->data; format; format = format->next) {
if (format->name == theirs) { if (format->name == theirs) {
WOLFSSL_MSG("Found Matching QSH Scheme"); WOLFSSL_MSG("Found Matching QSH Scheme");
return 1; /* have QSH */ return 1; /* have QSH */
} }
} }
@@ -4437,33 +4443,33 @@ int TLSX_UseQSHScheme(TLSX** extensions, word16 name, byte* pKey, word16 pkeySz,
/* if scheme is implemented than add */ /* if scheme is implemented than add */
if (TLSX_HaveQSHScheme(name)) { if (TLSX_HaveQSHScheme(name)) {
if ((ret = TLSX_QSH_Append(&format, name, pKey, pkeySz)) != 0) if ((ret = TLSX_QSH_Append(&format, name, pKey, pkeySz)) != 0)
return ret; return ret;
if (!extension) { if (!extension) {
if ((ret = TLSX_Push(extensions, TLSX_QUANTUM_SAFE_HYBRID, format, if ((ret = TLSX_Push(extensions, TLSX_QUANTUM_SAFE_HYBRID, format,
heap)) != 0) { heap)) != 0) {
XFREE(format, 0, DYNAMIC_TYPE_TLSX); XFREE(format, 0, DYNAMIC_TYPE_TLSX);
return ret; return ret;
} }
} }
else { else {
/* push new QSH object to extension data. */ /* push new QSH object to extension data. */
format->next = (QSHScheme*)extension->data; format->next = (QSHScheme*)extension->data;
extension->data = (void*)format; extension->data = (void*)format;
/* look for another format of the same name to remove (replacement) */ /* look for another format of the same name to remove (replacement) */
do { do {
if (format->next && (format->next->name == name)) { if (format->next && (format->next->name == name)) {
QSHScheme* next = format->next; QSHScheme* next = format->next;
format->next = next->next; format->next = next->next;
XFREE(next, 0, DYNAMIC_TYPE_TLSX); XFREE(next, 0, DYNAMIC_TYPE_TLSX);
break; break;
} }
} while ((format = format->next)); } while ((format = format->next));
} }
} }
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }
@@ -8917,6 +8923,7 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
WOLFSSL_METHOD* method = WOLFSSL_METHOD* method =
(WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD), (WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD),
heap, DYNAMIC_TYPE_METHOD); heap, DYNAMIC_TYPE_METHOD);
(void)heap;
if (method) if (method)
InitSSL_Method(method, MakeTLSv1()); InitSSL_Method(method, MakeTLSv1());
return method; return method;
@@ -8933,6 +8940,7 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
WOLFSSL_METHOD* method = WOLFSSL_METHOD* method =
(WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD), (WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD),
heap, DYNAMIC_TYPE_METHOD); heap, DYNAMIC_TYPE_METHOD);
(void)heap;
if (method) if (method)
InitSSL_Method(method, MakeTLSv1_1()); InitSSL_Method(method, MakeTLSv1_1());
return method; return method;
@@ -9034,6 +9042,7 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
WOLFSSL_METHOD* method = WOLFSSL_METHOD* method =
(WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD), (WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD),
heap, DYNAMIC_TYPE_METHOD); heap, DYNAMIC_TYPE_METHOD);
(void)heap;
if (method) { if (method) {
InitSSL_Method(method, MakeTLSv1()); InitSSL_Method(method, MakeTLSv1());
method->side = WOLFSSL_SERVER_END; method->side = WOLFSSL_SERVER_END;
@@ -9052,6 +9061,7 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
WOLFSSL_METHOD* method = WOLFSSL_METHOD* method =
(WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD), (WOLFSSL_METHOD*) XMALLOC(sizeof(WOLFSSL_METHOD),
heap, DYNAMIC_TYPE_METHOD); heap, DYNAMIC_TYPE_METHOD);
(void)heap;
if (method) { if (method) {
InitSSL_Method(method, MakeTLSv1_1()); InitSSL_Method(method, MakeTLSv1_1());
method->side = WOLFSSL_SERVER_END; method->side = WOLFSSL_SERVER_END;

2
wolfcrypt/src/ecc.c Normal file → Executable file
View File

@@ -2404,6 +2404,8 @@ ecc_point* wc_ecc_new_point_h(void* heap)
{ {
ecc_point* p; ecc_point* p;
(void)heap;
p = (ecc_point*)XMALLOC(sizeof(ecc_point), heap, DYNAMIC_TYPE_ECC); p = (ecc_point*)XMALLOC(sizeof(ecc_point), heap, DYNAMIC_TYPE_ECC);
if (p == NULL) { if (p == NULL) {
return NULL; return NULL;

2
wolfcrypt/src/pwdbased.c Normal file → Executable file
View File

@@ -459,6 +459,8 @@ int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen,
byte B[PBKDF_DIGEST_SIZE]; byte B[PBKDF_DIGEST_SIZE];
#endif #endif
(void)heap;
if (!iterations) if (!iterations)
iterations = 1; iterations = 1;