Fix compiler warnings (ZD12802 and others)

This commit is contained in:
Daniele Lacamera
2021-08-23 08:12:24 +02:00
parent 26cf17e602
commit b56c89bb84
2 changed files with 4 additions and 5 deletions

View File

@ -6817,7 +6817,7 @@ int DecryptContent(byte* input, word32 sz, const char* password, int passwordSz)
{ {
#ifndef WOLFSSL_ASN_TEMPLATE #ifndef WOLFSSL_ASN_TEMPLATE
word32 inOutIdx = 0, seqEnd, oid, shaOid = 0; word32 inOutIdx = 0, seqEnd, oid, shaOid = 0;
int ret = 0, first, second, length = 0, version, saltSz, id; int ret = 0, first, second, length = 0, version, saltSz, id = 0;
int iterations = 0, keySz = 0; int iterations = 0, keySz = 0;
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
byte* salt = NULL; byte* salt = NULL;

View File

@ -93,14 +93,14 @@ static int hex_to_bytes(const char *hex, unsigned char *output, unsigned long sz
{ {
word32 i; word32 i;
for (i = 0; i < sz; i++) { for (i = 0; i < sz; i++) {
char ch1, ch2; signed char ch1, ch2;
ch1 = HexCharToByte(hex[i * 2]); ch1 = HexCharToByte(hex[i * 2]);
ch2 = HexCharToByte(hex[i * 2 + 1]); ch2 = HexCharToByte(hex[i * 2 + 1]);
if (ch1 < 0 || ch2 < 0) { if ((ch1 < 0) || (ch2 < 0)) {
WOLFSSL_MSG("hex_to_bytes: syntax error"); WOLFSSL_MSG("hex_to_bytes: syntax error");
return -1; return -1;
} }
output[i] = (ch1 << 4) + ch2; output[i] = (unsigned char)((ch1 << 4) + ch2);
} }
return (int)sz; return (int)sz;
} }
@ -157,7 +157,6 @@ static int expect_ok(const char *cmd, int size)
/* Conversion utility from hex string format to bytes */ /* Conversion utility from hex string format to bytes */
static int hexbuffer_conv(char *hex_str, unsigned char *output, unsigned long sz) static int hexbuffer_conv(char *hex_str, unsigned char *output, unsigned long sz)
{ {
int ret;
if (XSTRLEN(hex_str) != (2 * sz)) { if (XSTRLEN(hex_str) != (2 * sz)) {
return -1; return -1;
} }