Skip to content

Commit 25efe6b

Browse files
committed
wolfcrypt/src/asn.c: fix -Wconversions in GetASN_BitString(), GetASN_UTF8String(), and GetASN_ObjectId().
1 parent b7b6752 commit 25efe6b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wolfcrypt/src/asn.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,9 +1128,9 @@ static int GetASN_BitString(const byte* input, word32 idx, int length)
11281128
static int GetASN_UTF8String(const byte* input, word32 idx, int length)
11291129
{
11301130
int ret = 0;
1131-
int i = 0;
1131+
word32 i = 0;
11321132

1133-
while ((ret == 0) && (i < length)) {
1133+
while ((ret == 0) && ((int)i < length)) {
11341134
int cnt;
11351135

11361136
/* Check code points and get count of following bytes. */
@@ -1157,7 +1157,7 @@ static int GetASN_UTF8String(const byte* input, word32 idx, int length)
11571157
/* Check each following byte. */
11581158
for (; cnt > 0; cnt--) {
11591159
/* Check we have enough data. */
1160-
if (i == length) {
1160+
if ((int)i == length) {
11611161
WOLFSSL_MSG("Missing character in UTF8STRING\n");
11621162
ret = ASN_PARSE_E;
11631163
break;
@@ -1202,7 +1202,7 @@ static int GetASN_ObjectId(const byte* input, word32 idx, int length)
12021202
/* Last octet of a subidentifier has bit 8 clear. Last octet must be last
12031203
* of a subidentifier. Ensure last octet hasn't got top bit set indicating.
12041204
*/
1205-
else if ((input[idx + length - 1] & 0x80) != 0x00) {
1205+
else if ((input[(int)idx + length - 1] & 0x80) != 0x00) {
12061206
WOLFSSL_MSG("OID last octet has top bit set");
12071207
ret = ASN_PARSE_E;
12081208
}

0 commit comments

Comments
 (0)