Skip to content

Commit c4f73f5

Browse files
committed
Peer review cleanups.
1 parent 7f7d94a commit c4f73f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wolfcrypt/src/asn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ static int GetASN_ObjectId(const byte* input, word32 idx, int length)
12101210
/* Last octet of a sub-identifier has bit 8 clear. Last octet must be last
12111211
* of a subidentifier. Ensure last octet hasn't got top bit set.
12121212
*/
1213-
else if ((input[(int)idx + length - 1] & 0x80) != 0x00) {
1213+
else if ((input[(int)idx + length - 1] & 0x80) == 0x80) {
12141214
WOLFSSL_MSG("OID last octet has top bit set");
12151215
ret = ASN_PARSE_E;
12161216
}
@@ -2436,7 +2436,7 @@ static int GetASNHeader_ex(const byte* input, byte tag, word32* inOutIdx,
24362436
WOLFSSL_MSG("OID length less than 3");
24372437
ret = ASN_PARSE_E;
24382438
}
2439-
else if ((input[(int)idx + length - 1] & 0x80) != 0x00) {
2439+
else if ((input[(int)idx + length - 1] & 0x80) == 0x80) {
24402440
/* Last octet of a sub-identifier has bit 8 clear. Last octet must be
24412441
* last of a subidentifier. Ensure last octet hasn't got top bit set. */
24422442
WOLFSSL_MSG("OID last octet has top bit set");
@@ -3490,7 +3490,7 @@ int CheckBitString(const byte* input, word32* inOutIdx, int* len,
34903490
}
34913491

34923492
b = input[idx];
3493-
if (zeroBits && b != 0x00)
3493+
if (zeroBits && (b != 0x00))
34943494
return ASN_EXPECT_0_E;
34953495
if (b >= 0x08)
34963496
return ASN_PARSE_E;

0 commit comments

Comments
 (0)